@tenphi/tasty 0.0.0-snapshot.275370e → 0.0.0-snapshot.27b6708
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 +175 -109
- package/dist/{ssr/async-storage.js → async-storage-DKK-wTD4.js} +2 -2
- package/dist/async-storage-DKK-wTD4.js.map +1 -0
- package/dist/babel-BUQGeOXA.d.ts +83 -0
- package/dist/{ssr/collector.js → collector-DTahQUiV.js} +97 -28
- package/dist/collector-DTahQUiV.js.map +1 -0
- package/dist/{ssr/collector.d.ts → collector-DUaHCcTS.d.ts} +54 -7
- package/dist/config-B5kHzuNz.js +12269 -0
- package/dist/config-B5kHzuNz.js.map +1 -0
- package/dist/config-YsxGv4tq.d.ts +1263 -0
- package/dist/{ssr/context.js → context-CA8YKeMn.js} +11 -3
- package/dist/context-CA8YKeMn.js.map +1 -0
- package/dist/core/index.d.ts +5 -34
- package/dist/core/index.js +6 -27
- package/dist/core-Dr4u1NVD.js +1566 -0
- package/dist/core-Dr4u1NVD.js.map +1 -0
- package/dist/{zero/extractor.js → css-writer-B-J87ncv.js} +148 -24
- package/dist/css-writer-B-J87ncv.js.map +1 -0
- package/dist/{ssr/format-global-rules.js → format-global-rules-DklyaXv-.js} +2 -2
- package/dist/format-global-rules-DklyaXv-.js.map +1 -0
- package/dist/{ssr/format-rules.js → format-rules-DKOA-6qu.js} +59 -2
- package/dist/format-rules-DKOA-6qu.js.map +1 -0
- package/dist/{ssr/hydrate.js → hydrate-OeMX99We.js} +3 -11
- package/dist/hydrate-OeMX99We.js.map +1 -0
- package/dist/index-Cd45t5NM.d.ts +1521 -0
- package/dist/index-PqN-DIpn.d.ts +1911 -0
- package/dist/index.d.ts +5 -51
- package/dist/index.js +922 -36
- package/dist/index.js.map +1 -0
- package/dist/keyframes-CV8azJf3.js +493 -0
- package/dist/keyframes-CV8azJf3.js.map +1 -0
- package/dist/{utils/merge-styles.d.ts → merge-styles-CU7JbEwg.d.ts} +3 -3
- package/dist/{utils/merge-styles.js → merge-styles-oklji0KB.js} +3 -4
- package/dist/merge-styles-oklji0KB.js.map +1 -0
- package/dist/{utils/resolve-recipes.js → resolve-recipes-DTG81rzl.js} +4 -6
- package/dist/resolve-recipes-DTG81rzl.js.map +1 -0
- package/dist/ssr/astro-client.js +1 -1
- package/dist/ssr/astro-client.js.map +1 -1
- package/dist/ssr/astro-middleware-static.d.ts +16 -0
- package/dist/ssr/astro-middleware-static.js +18 -0
- package/dist/ssr/astro-middleware-static.js.map +1 -0
- package/dist/ssr/astro-middleware.d.ts +8 -6
- package/dist/ssr/astro-middleware.js +10 -10
- package/dist/ssr/astro-middleware.js.map +1 -1
- package/dist/ssr/astro.d.ts +2 -17
- package/dist/ssr/astro.js +29 -21
- package/dist/ssr/astro.js.map +1 -1
- package/dist/ssr/index.d.ts +37 -4
- package/dist/ssr/index.js +5 -5
- package/dist/ssr/index.js.map +1 -1
- package/dist/ssr/next.d.ts +2 -3
- package/dist/ssr/next.js +7 -8
- package/dist/ssr/next.js.map +1 -1
- package/dist/static/index.d.ts +91 -5
- package/dist/static/index.js +49 -3
- package/dist/static/index.js.map +1 -0
- package/dist/static/inject.js.map +1 -1
- package/dist/zero/babel.d.ts +2 -81
- package/dist/zero/babel.js +45 -29
- package/dist/zero/babel.js.map +1 -1
- package/dist/zero/index.d.ts +81 -3
- package/dist/zero/index.js +2 -3
- package/dist/zero/next.d.ts +1 -1
- package/dist/zero/next.js +1 -1
- package/dist/zero/next.js.map +1 -1
- package/docs/README.md +13 -7
- package/docs/adoption.md +53 -28
- package/docs/ai-agents.md +224 -0
- package/docs/comparison.md +59 -30
- package/docs/configuration.md +498 -69
- package/docs/debug.md +18 -16
- package/docs/design-system.md +43 -24
- package/docs/dsl.md +510 -177
- package/docs/getting-started.md +55 -34
- package/docs/injector.md +60 -7
- package/docs/methodology.md +68 -36
- package/docs/migration-v3.md +285 -0
- package/docs/pipeline.md +741 -0
- package/docs/plugins.md +349 -0
- package/docs/react-api.md +162 -38
- package/docs/ssr.md +45 -35
- package/docs/styles.md +65 -16
- package/docs/tasty-static.md +25 -8
- package/package.json +44 -21
- package/tasty.config.ts +6 -0
- package/dist/_virtual/_rolldown/runtime.js +0 -7
- package/dist/chunks/cacheKey.d.ts +0 -1
- package/dist/chunks/cacheKey.js +0 -77
- package/dist/chunks/cacheKey.js.map +0 -1
- package/dist/chunks/definitions.d.ts +0 -37
- package/dist/chunks/definitions.js +0 -258
- package/dist/chunks/definitions.js.map +0 -1
- package/dist/chunks/index.d.ts +0 -1
- package/dist/chunks/renderChunk.d.ts +0 -1
- package/dist/chunks/renderChunk.js +0 -59
- package/dist/chunks/renderChunk.js.map +0 -1
- package/dist/compute-styles.d.ts +0 -31
- package/dist/compute-styles.js +0 -322
- package/dist/compute-styles.js.map +0 -1
- package/dist/config.d.ts +0 -407
- package/dist/config.js +0 -591
- package/dist/config.js.map +0 -1
- package/dist/counter-style/index.js +0 -51
- package/dist/counter-style/index.js.map +0 -1
- package/dist/debug.d.ts +0 -89
- package/dist/debug.js +0 -453
- package/dist/debug.js.map +0 -1
- package/dist/font-face/index.js +0 -63
- package/dist/font-face/index.js.map +0 -1
- package/dist/hooks/index.d.ts +0 -7
- package/dist/hooks/useCounterStyle.d.ts +0 -36
- package/dist/hooks/useCounterStyle.js +0 -65
- package/dist/hooks/useCounterStyle.js.map +0 -1
- package/dist/hooks/useFontFace.d.ts +0 -45
- package/dist/hooks/useFontFace.js +0 -66
- package/dist/hooks/useFontFace.js.map +0 -1
- package/dist/hooks/useGlobalStyles.d.ts +0 -46
- package/dist/hooks/useGlobalStyles.js +0 -88
- package/dist/hooks/useGlobalStyles.js.map +0 -1
- package/dist/hooks/useKeyframes.d.ts +0 -58
- package/dist/hooks/useKeyframes.js +0 -55
- package/dist/hooks/useKeyframes.js.map +0 -1
- package/dist/hooks/useProperty.d.ts +0 -81
- package/dist/hooks/useProperty.js +0 -96
- package/dist/hooks/useProperty.js.map +0 -1
- package/dist/hooks/useRawCSS.d.ts +0 -22
- package/dist/hooks/useRawCSS.js +0 -103
- package/dist/hooks/useRawCSS.js.map +0 -1
- package/dist/hooks/useStyles.d.ts +0 -40
- package/dist/hooks/useStyles.js +0 -31
- package/dist/hooks/useStyles.js.map +0 -1
- package/dist/injector/index.d.ts +0 -182
- package/dist/injector/index.js +0 -185
- package/dist/injector/index.js.map +0 -1
- package/dist/injector/injector.d.ts +0 -198
- package/dist/injector/injector.js +0 -651
- package/dist/injector/injector.js.map +0 -1
- package/dist/injector/sheet-manager.d.ts +0 -132
- package/dist/injector/sheet-manager.js +0 -699
- package/dist/injector/sheet-manager.js.map +0 -1
- package/dist/injector/types.d.ts +0 -235
- package/dist/keyframes/index.js +0 -206
- package/dist/keyframes/index.js.map +0 -1
- package/dist/parser/classify.js +0 -319
- package/dist/parser/classify.js.map +0 -1
- package/dist/parser/const.js +0 -60
- package/dist/parser/const.js.map +0 -1
- package/dist/parser/lru.js +0 -109
- package/dist/parser/lru.js.map +0 -1
- package/dist/parser/parser.d.ts +0 -25
- package/dist/parser/parser.js +0 -115
- package/dist/parser/parser.js.map +0 -1
- package/dist/parser/tokenizer.js +0 -69
- package/dist/parser/tokenizer.js.map +0 -1
- package/dist/parser/types.d.ts +0 -51
- package/dist/parser/types.js +0 -46
- package/dist/parser/types.js.map +0 -1
- package/dist/pipeline/conditions.d.ts +0 -134
- package/dist/pipeline/conditions.js +0 -406
- package/dist/pipeline/conditions.js.map +0 -1
- package/dist/pipeline/exclusive.js +0 -285
- package/dist/pipeline/exclusive.js.map +0 -1
- package/dist/pipeline/index.d.ts +0 -55
- package/dist/pipeline/index.js +0 -708
- package/dist/pipeline/index.js.map +0 -1
- package/dist/pipeline/materialize.js +0 -1157
- package/dist/pipeline/materialize.js.map +0 -1
- package/dist/pipeline/parseStateKey.d.ts +0 -15
- package/dist/pipeline/parseStateKey.js +0 -446
- package/dist/pipeline/parseStateKey.js.map +0 -1
- package/dist/pipeline/simplify.js +0 -690
- package/dist/pipeline/simplify.js.map +0 -1
- package/dist/pipeline/warnings.js +0 -18
- package/dist/pipeline/warnings.js.map +0 -1
- package/dist/plugins/index.d.ts +0 -2
- package/dist/plugins/okhsl-plugin.d.ts +0 -35
- package/dist/plugins/okhsl-plugin.js +0 -97
- package/dist/plugins/okhsl-plugin.js.map +0 -1
- package/dist/plugins/types.d.ts +0 -87
- package/dist/properties/index.js +0 -222
- package/dist/properties/index.js.map +0 -1
- package/dist/properties/property-type-resolver.d.ts +0 -24
- package/dist/properties/property-type-resolver.js +0 -90
- package/dist/properties/property-type-resolver.js.map +0 -1
- package/dist/rsc-cache.js +0 -79
- package/dist/rsc-cache.js.map +0 -1
- package/dist/ssr/async-storage.d.ts +0 -17
- package/dist/ssr/async-storage.js.map +0 -1
- package/dist/ssr/collect-auto-properties.js +0 -58
- package/dist/ssr/collect-auto-properties.js.map +0 -1
- package/dist/ssr/collector.js.map +0 -1
- package/dist/ssr/context.js.map +0 -1
- package/dist/ssr/format-global-rules.js.map +0 -1
- package/dist/ssr/format-keyframes.js +0 -69
- package/dist/ssr/format-keyframes.js.map +0 -1
- package/dist/ssr/format-property.js +0 -49
- package/dist/ssr/format-property.js.map +0 -1
- package/dist/ssr/format-rules.js.map +0 -1
- package/dist/ssr/hydrate.d.ts +0 -29
- package/dist/ssr/hydrate.js.map +0 -1
- package/dist/ssr/ssr-collector-ref.js +0 -29
- package/dist/ssr/ssr-collector-ref.js.map +0 -1
- package/dist/states/index.d.ts +0 -49
- package/dist/states/index.js +0 -170
- package/dist/states/index.js.map +0 -1
- package/dist/static/tastyStatic.d.ts +0 -46
- package/dist/static/tastyStatic.js +0 -30
- package/dist/static/tastyStatic.js.map +0 -1
- package/dist/static/types.d.ts +0 -49
- package/dist/static/types.js +0 -24
- package/dist/static/types.js.map +0 -1
- package/dist/styles/border.d.ts +0 -25
- package/dist/styles/border.js +0 -120
- package/dist/styles/border.js.map +0 -1
- package/dist/styles/color.d.ts +0 -14
- package/dist/styles/color.js +0 -26
- package/dist/styles/color.js.map +0 -1
- package/dist/styles/const.js +0 -17
- package/dist/styles/const.js.map +0 -1
- package/dist/styles/createStyle.js +0 -79
- package/dist/styles/createStyle.js.map +0 -1
- package/dist/styles/dimension.js +0 -109
- package/dist/styles/dimension.js.map +0 -1
- package/dist/styles/directional.js +0 -133
- package/dist/styles/directional.js.map +0 -1
- package/dist/styles/display.d.ts +0 -30
- package/dist/styles/display.js +0 -73
- package/dist/styles/display.js.map +0 -1
- package/dist/styles/fade.d.ts +0 -15
- package/dist/styles/fade.js +0 -62
- package/dist/styles/fade.js.map +0 -1
- package/dist/styles/fill.d.ts +0 -42
- package/dist/styles/fill.js +0 -51
- package/dist/styles/fill.js.map +0 -1
- package/dist/styles/flow.d.ts +0 -16
- package/dist/styles/flow.js +0 -12
- package/dist/styles/flow.js.map +0 -1
- package/dist/styles/gap.d.ts +0 -31
- package/dist/styles/gap.js +0 -38
- package/dist/styles/gap.js.map +0 -1
- package/dist/styles/height.d.ts +0 -17
- package/dist/styles/height.js +0 -19
- package/dist/styles/height.js.map +0 -1
- package/dist/styles/index.d.ts +0 -1
- package/dist/styles/index.js +0 -8
- package/dist/styles/index.js.map +0 -1
- package/dist/styles/inset.d.ts +0 -24
- package/dist/styles/inset.js +0 -34
- package/dist/styles/inset.js.map +0 -1
- package/dist/styles/list.d.ts +0 -16
- package/dist/styles/list.js +0 -100
- package/dist/styles/list.js.map +0 -1
- package/dist/styles/margin.d.ts +0 -24
- package/dist/styles/margin.js +0 -32
- package/dist/styles/margin.js.map +0 -1
- package/dist/styles/outline.d.ts +0 -29
- package/dist/styles/outline.js +0 -55
- package/dist/styles/outline.js.map +0 -1
- package/dist/styles/padding.d.ts +0 -24
- package/dist/styles/padding.js +0 -32
- package/dist/styles/padding.js.map +0 -1
- package/dist/styles/placement.d.ts +0 -37
- package/dist/styles/placement.js +0 -74
- package/dist/styles/placement.js.map +0 -1
- package/dist/styles/predefined.d.ts +0 -71
- package/dist/styles/predefined.js +0 -237
- package/dist/styles/predefined.js.map +0 -1
- package/dist/styles/preset.d.ts +0 -52
- package/dist/styles/preset.js +0 -127
- package/dist/styles/preset.js.map +0 -1
- package/dist/styles/radius.d.ts +0 -12
- package/dist/styles/radius.js +0 -83
- package/dist/styles/radius.js.map +0 -1
- package/dist/styles/scrollMargin.d.ts +0 -24
- package/dist/styles/scrollMargin.js +0 -32
- package/dist/styles/scrollMargin.js.map +0 -1
- package/dist/styles/scrollbar.d.ts +0 -25
- package/dist/styles/scrollbar.js +0 -51
- package/dist/styles/scrollbar.js.map +0 -1
- package/dist/styles/shadow.d.ts +0 -14
- package/dist/styles/shadow.js +0 -25
- package/dist/styles/shadow.js.map +0 -1
- package/dist/styles/shared.js +0 -17
- package/dist/styles/shared.js.map +0 -1
- package/dist/styles/transition.d.ts +0 -14
- package/dist/styles/transition.js +0 -159
- package/dist/styles/transition.js.map +0 -1
- package/dist/styles/types.d.ts +0 -564
- package/dist/styles/width.d.ts +0 -17
- package/dist/styles/width.js +0 -19
- package/dist/styles/width.js.map +0 -1
- package/dist/tasty.d.ts +0 -134
- package/dist/tasty.js +0 -248
- package/dist/tasty.js.map +0 -1
- package/dist/types.d.ts +0 -184
- package/dist/utils/cache-wrapper.js +0 -21
- package/dist/utils/cache-wrapper.js.map +0 -1
- package/dist/utils/case-converter.js +0 -8
- package/dist/utils/case-converter.js.map +0 -1
- package/dist/utils/color-math.d.ts +0 -46
- package/dist/utils/color-math.js +0 -749
- package/dist/utils/color-math.js.map +0 -1
- package/dist/utils/color-space.d.ts +0 -5
- package/dist/utils/color-space.js +0 -228
- package/dist/utils/color-space.js.map +0 -1
- package/dist/utils/colors.d.ts +0 -5
- package/dist/utils/colors.js +0 -10
- package/dist/utils/colors.js.map +0 -1
- package/dist/utils/css-types.d.ts +0 -7
- package/dist/utils/deps-equal.js +0 -15
- package/dist/utils/deps-equal.js.map +0 -1
- package/dist/utils/dotize.d.ts +0 -26
- package/dist/utils/dotize.js +0 -122
- package/dist/utils/dotize.js.map +0 -1
- package/dist/utils/filter-base-props.d.ts +0 -15
- package/dist/utils/filter-base-props.js +0 -45
- package/dist/utils/filter-base-props.js.map +0 -1
- package/dist/utils/get-display-name.d.ts +0 -7
- package/dist/utils/get-display-name.js +0 -10
- package/dist/utils/get-display-name.js.map +0 -1
- package/dist/utils/has-keys.js +0 -13
- package/dist/utils/has-keys.js.map +0 -1
- package/dist/utils/hash.js +0 -14
- package/dist/utils/hash.js.map +0 -1
- package/dist/utils/is-dev-env.js +0 -19
- package/dist/utils/is-dev-env.js.map +0 -1
- package/dist/utils/is-valid-element-type.js +0 -15
- package/dist/utils/is-valid-element-type.js.map +0 -1
- package/dist/utils/merge-styles.js.map +0 -1
- package/dist/utils/mod-attrs.d.ts +0 -6
- package/dist/utils/mod-attrs.js +0 -20
- package/dist/utils/mod-attrs.js.map +0 -1
- package/dist/utils/process-tokens.d.ts +0 -17
- package/dist/utils/process-tokens.js +0 -83
- package/dist/utils/process-tokens.js.map +0 -1
- package/dist/utils/resolve-recipes.d.ts +0 -17
- package/dist/utils/resolve-recipes.js.map +0 -1
- package/dist/utils/selector-transform.js +0 -32
- package/dist/utils/selector-transform.js.map +0 -1
- package/dist/utils/string.js +0 -8
- package/dist/utils/string.js.map +0 -1
- package/dist/utils/styles.d.ts +0 -99
- package/dist/utils/styles.js +0 -220
- package/dist/utils/styles.js.map +0 -1
- package/dist/utils/typography.d.ts +0 -58
- package/dist/utils/typography.js +0 -51
- package/dist/utils/typography.js.map +0 -1
- package/dist/utils/warnings.d.ts +0 -16
- package/dist/utils/warnings.js +0 -16
- package/dist/utils/warnings.js.map +0 -1
- package/dist/zero/css-writer.d.ts +0 -45
- package/dist/zero/css-writer.js +0 -73
- package/dist/zero/css-writer.js.map +0 -1
- package/dist/zero/extractor.d.ts +0 -24
- package/dist/zero/extractor.js.map +0 -1
- package/docs/PIPELINE.md +0 -519
package/docs/styles.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Style Properties Reference
|
|
2
2
|
|
|
3
|
-
All standard CSS properties are supported in Tasty and benefit from its syntax sugar: design tokens (`$name`, `#name`), custom units (`2x`, `1r`, `1bw`), color opacity (`#purple.5`), auto-calc (`(100% - 2x)`), and custom functions. Values are parsed through the Tasty engine automatically.
|
|
3
|
+
All standard CSS properties are supported in Tasty and benefit from its syntax sugar: design tokens (`$name`, `#name`), custom units (`2x`, `1r`, `1bw`), color opacity (`#purple.5`), auto-calc (`(100% - 2x)`), and [custom functions](dsl.md#functions-function) (`$$negative(10px)`). Values are parsed through the Tasty engine automatically.
|
|
4
4
|
|
|
5
5
|
The properties documented below have **custom handlers** with enhanced syntax. They should be **preferred** over their raw CSS equivalents because they:
|
|
6
6
|
|
|
@@ -100,18 +100,23 @@ For flex/grid layouts, outputs native `gap`. For block layouts, emulates gap usi
|
|
|
100
100
|
|
|
101
101
|
Element padding with directional modifiers and multi-group support. Use **comma-separated groups** to set a base value and then override specific directions.
|
|
102
102
|
|
|
103
|
-
**Syntax:** `[value]` | `[
|
|
103
|
+
**Syntax:** `[value]` | `[block inline]` | `[top right bottom left]` | `[value direction...]` — comma-separated for multiple groups
|
|
104
104
|
|
|
105
105
|
**Direction modifiers:** `top`, `right`, `bottom`, `left`
|
|
106
106
|
|
|
107
107
|
**Output modifier:** `longhand` — forces output as individual CSS longhand properties (`padding-top`, `padding-right`, `padding-bottom`, `padding-left`) instead of the `padding` shorthand. Useful when children need to selectively inherit individual directions.
|
|
108
108
|
|
|
109
|
+
**One value per directional group.** A group that names direction modifiers takes **exactly one** value, applied to every direction it names. For different values per side, use comma-separated groups: `padding: '2x top, 4x right'`. Writing `padding: '2x 4x top right'` ignores `4x` and warns in development — the parser keeps values and modifiers in separate buckets, so their interleaving in the source is not recoverable and `'2x 4x top right'`, `'2x top 4x right'` and `'top 2x right 4x'` are all the same input.
|
|
110
|
+
|
|
111
|
+
A group that names *no* direction keeps plain CSS shorthand order, which is unambiguous and unchanged.
|
|
112
|
+
|
|
109
113
|
| Value | Effect |
|
|
110
114
|
|-------|--------|
|
|
111
115
|
| `"2x"` | All sides `2x` |
|
|
112
116
|
| `"2x 1x"` | Top/bottom `2x`, left/right `1x` |
|
|
113
117
|
| `"2x top"` | Top `2x`, right/bottom/left `0` |
|
|
114
118
|
| `"1x left right"` | Left and right `1x`, top/bottom `0` |
|
|
119
|
+
| `"2x top, 4x right"` | Top `2x`, right `4x`, bottom/left `0` |
|
|
115
120
|
| `"1x, 2x top"` | All sides `1x`, then top overridden to `2x` |
|
|
116
121
|
| `"1x, 2x top bottom"` | Left/right `1x`, top/bottom `2x` |
|
|
117
122
|
| `"2x longhand"` | All sides `2x`, output as 4 individual `padding-*` properties |
|
|
@@ -128,17 +133,20 @@ Individual props `paddingTop`, `paddingRight`, `paddingBottom`, `paddingLeft`, `
|
|
|
128
133
|
|
|
129
134
|
Element margin. Same syntax, modifiers, and multi-group support as `padding`.
|
|
130
135
|
|
|
131
|
-
**Syntax:** `[value]` | `[
|
|
136
|
+
**Syntax:** `[value]` | `[block inline]` | `[top right bottom left]` | `[value direction...]` — comma-separated for multiple groups
|
|
132
137
|
|
|
133
138
|
**Direction modifiers:** `top`, `right`, `bottom`, `left`
|
|
134
139
|
|
|
135
140
|
**Output modifier:** `longhand` — forces output as individual CSS longhand properties (`margin-top`, etc.) instead of the `margin` shorthand.
|
|
136
141
|
|
|
142
|
+
The [one-value-per-directional-group rule](#padding) from `padding` applies here too.
|
|
143
|
+
|
|
137
144
|
| Value | Effect |
|
|
138
145
|
|-------|--------|
|
|
139
146
|
| `"2x"` | All sides `2x` |
|
|
140
147
|
| `"2x 1x"` | Top/bottom `2x`, left/right `1x` |
|
|
141
148
|
| `"2x top"` | Top `2x`, right/bottom/left `0` |
|
|
149
|
+
| `"2x top, 4x right"` | Top `2x`, right `4x`, bottom/left `0` |
|
|
142
150
|
| `"auto left right, 1x top bottom"` | Left/right `auto`, top/bottom `1x` |
|
|
143
151
|
| `true` | All sides `1x` |
|
|
144
152
|
| Number | Converted to `px` |
|
|
@@ -191,10 +199,23 @@ Separate `minHeight` and `maxHeight` props are supported and override values fro
|
|
|
191
199
|
|
|
192
200
|
Positioning offsets with directional modifiers and multi-group support. Same directional syntax as `padding`.
|
|
193
201
|
|
|
194
|
-
**Syntax:** `[value]` | `[
|
|
202
|
+
**Syntax:** `[value]` | `[block inline]` | `[top right bottom left]` | `[value direction...]` — comma-separated for multiple groups
|
|
195
203
|
|
|
196
204
|
**Direction modifiers:** `top`, `right`, `bottom`, `left`
|
|
197
205
|
|
|
206
|
+
The [one-value-per-directional-group rule](#padding) from `padding` applies here too, with `dock`
|
|
207
|
+
as the single exception.
|
|
208
|
+
|
|
209
|
+
**`dock` modifier:** pins the named edge and spans its full length, by also applying the value
|
|
210
|
+
to the two perpendicular sides. `inset: 'bottom dock'` gives `inset: auto 0 0 0` — anchored to
|
|
211
|
+
the bottom, full width. Without a direction, `dock` fills every side.
|
|
212
|
+
|
|
213
|
+
`dock` is the one place a directional group takes **two** values: the first insets the named
|
|
214
|
+
edge, the second the sides it spans. `inset: '2x 4x bottom dock'` pins the bottom at `2x` and
|
|
215
|
+
insets the sides by `4x`. A third value, or a second value without `dock`, is ignored and warns
|
|
216
|
+
in development. With several directions the first value applies to each named edge and the
|
|
217
|
+
second to every side they span.
|
|
218
|
+
|
|
198
219
|
**Output modifier:** `longhand` — forces output as individual CSS properties (`top`, `right`, `bottom`, `left`) instead of the `inset` shorthand.
|
|
199
220
|
|
|
200
221
|
| Value | Effect |
|
|
@@ -205,6 +226,11 @@ Positioning offsets with directional modifiers and multi-group support. Same dir
|
|
|
205
226
|
| `"0, 2x top"` | All sides `0`, then top overridden to `2x` |
|
|
206
227
|
| `"0 longhand"` | All sides `0`, output as individual `top`/`right`/`bottom`/`left` |
|
|
207
228
|
| `true` | All sides `0` |
|
|
229
|
+
| `"bottom dock"` | Bottom/left/right `0`, top `auto` — bottom-anchored, full width |
|
|
230
|
+
| `"right dock"` | Right/top/bottom `0`, left `auto` — right-anchored, full height |
|
|
231
|
+
| `"2x bottom dock"` | Bottom/left/right `2x`, top `auto` |
|
|
232
|
+
| `"2x 4x bottom dock"` | Bottom `2x`, left/right `4x`, top `auto` |
|
|
233
|
+
| `"dock"` | All sides `0` |
|
|
208
234
|
|
|
209
235
|
Later comma-separated groups override earlier groups for conflicting directions.
|
|
210
236
|
|
|
@@ -228,6 +254,7 @@ Background color with design token support. Preferred over `backgroundColor` and
|
|
|
228
254
|
| `"#purple.10"` | Token color at 10% opacity |
|
|
229
255
|
| `"#surface #primary.10"` | Background `#surface` with `#primary.10` overlay (two colors enable smooth transitions between both) |
|
|
230
256
|
| `"rgb(255 128 0)"` | CSS color value |
|
|
257
|
+
| `"color-mix(in oklab, #primary 50%, #surface)"` | CSS color function — see [CSS Color Functions](dsl.md#css-color-functions) |
|
|
231
258
|
| `true` | Default fill color |
|
|
232
259
|
|
|
233
260
|
When two colors are provided, the first sets the background color and the second is applied as an overlay gradient layer. This enables independent CSS transitions on each color. The overlay is only applied when no explicit `image` or `backgroundImage` is set.
|
|
@@ -260,9 +287,17 @@ Text color with design token support.
|
|
|
260
287
|
| `"#current"` | Current inherited color |
|
|
261
288
|
| `"#current.5"` | Current inherited color at 50% opacity |
|
|
262
289
|
| `"(#primary, #secondary)"` | Fallback: use `#primary`, fall back to `#secondary` |
|
|
290
|
+
| `"light-dark(#dark, #light)"` | CSS color function — see [CSS Color Functions](dsl.md#css-color-functions) |
|
|
263
291
|
| `true` | `currentColor` |
|
|
264
292
|
|
|
265
|
-
|
|
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.
|
|
266
301
|
|
|
267
302
|
### `svgFill`
|
|
268
303
|
|
|
@@ -270,7 +305,7 @@ SVG fill color. Same color token syntax as `fill` and `color`. Outputs the nativ
|
|
|
270
305
|
|
|
271
306
|
```jsx
|
|
272
307
|
svgFill="#purple.10"
|
|
273
|
-
svgFill="
|
|
308
|
+
svgFill="#current"
|
|
274
309
|
```
|
|
275
310
|
|
|
276
311
|
---
|
|
@@ -319,7 +354,11 @@ Border radius with shape presets and directional modifiers.
|
|
|
319
354
|
| `"backleaf"` | Asymmetric: round, sharp, round, sharp |
|
|
320
355
|
| `"inherit"` | Inherit border-radius from parent |
|
|
321
356
|
|
|
322
|
-
**
|
|
357
|
+
**Edge modifiers:** `top`, `right`, `bottom`, `left` — rounds the *pair* of corners along that edge.
|
|
358
|
+
|
|
359
|
+
**Corner modifiers:** `top-left`, `top-right`, `bottom-right`, `bottom-left` — rounds a single corner.
|
|
360
|
+
Use these when an edge modifier would round one corner too many. Edge and corner modifiers combine
|
|
361
|
+
(`radius: 'top bottom-right'`).
|
|
323
362
|
|
|
324
363
|
**Output modifier:** `longhand` — forces output as individual CSS longhand properties (`border-top-left-radius`, `border-top-right-radius`, `border-bottom-right-radius`, `border-bottom-left-radius`) instead of the `border-radius` shorthand. Useful when children need to selectively inherit individual corners via `radius: 'inherit left'`.
|
|
325
364
|
|
|
@@ -334,6 +373,9 @@ Border radius with shape presets and directional modifiers.
|
|
|
334
373
|
| `"1r longhand"` | All corners `1r`, output as 4 individual `border-*-radius` properties |
|
|
335
374
|
| `"inherit"` | All corners inherit from parent (`border-radius: inherit`) |
|
|
336
375
|
| `"inherit right"` | Right corners inherit from parent (uses longhand properties) |
|
|
376
|
+
| `"top-right"` | Top-right corner `1r`, every other corner `0` |
|
|
377
|
+
| `"4px top-left"` | Top-left corner `4px`, every other corner `0` |
|
|
378
|
+
| `"top bottom-right"` | Both top corners and bottom-right `1r`, bottom-left `0` |
|
|
337
379
|
|
|
338
380
|
### `outline`
|
|
339
381
|
|
|
@@ -378,11 +420,11 @@ Multiple shadows: `shadow="1x 1x 2x #dark.20, inset 0 0 4x #dark.10"`
|
|
|
378
420
|
|
|
379
421
|
Typography preset that sets font-size, line-height, letter-spacing, font-weight, font-style, and text-transform from named design tokens.
|
|
380
422
|
|
|
381
|
-
**Syntax:** `name`, `name / modifier
|
|
423
|
+
**Syntax:** `name`, `name / modifier...`, or `modifier...` (shorthand)
|
|
382
424
|
|
|
383
425
|
Preset names are project-specific (e.g. `h1`–`h6`, `t1`–`t4`, `p1`–`p4`). Register them for autocomplete by augmenting `TastyPresetNames`.
|
|
384
426
|
|
|
385
|
-
Use `/` to separate the preset name from
|
|
427
|
+
Use `/` to separate the preset name from one or more space-separated modifiers. When modifiers are used alone (without a name), the preset name defaults to `inherit`. Modifiers can be combined freely because they target different properties.
|
|
386
428
|
|
|
387
429
|
**Modifiers:**
|
|
388
430
|
|
|
@@ -394,11 +436,13 @@ Use `/` to separate the preset name from a modifier. When a modifier is used alo
|
|
|
394
436
|
| `tight` | Sets line-height equal to font-size |
|
|
395
437
|
|
|
396
438
|
```jsx
|
|
397
|
-
preset="h1"
|
|
398
|
-
preset="h2 / strong"
|
|
399
|
-
preset="
|
|
400
|
-
preset="
|
|
401
|
-
preset="
|
|
439
|
+
preset="h1" // heading 1
|
|
440
|
+
preset="h2 / strong" // bold heading 2
|
|
441
|
+
preset="h2 / strong italic" // bold + italic heading 2
|
|
442
|
+
preset="t3 / italic" // italic text 3
|
|
443
|
+
preset="t2 / strong tight" // bold text 2 with tight line-height
|
|
444
|
+
preset="bold" // inherit preset with bold (shorthand)
|
|
445
|
+
preset="bold italic" // inherit preset with bold + italic (shorthand)
|
|
402
446
|
```
|
|
403
447
|
|
|
404
448
|
Individual typography props (`fontSize`, `lineHeight`, `letterSpacing`, `fontWeight`, `fontStyle`, `textTransform`) can be used alongside `preset` to override specific values, but using `preset` alone is recommended.
|
|
@@ -550,15 +594,20 @@ Scrollbar styling using CSS standard properties (`scrollbar-width`, `scrollbar-c
|
|
|
550
594
|
|
|
551
595
|
Gradient-based edge fading using CSS masks. Use **comma-separated groups** to set different widths and colors per direction.
|
|
552
596
|
|
|
553
|
-
**Syntax:** `[width] [
|
|
597
|
+
**Syntax:** `[width] [direction...] [#from-color] [#to-color]` — comma-separated for multiple groups
|
|
554
598
|
|
|
555
599
|
**Direction modifiers:** `top`, `right`, `bottom`, `left`
|
|
556
600
|
|
|
601
|
+
A group that names edges takes a **single** width, applied to every edge it names — different
|
|
602
|
+
widths per edge come from comma groups. A group that names no edge covers all four and keeps
|
|
603
|
+
plain CSS shorthand order, like `padding`. See the [`padding` rule](#padding).
|
|
604
|
+
|
|
557
605
|
| Value | Effect |
|
|
558
606
|
|-------|--------|
|
|
559
607
|
| `"top"` | Fade top edge, default width (`2x`), all other edges unfaded |
|
|
560
608
|
| `"2x left right"` | Fade left and right edges with `2x` width, top/bottom unfaded |
|
|
561
|
-
| `"3x 1x
|
|
609
|
+
| `"3x 1x"` | All edges faded — top/bottom `3x`, left/right `1x` (CSS shorthand order) |
|
|
610
|
+
| `"3x top, 1x bottom"` | Fade top with `3x` width, bottom with `1x` width |
|
|
562
611
|
| `"2x #transparent #dark"` | All edges faded with `2x` width, from `#transparent` to `#dark` |
|
|
563
612
|
| `"top #a #b, bottom #c #d"` | Top fades from `#a` to `#b`, bottom fades from `#c` to `#d` |
|
|
564
613
|
|
package/docs/tasty-static.md
CHANGED
|
@@ -20,7 +20,7 @@ The zero-runtime mode is part of the main `@tenphi/tasty` package but requires a
|
|
|
20
20
|
| `@babel/core` | >= 7.24 | Babel plugin (`@tenphi/tasty/babel-plugin`) |
|
|
21
21
|
| `@babel/helper-plugin-utils` | >= 7.24 | Babel plugin |
|
|
22
22
|
| `@babel/types` | >= 7.24 | Babel plugin |
|
|
23
|
-
| `jiti` | >= 2.6 | Next.js wrapper (`@tenphi/tasty/next`) when using `configFile` option |
|
|
23
|
+
| `jiti` | >= 2.6 | Next.js wrapper (`@tenphi/tasty/zero/next`) when using `configFile` option |
|
|
24
24
|
|
|
25
25
|
All of these are declared as optional peer dependencies of `@tenphi/tasty`. Install only what your setup requires:
|
|
26
26
|
|
|
@@ -168,16 +168,32 @@ module.exports = {
|
|
|
168
168
|
| `config.replaceTokens` | `Record<string, string \| number>` | — | Parse-time token substitution. Keys use `$name` for custom properties and `#name` for color tokens. |
|
|
169
169
|
| `config.recipes` | `Record<string, RecipeStyles>` | `{}` | Predefined style recipes |
|
|
170
170
|
| `config.keyframes` | `Record<string, KeyframesSteps>` | — | Global `@keyframes` definitions available to all `tastyStatic` calls |
|
|
171
|
-
| `config.
|
|
172
|
-
| `config.
|
|
171
|
+
| `config.fontFaces` | `Record<string, FontFaceInput>` | — | Global `@font-face` definitions |
|
|
172
|
+
| `config.counterStyles` | `Record<string, CounterStyleDescriptors>` | — | Global `@counter-style` definitions |
|
|
173
173
|
| `config.units` | `Record<string, string \| UnitHandler>` | — | Custom units for the style parser (merged with built-ins). E.g. `{ em: 'em', vw: 'vw' }` |
|
|
174
|
-
| `config.
|
|
174
|
+
| `config.functions` | `Record<string, FunctionDefinition \| Function>` | — | Custom functions (merged). Bare keys → parse functions; `$$name` keys → declarative CSS `@function` definitions |
|
|
175
|
+
| `config.polyfills` | `{ functions?: boolean }` | `{}` | Opt-in polyfills. `functions: true` inlines `@function` calls into plain CSS at build time |
|
|
175
176
|
| `config.plugins` | `TastyPlugin[]` | — | Plugins that extend tasty with custom functions, units, states, and handlers |
|
|
176
177
|
| `config.handlers` | `Record<string, StyleHandlerDefinition>` | — | Custom style handlers that transform style properties into CSS declarations |
|
|
177
178
|
| `config.presets` | `Record<string, TypographyPreset>` | — | Typography presets — shorthand for `generateTypographyTokens()`. Generated tokens merge under explicit `tokens`. |
|
|
178
179
|
| `config.globalStyles` | `Record<string, Styles>` | — | Global Tasty styles keyed by CSS selector. Supports the full style syntax. |
|
|
179
180
|
| `config.autoPropertyTypes` | `boolean` | `true` | Automatically infer and register CSS `@property` declarations from values |
|
|
180
181
|
| `config.parserCacheSize` | `number` | `1000` | Parser LRU cache size. Larger values improve performance for builds with many unique style values |
|
|
182
|
+
| `config.namePrefix` | `string` | `'ts'` | Prefix prepended to every generated identifier. Defaults to `'ts'` so static classes never collide with runtime (`'t'`) classes. See [Configuration: Name prefix](configuration.md#name-prefix). |
|
|
183
|
+
|
|
184
|
+
### Coexisting with runtime tasty
|
|
185
|
+
|
|
186
|
+
When a page mixes `tastyStatic` with runtime `tasty`, both must use **different** `namePrefix` values. The defaults handle this automatically (`'t'` for runtime, `'ts'` for zero-runtime). If you customize one, customize the other:
|
|
187
|
+
|
|
188
|
+
```ts
|
|
189
|
+
// tasty-zero.config.ts (Babel plugin)
|
|
190
|
+
export default { namePrefix: 'mbs' };
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
```ts
|
|
194
|
+
// app entry (runtime configure)
|
|
195
|
+
configure({ namePrefix: 'mb' });
|
|
196
|
+
```
|
|
181
197
|
|
|
182
198
|
---
|
|
183
199
|
|
|
@@ -221,7 +237,7 @@ The `withTastyZero` wrapper configures both **webpack** and **Turbopack** automa
|
|
|
221
237
|
|
|
222
238
|
```typescript
|
|
223
239
|
// next.config.ts
|
|
224
|
-
import { withTastyZero } from '@tenphi/tasty/next';
|
|
240
|
+
import { withTastyZero } from '@tenphi/tasty/zero/next';
|
|
225
241
|
|
|
226
242
|
export default withTastyZero({
|
|
227
243
|
output: 'public/tasty.css',
|
|
@@ -380,7 +396,7 @@ With Next.js:
|
|
|
380
396
|
|
|
381
397
|
```typescript
|
|
382
398
|
// next.config.ts
|
|
383
|
-
import { withTastyZero } from '@tenphi/tasty/next';
|
|
399
|
+
import { withTastyZero } from '@tenphi/tasty/zero/next';
|
|
384
400
|
|
|
385
401
|
export default withTastyZero({
|
|
386
402
|
mode: 'inject',
|
|
@@ -496,12 +512,12 @@ For dynamic styling needs, combine with regular CSS or CSS variables:
|
|
|
496
512
|
```tsx
|
|
497
513
|
const card = tastyStatic({
|
|
498
514
|
padding: '4x',
|
|
499
|
-
fill: '
|
|
515
|
+
fill: '($card-bg, #white)',
|
|
500
516
|
});
|
|
501
517
|
|
|
502
518
|
<div
|
|
503
519
|
className={card}
|
|
504
|
-
style={{ '--card-bg': isActive ? '
|
|
520
|
+
style={{ '--card-bg': isActive ? 'var(--purple-color)' : 'var(--white-color)' }}
|
|
505
521
|
/>
|
|
506
522
|
```
|
|
507
523
|
|
|
@@ -530,3 +546,4 @@ const card = tastyStatic({
|
|
|
530
546
|
- [Style DSL](dsl.md) — State maps, tokens, units, extending semantics (shared by runtime and static)
|
|
531
547
|
- [React API](react-api.md) — Runtime styling: `tasty()` factory, component props, variants, sub-elements, style functions
|
|
532
548
|
- [Configuration](configuration.md) — Global configuration: tokens, recipes, custom units, and style handlers
|
|
549
|
+
- [Plugins & Extension Points](plugins.md) — Which extension points work at build time (`functions`, `units`, `states`, `handlers`, `recipes`) and which do not (`propHandlers` — `tastyStatic()` takes styles objects, not props)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tenphi/tasty",
|
|
3
|
-
"version": "0.0.0-snapshot.
|
|
3
|
+
"version": "0.0.0-snapshot.27b6708",
|
|
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",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"import": "./dist/zero/index.js",
|
|
33
33
|
"default": "./dist/zero/index.js"
|
|
34
34
|
},
|
|
35
|
-
"./next": {
|
|
35
|
+
"./zero/next": {
|
|
36
36
|
"types": "./dist/zero/next.d.ts",
|
|
37
37
|
"import": "./dist/zero/next.js",
|
|
38
38
|
"default": "./dist/zero/next.js"
|
|
@@ -62,6 +62,16 @@
|
|
|
62
62
|
"import": "./dist/ssr/astro-client.js",
|
|
63
63
|
"default": "./dist/ssr/astro-client.js"
|
|
64
64
|
},
|
|
65
|
+
"./ssr/astro-middleware": {
|
|
66
|
+
"types": "./dist/ssr/astro-middleware.d.ts",
|
|
67
|
+
"import": "./dist/ssr/astro-middleware.js",
|
|
68
|
+
"default": "./dist/ssr/astro-middleware.js"
|
|
69
|
+
},
|
|
70
|
+
"./ssr/astro-middleware-static": {
|
|
71
|
+
"types": "./dist/ssr/astro-middleware-static.d.ts",
|
|
72
|
+
"import": "./dist/ssr/astro-middleware-static.js",
|
|
73
|
+
"default": "./dist/ssr/astro-middleware-static.js"
|
|
74
|
+
},
|
|
65
75
|
"./tasty.config": "./tasty.config.ts"
|
|
66
76
|
},
|
|
67
77
|
"files": [
|
|
@@ -73,7 +83,9 @@
|
|
|
73
83
|
"./dist/ssr/index.js",
|
|
74
84
|
"./dist/ssr/next.js",
|
|
75
85
|
"./dist/ssr/astro.js",
|
|
76
|
-
"./dist/ssr/astro-client.js"
|
|
86
|
+
"./dist/ssr/astro-client.js",
|
|
87
|
+
"./dist/ssr/astro-middleware.js",
|
|
88
|
+
"./dist/ssr/astro-middleware-static.js"
|
|
77
89
|
],
|
|
78
90
|
"engines": {
|
|
79
91
|
"node": ">=20"
|
|
@@ -81,6 +93,9 @@
|
|
|
81
93
|
"scripts": {
|
|
82
94
|
"build": "tsdown",
|
|
83
95
|
"test": "vitest run",
|
|
96
|
+
"test:node": "vitest run --project node",
|
|
97
|
+
"test:browser": "vitest run --project browser",
|
|
98
|
+
"test:setup": "playwright install chromium",
|
|
84
99
|
"test:watch": "vitest",
|
|
85
100
|
"test:coverage": "vitest run --coverage",
|
|
86
101
|
"typecheck": "tsc --noEmit",
|
|
@@ -89,11 +104,14 @@
|
|
|
89
104
|
"format": "prettier --write \"src/**/*.{ts,tsx}\"",
|
|
90
105
|
"format:check": "prettier --check \"src/**/*.{ts,tsx}\"",
|
|
91
106
|
"size": "size-limit",
|
|
92
|
-
"bench": "vitest bench",
|
|
107
|
+
"bench": "vitest bench --project node",
|
|
108
|
+
"bench:browser": "vitest bench --project browser",
|
|
93
109
|
"prepublishOnly": "pnpm run build",
|
|
94
110
|
"changeset": "changeset",
|
|
95
111
|
"version": "changeset version",
|
|
96
112
|
"release": "changeset publish",
|
|
113
|
+
"knip": "knip",
|
|
114
|
+
"check:test-only": "node scripts/check-test-only-code.mjs",
|
|
97
115
|
"hygiene": "pnpm lint && pnpm format:check && pnpm typecheck",
|
|
98
116
|
"hygiene:fix": "pnpm lint:fix && pnpm format && pnpm typecheck"
|
|
99
117
|
},
|
|
@@ -123,6 +141,7 @@
|
|
|
123
141
|
"@babel/helper-plugin-utils": "^7.24.0",
|
|
124
142
|
"@babel/types": "^7.24.0",
|
|
125
143
|
"jiti": "^2.6.1",
|
|
144
|
+
"next": ">=14.0.0",
|
|
126
145
|
"react": "^18.0.0 || ^19.0.0"
|
|
127
146
|
},
|
|
128
147
|
"peerDependenciesMeta": {
|
|
@@ -140,6 +159,9 @@
|
|
|
140
159
|
},
|
|
141
160
|
"jiti": {
|
|
142
161
|
"optional": true
|
|
162
|
+
},
|
|
163
|
+
"next": {
|
|
164
|
+
"optional": true
|
|
143
165
|
}
|
|
144
166
|
},
|
|
145
167
|
"dependencies": {
|
|
@@ -147,53 +169,54 @@
|
|
|
147
169
|
},
|
|
148
170
|
"devDependencies": {
|
|
149
171
|
"@babel/core": "^7.24.0",
|
|
150
|
-
"@
|
|
172
|
+
"@babel/helper-plugin-utils": "^7.24.0",
|
|
173
|
+
"@babel/types": "^7.24.0",
|
|
174
|
+
"@changesets/changelog-github": "^0.7.0",
|
|
151
175
|
"@changesets/cli": "^2.29.8",
|
|
152
176
|
"@eslint/js": "^10.0.1",
|
|
153
177
|
"@size-limit/esbuild": "^12.0.0",
|
|
154
178
|
"@size-limit/file": "^12.0.0",
|
|
179
|
+
"@tenphi/eslint-plugin-tasty": "^0.11.3",
|
|
155
180
|
"@testing-library/jest-dom": "^6.9.1",
|
|
156
181
|
"@testing-library/react": "^16.3.2",
|
|
157
182
|
"@types/babel__core": "^7.20.5",
|
|
158
183
|
"@types/babel__helper-plugin-utils": "^7.10.3",
|
|
159
184
|
"@types/node": "^25.3.2",
|
|
160
185
|
"@types/react": "^19.0.0",
|
|
161
|
-
"@vitest/
|
|
186
|
+
"@vitest/browser-playwright": "^4.1.10",
|
|
162
187
|
"eslint": "^10.0.0",
|
|
163
188
|
"eslint-config-prettier": "^10.1.8",
|
|
164
|
-
"
|
|
189
|
+
"jiti": "^2.6.1",
|
|
190
|
+
"knip": "^5.61.3",
|
|
191
|
+
"next": "^16.0.0",
|
|
192
|
+
"playwright": "^1.62.1",
|
|
165
193
|
"prettier": "^3.8.1",
|
|
166
194
|
"react": "^19.0.0",
|
|
167
195
|
"size-limit": "^12.0.0",
|
|
168
|
-
"tsdown": "^0.
|
|
169
|
-
"typescript": "^
|
|
196
|
+
"tsdown": "^0.22.0",
|
|
197
|
+
"typescript": "^6.0.2",
|
|
170
198
|
"typescript-eslint": "^8.56.0",
|
|
171
|
-
"vitest": "^4.
|
|
172
|
-
},
|
|
173
|
-
"pnpm": {
|
|
174
|
-
"onlyBuiltDependencies": [
|
|
175
|
-
"esbuild"
|
|
176
|
-
]
|
|
199
|
+
"vitest": "^4.1.10"
|
|
177
200
|
},
|
|
178
|
-
"packageManager": "pnpm@
|
|
201
|
+
"packageManager": "pnpm@11.0.8",
|
|
179
202
|
"size-limit": [
|
|
180
203
|
{
|
|
181
204
|
"name": "main (import *)",
|
|
182
205
|
"path": "dist/index.js",
|
|
183
206
|
"import": "*",
|
|
184
|
-
"limit": "
|
|
207
|
+
"limit": "56.6 kB"
|
|
185
208
|
},
|
|
186
209
|
{
|
|
187
210
|
"name": "core (import *)",
|
|
188
211
|
"path": "dist/core/index.js",
|
|
189
212
|
"import": "*",
|
|
190
|
-
"limit": "
|
|
213
|
+
"limit": "53.65 kB"
|
|
191
214
|
},
|
|
192
215
|
{
|
|
193
216
|
"name": "static",
|
|
194
217
|
"path": "dist/static/index.js",
|
|
195
218
|
"import": "*",
|
|
196
|
-
"limit": "
|
|
219
|
+
"limit": "16.8 kB"
|
|
197
220
|
},
|
|
198
221
|
{
|
|
199
222
|
"name": "zero",
|
|
@@ -204,7 +227,7 @@
|
|
|
204
227
|
"path",
|
|
205
228
|
"crypto"
|
|
206
229
|
],
|
|
207
|
-
"limit": "
|
|
230
|
+
"limit": "31.25 kB"
|
|
208
231
|
},
|
|
209
232
|
{
|
|
210
233
|
"name": "babel-plugin",
|
|
@@ -215,7 +238,7 @@
|
|
|
215
238
|
"path",
|
|
216
239
|
"crypto"
|
|
217
240
|
],
|
|
218
|
-
"limit": "
|
|
241
|
+
"limit": "49.35 kB"
|
|
219
242
|
}
|
|
220
243
|
]
|
|
221
244
|
}
|
package/tasty.config.ts
CHANGED
|
@@ -3,6 +3,7 @@ export default {
|
|
|
3
3
|
'#white',
|
|
4
4
|
'#black',
|
|
5
5
|
'#current',
|
|
6
|
+
'#clear',
|
|
6
7
|
'$gap',
|
|
7
8
|
'$radius',
|
|
8
9
|
'$border-width',
|
|
@@ -11,4 +12,9 @@ export default {
|
|
|
11
12
|
'$sharp-radius',
|
|
12
13
|
'$bold-font-weight',
|
|
13
14
|
],
|
|
15
|
+
styles: ['viewTransitionName'],
|
|
16
|
+
// This repo imports its own API relatively, so the plugin's default
|
|
17
|
+
// `@tenphi/tasty` import tracking never matches. List the local entry points so
|
|
18
|
+
// `tasty({ styles })` call sites are actually linted.
|
|
19
|
+
importSources: ['@tenphi/tasty', './tasty', '../tasty', './src/tasty'],
|
|
14
20
|
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
//#region \0rolldown/runtime.js
|
|
2
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, { get: (a, b) => (typeof require !== "undefined" ? require : a)[b] }) : x)(function(x) {
|
|
3
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
4
|
-
throw Error("Calling `require` for \"" + x + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
|
|
5
|
-
});
|
|
6
|
-
//#endregion
|
|
7
|
-
export { __require };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { };
|
package/dist/chunks/cacheKey.js
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { extractLocalPredefinedStates, extractPredefinedStateRefs } from "../states/index.js";
|
|
2
|
-
//#region src/chunks/cacheKey.ts
|
|
3
|
-
/**
|
|
4
|
-
* Chunk-specific cache key generation.
|
|
5
|
-
*
|
|
6
|
-
* Generates cache keys that only include styles relevant to a specific chunk,
|
|
7
|
-
* enabling more granular caching and reuse.
|
|
8
|
-
*
|
|
9
|
-
* Enhanced to support predefined states:
|
|
10
|
-
* - Global predefined states don't affect cache keys (constant across app)
|
|
11
|
-
* - Local predefined states only affect cache keys if referenced in the chunk
|
|
12
|
-
*/
|
|
13
|
-
const _stableStringifyCache = /* @__PURE__ */ new WeakMap();
|
|
14
|
-
/**
|
|
15
|
-
* Recursively serialize a value with sorted keys for stable output.
|
|
16
|
-
* This ensures that {a: 1, b: 2} and {b: 2, a: 1} produce the same string.
|
|
17
|
-
* Uses a WeakMap cache for object values to avoid re-serializing the same references.
|
|
18
|
-
*/
|
|
19
|
-
function stableStringify(value) {
|
|
20
|
-
if (value === null) return "null";
|
|
21
|
-
if (value === void 0) return "undefined";
|
|
22
|
-
if (typeof value !== "object") return JSON.stringify(value);
|
|
23
|
-
const cached = _stableStringifyCache.get(value);
|
|
24
|
-
if (cached !== void 0) return cached;
|
|
25
|
-
let result;
|
|
26
|
-
if (Array.isArray(value)) result = "[" + value.map(stableStringify).join(",") + "]";
|
|
27
|
-
else {
|
|
28
|
-
const obj = value;
|
|
29
|
-
const sortedKeys = Object.keys(obj).sort();
|
|
30
|
-
const parts = [];
|
|
31
|
-
for (const key of sortedKeys) if (obj[key] !== void 0) parts.push(`${JSON.stringify(key)}:${stableStringify(obj[key])}`);
|
|
32
|
-
result = "{" + parts.join(",") + "}";
|
|
33
|
-
}
|
|
34
|
-
_stableStringifyCache.set(value, result);
|
|
35
|
-
return result;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Generate a cache key for a specific chunk.
|
|
39
|
-
*
|
|
40
|
-
* Only includes the styles that belong to this chunk, allowing
|
|
41
|
-
* chunks to be cached independently.
|
|
42
|
-
*
|
|
43
|
-
* Also includes relevant local predefined states that are referenced
|
|
44
|
-
* by this chunk's styles.
|
|
45
|
-
*
|
|
46
|
-
* @param styles - The full styles object
|
|
47
|
-
* @param chunkName - Name of the chunk
|
|
48
|
-
* @param styleKeys - Keys of styles belonging to this chunk
|
|
49
|
-
* @returns A stable cache key string
|
|
50
|
-
*/
|
|
51
|
-
function generateChunkCacheKey(styles, chunkName, styleKeys) {
|
|
52
|
-
const parts = [chunkName];
|
|
53
|
-
let chunkStylesStr = "";
|
|
54
|
-
for (const key of styleKeys) {
|
|
55
|
-
const value = styles[key];
|
|
56
|
-
if (value !== void 0) {
|
|
57
|
-
const serialized = stableStringify(value);
|
|
58
|
-
parts.push(`${key}:${serialized}`);
|
|
59
|
-
chunkStylesStr += serialized;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
const localStates = extractLocalPredefinedStates(styles);
|
|
63
|
-
if (Object.keys(localStates).length > 0) {
|
|
64
|
-
const referencedStates = extractPredefinedStateRefs(chunkStylesStr);
|
|
65
|
-
const relevantLocalStates = [];
|
|
66
|
-
for (const stateName of referencedStates) if (localStates[stateName]) relevantLocalStates.push(`${stateName}=${localStates[stateName]}`);
|
|
67
|
-
if (relevantLocalStates.length > 0) {
|
|
68
|
-
relevantLocalStates.sort();
|
|
69
|
-
parts.unshift(`[states:${relevantLocalStates.join("|")}]`);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
return parts.join("\0");
|
|
73
|
-
}
|
|
74
|
-
//#endregion
|
|
75
|
-
export { generateChunkCacheKey };
|
|
76
|
-
|
|
77
|
-
//# sourceMappingURL=cacheKey.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cacheKey.js","names":[],"sources":["../../src/chunks/cacheKey.ts"],"sourcesContent":["/**\n * Chunk-specific cache key generation.\n *\n * Generates cache keys that only include styles relevant to a specific chunk,\n * enabling more granular caching and reuse.\n *\n * Enhanced to support predefined states:\n * - Global predefined states don't affect cache keys (constant across app)\n * - Local predefined states only affect cache keys if referenced in the chunk\n */\n\nimport {\n extractLocalPredefinedStates,\n extractPredefinedStateRefs,\n} from '../states';\nimport type { Styles } from '../styles/types';\n\nconst _stableStringifyCache = new WeakMap<object, string>();\n\n/**\n * Recursively serialize a value with sorted keys for stable output.\n * This ensures that {a: 1, b: 2} and {b: 2, a: 1} produce the same string.\n * Uses a WeakMap cache for object values to avoid re-serializing the same references.\n */\nfunction stableStringify(value: unknown): string {\n if (value === null) {\n return 'null';\n }\n if (value === undefined) {\n return 'undefined';\n }\n if (typeof value !== 'object') {\n return JSON.stringify(value);\n }\n\n const cached = _stableStringifyCache.get(value as object);\n if (cached !== undefined) return cached;\n\n let result: string;\n if (Array.isArray(value)) {\n result = '[' + value.map(stableStringify).join(',') + ']';\n } else {\n const obj = value as Record<string, unknown>;\n const sortedKeys = Object.keys(obj).sort();\n const parts: string[] = [];\n for (const key of sortedKeys) {\n if (obj[key] !== undefined) {\n parts.push(`${JSON.stringify(key)}:${stableStringify(obj[key])}`);\n }\n }\n result = '{' + parts.join(',') + '}';\n }\n\n _stableStringifyCache.set(value as object, result);\n return result;\n}\n\n/**\n * Generate a cache key for a specific chunk.\n *\n * Only includes the styles that belong to this chunk, allowing\n * chunks to be cached independently.\n *\n * Also includes relevant local predefined states that are referenced\n * by this chunk's styles.\n *\n * @param styles - The full styles object\n * @param chunkName - Name of the chunk\n * @param styleKeys - Keys of styles belonging to this chunk\n * @returns A stable cache key string\n */\nexport function generateChunkCacheKey(\n styles: Styles,\n chunkName: string,\n styleKeys: string[],\n): string {\n // Start with chunk name for namespace separation\n const parts: string[] = [chunkName];\n\n // styleKeys are already sorted by categorizeStyleKeys\n let chunkStylesStr = '';\n\n for (const key of styleKeys) {\n const value = styles[key];\n if (value !== undefined) {\n // Use stable stringify for consistent serialization regardless of key order\n const serialized = stableStringify(value);\n parts.push(`${key}:${serialized}`);\n chunkStylesStr += serialized;\n }\n }\n\n // Extract local predefined states from the full styles object\n const localStates = extractLocalPredefinedStates(styles);\n\n // Only include local predefined states that are actually referenced in this chunk\n if (Object.keys(localStates).length > 0) {\n const referencedStates = extractPredefinedStateRefs(chunkStylesStr);\n const relevantLocalStates: string[] = [];\n\n for (const stateName of referencedStates) {\n if (localStates[stateName]) {\n relevantLocalStates.push(`${stateName}=${localStates[stateName]}`);\n }\n }\n\n // Add relevant local states to the cache key (sorted for stability)\n if (relevantLocalStates.length > 0) {\n relevantLocalStates.sort();\n parts.unshift(`[states:${relevantLocalStates.join('|')}]`);\n }\n }\n\n // Use null character as separator (safe, not in JSON output)\n return parts.join('\\0');\n}\n"],"mappings":";;;;;;;;;;;;AAiBA,MAAM,wCAAwB,IAAI,SAAyB;;;;;;AAO3D,SAAS,gBAAgB,OAAwB;AAC/C,KAAI,UAAU,KACZ,QAAO;AAET,KAAI,UAAU,KAAA,EACZ,QAAO;AAET,KAAI,OAAO,UAAU,SACnB,QAAO,KAAK,UAAU,MAAM;CAG9B,MAAM,SAAS,sBAAsB,IAAI,MAAgB;AACzD,KAAI,WAAW,KAAA,EAAW,QAAO;CAEjC,IAAI;AACJ,KAAI,MAAM,QAAQ,MAAM,CACtB,UAAS,MAAM,MAAM,IAAI,gBAAgB,CAAC,KAAK,IAAI,GAAG;MACjD;EACL,MAAM,MAAM;EACZ,MAAM,aAAa,OAAO,KAAK,IAAI,CAAC,MAAM;EAC1C,MAAM,QAAkB,EAAE;AAC1B,OAAK,MAAM,OAAO,WAChB,KAAI,IAAI,SAAS,KAAA,EACf,OAAM,KAAK,GAAG,KAAK,UAAU,IAAI,CAAC,GAAG,gBAAgB,IAAI,KAAK,GAAG;AAGrE,WAAS,MAAM,MAAM,KAAK,IAAI,GAAG;;AAGnC,uBAAsB,IAAI,OAAiB,OAAO;AAClD,QAAO;;;;;;;;;;;;;;;;AAiBT,SAAgB,sBACd,QACA,WACA,WACQ;CAER,MAAM,QAAkB,CAAC,UAAU;CAGnC,IAAI,iBAAiB;AAErB,MAAK,MAAM,OAAO,WAAW;EAC3B,MAAM,QAAQ,OAAO;AACrB,MAAI,UAAU,KAAA,GAAW;GAEvB,MAAM,aAAa,gBAAgB,MAAM;AACzC,SAAM,KAAK,GAAG,IAAI,GAAG,aAAa;AAClC,qBAAkB;;;CAKtB,MAAM,cAAc,6BAA6B,OAAO;AAGxD,KAAI,OAAO,KAAK,YAAY,CAAC,SAAS,GAAG;EACvC,MAAM,mBAAmB,2BAA2B,eAAe;EACnE,MAAM,sBAAgC,EAAE;AAExC,OAAK,MAAM,aAAa,iBACtB,KAAI,YAAY,WACd,qBAAoB,KAAK,GAAG,UAAU,GAAG,YAAY,aAAa;AAKtE,MAAI,oBAAoB,SAAS,GAAG;AAClC,uBAAoB,MAAM;AAC1B,SAAM,QAAQ,WAAW,oBAAoB,KAAK,IAAI,CAAC,GAAG;;;AAK9D,QAAO,MAAM,KAAK,KAAK"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
//#region src/chunks/definitions.d.ts
|
|
2
|
-
declare const CHUNK_NAMES: {
|
|
3
|
-
/** Special chunk for styles that cannot be split */readonly COMBINED: "combined";
|
|
4
|
-
readonly SUBCOMPONENTS: "subcomponents";
|
|
5
|
-
readonly APPEARANCE: "appearance";
|
|
6
|
-
readonly FONT: "font";
|
|
7
|
-
readonly DIMENSION: "dimension";
|
|
8
|
-
readonly DISPLAY: "display";
|
|
9
|
-
readonly LAYOUT: "layout";
|
|
10
|
-
readonly POSITION: "position";
|
|
11
|
-
readonly MISC: "misc";
|
|
12
|
-
};
|
|
13
|
-
type ChunkName = (typeof CHUNK_NAMES)[keyof typeof CHUNK_NAMES];
|
|
14
|
-
/**
|
|
15
|
-
* Pre-computed map for O(1) style-to-chunk lookup.
|
|
16
|
-
* Built once at module load time.
|
|
17
|
-
*/
|
|
18
|
-
declare const STYLE_TO_CHUNK: Map<string, ChunkName>;
|
|
19
|
-
interface ChunkInfo {
|
|
20
|
-
/** Name of the chunk */
|
|
21
|
-
name: ChunkName | string;
|
|
22
|
-
/** Style keys belonging to this chunk */
|
|
23
|
-
styleKeys: string[];
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Categorize style keys into chunks.
|
|
27
|
-
*
|
|
28
|
-
* Returns chunks in a deterministic order (by CHUNK_ORDER) regardless
|
|
29
|
-
* of the order of keys in the input styles object.
|
|
30
|
-
*
|
|
31
|
-
* @param styles - The styles object to categorize
|
|
32
|
-
* @returns Map of chunk name to array of style keys in that chunk (in priority order)
|
|
33
|
-
*/
|
|
34
|
-
declare function categorizeStyleKeys(styles: Record<string, unknown>): Map<string, string[]>;
|
|
35
|
-
//#endregion
|
|
36
|
-
export { CHUNK_NAMES, ChunkInfo, ChunkName, STYLE_TO_CHUNK, categorizeStyleKeys };
|
|
37
|
-
//# sourceMappingURL=definitions.d.ts.map
|