@tenphi/tasty 0.0.0-snapshot.a7fb1f5 → 0.0.0-snapshot.a8a2a5d
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 +453 -360
- package/dist/babel-types-BOABQvEI.d.ts +16 -0
- package/dist/chunks/async-storage-CzSKAyrI.js +36 -0
- package/dist/chunks/async-storage-CzSKAyrI.js.map +1 -0
- package/dist/chunks/build-config-DQkT3Wru.js +59 -0
- package/dist/chunks/build-config-DQkT3Wru.js.map +1 -0
- package/dist/chunks/collector-Df9zcabl.js +209 -0
- package/dist/chunks/collector-Df9zcabl.js.map +1 -0
- package/dist/chunks/config-engine-C7OUmM1J.js +269 -0
- package/dist/chunks/config-engine-C7OUmM1J.js.map +1 -0
- package/dist/chunks/config-file-BX3F_61U.js +24 -0
- package/dist/chunks/config-file-BX3F_61U.js.map +1 -0
- package/dist/chunks/css-definitions-BkdTqT7G.js +896 -0
- package/dist/chunks/css-definitions-BkdTqT7G.js.map +1 -0
- package/dist/chunks/css-resources-C0zT36nQ.js +141 -0
- package/dist/chunks/css-resources-C0zT36nQ.js.map +1 -0
- package/dist/{debug.js → chunks/debug-CwGMB2RI.js} +197 -149
- package/dist/chunks/debug-CwGMB2RI.js.map +1 -0
- package/dist/chunks/dsl-BAwiOznp.js +1442 -0
- package/dist/chunks/dsl-BAwiOznp.js.map +1 -0
- package/dist/chunks/hydration-DEmoq1sQ.js +39 -0
- package/dist/chunks/hydration-DEmoq1sQ.js.map +1 -0
- package/dist/chunks/react-runtime-B8YqpFx7.js +678 -0
- package/dist/chunks/react-runtime-B8YqpFx7.js.map +1 -0
- package/dist/chunks/runtime-engine-CHNH2nGy.js +2418 -0
- package/dist/chunks/runtime-engine-CHNH2nGy.js.map +1 -0
- package/dist/chunks/runtime-state-BxLKsQzs.js +150 -0
- package/dist/chunks/runtime-state-BxLKsQzs.js.map +1 -0
- package/dist/{utils/merge-styles.js → chunks/shared-utils-CYgOs2mp.js} +58 -58
- package/dist/chunks/shared-utils-CYgOs2mp.js.map +1 -0
- package/dist/chunks/style-engine-DkKH-TqL.js +5573 -0
- package/dist/chunks/style-engine-DkKH-TqL.js.map +1 -0
- package/dist/chunks/zero-engine-C-0ar_PT.js +308 -0
- package/dist/chunks/zero-engine-C-0ar_PT.js.map +1 -0
- package/dist/collector-BN6hCWIx.d.ts +160 -0
- package/dist/config-Chmu-PnP.d.ts +1349 -0
- package/dist/core/index.d.ts +5 -34
- package/dist/core/index.js +9 -27
- package/dist/hydrate-CTh8SGd9.d.ts +20 -0
- package/dist/index-szujmf6W.d.ts +1848 -0
- package/dist/index.d.ts +5 -51
- package/dist/index.js +11 -36
- package/dist/merge-styles-Cx25bpax.d.ts +4 -0
- package/dist/ssr/astro-client.d.ts +1 -0
- package/dist/ssr/astro-client.js +5 -0
- package/dist/ssr/astro-client.js.map +1 -0
- package/dist/ssr/astro-middleware-extract-static.d.ts +8 -0
- package/dist/ssr/astro-middleware-extract-static.js +8 -0
- package/dist/ssr/astro-middleware-extract-static.js.map +1 -0
- package/dist/ssr/astro-middleware-extract.d.ts +8 -0
- package/dist/ssr/astro-middleware-extract.js +8 -0
- package/dist/ssr/astro-middleware-extract.js.map +1 -0
- package/dist/ssr/astro-middleware-static.d.ts +15 -0
- package/dist/ssr/astro-middleware-static.js +6 -0
- package/dist/ssr/astro-middleware-static.js.map +1 -0
- package/dist/ssr/astro-middleware.d.ts +16 -0
- package/dist/ssr/astro-middleware.js +6 -0
- package/dist/ssr/astro-middleware.js.map +1 -0
- package/dist/ssr/astro.d.ts +110 -14
- package/dist/ssr/astro.js +205 -50
- package/dist/ssr/astro.js.map +1 -1
- package/dist/ssr/client.d.ts +2 -0
- package/dist/ssr/client.js +1 -0
- package/dist/ssr/index.d.ts +15 -4
- package/dist/ssr/index.js +7 -8
- package/dist/ssr/index.js.map +1 -1
- package/dist/ssr/next-config.d.ts +63 -0
- package/dist/ssr/next-config.js +122 -0
- package/dist/ssr/next-config.js.map +1 -0
- package/dist/ssr/next.d.ts +13 -12
- package/dist/ssr/next.js +33 -48
- package/dist/ssr/next.js.map +1 -1
- package/dist/static/index.d.ts +86 -5
- package/dist/static/index.js +29 -3
- package/dist/static/index.js.map +1 -0
- package/dist/static/inject.d.ts +1 -4
- package/dist/static/inject.js +1 -2
- package/dist/static/inject.js.map +1 -1
- package/dist/types-DbMN-Yyn.d.ts +1545 -0
- package/dist/zero/babel.d.ts +12 -123
- package/dist/zero/babel.js +125 -151
- package/dist/zero/babel.js.map +1 -1
- package/dist/zero/index.d.ts +130 -3
- package/dist/zero/index.js +24 -3
- package/dist/zero/index.js.map +1 -0
- package/dist/zero/next.d.ts +5 -7
- package/dist/zero/next.js +4 -40
- 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 +259 -0
- package/docs/comparison.md +83 -54
- package/docs/configuration.md +712 -81
- package/docs/debug.md +39 -24
- package/docs/design-system.md +186 -41
- package/docs/dsl.md +740 -197
- package/docs/getting-started.md +132 -52
- package/docs/injector.md +184 -92
- package/docs/llms.txt +31 -0
- package/docs/methodology.md +107 -50
- package/docs/migration-v3.md +285 -0
- package/docs/pipeline.md +768 -0
- package/docs/plugins.md +333 -0
- package/docs/react-api.md +746 -0
- package/docs/runtime-benchmarks.md +388 -0
- package/docs/ssr.md +399 -117
- package/docs/styles.md +234 -49
- package/docs/tasty-static.md +298 -118
- package/harness/dev.harnesspm/rules/usage.md +12 -0
- package/harness/dev.harnesspm/scripts/render.mjs +320 -0
- package/harness/dev.harnesspm/scripts/styles.mjs +299 -0
- package/harness/plugin.json +20 -0
- package/package.json +159 -44
- package/tasty.config.ts +7 -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 -357
- package/dist/compute-styles.js.map +0 -1
- package/dist/config.d.ts +0 -366
- package/dist/config.js +0 -502
- 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/index.d.ts +0 -7
- package/dist/hooks/useCounterStyle.d.ts +0 -50
- package/dist/hooks/useCounterStyle.js +0 -45
- package/dist/hooks/useCounterStyle.js.map +0 -1
- package/dist/hooks/useFontFace.d.ts +0 -43
- package/dist/hooks/useFontFace.js +0 -69
- package/dist/hooks/useFontFace.js.map +0 -1
- package/dist/hooks/useGlobalStyles.d.ts +0 -30
- package/dist/hooks/useGlobalStyles.js +0 -77
- package/dist/hooks/useGlobalStyles.js.map +0 -1
- package/dist/hooks/useKeyframes.d.ts +0 -56
- package/dist/hooks/useKeyframes.js +0 -63
- package/dist/hooks/useKeyframes.js.map +0 -1
- package/dist/hooks/useProperty.d.ts +0 -79
- package/dist/hooks/useProperty.js +0 -108
- package/dist/hooks/useProperty.js.map +0 -1
- package/dist/hooks/useRawCSS.d.ts +0 -53
- package/dist/hooks/useRawCSS.js +0 -34
- package/dist/hooks/useRawCSS.js.map +0 -1
- package/dist/hooks/useStyles.d.ts +0 -40
- package/dist/hooks/useStyles.js +0 -29
- package/dist/hooks/useStyles.js.map +0 -1
- package/dist/injector/index.d.ts +0 -187
- package/dist/injector/index.js +0 -192
- package/dist/injector/index.js.map +0 -1
- package/dist/injector/injector.d.ts +0 -195
- package/dist/injector/injector.js +0 -587
- package/dist/injector/injector.js.map +0 -1
- package/dist/injector/sheet-manager.d.ts +0 -132
- package/dist/injector/sheet-manager.js +0 -697
- 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 -230
- 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 -1103
- 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 -515
- 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 -76
- 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/ssr/async-storage.d.ts +0 -17
- package/dist/ssr/async-storage.js +0 -34
- package/dist/ssr/async-storage.js.map +0 -1
- package/dist/ssr/collect-auto-properties.js +0 -39
- package/dist/ssr/collect-auto-properties.js.map +0 -1
- package/dist/ssr/collector.d.ts +0 -102
- package/dist/ssr/collector.js +0 -219
- package/dist/ssr/collector.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 -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 +0 -73
- package/dist/ssr/format-rules.js.map +0 -1
- package/dist/ssr/hydrate.d.ts +0 -22
- package/dist/ssr/hydrate.js +0 -49
- 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 -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 -243
- 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/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.d.ts +0 -7
- 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 +0 -146
- 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 -47
- 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 +0 -266
- package/dist/zero/extractor.js.map +0 -1
- package/docs/PIPELINE.md +0 -519
- package/docs/runtime.md +0 -572
package/docs/debug.md
CHANGED
|
@@ -6,18 +6,17 @@ Runtime CSS inspection and diagnostics for the Tasty styling system. Inspect inj
|
|
|
6
6
|
|
|
7
7
|
## Overview
|
|
8
8
|
|
|
9
|
-
`tastyDebug` is a diagnostic object that exposes Tasty's runtime CSS state. It is designed for development use
|
|
10
|
-
|
|
11
|
-
In development mode (`isDevEnv()` returns `true`), `tastyDebug` is automatically installed on `window.tastyDebug`. In production, install it manually when needed.
|
|
9
|
+
`tastyDebug` is a diagnostic object that exposes Tasty's runtime CSS state. It is designed for development use and can be installed on `window` explicitly when needed.
|
|
12
10
|
|
|
13
11
|
All methods **log to the console by default**. Pass `{ raw: true }` to suppress logging and only return data.
|
|
14
12
|
|
|
13
|
+
> **Note (2.0.0+):** Class names use a content-addressed base36 hash format (e.g. `t3a5f`) instead of the previous sequential `t{number}` format. Cross-environment hydration reads the rendered class list from `window.__TASTY__` (the legacy `window.__TASTY_SSR_CACHE__` global was removed in 2.0.0).
|
|
14
|
+
|
|
15
15
|
---
|
|
16
16
|
|
|
17
17
|
## Quick Start
|
|
18
18
|
|
|
19
19
|
```typescript
|
|
20
|
-
// Auto-installed in dev mode. Otherwise:
|
|
21
20
|
import { tastyDebug } from '@tenphi/tasty';
|
|
22
21
|
tastyDebug.install();
|
|
23
22
|
|
|
@@ -52,6 +51,19 @@ interface DebugOptions {
|
|
|
52
51
|
|
|
53
52
|
When `raw` is `false` (the default), results are logged to the console **and** returned. When `raw` is `true`, results are returned silently.
|
|
54
53
|
|
|
54
|
+
### Environments Without a DOM
|
|
55
|
+
|
|
56
|
+
`tastyDebug` reads the document, so on a server — SSR, a Node REPL, a test
|
|
57
|
+
runner in the `node` environment — there is nothing for it to read. Every
|
|
58
|
+
method returns its empty result (`''`, an empty `InspectResult`, a summary of
|
|
59
|
+
zeroes, `metrics: null`) instead of throwing, and explains itself once with a
|
|
60
|
+
console warning. `{ raw: true }` suppresses that warning along with the rest of
|
|
61
|
+
the logging.
|
|
62
|
+
|
|
63
|
+
To see the styles a server render produced, read the `ServerStyleCollector`
|
|
64
|
+
instead — `collector.getCSS()` and `collector.getRenderedClassNames()`. See
|
|
65
|
+
[SSR](./ssr.md).
|
|
66
|
+
|
|
55
67
|
---
|
|
56
68
|
|
|
57
69
|
## API Reference
|
|
@@ -66,18 +78,18 @@ Retrieves CSS text for a given target. Logs the result with rule count and size.
|
|
|
66
78
|
|---|---|
|
|
67
79
|
| `'all'` | All tasty CSS (component + global + raw) |
|
|
68
80
|
| `'active'` | CSS for classes currently in the DOM |
|
|
69
|
-
| `'unused'` | CSS
|
|
81
|
+
| `'unused'` | CSS for classes `gc({ force: true })` would delete now — not rendered, not pinned, past the `gc.grace` window |
|
|
70
82
|
| `'global'` | Only global CSS (from `injectGlobal`) |
|
|
71
83
|
| `'page'` | All CSS on the page (including non-tasty) |
|
|
72
|
-
| `'
|
|
73
|
-
| `['
|
|
84
|
+
| `'t3a5f'` | CSS for a specific tasty class (class names are `t` + base36 hash) |
|
|
85
|
+
| `['t3a5f', 't9k2']` | CSS for multiple tasty classes |
|
|
74
86
|
| `'.my-button'` | CSS affecting a DOM element (by selector) |
|
|
75
87
|
| `element` | CSS affecting a DOM element (by reference) |
|
|
76
88
|
|
|
77
89
|
**Extra options:**
|
|
78
90
|
|
|
79
91
|
```typescript
|
|
80
|
-
interface
|
|
92
|
+
interface CSSOptions extends DebugOptions {
|
|
81
93
|
prettify?: boolean; // Format output (default: true)
|
|
82
94
|
source?: boolean; // Read original CSS instead of live CSSOM (default: false, dev-mode only)
|
|
83
95
|
}
|
|
@@ -88,11 +100,11 @@ interface CssOptions extends DebugOptions {
|
|
|
88
100
|
tastyDebug.css('active');
|
|
89
101
|
|
|
90
102
|
// Specific class, silent
|
|
91
|
-
const css = tastyDebug.css('
|
|
103
|
+
const css = tastyDebug.css('t3a5f', { raw: true });
|
|
92
104
|
|
|
93
105
|
// Compare original vs browser-parsed CSS (dev mode only)
|
|
94
|
-
tastyDebug.css('
|
|
95
|
-
tastyDebug.css('
|
|
106
|
+
tastyDebug.css('t3a5f'); // live CSSOM
|
|
107
|
+
tastyDebug.css('t3a5f', { source: true }); // original output
|
|
96
108
|
|
|
97
109
|
// Shadow DOM
|
|
98
110
|
tastyDebug.css('all', { root: shadowRoot });
|
|
@@ -109,14 +121,14 @@ Inspects a DOM element and returns detailed information about its tasty styles,
|
|
|
109
121
|
```typescript
|
|
110
122
|
interface InspectResult {
|
|
111
123
|
element?: Element | null;
|
|
112
|
-
classes: string[];
|
|
113
|
-
chunks:
|
|
114
|
-
css: string;
|
|
115
|
-
size: number;
|
|
116
|
-
rules: number;
|
|
124
|
+
classes: string[]; // Tasty classes on the element
|
|
125
|
+
chunks: DebugChunkInfo[]; // Chunk assignment per class
|
|
126
|
+
css: string; // Prettified CSS
|
|
127
|
+
size: number; // CSS size in characters
|
|
128
|
+
rules: number; // Number of CSS rule blocks
|
|
117
129
|
}
|
|
118
130
|
|
|
119
|
-
interface
|
|
131
|
+
interface DebugChunkInfo {
|
|
120
132
|
className: string;
|
|
121
133
|
chunkName: string | null; // e.g., 'appearance', 'font', 'dimension'
|
|
122
134
|
}
|
|
@@ -125,11 +137,11 @@ interface ChunkInfo {
|
|
|
125
137
|
```typescript
|
|
126
138
|
tastyDebug.inspect('.my-card');
|
|
127
139
|
// Logs: inspect div — 3 classes, 5 rules, 1.2KB
|
|
128
|
-
// Chunks:
|
|
140
|
+
// Chunks: t3a5f→appearance, t9k2→font, tb71→dimension
|
|
129
141
|
|
|
130
142
|
// Silent
|
|
131
143
|
const result = tastyDebug.inspect('.my-card', { raw: true });
|
|
132
|
-
console.log(result.classes); // ['
|
|
144
|
+
console.log(result.classes); // ['t3a5f', 't9k2', 'tb71']
|
|
133
145
|
console.log(result.rules); // 5
|
|
134
146
|
```
|
|
135
147
|
|
|
@@ -142,7 +154,8 @@ One-shot overview of the entire Tasty CSS state. Logs a compact report.
|
|
|
142
154
|
```typescript
|
|
143
155
|
interface Summary {
|
|
144
156
|
activeClasses: string[];
|
|
145
|
-
unusedClasses: string[];
|
|
157
|
+
unusedClasses: string[]; // classes gc({ force: true }) would delete now
|
|
158
|
+
hotClasses: string[]; // not rendered, but pinned or inside gc.grace — not yet collectable
|
|
146
159
|
totalStyledClasses: string[];
|
|
147
160
|
|
|
148
161
|
activeCSSSize: number;
|
|
@@ -239,7 +252,9 @@ tastyDebug.cache();
|
|
|
239
252
|
|
|
240
253
|
### `cleanup(opts?): void`
|
|
241
254
|
|
|
242
|
-
|
|
255
|
+
Removes every injected style that is neither carried by an element nor pinned by
|
|
256
|
+
an outstanding `inject()` handle — the same set `summary()` reports as unused.
|
|
257
|
+
Equivalent to `gc({ force: true })`.
|
|
243
258
|
|
|
244
259
|
```typescript
|
|
245
260
|
tastyDebug.cleanup();
|
|
@@ -260,7 +275,7 @@ tastyDebug.help();
|
|
|
260
275
|
|
|
261
276
|
### `install(): void`
|
|
262
277
|
|
|
263
|
-
Attaches `tastyDebug` to `window.tastyDebug`.
|
|
278
|
+
Attaches `tastyDebug` to `window.tastyDebug`.
|
|
264
279
|
|
|
265
280
|
```typescript
|
|
266
281
|
import { tastyDebug } from '@tenphi/tasty';
|
|
@@ -291,10 +306,10 @@ tastyDebug.summary({ root: shadowRoot });
|
|
|
291
306
|
tastyDebug.inspect('.my-button');
|
|
292
307
|
|
|
293
308
|
// 2. See CSS for a specific class
|
|
294
|
-
tastyDebug.css('
|
|
309
|
+
tastyDebug.css('t3a5f');
|
|
295
310
|
|
|
296
311
|
// 3. Compare original vs browser-parsed (dev mode)
|
|
297
|
-
tastyDebug.css('
|
|
312
|
+
tastyDebug.css('t3a5f', { source: true });
|
|
298
313
|
```
|
|
299
314
|
|
|
300
315
|
### Checking cache efficiency
|
package/docs/design-system.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# Building a Design System
|
|
2
2
|
|
|
3
|
-
This guide
|
|
3
|
+
This guide shows how to build shared React components whose styles stay predictable as states, variants, themes, and responsive rules accumulate. You will define tokens, state aliases, recipes, primitive APIs, and compound components with sub-elements.
|
|
4
4
|
|
|
5
|
-
It assumes you have already decided to adopt Tasty. The goal is not
|
|
5
|
+
It assumes you have already decided to adopt Tasty. The goal is not only to centralize values, but to give your design system one state model and a governed component-facing styling API. For evaluation criteria and incremental rollout, see the [Adoption Guide](adoption.md). For the recommended component architecture, see [Methodology](methodology.md).
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -42,15 +42,25 @@ configure({
|
|
|
42
42
|
// Borders
|
|
43
43
|
'#border': '#e0e0e0',
|
|
44
44
|
|
|
45
|
-
//
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
// Spacing and shape scale
|
|
46
|
+
$gap: '8px',
|
|
47
|
+
$radius: '4px',
|
|
48
48
|
'$border-width': '1px',
|
|
49
49
|
'$outline-width': '2px',
|
|
50
50
|
},
|
|
51
|
+
// Built-in units compile to fixed values by default. Pointing them at the
|
|
52
|
+
// tokens above lets a theme or density mode change the scale at runtime.
|
|
53
|
+
units: {
|
|
54
|
+
x: 'var(--gap)', // 2x → calc(2 * var(--gap))
|
|
55
|
+
r: 'var(--radius)',
|
|
56
|
+
bw: 'var(--border-width)',
|
|
57
|
+
ow: 'var(--outline-width)',
|
|
58
|
+
},
|
|
51
59
|
});
|
|
52
60
|
```
|
|
53
61
|
|
|
62
|
+
Leave out the `units` block to keep the built-in fixed scale (`x` = `8px`, `r` = `6px`, `bw` = `1px`, `ow` = `3px`), or set fixed values there instead (`units: { x: '8px', r: '4px' }`). Define the token a unit points at; until you do, `--gap`, `--radius`, `--border-width`, and `--outline-width` start at the built-in unit values. Boolean shorthands follow the same scale: `radius: true` is `1r`, `border: true` is `1bw`, and `outline: true` is `1ow`. See [Built-in Units](dsl.md#built-in-units).
|
|
63
|
+
|
|
54
64
|
Tokens are injected as CSS custom properties on `:root` when the first style is rendered. They support state maps for theme-aware values:
|
|
55
65
|
|
|
56
66
|
```tsx
|
|
@@ -66,7 +76,7 @@ configure({
|
|
|
66
76
|
|
|
67
77
|
The `#on-*` convention names the text color that sits on top of a fill — `#on-primary` is the text color on a `#primary` background. This makes state maps self-documenting: `fill: '#primary'` and `color: '#on-primary'` clearly belong together.
|
|
68
78
|
|
|
69
|
-
|
|
79
|
+
To generate the whole palette instead of hand-picking values, use [Glaze](https://github.com/tenphi/glaze): it builds light, dark, and high-contrast variants from one hue in the OKHST color space, solves WCAG and APCA contrast, and exports Tasty tokens you can pass straight to `configure({ tokens: theme.tasty() })`.
|
|
70
80
|
|
|
71
81
|
### Replace tokens for value aliases
|
|
72
82
|
|
|
@@ -84,35 +94,65 @@ configure({
|
|
|
84
94
|
|
|
85
95
|
### Typography presets
|
|
86
96
|
|
|
87
|
-
|
|
97
|
+
Pass typography presets directly to `configure()` — they are converted to tokens automatically:
|
|
88
98
|
|
|
89
99
|
```tsx
|
|
90
|
-
import { configure
|
|
100
|
+
import { configure } from '@tenphi/tasty';
|
|
91
101
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
102
|
+
configure({
|
|
103
|
+
presets: {
|
|
104
|
+
h1: {
|
|
105
|
+
fontSize: '2rem',
|
|
106
|
+
lineHeight: '1.2',
|
|
107
|
+
letterSpacing: '-0.02em',
|
|
108
|
+
fontWeight: 700,
|
|
109
|
+
},
|
|
110
|
+
t2: {
|
|
111
|
+
fontSize: '0.875rem',
|
|
112
|
+
lineHeight: '1.5',
|
|
113
|
+
letterSpacing: 'normal',
|
|
114
|
+
fontWeight: 400,
|
|
115
|
+
},
|
|
116
|
+
},
|
|
95
117
|
});
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Preset values support state maps for responsive or theme-aware typography:
|
|
96
121
|
|
|
122
|
+
```tsx
|
|
97
123
|
configure({
|
|
98
|
-
|
|
99
|
-
|
|
124
|
+
presets: {
|
|
125
|
+
t2: {
|
|
126
|
+
fontSize: '0.875rem',
|
|
127
|
+
lineHeight: '1.5',
|
|
128
|
+
fontWeight: { '': 400, '@dark': 300 },
|
|
129
|
+
},
|
|
100
130
|
},
|
|
101
131
|
});
|
|
102
132
|
```
|
|
103
133
|
|
|
104
134
|
Then use `preset: 'h1'` or `preset: 't2'` in any component's styles.
|
|
105
135
|
|
|
136
|
+
> You can also call `generateTypographyTokens()` manually and spread the result into `tokens` for more control — `presets` is just a shorthand.
|
|
137
|
+
|
|
106
138
|
### Registering brand fonts
|
|
107
139
|
|
|
108
|
-
Register your design system's custom fonts via `configure({
|
|
140
|
+
Register your design system's custom fonts via `configure({ fontFaces })` so every component can reference them:
|
|
109
141
|
|
|
110
142
|
```ts
|
|
111
143
|
configure({
|
|
112
|
-
|
|
144
|
+
fontFaces: {
|
|
113
145
|
'Brand Sans': [
|
|
114
|
-
{
|
|
115
|
-
|
|
146
|
+
{
|
|
147
|
+
src: 'url("/fonts/brand-regular.woff2") format("woff2")',
|
|
148
|
+
fontWeight: 400,
|
|
149
|
+
fontDisplay: 'swap',
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
src: 'url("/fonts/brand-bold.woff2") format("woff2")',
|
|
153
|
+
fontWeight: 700,
|
|
154
|
+
fontDisplay: 'swap',
|
|
155
|
+
},
|
|
116
156
|
],
|
|
117
157
|
},
|
|
118
158
|
});
|
|
@@ -132,7 +172,8 @@ configure({
|
|
|
132
172
|
'@mobile': '@media(w < 768px)',
|
|
133
173
|
'@tablet': '@media(768px <= w < 1024px)',
|
|
134
174
|
'@desktop': '@media(w >= 1024px)',
|
|
135
|
-
'@dark':
|
|
175
|
+
'@dark':
|
|
176
|
+
'@root(schema=dark) | (!@root(schema) & @media(prefers-color-scheme: dark))',
|
|
136
177
|
'@reduced-motion': '@media(prefers-reduced-motion: reduce)',
|
|
137
178
|
},
|
|
138
179
|
});
|
|
@@ -145,11 +186,25 @@ const Card = tasty({
|
|
|
145
186
|
styles: {
|
|
146
187
|
padding: { '': '4x', '@mobile': '2x' },
|
|
147
188
|
flow: { '': 'row', '@mobile': 'column' },
|
|
148
|
-
|
|
189
|
+
radius: { '': '1r', '@mobile': '0' },
|
|
149
190
|
},
|
|
150
191
|
});
|
|
151
192
|
```
|
|
152
193
|
|
|
194
|
+
Aliases can build on each other, so a composite state is defined once too:
|
|
195
|
+
|
|
196
|
+
```tsx
|
|
197
|
+
configure({
|
|
198
|
+
states: {
|
|
199
|
+
'@mobile': '@media(w < 768px)',
|
|
200
|
+
'@tablet': '@media(768px <= w < 1024px)',
|
|
201
|
+
'@touch': '@mobile | @tablet',
|
|
202
|
+
},
|
|
203
|
+
});
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
Theme switching belongs in tokens (`'#surface': { '': '#fff', '@dark': '#1c1c1e' }`) rather than in component state maps, so components stay theme-agnostic.
|
|
207
|
+
|
|
153
208
|
Without aliases, the same component would need the full media query expression inlined in every state map — across every property, in every component. Aliases eliminate that duplication.
|
|
154
209
|
|
|
155
210
|
---
|
|
@@ -173,7 +228,7 @@ configure({
|
|
|
173
228
|
'input-reset': {
|
|
174
229
|
border: 'none',
|
|
175
230
|
outline: 'none',
|
|
176
|
-
fill: '
|
|
231
|
+
fill: '#clear',
|
|
177
232
|
font: true,
|
|
178
233
|
preset: 't3',
|
|
179
234
|
},
|
|
@@ -199,7 +254,7 @@ const ProfileCard = tasty({
|
|
|
199
254
|
});
|
|
200
255
|
```
|
|
201
256
|
|
|
202
|
-
Use the `/` separator when a recipe should be applied
|
|
257
|
+
Use the `/` separator when a recipe should be applied _after_ local styles (post-merge), so recipe states take priority:
|
|
203
258
|
|
|
204
259
|
```tsx
|
|
205
260
|
const Input = tasty({
|
|
@@ -248,7 +303,7 @@ const Grid = tasty({
|
|
|
248
303
|
display: 'grid',
|
|
249
304
|
gap: '1x',
|
|
250
305
|
},
|
|
251
|
-
styleProps:
|
|
306
|
+
styleProps: FLOW_STYLES, // includes gridColumns, gridRows, gridAreas
|
|
252
307
|
});
|
|
253
308
|
```
|
|
254
309
|
|
|
@@ -267,18 +322,54 @@ Product engineers use these to compose layouts without writing CSS:
|
|
|
267
322
|
</Grid>
|
|
268
323
|
```
|
|
269
324
|
|
|
325
|
+
### Interactive components with variants
|
|
326
|
+
|
|
327
|
+
Variants are named looks that replace each other. Combine them with `modProps` for states that stack, such as size or loading:
|
|
328
|
+
|
|
329
|
+
```tsx
|
|
330
|
+
const Button = tasty({
|
|
331
|
+
as: 'button',
|
|
332
|
+
modProps: { size: ['sm', 'md', 'lg'] as const },
|
|
333
|
+
styles: {
|
|
334
|
+
recipe: 'interactive',
|
|
335
|
+
padding: { '': '1.5x 3x', 'size=sm': '1x 2x', 'size=lg': '2x 4x' },
|
|
336
|
+
radius: '1r',
|
|
337
|
+
},
|
|
338
|
+
variants: {
|
|
339
|
+
default: {
|
|
340
|
+
fill: {
|
|
341
|
+
'': '#primary',
|
|
342
|
+
':hover': '#primary-hover',
|
|
343
|
+
disabled: '#surface',
|
|
344
|
+
},
|
|
345
|
+
color: '#on-primary',
|
|
346
|
+
},
|
|
347
|
+
danger: {
|
|
348
|
+
fill: { '': '#danger', ':hover': '#danger-hover', disabled: '#surface' },
|
|
349
|
+
color: '#on-danger',
|
|
350
|
+
},
|
|
351
|
+
},
|
|
352
|
+
});
|
|
353
|
+
|
|
354
|
+
<Button variant="danger" size="lg">
|
|
355
|
+
Delete
|
|
356
|
+
</Button>;
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
`variant` is typed from the keys, the `default` variant applies when no `variant` prop is passed (or the variant the `variant` option names, such as `variant: 'danger'`), and only the variants that actually render emit CSS. See [React API — Variants](react-api.md#variants).
|
|
360
|
+
|
|
270
361
|
### Which styleProps to expose
|
|
271
362
|
|
|
272
363
|
Match the prop set to the component's role:
|
|
273
364
|
|
|
274
|
-
| Component category
|
|
275
|
-
|
|
276
|
-
| Layout containers (`Space`, `Box`, `Grid`) | `FLOW_STYLES` — flow, gap, align
|
|
277
|
-
| Positioned elements (`Button`, `Badge`)
|
|
278
|
-
| Text elements
|
|
279
|
-
| Compound components
|
|
365
|
+
| Component category | Recommended styleProps |
|
|
366
|
+
| ------------------------------------------ | --------------------------------------------------------------------------------------------------- |
|
|
367
|
+
| Layout containers (`Space`, `Box`, `Grid`) | `FLOW_STYLES` — flow, gap, align/justify/place, grid templates (add `padding` or `fill` explicitly) |
|
|
368
|
+
| Positioned elements (`Button`, `Badge`) | `POSITION_STYLES` — placeSelf, gridArea, order |
|
|
369
|
+
| Text elements | `['color', ...TEXT_STYLES]` (`preset` is always available) |
|
|
370
|
+
| Compound components | Typically none — styling happens via sub-elements and wrapping |
|
|
280
371
|
|
|
281
|
-
Exposing too many props weakens the design system's constraints. See [Methodology — styleProps as the public API](methodology.md#styleprops-as-the-public-api) for the rationale.
|
|
372
|
+
`BASE_STYLES` (`display`, `font`, `preset`, `hide`, `whiteSpace`, `opacity`, `transition`) are accepted as props on every component without being listed. Exposing too many props weakens the design system's constraints. See [Methodology — styleProps as the public API](methodology.md#styleprops-as-the-public-api) for the rationale.
|
|
282
373
|
|
|
283
374
|
---
|
|
284
375
|
|
|
@@ -323,9 +414,7 @@ Usage:
|
|
|
323
414
|
```tsx
|
|
324
415
|
<Card>
|
|
325
416
|
<Card.Title>Monthly Revenue</Card.Title>
|
|
326
|
-
<Card.Content>
|
|
327
|
-
$1.2M — up 12% from last month.
|
|
328
|
-
</Card.Content>
|
|
417
|
+
<Card.Content>$1.2M — up 12% from last month.</Card.Content>
|
|
329
418
|
<Card.Footer>
|
|
330
419
|
<Button>Details</Button>
|
|
331
420
|
</Card.Footer>
|
|
@@ -334,32 +423,34 @@ Usage:
|
|
|
334
423
|
|
|
335
424
|
Sub-elements share the root component's state context by default. A `disabled` modifier on `<Card>` affects `Title`, `Content`, and `Footer` styles automatically — no prop drilling. For the full mental model, see [Methodology — Component architecture](methodology.md#component-architecture-root--sub-elements).
|
|
336
425
|
|
|
337
|
-
For sub-element syntax details (selector affix `$`, `@own()`, `elements` config), see [
|
|
426
|
+
For sub-element syntax details (selector affix `$`, `@own()`, `elements` config), see [React API — Sub-element Styling](react-api.md#sub-element-styling).
|
|
338
427
|
|
|
339
428
|
---
|
|
340
429
|
|
|
341
430
|
## Defining the override contract
|
|
342
431
|
|
|
343
|
-
A design system works best when the rules for customization are explicit. Tasty
|
|
432
|
+
A design system works best when the rules for customization are explicit. Tasty gives product engineers four sanctioned ways to customize a component, and a few to discourage:
|
|
344
433
|
|
|
345
434
|
### What product engineers can do
|
|
346
435
|
|
|
347
436
|
1. **Use styleProps** — adjust layout, spacing, positioning through the props the component exposes:
|
|
348
437
|
|
|
349
438
|
```tsx
|
|
350
|
-
<Space flow="row" gap="3x"
|
|
439
|
+
<Space flow="row" gap="3x" placeItems="center">
|
|
351
440
|
```
|
|
352
441
|
|
|
353
442
|
2. **Use modProps** — control component states through typed props instead of `mods`:
|
|
354
443
|
|
|
355
444
|
```tsx
|
|
356
|
-
<Button isLoading size="large">
|
|
445
|
+
<Button isLoading size="large">
|
|
446
|
+
Submit
|
|
447
|
+
</Button>
|
|
357
448
|
```
|
|
358
449
|
|
|
359
450
|
3. **Pass tokens** — inject runtime values through the `tokens` prop for per-instance customization:
|
|
360
451
|
|
|
361
452
|
```tsx
|
|
362
|
-
<ProgressBar tokens={{
|
|
453
|
+
<ProgressBar tokens={{ $progress: `${percent}%` }} />
|
|
363
454
|
```
|
|
364
455
|
|
|
365
456
|
4. **Create styled wrappers** — extend a component's styles with `tasty(Base, { styles })`:
|
|
@@ -367,7 +458,12 @@ A design system works best when the rules for customization are explicit. Tasty
|
|
|
367
458
|
```tsx
|
|
368
459
|
const DangerButton = tasty(Button, {
|
|
369
460
|
styles: {
|
|
370
|
-
fill: {
|
|
461
|
+
fill: {
|
|
462
|
+
'': '#danger',
|
|
463
|
+
':hover': '#danger-hover',
|
|
464
|
+
':active': '#danger-pressed',
|
|
465
|
+
disabled: '@inherit', // a map with '' replaces the parent's; keep its disabled branch
|
|
466
|
+
},
|
|
371
467
|
color: '#on-danger',
|
|
372
468
|
},
|
|
373
469
|
});
|
|
@@ -383,6 +479,53 @@ See [Methodology — styles prop vs style prop](methodology.md#styles-prop-vs-st
|
|
|
383
479
|
|
|
384
480
|
---
|
|
385
481
|
|
|
482
|
+
## Guardrails: linting and types
|
|
483
|
+
|
|
484
|
+
A vocabulary only holds if mistakes surface early. Register the same names you pass to `configure()` with the ESLint plugin and with TypeScript:
|
|
485
|
+
|
|
486
|
+
```ts
|
|
487
|
+
// tasty.config.ts — read by @tenphi/eslint-plugin-tasty
|
|
488
|
+
export default {
|
|
489
|
+
tokens: ['#surface', '#text', '#primary', '#danger', '$gap', '$radius'],
|
|
490
|
+
states: ['@mobile', '@tablet', '@desktop', '@dark', '@reduced-motion'],
|
|
491
|
+
presets: ['h1', 'h2', 'h3', 't2', 't3'],
|
|
492
|
+
recipes: ['card', 'elevated', 'input-reset', 'interactive'],
|
|
493
|
+
importSources: ['@my-org/ds'], // where product code imports tasty() from
|
|
494
|
+
};
|
|
495
|
+
```
|
|
496
|
+
|
|
497
|
+
```js
|
|
498
|
+
// eslint.config.js
|
|
499
|
+
import tasty from '@tenphi/eslint-plugin-tasty';
|
|
500
|
+
|
|
501
|
+
export default [tasty.configs.recommended]; // or tasty.configs.strict
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
```ts
|
|
505
|
+
// tasty.d.ts
|
|
506
|
+
import '@tenphi/tasty';
|
|
507
|
+
|
|
508
|
+
declare module '@tenphi/tasty' {
|
|
509
|
+
interface TastyNamedColors {
|
|
510
|
+
surface: true;
|
|
511
|
+
text: true;
|
|
512
|
+
primary: true;
|
|
513
|
+
danger: true;
|
|
514
|
+
}
|
|
515
|
+
interface TastyPresetNames {
|
|
516
|
+
h1: true;
|
|
517
|
+
h2: true;
|
|
518
|
+
h3: true;
|
|
519
|
+
t2: true;
|
|
520
|
+
t3: true;
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
```
|
|
524
|
+
|
|
525
|
+
Unknown colors, presets, and recipes then fail lint (`valid-color-token`, `valid-preset`, `valid-recipe`), and `strict` adds checks for unknown `$` tokens and state aliases (`valid-custom-property`, `no-unknown-state-alias`). The same names autocomplete in editors. Deriving both lists from the same token and recipe modules that `config.ts` imports keeps all three in sync.
|
|
526
|
+
|
|
527
|
+
---
|
|
528
|
+
|
|
386
529
|
## Project structure
|
|
387
530
|
|
|
388
531
|
A recommended structure for a design system built on Tasty:
|
|
@@ -390,6 +533,8 @@ A recommended structure for a design system built on Tasty:
|
|
|
390
533
|
```
|
|
391
534
|
ds/
|
|
392
535
|
config.ts # configure() — tokens, units, states, recipes
|
|
536
|
+
tasty.config.ts # Names the ESLint plugin validates against
|
|
537
|
+
tasty.d.ts # TypeScript augmentation for autocomplete
|
|
393
538
|
primitives/
|
|
394
539
|
Space.tsx # Layout: flex container with FLOW_STYLES
|
|
395
540
|
Box.tsx # Generic container
|
|
@@ -404,8 +549,8 @@ ds/
|
|
|
404
549
|
index.ts # Recipe definitions (imported by config.ts)
|
|
405
550
|
tokens/
|
|
406
551
|
colors.ts # Color token definitions
|
|
407
|
-
typography.ts # Typography presets
|
|
408
|
-
|
|
552
|
+
typography.ts # Typography presets for configure({ presets })
|
|
553
|
+
units.ts # Spacing and shape scale for configure({ units })
|
|
409
554
|
index.ts # Public API: re-exports components + configure
|
|
410
555
|
```
|
|
411
556
|
|
|
@@ -418,7 +563,7 @@ The key principle: `config.ts` imports tokens and recipes, calls `configure()`,
|
|
|
418
563
|
- **[Methodology](methodology.md)** — The recommended patterns for structuring Tasty components
|
|
419
564
|
- **[Getting Started](getting-started.md)** — Installation, first component, tooling setup
|
|
420
565
|
- **[Style DSL](dsl.md)** — State maps, tokens, units, extending semantics, keyframes, @property
|
|
421
|
-
- **[
|
|
566
|
+
- **[React API](react-api.md)** — `tasty()` factory, component props, variants, sub-elements, style functions
|
|
422
567
|
- **[Configuration](configuration.md)** — Full `configure()` API: tokens, recipes, custom units, style handlers
|
|
423
568
|
- **[Adoption Guide](adoption.md)** — Who should adopt Tasty, incremental phases, what changes for product engineers
|
|
424
569
|
- **[Style Properties](styles.md)** — Complete reference for all enhanced style properties
|