@tenphi/tasty 0.0.0-snapshot.fa94a5a → 0.0.0-snapshot.fc19da9
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 +437 -362
- package/dist/babel-types-DpUCD2L_.d.ts +18 -0
- package/dist/chunks/async-storage-f9j9JRtq.js +37 -0
- package/dist/chunks/async-storage-f9j9JRtq.js.map +1 -0
- package/dist/chunks/build-config-BDLYGmKn.js +60 -0
- package/dist/chunks/build-config-BDLYGmKn.js.map +1 -0
- package/dist/chunks/collector-DqcB0UUT.js +210 -0
- package/dist/chunks/collector-DqcB0UUT.js.map +1 -0
- package/dist/chunks/config-engine-CGIMO2PV.js +272 -0
- package/dist/chunks/config-engine-CGIMO2PV.js.map +1 -0
- package/dist/chunks/config-file-DlZXJMj8.js +25 -0
- package/dist/chunks/config-file-DlZXJMj8.js.map +1 -0
- package/dist/chunks/css-definitions-BibU6ZnP.js +904 -0
- package/dist/chunks/css-definitions-BibU6ZnP.js.map +1 -0
- package/dist/chunks/css-resources-P7IBUUZs.js +142 -0
- package/dist/chunks/css-resources-P7IBUUZs.js.map +1 -0
- package/dist/{debug.js → chunks/debug-BzYPQ0H2.js} +197 -149
- package/dist/chunks/debug-BzYPQ0H2.js.map +1 -0
- package/dist/chunks/dsl-DRhFWQzo.js +1378 -0
- package/dist/chunks/dsl-DRhFWQzo.js.map +1 -0
- package/dist/chunks/hydration-TRcz5vnk.js +41 -0
- package/dist/chunks/hydration-TRcz5vnk.js.map +1 -0
- package/dist/chunks/react-runtime-B2e-Wha-.js +689 -0
- package/dist/chunks/react-runtime-B2e-Wha-.js.map +1 -0
- package/dist/chunks/runtime-engine-yeyCAx2e.js +2431 -0
- package/dist/chunks/runtime-engine-yeyCAx2e.js.map +1 -0
- package/dist/chunks/runtime-state-C0u1jp-Q.js +141 -0
- package/dist/chunks/runtime-state-C0u1jp-Q.js.map +1 -0
- package/dist/{utils/merge-styles.js → chunks/shared-utils-y-HjvPN4.js} +61 -58
- package/dist/chunks/shared-utils-y-HjvPN4.js.map +1 -0
- package/dist/chunks/style-engine-D35rvcdB.js +5420 -0
- package/dist/chunks/style-engine-D35rvcdB.js.map +1 -0
- package/dist/chunks/zero-engine-DpkieEPZ.js +310 -0
- package/dist/chunks/zero-engine-DpkieEPZ.js.map +1 -0
- package/dist/collector-D4POJ53X.d.ts +164 -0
- package/dist/config-DvPUj4cw.d.ts +1364 -0
- package/dist/core/index.d.ts +5 -34
- package/dist/core/index.js +9 -27
- package/dist/hydrate-CRyjjAyl.d.ts +22 -0
- package/dist/index-DC4q-xDq.d.ts +1946 -0
- package/dist/index.d.ts +5 -51
- package/dist/index.js +11 -36
- package/dist/{utils/merge-styles.d.ts → merge-styles-Jb5iZ-Jf.d.ts} +3 -4
- package/dist/ssr/astro-client.d.ts +1 -0
- package/dist/ssr/astro-client.js +6 -0
- package/dist/ssr/astro-client.js.map +1 -0
- package/dist/ssr/astro-middleware-extract-static.d.ts +10 -0
- package/dist/ssr/astro-middleware-extract-static.js +9 -0
- package/dist/ssr/astro-middleware-extract-static.js.map +1 -0
- package/dist/ssr/astro-middleware-extract.d.ts +10 -0
- package/dist/ssr/astro-middleware-extract.js +9 -0
- package/dist/ssr/astro-middleware-extract.js.map +1 -0
- package/dist/ssr/astro-middleware-static.d.ts +17 -0
- package/dist/ssr/astro-middleware-static.js +7 -0
- package/dist/ssr/astro-middleware-static.js.map +1 -0
- package/dist/ssr/astro-middleware.d.ts +18 -0
- package/dist/ssr/astro-middleware.js +7 -0
- package/dist/ssr/astro-middleware.js.map +1 -0
- package/dist/ssr/astro.d.ts +110 -12
- package/dist/ssr/astro.js +206 -50
- package/dist/ssr/astro.js.map +1 -1
- package/dist/ssr/client.d.ts +2 -0
- package/dist/ssr/client.js +2 -0
- package/dist/ssr/index.d.ts +17 -5
- package/dist/ssr/index.js +7 -9
- package/dist/ssr/index.js.map +1 -1
- package/dist/ssr/next-config.d.ts +64 -0
- package/dist/ssr/next-config.js +123 -0
- package/dist/ssr/next-config.js.map +1 -0
- package/dist/ssr/next.d.ts +13 -12
- package/dist/ssr/next.js +40 -51
- package/dist/ssr/next.js.map +1 -1
- package/dist/static/index.d.ts +90 -5
- package/dist/static/index.js +31 -4
- package/dist/static/index.js.map +1 -0
- package/dist/static/inject.d.ts +4 -0
- package/dist/static/inject.js +17 -0
- package/dist/static/inject.js.map +1 -0
- package/dist/types-ZbF2_6LV.d.ts +1567 -0
- package/dist/zero/babel.d.ts +20 -120
- package/dist/zero/babel.js +189 -148
- package/dist/zero/babel.js.map +1 -1
- package/dist/zero/index.d.ts +117 -3
- package/dist/zero/index.js +23 -3
- package/dist/zero/index.js.map +1 -0
- package/dist/zero/next.d.ts +16 -5
- package/dist/zero/next.js +8 -42
- package/dist/zero/next.js.map +1 -1
- package/docs/README.md +23 -12
- package/docs/adoption.md +72 -37
- package/docs/ai-agents.md +252 -0
- package/docs/comparison.md +83 -54
- package/docs/configuration.md +698 -81
- package/docs/debug.md +39 -24
- package/docs/design-system.md +174 -41
- package/docs/dsl.md +615 -197
- package/docs/getting-started.md +132 -52
- package/docs/injector.md +195 -90
- package/docs/methodology.md +153 -47
- package/docs/migration-v3.md +285 -0
- package/docs/pipeline.md +768 -0
- package/docs/plugins.md +333 -0
- package/docs/react-api.md +703 -0
- package/docs/runtime-benchmarks.md +388 -0
- package/docs/ssr.md +395 -149
- package/docs/styles.md +194 -45
- package/docs/tasty-static.md +327 -101
- package/package.json +153 -35
- package/tasty.config.ts +6 -0
- package/dist/_virtual/_rolldown/runtime.js +0 -8
- package/dist/chunks/cacheKey.js +0 -78
- package/dist/chunks/cacheKey.js.map +0 -1
- package/dist/chunks/definitions.d.ts +0 -37
- package/dist/chunks/definitions.js +0 -259
- package/dist/chunks/definitions.js.map +0 -1
- package/dist/chunks/renderChunk.js +0 -60
- package/dist/chunks/renderChunk.js.map +0 -1
- package/dist/config.d.ts +0 -366
- package/dist/config.js +0 -504
- 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.map +0 -1
- package/dist/font-face/index.js +0 -63
- package/dist/font-face/index.js.map +0 -1
- package/dist/hooks/resolve-ssr-collector.js +0 -15
- package/dist/hooks/resolve-ssr-collector.js.map +0 -1
- package/dist/hooks/useCounterStyle.d.ts +0 -50
- package/dist/hooks/useCounterStyle.js +0 -47
- package/dist/hooks/useCounterStyle.js.map +0 -1
- package/dist/hooks/useFontFace.d.ts +0 -43
- package/dist/hooks/useFontFace.js +0 -71
- package/dist/hooks/useFontFace.js.map +0 -1
- package/dist/hooks/useGlobalStyles.d.ts +0 -30
- package/dist/hooks/useGlobalStyles.js +0 -79
- package/dist/hooks/useGlobalStyles.js.map +0 -1
- package/dist/hooks/useKeyframes.d.ts +0 -56
- package/dist/hooks/useKeyframes.js +0 -65
- package/dist/hooks/useKeyframes.js.map +0 -1
- package/dist/hooks/useProperty.d.ts +0 -79
- package/dist/hooks/useProperty.js +0 -110
- package/dist/hooks/useProperty.js.map +0 -1
- package/dist/hooks/useRawCSS.d.ts +0 -53
- package/dist/hooks/useRawCSS.js +0 -36
- package/dist/hooks/useRawCSS.js.map +0 -1
- package/dist/hooks/useStyles.d.ts +0 -45
- package/dist/hooks/useStyles.js +0 -270
- package/dist/hooks/useStyles.js.map +0 -1
- package/dist/injector/index.d.ts +0 -183
- package/dist/injector/index.js +0 -180
- package/dist/injector/index.js.map +0 -1
- package/dist/injector/injector.d.ts +0 -166
- package/dist/injector/injector.js +0 -465
- package/dist/injector/injector.js.map +0 -1
- package/dist/injector/sheet-manager.d.ts +0 -136
- package/dist/injector/sheet-manager.js +0 -731
- package/dist/injector/sheet-manager.js.map +0 -1
- package/dist/injector/types.d.ts +0 -204
- package/dist/keyframes/index.js +0 -206
- package/dist/keyframes/index.js.map +0 -1
- package/dist/parser/classify.js +0 -320
- package/dist/parser/classify.js.map +0 -1
- package/dist/parser/const.js +0 -33
- 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 -116
- 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 -231
- package/dist/pipeline/exclusive.js.map +0 -1
- package/dist/pipeline/index.d.ts +0 -53
- package/dist/pipeline/index.js +0 -699
- package/dist/pipeline/index.js.map +0 -1
- package/dist/pipeline/materialize.js +0 -1105
- package/dist/pipeline/materialize.js.map +0 -1
- package/dist/pipeline/parseStateKey.d.ts +0 -15
- package/dist/pipeline/parseStateKey.js +0 -447
- package/dist/pipeline/parseStateKey.js.map +0 -1
- package/dist/pipeline/simplify.js +0 -516
- 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/okhsl-plugin.d.ts +0 -35
- package/dist/plugins/okhsl-plugin.js +0 -98
- package/dist/plugins/okhsl-plugin.js.map +0 -1
- package/dist/plugins/types.d.ts +0 -76
- package/dist/properties/index.js +0 -223
- 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 -91
- package/dist/properties/property-type-resolver.js.map +0 -1
- package/dist/ssr/async-storage.d.ts +0 -17
- package/dist/ssr/async-storage.js +0 -35
- package/dist/ssr/async-storage.js.map +0 -1
- package/dist/ssr/collect-auto-properties.js +0 -40
- package/dist/ssr/collect-auto-properties.js.map +0 -1
- package/dist/ssr/collector.d.ts +0 -102
- package/dist/ssr/collector.js +0 -227
- package/dist/ssr/collector.js.map +0 -1
- package/dist/ssr/context.d.ts +0 -8
- package/dist/ssr/context.js +0 -14
- package/dist/ssr/context.js.map +0 -1
- package/dist/ssr/format-global-rules.js +0 -22
- package/dist/ssr/format-global-rules.js.map +0 -1
- package/dist/ssr/format-keyframes.js +0 -70
- package/dist/ssr/format-keyframes.js.map +0 -1
- package/dist/ssr/format-property.js +0 -50
- package/dist/ssr/format-property.js.map +0 -1
- package/dist/ssr/format-rules.js +0 -70
- package/dist/ssr/format-rules.js.map +0 -1
- package/dist/ssr/hydrate.d.ts +0 -22
- package/dist/ssr/hydrate.js +0 -50
- package/dist/ssr/hydrate.js.map +0 -1
- package/dist/ssr/ssr-collector-ref.js +0 -12
- package/dist/ssr/ssr-collector-ref.js.map +0 -1
- package/dist/states/index.d.ts +0 -49
- package/dist/states/index.js +0 -171
- package/dist/states/index.js.map +0 -1
- package/dist/static/tastyStatic.d.ts +0 -46
- package/dist/static/tastyStatic.js +0 -31
- 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/align.d.ts +0 -15
- package/dist/styles/align.js +0 -14
- package/dist/styles/align.js.map +0 -1
- package/dist/styles/border.d.ts +0 -25
- package/dist/styles/border.js +0 -114
- package/dist/styles/border.js.map +0 -1
- package/dist/styles/color.d.ts +0 -14
- package/dist/styles/color.js +0 -27
- package/dist/styles/color.js.map +0 -1
- package/dist/styles/createStyle.js +0 -80
- package/dist/styles/createStyle.js.map +0 -1
- package/dist/styles/dimension.js +0 -97
- package/dist/styles/dimension.js.map +0 -1
- package/dist/styles/display.d.ts +0 -37
- package/dist/styles/display.js +0 -67
- package/dist/styles/display.js.map +0 -1
- package/dist/styles/fade.d.ts +0 -15
- package/dist/styles/fade.js +0 -58
- package/dist/styles/fade.js.map +0 -1
- package/dist/styles/fill.d.ts +0 -42
- package/dist/styles/fill.js +0 -52
- 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 -37
- package/dist/styles/gap.js.map +0 -1
- package/dist/styles/height.d.ts +0 -17
- package/dist/styles/height.js +0 -20
- package/dist/styles/height.js.map +0 -1
- package/dist/styles/index.d.ts +0 -2
- package/dist/styles/index.js +0 -9
- package/dist/styles/index.js.map +0 -1
- package/dist/styles/inset.d.ts +0 -52
- package/dist/styles/inset.js +0 -150
- package/dist/styles/inset.js.map +0 -1
- package/dist/styles/justify.d.ts +0 -15
- package/dist/styles/justify.js +0 -14
- package/dist/styles/justify.js.map +0 -1
- package/dist/styles/list.d.ts +0 -16
- package/dist/styles/list.js +0 -98
- package/dist/styles/list.js.map +0 -1
- package/dist/styles/margin.d.ts +0 -24
- package/dist/styles/margin.js +0 -104
- package/dist/styles/margin.js.map +0 -1
- package/dist/styles/outline.d.ts +0 -29
- package/dist/styles/outline.js +0 -65
- package/dist/styles/outline.js.map +0 -1
- package/dist/styles/padding.d.ts +0 -24
- package/dist/styles/padding.js +0 -104
- package/dist/styles/padding.js.map +0 -1
- package/dist/styles/predefined.d.ts +0 -71
- package/dist/styles/predefined.js +0 -238
- package/dist/styles/predefined.js.map +0 -1
- package/dist/styles/preset.d.ts +0 -47
- package/dist/styles/preset.js +0 -112
- package/dist/styles/preset.js.map +0 -1
- package/dist/styles/radius.d.ts +0 -14
- package/dist/styles/radius.js +0 -51
- package/dist/styles/radius.js.map +0 -1
- package/dist/styles/scrollbar.d.ts +0 -25
- package/dist/styles/scrollbar.js +0 -48
- package/dist/styles/scrollbar.js.map +0 -1
- package/dist/styles/shadow.d.ts +0 -14
- package/dist/styles/shadow.js +0 -24
- package/dist/styles/shadow.js.map +0 -1
- package/dist/styles/transition.d.ts +0 -14
- package/dist/styles/transition.js +0 -158
- package/dist/styles/transition.js.map +0 -1
- package/dist/styles/types.d.ts +0 -545
- package/dist/styles/width.d.ts +0 -17
- package/dist/styles/width.js +0 -20
- package/dist/styles/width.js.map +0 -1
- package/dist/tasty.d.ts +0 -119
- package/dist/tasty.js +0 -232
- package/dist/tasty.js.map +0 -1
- package/dist/types.d.ts +0 -184
- package/dist/utils/cache-wrapper.js +0 -22
- 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 -229
- package/dist/utils/color-space.js.map +0 -1
- package/dist/utils/colors.d.ts +0 -5
- package/dist/utils/colors.js +0 -11
- package/dist/utils/colors.js.map +0 -1
- package/dist/utils/css-types.d.ts +0 -7
- 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/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 -8
- package/dist/utils/mod-attrs.js +0 -21
- package/dist/utils/mod-attrs.js.map +0 -1
- package/dist/utils/process-tokens.d.ts +0 -21
- package/dist/utils/process-tokens.js +0 -91
- package/dist/utils/process-tokens.js.map +0 -1
- package/dist/utils/resolve-recipes.d.ts +0 -17
- package/dist/utils/resolve-recipes.js +0 -147
- 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 -101
- package/dist/utils/styles.js +0 -223
- package/dist/utils/styles.js.map +0 -1
- package/dist/utils/typography.d.ts +0 -47
- package/dist/utils/typography.js +0 -43
- 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 -74
- package/dist/zero/css-writer.js.map +0 -1
- package/dist/zero/extractor.d.ts +0 -24
- package/dist/zero/extractor.js +0 -267
- package/dist/zero/extractor.js.map +0 -1
- package/docs/PIPELINE.md +0 -519
- package/docs/runtime.md +0 -485
package/docs/methodology.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# Methodology
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
State maps keep a property’s branches from fighting. This guide applies the same goal to component architecture: keep state ownership explicit, expose intentional public APIs, and make extension predictable as a component system grows.
|
|
4
|
+
|
|
5
|
+
The patterns are recommended rather than required. Tasty works without them, but they help design-system teams carry its state-resolution guarantees across roots, sub-elements, typed props, tokens, and styled wrappers.
|
|
4
6
|
|
|
5
7
|
---
|
|
6
8
|
|
|
@@ -75,7 +77,7 @@ const Nav = tasty({
|
|
|
75
77
|
'': '#text',
|
|
76
78
|
'@own(:hover)': '#primary',
|
|
77
79
|
'@own(:focus-visible)': '#primary',
|
|
78
|
-
|
|
80
|
+
selected: '#primary',
|
|
79
81
|
},
|
|
80
82
|
},
|
|
81
83
|
},
|
|
@@ -117,16 +119,17 @@ Style props accept state maps, so responsive values work through the same API:
|
|
|
117
119
|
|
|
118
120
|
Tasty exports predefined style prop lists that group properties by role. Use them instead of hand-picking arrays:
|
|
119
121
|
|
|
120
|
-
| Preset
|
|
121
|
-
|
|
122
|
-
| `FLOW_STYLES`
|
|
123
|
-
| `POSITION_STYLES`
|
|
124
|
-
| `DIMENSION_STYLES` | width, height, flexBasis, flexGrow, flexShrink, flex
|
|
125
|
-
| `COLOR_STYLES`
|
|
126
|
-
| `BLOCK_STYLES`
|
|
127
|
-
| `
|
|
128
|
-
| `
|
|
129
|
-
| `
|
|
122
|
+
| Preset | Properties | Typical use |
|
|
123
|
+
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------- |
|
|
124
|
+
| `FLOW_STYLES` | flow, gap, columnGap, rowGap, align, justify, place, placeItems, placeContent, alignItems, alignContent, justifyItems, justifyContent, gridColumns, gridRows, gridTemplate, gridAreas | Layout containers (`Space`, `Grid`) |
|
|
125
|
+
| `POSITION_STYLES` | gridArea, gridColumn, gridRow, order, placeSelf, alignSelf, justifySelf, zIndex, physical/logical margin, inset, scroll margin/padding, position | Positioned elements (`Button`, `Badge`) |
|
|
126
|
+
| `DIMENSION_STYLES` | width, height, blockSize, inlineSize, flexBasis, flexGrow, flexShrink, flex | Sized elements |
|
|
127
|
+
| `COLOR_STYLES` | color, fill, fade, image | Color-customizable elements |
|
|
128
|
+
| `BLOCK_STYLES` | padding, blockPadding, inlinePadding, overflow, scrollbar, textAlign, border, blockBorder, inlineBorder, radius, shadow, outline | Block-level containers |
|
|
129
|
+
| `TEXT_STYLES` | textTransform, fontWeight, fontStyle | Text elements |
|
|
130
|
+
| `CONTAINER_STYLES` | All of the above combined (+ BASE_STYLES) | Fully flexible containers |
|
|
131
|
+
| `OUTER_STYLES` | POSITION_STYLES + DIMENSION_STYLES + block outer (border, radius, shadow, outline) | Components whose outer shell is customizable |
|
|
132
|
+
| `INNER_STYLES` | BASE_STYLES + COLOR_STYLES + block inner (padding, overflow, scrollbar) + FLOW_STYLES | Components whose inner layout is customizable |
|
|
130
133
|
|
|
131
134
|
```tsx
|
|
132
135
|
import { tasty, FLOW_STYLES, POSITION_STYLES } from '@tenphi/tasty';
|
|
@@ -154,12 +157,15 @@ Match the preset to the component's role:
|
|
|
154
157
|
|
|
155
158
|
- **Layout containers** (`Space`, `Box`, `Grid`) — `FLOW_STYLES`, optionally with `DIMENSION_STYLES`
|
|
156
159
|
- **Positioned elements** (`Button`, `Badge`) — `POSITION_STYLES`
|
|
157
|
-
- **Text elements** —
|
|
160
|
+
- **Text elements** — `['color', ...TEXT_STYLES]`
|
|
161
|
+
|
|
162
|
+
`BASE_STYLES` (`display`, `font`, `preset`, `hide`, `whiteSpace`, `opacity`, `transition`) are accepted as props on every component without being listed; extend that set app-wide with [`configure({ baseStyleProps })`](configuration.md#base-style-props).
|
|
163
|
+
|
|
158
164
|
- **Compound components** — typically none; styling happens via sub-elements and extension
|
|
159
165
|
|
|
160
166
|
### The governance trade-off
|
|
161
167
|
|
|
162
|
-
Exposing every CSS property as a prop defeats the purpose of a design system. The more props a component exposes, the more ways product engineers can deviate from the intended design. A good rule of thumb: expose props that product engineers
|
|
168
|
+
Exposing every CSS property as a prop defeats the purpose of a design system. The more props a component exposes, the more ways product engineers can deviate from the intended design. A good rule of thumb: expose props that product engineers _need_ to adjust for layout and composition, and keep visual identity (colors, borders, typography) controlled through the component definition, variants, or styled wrappers.
|
|
163
169
|
|
|
164
170
|
---
|
|
165
171
|
|
|
@@ -180,17 +186,19 @@ const Card = tasty({
|
|
|
180
186
|
});
|
|
181
187
|
|
|
182
188
|
// Clean prop API — no mods object needed
|
|
183
|
-
<Card isLoading isSelected>
|
|
189
|
+
<Card isLoading isSelected>
|
|
190
|
+
Content
|
|
191
|
+
</Card>;
|
|
184
192
|
```
|
|
185
193
|
|
|
186
194
|
### When to use which
|
|
187
195
|
|
|
188
|
-
| Pattern
|
|
189
|
-
|
|
190
|
-
| `modProps`
|
|
191
|
-
| `mods` prop
|
|
192
|
-
| Both
|
|
193
|
-
| `styleProps` | Exposing CSS properties (layout, sizing) for customization — different from modifiers.
|
|
196
|
+
| Pattern | Use when |
|
|
197
|
+
| ------------ | --------------------------------------------------------------------------------------------------------------------------------------- |
|
|
198
|
+
| `modProps` | The component has a fixed set of known boolean/string states that drive styles. Provides TypeScript autocomplete and a cleaner JSX API. |
|
|
199
|
+
| `mods` prop | The component needs arbitrary or dynamic modifiers that aren't known at definition time. |
|
|
200
|
+
| Both | Combine `modProps` for the known states and `mods` for ad-hoc overrides. Mod props take precedence. |
|
|
201
|
+
| `styleProps` | Exposing CSS properties (layout, sizing) for customization — different from modifiers. |
|
|
194
202
|
|
|
195
203
|
### Typed modProps vs array form
|
|
196
204
|
|
|
@@ -214,7 +222,27 @@ The array form is simpler but types all values as `ModValue`:
|
|
|
214
222
|
modProps: ['isLoading', 'isSelected'] as const,
|
|
215
223
|
```
|
|
216
224
|
|
|
217
|
-
For the full API reference, see [
|
|
225
|
+
For the full API reference, see [React API — Mod Props](react-api.md#mod-props).
|
|
226
|
+
|
|
227
|
+
### variants vs modProps
|
|
228
|
+
|
|
229
|
+
Use `variants` for looks that replace each other (primary, danger, ghost) and `modProps` for states that combine (`isLoading`, `size`):
|
|
230
|
+
|
|
231
|
+
```tsx
|
|
232
|
+
const Button = tasty({
|
|
233
|
+
as: 'button',
|
|
234
|
+
modProps: { isLoading: Boolean, size: ['sm', 'md', 'lg'] as const },
|
|
235
|
+
styles: { padding: { '': '1.5x 3x', 'size=sm': '1x 2x' }, radius: '1r' },
|
|
236
|
+
variants: {
|
|
237
|
+
default: { fill: '#primary', color: '#on-primary' },
|
|
238
|
+
danger: { fill: '#danger', color: '#on-danger' },
|
|
239
|
+
},
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
<Button variant="danger" size="sm" isLoading />;
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
`variant` is typed from the variant keys, the `default` variant applies when no `variant` prop is passed, and only variants that render emit CSS. See [React API — Variants](react-api.md#variants).
|
|
218
246
|
|
|
219
247
|
---
|
|
220
248
|
|
|
@@ -232,30 +260,78 @@ const ProgressBar = tasty({
|
|
|
232
260
|
width: '$progress',
|
|
233
261
|
height: '100%',
|
|
234
262
|
fill: '#primary',
|
|
235
|
-
transition: 'width
|
|
263
|
+
transition: 'width',
|
|
236
264
|
},
|
|
237
265
|
},
|
|
238
266
|
elements: { Bar: 'div' },
|
|
239
267
|
});
|
|
240
268
|
|
|
241
269
|
// Usage: the progress value comes from a prop, not from styles
|
|
242
|
-
<ProgressBar tokens={{
|
|
270
|
+
<ProgressBar tokens={{ $progress: `${percent}%` }} />;
|
|
243
271
|
```
|
|
244
272
|
|
|
245
273
|
The `tokens` prop sets `style="--progress: 75%"` on the DOM element. The `$progress` reference in styles maps to `var(--progress)`, so the bar width updates without regenerating any CSS.
|
|
246
274
|
|
|
247
275
|
### When to use tokens vs other mechanisms
|
|
248
276
|
|
|
249
|
-
| Need
|
|
250
|
-
|
|
251
|
-
| Value changes per instance at render time (progress, user color, avatar size) | `tokens` prop (on component)
|
|
252
|
-
| Value is constant across all instances (card padding, border radius)
|
|
253
|
-
| Value should be inlined at parse time (alias for another token)
|
|
254
|
-
| Value changes based on component state (hover, disabled, breakpoint)
|
|
255
|
-
| Value changes based on a variant (primary, danger, outline)
|
|
277
|
+
| Need | Use |
|
|
278
|
+
| ----------------------------------------------------------------------------- | --------------------------------------------------------- |
|
|
279
|
+
| Value changes per instance at render time (progress, user color, avatar size) | `tokens` prop (on component) |
|
|
280
|
+
| Value is constant across all instances (card padding, border radius) | `configure({ tokens })` for `:root` CSS custom properties |
|
|
281
|
+
| Value should be inlined at parse time (alias for another token) | `configure({ replaceTokens })` |
|
|
282
|
+
| Value changes based on component state (hover, disabled, breakpoint) | State map in `styles` |
|
|
283
|
+
| Value changes based on a variant (primary, danger, outline) | `variants` option |
|
|
256
284
|
|
|
257
285
|
Design tokens (via `configure({ tokens })`) are injected as CSS custom properties on `:root`. Replace tokens (via `configure({ replaceTokens })`) are resolved at parse time and baked into the generated CSS. The `tokens` prop on components is resolved at render time via inline CSS custom properties. Use design tokens for design-system constants, replace tokens for value aliases, and the `tokens` prop for truly dynamic per-instance values.
|
|
258
286
|
|
|
287
|
+
### tokenProps
|
|
288
|
+
|
|
289
|
+
`tokenProps` expose token keys as top-level component props — the token equivalent of `styleProps` and `modProps`. Use them when a component has a fixed set of known dynamic token values.
|
|
290
|
+
|
|
291
|
+
#### Array form
|
|
292
|
+
|
|
293
|
+
Prop names are plain camelCase identifiers. Names ending in `Color` map to `#` color tokens; everything else maps to `$` custom property tokens:
|
|
294
|
+
|
|
295
|
+
```tsx
|
|
296
|
+
const ProgressBar = tasty({
|
|
297
|
+
tokenProps: ['progress', 'accentColor'] as const,
|
|
298
|
+
styles: { width: '$progress', fill: '#accent' },
|
|
299
|
+
});
|
|
300
|
+
|
|
301
|
+
// Clean prop API — no tokens object needed
|
|
302
|
+
<ProgressBar progress="75%" accentColor="#purple" />;
|
|
303
|
+
|
|
304
|
+
// Conversion:
|
|
305
|
+
// 'progress' → $progress → --progress
|
|
306
|
+
// 'accentColor' → #accent → --accent-color
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
#### Object form
|
|
310
|
+
|
|
311
|
+
Keys are prop names; values are `$`/`#`-prefixed token keys. No suffix convention needed — the prefix in the value is explicit:
|
|
312
|
+
|
|
313
|
+
```tsx
|
|
314
|
+
const Card = tasty({
|
|
315
|
+
tokenProps: {
|
|
316
|
+
size: '$card-size',
|
|
317
|
+
color: '#card-accent',
|
|
318
|
+
},
|
|
319
|
+
styles: { padding: '$card-size', fill: '#card-accent' },
|
|
320
|
+
});
|
|
321
|
+
|
|
322
|
+
<Card size="4x" color="#purple" />;
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
#### Merge order
|
|
326
|
+
|
|
327
|
+
When all three token sources are present, values merge with increasing priority:
|
|
328
|
+
|
|
329
|
+
1. `tokens` option in `tasty({...})` — default tokens (lowest)
|
|
330
|
+
2. `tokens` prop on the component instance — runtime overrides
|
|
331
|
+
3. `tokenProps`-derived values — highest priority (explicit named props win)
|
|
332
|
+
|
|
333
|
+
The `tokens` prop remains available for ad-hoc or dynamic tokens alongside `tokenProps`.
|
|
334
|
+
|
|
259
335
|
---
|
|
260
336
|
|
|
261
337
|
## styles prop vs style prop
|
|
@@ -278,15 +354,14 @@ const LargeCard = tasty(Card, {
|
|
|
278
354
|
styles: { padding: '6x', Title: { color: '#danger' } },
|
|
279
355
|
});
|
|
280
356
|
|
|
281
|
-
<LargeCard
|
|
357
|
+
<LargeCard />;
|
|
282
358
|
```
|
|
283
359
|
|
|
284
360
|
Why? Styled wrappers are:
|
|
285
361
|
|
|
286
|
-
- **
|
|
287
|
-
- **Stable** — the style object is defined once, not recreated on every render
|
|
362
|
+
- **Stable** — the style object is defined once at module level, not recreated on every render
|
|
288
363
|
- **Composable** — another engineer can extend `LargeCard` further
|
|
289
|
-
- **Inspectable** —
|
|
364
|
+
- **Inspectable** — give it a `qa` (`tasty(Card, { qa: 'LargeCard', styles })`) and it appears as `TastyWrappedComponent(LargeCard)` in React DevTools and as `data-qa="LargeCard"` in the DOM
|
|
290
365
|
- **Lint-friendly** — the ESLint plugin's `no-styles-prop` rule flags direct usage
|
|
291
366
|
|
|
292
367
|
The `styles` prop exists as an escape hatch — for prototyping, one-off overrides during development, or cases where wrapping is impractical. It should not be the default way product engineers customize components.
|
|
@@ -351,6 +426,34 @@ tasty(Button, {
|
|
|
351
426
|
|
|
352
427
|
For full details on merge semantics, `@inherit`, `null`, and `false` tombstones, see [Style DSL — Extending vs. Replacing State Maps](dsl.md#extending-vs-replacing-state-maps).
|
|
353
428
|
|
|
429
|
+
### Styling non-Tasty components or string tags
|
|
430
|
+
|
|
431
|
+
`tasty(Component, { ... })` always forwards every prop to `Component`, which means `Component` must be Tasty-aware (i.e. it knows how to consume `styles`, `mods`, `qa`, etc.). To apply styles to a third-party component (Next.js `Link`, `react-router`'s `Link`, Radix primitives, MUI, etc.) or to a plain DOM tag, use the options-only form with `as`:
|
|
432
|
+
|
|
433
|
+
```tsx
|
|
434
|
+
import NextLink from 'next/link';
|
|
435
|
+
|
|
436
|
+
const Link = tasty({
|
|
437
|
+
as: NextLink,
|
|
438
|
+
styles: {
|
|
439
|
+
color: { '': '#accent-text', ':hover': '#text' },
|
|
440
|
+
textDecoration: 'underline',
|
|
441
|
+
},
|
|
442
|
+
styleProps: ['padding'],
|
|
443
|
+
});
|
|
444
|
+
|
|
445
|
+
const Span = tasty({
|
|
446
|
+
as: 'span',
|
|
447
|
+
styles: { preset: 'strong' },
|
|
448
|
+
});
|
|
449
|
+
|
|
450
|
+
<Link href="/blog" padding="1x">
|
|
451
|
+
Blog
|
|
452
|
+
</Link>;
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
The wrapped component only needs to forward `className` (and ideally `style` and `ref`) to its underlying DOM node. Tasty-specific props (`qa`, `qaVal`, `mods`, `tokens`, `isDisabled`, `isHidden`, `isChecked`, and any `styleProps`/`modProps`/`tokenProps` you declared) are consumed by the wrapper and converted to `data-*` attributes or CSS custom properties — they never leak to the DOM.
|
|
456
|
+
|
|
354
457
|
### When to use styleProps vs wrapping
|
|
355
458
|
|
|
356
459
|
If the component exposes the properties you need as `styleProps`, use them directly — that is what they are for:
|
|
@@ -373,11 +476,13 @@ const DangerCard = tasty(Card, {
|
|
|
373
476
|
|
|
374
477
|
This is preferred over `<Card styles={{ border: '1bw solid #danger' }}>` because:
|
|
375
478
|
|
|
376
|
-
1.
|
|
479
|
+
1. The styles live in one module-level definition instead of being rebuilt inside render
|
|
377
480
|
2. `DangerCard` can be extended further by others
|
|
378
|
-
3. It
|
|
481
|
+
3. It is searchable in code, and named in DevTools once you give it a `qa`
|
|
379
482
|
4. The ESLint `no-styles-prop` rule encourages this pattern
|
|
380
483
|
|
|
484
|
+
A wrapper does not re-expose the base's sub-element components: `DangerCard.Title` is `undefined` and not part of its type. Keep using the base's parts inside it — `<DangerCard><Card.Title>…</Card.Title></DangerCard>`. The wrapper's `Title` styles still apply, because they target `[data-element="Title"]`.
|
|
485
|
+
|
|
381
486
|
---
|
|
382
487
|
|
|
383
488
|
## How configuration simplifies components
|
|
@@ -454,11 +559,12 @@ See [Configuration](configuration.md) for the full `configure()` API.
|
|
|
454
559
|
|
|
455
560
|
- **Create styled wrappers** instead of passing `styles` directly — faster, composable, inspectable
|
|
456
561
|
- **Use design tokens and custom units** (`#text`, `2x`, `1r`) instead of raw CSS values
|
|
457
|
-
- **Use semantic transition names** (`transition: 'theme
|
|
562
|
+
- **Use semantic transition names** (`transition: 'theme'`) instead of listing CSS properties; omit the duration to use the motion tokens
|
|
458
563
|
- **Use `elements` prop** to declare typed sub-components for compound components
|
|
459
564
|
- **Use `styleProps`** to define what product engineers can customize
|
|
460
565
|
- **Use `modProps`** to expose known modifier states as clean component props
|
|
461
|
-
- **Use `
|
|
566
|
+
- **Use `tokenProps`** to expose known token keys as clean component props
|
|
567
|
+
- **Use `tokens` prop** for ad-hoc or dynamic per-instance token values (progress, user color)
|
|
462
568
|
- **Use modifiers** (`mods` or `modProps`) for state-driven style changes instead of runtime `styles` prop changes
|
|
463
569
|
|
|
464
570
|
### Avoid
|
|
@@ -473,7 +579,7 @@ fill: 'oklch(55% 0.25 265)',
|
|
|
473
579
|
fill: '#primary',
|
|
474
580
|
```
|
|
475
581
|
|
|
476
|
-
Tokens ensure consistency across components and make theme changes a one-line update.
|
|
582
|
+
Tokens ensure consistency across components and make theme changes a one-line update. The recommended lint config flags this with `tasty/no-raw-color-values` and `tasty/consistent-token-usage`.
|
|
477
583
|
|
|
478
584
|
### Using CSS property names when Tasty alternatives exist
|
|
479
585
|
|
|
@@ -489,7 +595,7 @@ radius: '1r',
|
|
|
489
595
|
flow: 'column',
|
|
490
596
|
```
|
|
491
597
|
|
|
492
|
-
Tasty's enhanced properties provide concise syntax, better composability, and simpler overrides. See [recommended props](styles.md#recommended-props) for the full mapping.
|
|
598
|
+
Tasty's enhanced properties provide concise syntax, better composability, and simpler overrides. See [recommended props](styles.md#recommended-props) for the full mapping. `tasty/prefer-shorthand-property` flags the native spellings.
|
|
493
599
|
|
|
494
600
|
### Changing styles prop at runtime
|
|
495
601
|
|
|
@@ -512,13 +618,13 @@ const Card = tasty({
|
|
|
512
618
|
});
|
|
513
619
|
```
|
|
514
620
|
|
|
515
|
-
Modifiers are compiled into exclusive selectors once. Changing `styles` at runtime forces Tasty to regenerate and re-inject CSS.
|
|
621
|
+
Modifiers are compiled into exclusive selectors once. Changing `styles` at runtime forces Tasty to regenerate and re-inject CSS. `tasty/no-styles-prop` and `tasty/no-runtime-styles-mutation` flag these patterns.
|
|
516
622
|
|
|
517
623
|
### Overusing style prop
|
|
518
624
|
|
|
519
625
|
```tsx
|
|
520
626
|
// Bad: bypassing Tasty for custom styling
|
|
521
|
-
<Button style={{ backgroundColor: 'red', padding: '12px 24px' }}
|
|
627
|
+
<Button style={{ backgroundColor: 'red', padding: '12px 24px' }} />;
|
|
522
628
|
|
|
523
629
|
// Good: create a styled wrapper
|
|
524
630
|
const DangerButton = tasty(Button, {
|
|
@@ -526,7 +632,7 @@ const DangerButton = tasty(Button, {
|
|
|
526
632
|
});
|
|
527
633
|
```
|
|
528
634
|
|
|
529
|
-
The `style` prop bypasses tokens, units, and state maps. It should only be used for third-party library integration.
|
|
635
|
+
The `style` prop bypasses tokens, units, and state maps. It should only be used for third-party library integration. `tasty/no-style-prop` flags it on Tasty components.
|
|
530
636
|
|
|
531
637
|
### Skipping elements for compound components
|
|
532
638
|
|
|
@@ -535,7 +641,7 @@ The `style` prop bypasses tokens, units, and state maps. It should only be used
|
|
|
535
641
|
<Card>
|
|
536
642
|
<div data-element="Title">Card Title</div>
|
|
537
643
|
<div data-element="Content">Card content</div>
|
|
538
|
-
</Card
|
|
644
|
+
</Card>;
|
|
539
645
|
|
|
540
646
|
// Better: declare elements for typed sub-components
|
|
541
647
|
const Card = tasty({
|
|
@@ -549,7 +655,7 @@ const Card = tasty({
|
|
|
549
655
|
<Card>
|
|
550
656
|
<Card.Title>Card Title</Card.Title>
|
|
551
657
|
<Card.Content>Card content</Card.Content>
|
|
552
|
-
</Card
|
|
658
|
+
</Card>;
|
|
553
659
|
```
|
|
554
660
|
|
|
555
661
|
The `elements` prop gives you typed sub-components with automatic `data-element` attributes, `mods` support, and better discoverability.
|
|
@@ -561,7 +667,7 @@ The `elements` prop gives you typed sub-components with automatic `data-element`
|
|
|
561
667
|
- **[Getting Started](getting-started.md)** — Installation, first component, tooling setup
|
|
562
668
|
- **[Building a Design System](design-system.md)** — Practical guide to building a DS layer with Tasty
|
|
563
669
|
- **[Style DSL](dsl.md)** — State maps, tokens, units, extending semantics, keyframes, @property
|
|
564
|
-
- **[
|
|
670
|
+
- **[React API](react-api.md)** — `tasty()` factory, component props, variants, sub-elements, style functions
|
|
565
671
|
- **[Configuration](configuration.md)** — Full `configure()` API: tokens, recipes, custom units, style handlers
|
|
566
672
|
- **[Style Properties](styles.md)** — Complete reference for all enhanced style properties
|
|
567
673
|
- **[Adoption Guide](adoption.md)** — Who should adopt Tasty, incremental phases, what changes for product engineers
|