@tenphi/tasty 0.0.0-snapshot.2705ab9 → 0.0.0-snapshot.275370e
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 +26 -20
- package/dist/_virtual/_rolldown/runtime.js +1 -2
- package/dist/chunks/cacheKey.d.ts +1 -0
- package/dist/chunks/cacheKey.js +1 -2
- package/dist/chunks/cacheKey.js.map +1 -1
- package/dist/chunks/definitions.js +1 -2
- package/dist/chunks/definitions.js.map +1 -1
- package/dist/chunks/index.d.ts +1 -0
- package/dist/chunks/renderChunk.d.ts +1 -0
- package/dist/chunks/renderChunk.js +1 -2
- package/dist/chunks/renderChunk.js.map +1 -1
- package/dist/compute-styles.d.ts +31 -0
- package/dist/compute-styles.js +322 -0
- package/dist/compute-styles.js.map +1 -0
- package/dist/config.d.ts +61 -20
- package/dist/config.js +119 -32
- package/dist/config.js.map +1 -1
- package/dist/core/index.d.ts +6 -6
- package/dist/core/index.js +7 -7
- package/dist/counter-style/index.js +1 -1
- package/dist/counter-style/index.js.map +1 -1
- package/dist/debug.js +5 -6
- package/dist/debug.js.map +1 -1
- package/dist/font-face/index.js +1 -1
- package/dist/font-face/index.js.map +1 -1
- package/dist/hooks/index.d.ts +7 -0
- package/dist/hooks/useCounterStyle.d.ts +3 -17
- package/dist/hooks/useCounterStyle.js +56 -38
- package/dist/hooks/useCounterStyle.js.map +1 -1
- package/dist/hooks/useFontFace.d.ts +3 -1
- package/dist/hooks/useFontFace.js +22 -27
- package/dist/hooks/useFontFace.js.map +1 -1
- package/dist/hooks/useGlobalStyles.d.ts +18 -2
- package/dist/hooks/useGlobalStyles.js +52 -43
- package/dist/hooks/useGlobalStyles.js.map +1 -1
- package/dist/hooks/useKeyframes.d.ts +4 -2
- package/dist/hooks/useKeyframes.js +43 -53
- package/dist/hooks/useKeyframes.js.map +1 -1
- package/dist/hooks/useProperty.d.ts +4 -2
- package/dist/hooks/useProperty.js +30 -44
- package/dist/hooks/useProperty.js.map +1 -1
- package/dist/hooks/useRawCSS.d.ts +13 -44
- package/dist/hooks/useRawCSS.js +91 -24
- package/dist/hooks/useRawCSS.js.map +1 -1
- package/dist/hooks/useStyles.d.ts +3 -8
- package/dist/hooks/useStyles.js +7 -214
- package/dist/hooks/useStyles.js.map +1 -1
- package/dist/index.d.ts +7 -7
- package/dist/index.js +8 -8
- package/dist/injector/index.d.ts +18 -19
- package/dist/injector/index.js +25 -20
- package/dist/injector/index.js.map +1 -1
- package/dist/injector/injector.d.ts +35 -3
- package/dist/injector/injector.js +200 -14
- package/dist/injector/injector.js.map +1 -1
- package/dist/injector/sheet-manager.d.ts +9 -13
- package/dist/injector/sheet-manager.js +34 -69
- package/dist/injector/sheet-manager.js.map +1 -1
- package/dist/injector/types.d.ts +52 -21
- package/dist/keyframes/index.js +1 -1
- package/dist/parser/classify.js +1 -2
- package/dist/parser/classify.js.map +1 -1
- package/dist/parser/const.js +14 -3
- package/dist/parser/const.js.map +1 -1
- package/dist/parser/lru.js +1 -1
- package/dist/parser/lru.js.map +1 -1
- package/dist/parser/parser.js +1 -2
- package/dist/parser/parser.js.map +1 -1
- package/dist/parser/tokenizer.js +1 -1
- package/dist/parser/tokenizer.js.map +1 -1
- package/dist/parser/types.js +1 -1
- package/dist/parser/types.js.map +1 -1
- package/dist/pipeline/conditions.js +1 -1
- package/dist/pipeline/conditions.js.map +1 -1
- package/dist/pipeline/exclusive.js +58 -4
- package/dist/pipeline/exclusive.js.map +1 -1
- package/dist/pipeline/index.js +4 -5
- package/dist/pipeline/index.js.map +1 -1
- package/dist/pipeline/materialize.js +57 -4
- package/dist/pipeline/materialize.js.map +1 -1
- package/dist/pipeline/parseStateKey.js +5 -6
- package/dist/pipeline/parseStateKey.js.map +1 -1
- package/dist/pipeline/simplify.js +181 -7
- package/dist/pipeline/simplify.js.map +1 -1
- package/dist/pipeline/warnings.js +1 -1
- package/dist/plugins/index.d.ts +2 -0
- package/dist/plugins/okhsl-plugin.js +1 -2
- package/dist/plugins/okhsl-plugin.js.map +1 -1
- package/dist/plugins/types.d.ts +12 -1
- package/dist/properties/index.js +2 -3
- package/dist/properties/index.js.map +1 -1
- package/dist/properties/property-type-resolver.js +1 -2
- package/dist/properties/property-type-resolver.js.map +1 -1
- package/dist/rsc-cache.js +79 -0
- package/dist/rsc-cache.js.map +1 -0
- package/dist/ssr/astro-client.d.ts +1 -0
- package/dist/ssr/astro-client.js +19 -0
- package/dist/ssr/astro-client.js.map +1 -0
- package/dist/ssr/astro-middleware.d.ts +15 -0
- package/dist/ssr/astro-middleware.js +19 -0
- package/dist/ssr/astro-middleware.js.map +1 -0
- package/dist/ssr/astro.d.ts +89 -10
- package/dist/ssr/astro.js +113 -29
- package/dist/ssr/astro.js.map +1 -1
- package/dist/ssr/async-storage.js +15 -6
- package/dist/ssr/async-storage.js.map +1 -1
- package/dist/ssr/collect-auto-properties.js +29 -11
- package/dist/ssr/collect-auto-properties.js.map +1 -1
- package/dist/ssr/collector.d.ts +9 -13
- package/dist/ssr/collector.js +35 -27
- package/dist/ssr/collector.js.map +1 -1
- package/dist/ssr/context.js +4 -2
- package/dist/ssr/context.js.map +1 -1
- package/dist/ssr/format-global-rules.js +1 -1
- package/dist/ssr/format-keyframes.js +1 -2
- package/dist/ssr/format-keyframes.js.map +1 -1
- package/dist/ssr/format-property.js +1 -2
- package/dist/ssr/format-property.js.map +1 -1
- package/dist/ssr/format-rules.js +1 -1
- package/dist/ssr/hydrate.d.ts +20 -13
- package/dist/ssr/hydrate.js +25 -30
- package/dist/ssr/hydrate.js.map +1 -1
- package/dist/ssr/index.d.ts +3 -4
- package/dist/ssr/index.js +5 -7
- package/dist/ssr/index.js.map +1 -1
- package/dist/ssr/next.d.ts +6 -5
- package/dist/ssr/next.js +14 -10
- package/dist/ssr/next.js.map +1 -1
- package/dist/ssr/ssr-collector-ref.js +20 -3
- package/dist/ssr/ssr-collector-ref.js.map +1 -1
- package/dist/states/index.js +1 -2
- package/dist/states/index.js.map +1 -1
- package/dist/static/index.js +1 -2
- package/dist/static/inject.d.ts +5 -0
- package/dist/static/inject.js +17 -0
- package/dist/static/inject.js.map +1 -0
- package/dist/static/tastyStatic.js +1 -2
- package/dist/static/tastyStatic.js.map +1 -1
- package/dist/static/types.js +1 -1
- package/dist/styles/border.d.ts +1 -1
- package/dist/styles/border.js +28 -22
- package/dist/styles/border.js.map +1 -1
- package/dist/styles/color.d.ts +1 -1
- package/dist/styles/color.js +2 -3
- package/dist/styles/color.js.map +1 -1
- package/dist/styles/const.js +17 -0
- package/dist/styles/const.js.map +1 -0
- package/dist/styles/createStyle.js +4 -5
- package/dist/styles/createStyle.js.map +1 -1
- package/dist/styles/dimension.js +15 -3
- package/dist/styles/dimension.js.map +1 -1
- package/dist/styles/directional.js +133 -0
- package/dist/styles/directional.js.map +1 -0
- package/dist/styles/display.d.ts +3 -10
- package/dist/styles/display.js +45 -39
- package/dist/styles/display.js.map +1 -1
- package/dist/styles/fade.d.ts +1 -1
- package/dist/styles/fade.js +9 -5
- package/dist/styles/fade.js.map +1 -1
- package/dist/styles/fill.d.ts +2 -2
- package/dist/styles/fill.js +3 -4
- package/dist/styles/fill.js.map +1 -1
- package/dist/styles/flow.js +1 -1
- package/dist/styles/gap.d.ts +1 -1
- package/dist/styles/gap.js +4 -3
- package/dist/styles/gap.js.map +1 -1
- package/dist/styles/height.d.ts +1 -1
- package/dist/styles/height.js +1 -2
- package/dist/styles/height.js.map +1 -1
- package/dist/styles/index.d.ts +0 -1
- package/dist/styles/index.js +3 -4
- package/dist/styles/index.js.map +1 -1
- package/dist/styles/inset.d.ts +1 -29
- package/dist/styles/inset.js +19 -135
- package/dist/styles/inset.js.map +1 -1
- package/dist/styles/list.d.ts +5 -5
- package/dist/styles/list.js +4 -2
- package/dist/styles/list.js.map +1 -1
- package/dist/styles/margin.d.ts +1 -1
- package/dist/styles/margin.js +17 -89
- package/dist/styles/margin.js.map +1 -1
- package/dist/styles/outline.d.ts +1 -1
- package/dist/styles/outline.js +6 -16
- package/dist/styles/outline.js.map +1 -1
- package/dist/styles/padding.d.ts +1 -1
- package/dist/styles/padding.js +17 -89
- package/dist/styles/padding.js.map +1 -1
- package/dist/styles/placement.d.ts +37 -0
- package/dist/styles/placement.js +74 -0
- package/dist/styles/placement.js.map +1 -0
- package/dist/styles/predefined.d.ts +4 -4
- package/dist/styles/predefined.js +8 -9
- package/dist/styles/predefined.js.map +1 -1
- package/dist/styles/preset.d.ts +1 -1
- package/dist/styles/preset.js +7 -7
- package/dist/styles/preset.js.map +1 -1
- package/dist/styles/radius.d.ts +1 -3
- package/dist/styles/radius.js +38 -6
- package/dist/styles/radius.js.map +1 -1
- package/dist/styles/scrollMargin.d.ts +24 -0
- package/dist/styles/scrollMargin.js +32 -0
- package/dist/styles/scrollMargin.js.map +1 -0
- package/dist/styles/scrollbar.d.ts +1 -1
- package/dist/styles/scrollbar.js +8 -5
- package/dist/styles/scrollbar.js.map +1 -1
- package/dist/styles/shadow.d.ts +1 -1
- package/dist/styles/shadow.js +4 -3
- package/dist/styles/shadow.js.map +1 -1
- package/dist/styles/shared.js +17 -0
- package/dist/styles/shared.js.map +1 -0
- package/dist/styles/transition.d.ts +1 -1
- package/dist/styles/transition.js +5 -4
- package/dist/styles/transition.js.map +1 -1
- package/dist/styles/types.d.ts +24 -7
- package/dist/styles/width.d.ts +1 -1
- package/dist/styles/width.js +1 -2
- package/dist/styles/width.js.map +1 -1
- package/dist/tasty.d.ts +29 -14
- package/dist/tasty.js +78 -62
- package/dist/tasty.js.map +1 -1
- package/dist/utils/cache-wrapper.js +1 -2
- package/dist/utils/cache-wrapper.js.map +1 -1
- package/dist/utils/case-converter.js +1 -1
- package/dist/utils/color-math.js +1 -1
- package/dist/utils/color-math.js.map +1 -1
- package/dist/utils/color-space.js +1 -2
- package/dist/utils/color-space.js.map +1 -1
- package/dist/utils/colors.js +1 -2
- package/dist/utils/colors.js.map +1 -1
- package/dist/utils/deps-equal.js +15 -0
- package/dist/utils/deps-equal.js.map +1 -0
- package/dist/utils/dotize.js +1 -1
- package/dist/utils/dotize.js.map +1 -1
- package/dist/utils/filter-base-props.d.ts +1 -1
- package/dist/utils/filter-base-props.js +1 -1
- package/dist/utils/filter-base-props.js.map +1 -1
- package/dist/utils/get-display-name.js +1 -1
- package/dist/utils/has-keys.js +1 -1
- package/dist/utils/hash.js +14 -0
- package/dist/utils/hash.js.map +1 -0
- package/dist/utils/is-dev-env.js +1 -1
- package/dist/utils/is-dev-env.js.map +1 -1
- package/dist/utils/is-valid-element-type.js +1 -1
- package/dist/utils/merge-styles.js +1 -2
- package/dist/utils/merge-styles.js.map +1 -1
- package/dist/utils/mod-attrs.d.ts +0 -2
- package/dist/utils/mod-attrs.js +1 -2
- package/dist/utils/mod-attrs.js.map +1 -1
- package/dist/utils/process-tokens.d.ts +1 -5
- package/dist/utils/process-tokens.js +3 -11
- package/dist/utils/process-tokens.js.map +1 -1
- package/dist/utils/resolve-recipes.js +1 -2
- package/dist/utils/resolve-recipes.js.map +1 -1
- package/dist/utils/selector-transform.js +1 -1
- package/dist/utils/string.js +1 -1
- package/dist/utils/styles.d.ts +1 -1
- package/dist/utils/styles.js +2 -3
- package/dist/utils/styles.js.map +1 -1
- package/dist/utils/typography.d.ts +21 -10
- package/dist/utils/typography.js +2 -2
- package/dist/utils/typography.js.map +1 -1
- package/dist/utils/warnings.js +1 -1
- package/dist/zero/babel.d.ts +24 -110
- package/dist/zero/babel.js +130 -42
- package/dist/zero/babel.js.map +1 -1
- package/dist/zero/css-writer.js +1 -2
- package/dist/zero/css-writer.js.map +1 -1
- package/dist/zero/extractor.js +1 -2
- package/dist/zero/extractor.js.map +1 -1
- package/dist/zero/index.js +1 -2
- package/dist/zero/next.d.ts +12 -0
- package/dist/zero/next.js +5 -4
- package/dist/zero/next.js.map +1 -1
- package/docs/README.md +2 -2
- package/docs/adoption.md +5 -3
- package/docs/comparison.md +24 -25
- package/docs/configuration.md +69 -1
- package/docs/design-system.md +22 -10
- package/docs/dsl.md +23 -8
- package/docs/getting-started.md +10 -10
- package/docs/injector.md +41 -25
- package/docs/methodology.md +52 -3
- package/docs/{runtime.md → react-api.md} +104 -32
- package/docs/ssr.md +139 -81
- package/docs/styles.md +17 -0
- package/docs/tasty-static.md +101 -2
- package/package.json +20 -9
- package/dist/hooks/resolve-ssr-collector.js +0 -15
- package/dist/hooks/resolve-ssr-collector.js.map +0 -1
- package/dist/ssr/context.d.ts +0 -8
- 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/justify.d.ts +0 -15
- package/dist/styles/justify.js +0 -14
- package/dist/styles/justify.js.map +0 -1
package/docs/tasty-static.md
CHANGED
|
@@ -157,14 +157,27 @@ module.exports = {
|
|
|
157
157
|
| Option | Type | Default | Description |
|
|
158
158
|
|--------|------|---------|-------------|
|
|
159
159
|
| `output` | `string` | `'tasty.css'` | Path for generated CSS file |
|
|
160
|
+
| `mode` | `'file' \| 'inject'` | `'file'` | `'file'` writes CSS to disk; `'inject'` embeds CSS inline in JS (see [Inject Mode](#inject-mode)) |
|
|
160
161
|
| `configFile` | `string` | — | Absolute path to a TS/JS module that default-exports a `TastyZeroConfig` object. JSON-serializable alternative to `config` — required for Turbopack. |
|
|
161
162
|
| `config` | `TastyZeroConfig \| () => TastyZeroConfig` | `{}` | Inline config object or factory function. Takes precedence over `configFile`. |
|
|
162
163
|
| `configDeps` | `string[]` | `[]` | Absolute file paths that affect config (for cache invalidation) |
|
|
163
|
-
| `
|
|
164
|
+
| `injectImport` | `boolean` | `true` | Replace `@tenphi/tasty/static` imports with an import of the generated CSS file. Set to `false` to manage CSS imports manually. |
|
|
165
|
+
| `config.states` | `Record<string, string>` | `{}` | Predefined state aliases (e.g. `{ '@mobile': '@media(w < 768px)' }`) |
|
|
164
166
|
| `config.devMode` | `boolean` | `false` | Add source comments to CSS |
|
|
167
|
+
| `config.tokens` | `ConfigTokens` | — | Design tokens injected as CSS custom properties on `:root`. Values are parsed through the Tasty DSL. Supports state maps for responsive/themed tokens. |
|
|
168
|
+
| `config.replaceTokens` | `Record<string, string \| number>` | — | Parse-time token substitution. Keys use `$name` for custom properties and `#name` for color tokens. |
|
|
165
169
|
| `config.recipes` | `Record<string, RecipeStyles>` | `{}` | Predefined style recipes |
|
|
170
|
+
| `config.keyframes` | `Record<string, KeyframesSteps>` | — | Global `@keyframes` definitions available to all `tastyStatic` calls |
|
|
166
171
|
| `config.fontFace` | `Record<string, FontFaceInput>` | — | Global `@font-face` definitions |
|
|
167
172
|
| `config.counterStyle` | `Record<string, CounterStyleDescriptors>` | — | Global `@counter-style` definitions |
|
|
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.funcs` | `Record<string, Function>` | — | Custom functions for the style parser (merged with existing) |
|
|
175
|
+
| `config.plugins` | `TastyPlugin[]` | — | Plugins that extend tasty with custom functions, units, states, and handlers |
|
|
176
|
+
| `config.handlers` | `Record<string, StyleHandlerDefinition>` | — | Custom style handlers that transform style properties into CSS declarations |
|
|
177
|
+
| `config.presets` | `Record<string, TypographyPreset>` | — | Typography presets — shorthand for `generateTypographyTokens()`. Generated tokens merge under explicit `tokens`. |
|
|
178
|
+
| `config.globalStyles` | `Record<string, Styles>` | — | Global Tasty styles keyed by CSS selector. Supports the full style syntax. |
|
|
179
|
+
| `config.autoPropertyTypes` | `boolean` | `true` | Automatically infer and register CSS `@property` declarations from values |
|
|
180
|
+
| `config.parserCacheSize` | `number` | `1000` | Parser LRU cache size. Larger values improve performance for builds with many unique style values |
|
|
168
181
|
|
|
169
182
|
---
|
|
170
183
|
|
|
@@ -224,6 +237,7 @@ export default withTastyZero({
|
|
|
224
237
|
| Option | Type | Default | Description |
|
|
225
238
|
|--------|------|---------|-------------|
|
|
226
239
|
| `output` | `string` | `'public/tasty.css'` | Output path for CSS relative to project root |
|
|
240
|
+
| `mode` | `'file' \| 'inject'` | `'file'` | `'file'` writes CSS to disk; `'inject'` embeds CSS inline in JS |
|
|
227
241
|
| `enabled` | `boolean` | `true` | Enable/disable the plugin |
|
|
228
242
|
| `configFile` | `string` | — | Path to a TS/JS module that default-exports `TastyZeroConfig`. Recommended for Turbopack compatibility. |
|
|
229
243
|
| `config` | `TastyZeroConfig` | — | Inline config object. For static configs that don't change during dev. |
|
|
@@ -333,6 +347,91 @@ export const Button = () => <button className={button}>Click</button>;
|
|
|
333
347
|
|
|
334
348
|
---
|
|
335
349
|
|
|
350
|
+
## Inject Mode
|
|
351
|
+
|
|
352
|
+
By default the Babel plugin writes CSS to a file (`mode: 'file'`). **Inject mode** (`mode: 'inject'`) embeds CSS inline in your JavaScript and injects it at runtime via a tiny injector. No CSS file is produced.
|
|
353
|
+
|
|
354
|
+
This is ideal for **reusable components**, **extensions**, and **libraries** where consumers shouldn't need to manage an external CSS file.
|
|
355
|
+
|
|
356
|
+
### How It Works
|
|
357
|
+
|
|
358
|
+
1. The Babel plugin extracts CSS at build time (same pipeline as file mode).
|
|
359
|
+
2. Instead of writing to a `.css` file, the CSS is embedded as string literals in the JS output.
|
|
360
|
+
3. The `@tenphi/tasty/static` import is rewritten to `@tenphi/tasty/static/inject`.
|
|
361
|
+
4. Each `tastyStatic` call becomes a self-contained expression that injects its CSS and evaluates to a `StaticStyle` object.
|
|
362
|
+
|
|
363
|
+
### Configuration
|
|
364
|
+
|
|
365
|
+
```javascript
|
|
366
|
+
// babel.config.js
|
|
367
|
+
module.exports = {
|
|
368
|
+
plugins: [
|
|
369
|
+
['@tenphi/tasty/babel-plugin', {
|
|
370
|
+
mode: 'inject',
|
|
371
|
+
config: {
|
|
372
|
+
states: { '@mobile': '@media(w < 768px)' },
|
|
373
|
+
},
|
|
374
|
+
}]
|
|
375
|
+
]
|
|
376
|
+
};
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
With Next.js:
|
|
380
|
+
|
|
381
|
+
```typescript
|
|
382
|
+
// next.config.ts
|
|
383
|
+
import { withTastyZero } from '@tenphi/tasty/next';
|
|
384
|
+
|
|
385
|
+
export default withTastyZero({
|
|
386
|
+
mode: 'inject',
|
|
387
|
+
configFile: './app/tasty-zero.config.ts',
|
|
388
|
+
})({
|
|
389
|
+
reactStrictMode: true,
|
|
390
|
+
});
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
When `mode` is `'inject'`, the `output` and `injectImport` options are ignored.
|
|
394
|
+
|
|
395
|
+
### Build Transformation (inject mode)
|
|
396
|
+
|
|
397
|
+
**Before:**
|
|
398
|
+
|
|
399
|
+
```tsx
|
|
400
|
+
import { tastyStatic } from '@tenphi/tasty/static';
|
|
401
|
+
|
|
402
|
+
const button = tastyStatic({
|
|
403
|
+
padding: '2x 4x',
|
|
404
|
+
fill: '#purple',
|
|
405
|
+
});
|
|
406
|
+
|
|
407
|
+
tastyStatic('.heading', { preset: 'h1' });
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
**After:**
|
|
411
|
+
|
|
412
|
+
```tsx
|
|
413
|
+
import { injectCSS as _$i } from '@tenphi/tasty/static/inject';
|
|
414
|
+
|
|
415
|
+
const button = (_$i("ts3f2a1b ts8c4d2e", ".ts3f2a1b.ts3f2a1b{padding:16px 32px}\n.ts8c4d2e.ts8c4d2e{background:#9370db}"), {
|
|
416
|
+
className: 'ts3f2a1b ts8c4d2e',
|
|
417
|
+
styles: { padding: '2x 4x', fill: '#purple' },
|
|
418
|
+
toString() { return this.className; }
|
|
419
|
+
});
|
|
420
|
+
|
|
421
|
+
_$i(".heading", ".heading{font-size:2.5rem;font-weight:700;line-height:1.2}");
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
### Dev Mode / HMR
|
|
425
|
+
|
|
426
|
+
Class names are content-hashed (`ts` + MD5). When styles change, a new hash produces a new `_$i` call that injects fresh CSS. The injector deduplicates by id, so unchanged styles are skipped. Old CSS stays in the DOM but is harmless since no elements reference those class names.
|
|
427
|
+
|
|
428
|
+
### Limitations (inject mode)
|
|
429
|
+
|
|
430
|
+
- **Client-side only** — Styles are injected via the DOM, so they are not available during SSR. For server-rendered apps, use `mode: 'file'` or the runtime `tasty()`.
|
|
431
|
+
- **Larger JS bundle** — CSS is embedded in JavaScript, increasing bundle size. Best suited for components and extensions, not full-app styling.
|
|
432
|
+
|
|
433
|
+
---
|
|
434
|
+
|
|
336
435
|
## Style Extension
|
|
337
436
|
|
|
338
437
|
```tsx
|
|
@@ -429,5 +528,5 @@ const card = tastyStatic({
|
|
|
429
528
|
|
|
430
529
|
- [Docs Hub](README.md) — Choose the right guide by task or rendering mode
|
|
431
530
|
- [Style DSL](dsl.md) — State maps, tokens, units, extending semantics (shared by runtime and static)
|
|
432
|
-
- [
|
|
531
|
+
- [React API](react-api.md) — Runtime styling: `tasty()` factory, component props, variants, sub-elements, style functions
|
|
433
532
|
- [Configuration](configuration.md) — Global configuration: tokens, recipes, custom units, and style handlers
|
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.275370e",
|
|
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",
|
|
@@ -17,6 +17,11 @@
|
|
|
17
17
|
"import": "./dist/static/index.js",
|
|
18
18
|
"default": "./dist/static/index.js"
|
|
19
19
|
},
|
|
20
|
+
"./static/inject": {
|
|
21
|
+
"types": "./dist/static/inject.d.ts",
|
|
22
|
+
"import": "./dist/static/inject.js",
|
|
23
|
+
"default": "./dist/static/inject.js"
|
|
24
|
+
},
|
|
20
25
|
"./babel-plugin": {
|
|
21
26
|
"types": "./dist/zero/babel.d.ts",
|
|
22
27
|
"import": "./dist/zero/babel.js",
|
|
@@ -52,6 +57,11 @@
|
|
|
52
57
|
"import": "./dist/ssr/astro.js",
|
|
53
58
|
"default": "./dist/ssr/astro.js"
|
|
54
59
|
},
|
|
60
|
+
"./ssr/astro-client": {
|
|
61
|
+
"types": "./dist/ssr/astro-client.d.ts",
|
|
62
|
+
"import": "./dist/ssr/astro-client.js",
|
|
63
|
+
"default": "./dist/ssr/astro-client.js"
|
|
64
|
+
},
|
|
55
65
|
"./tasty.config": "./tasty.config.ts"
|
|
56
66
|
},
|
|
57
67
|
"files": [
|
|
@@ -62,7 +72,8 @@
|
|
|
62
72
|
"sideEffects": [
|
|
63
73
|
"./dist/ssr/index.js",
|
|
64
74
|
"./dist/ssr/next.js",
|
|
65
|
-
"./dist/ssr/astro.js"
|
|
75
|
+
"./dist/ssr/astro.js",
|
|
76
|
+
"./dist/ssr/astro-client.js"
|
|
66
77
|
],
|
|
67
78
|
"engines": {
|
|
68
79
|
"node": ">=20"
|
|
@@ -136,7 +147,7 @@
|
|
|
136
147
|
},
|
|
137
148
|
"devDependencies": {
|
|
138
149
|
"@babel/core": "^7.24.0",
|
|
139
|
-
"@changesets/changelog-github": "^0.
|
|
150
|
+
"@changesets/changelog-github": "^0.6.0",
|
|
140
151
|
"@changesets/cli": "^2.29.8",
|
|
141
152
|
"@eslint/js": "^10.0.1",
|
|
142
153
|
"@size-limit/esbuild": "^12.0.0",
|
|
@@ -150,11 +161,11 @@
|
|
|
150
161
|
"@vitest/runner": "^4.0.18",
|
|
151
162
|
"eslint": "^10.0.0",
|
|
152
163
|
"eslint-config-prettier": "^10.1.8",
|
|
153
|
-
"jsdom": "^
|
|
164
|
+
"jsdom": "^29.0.1",
|
|
154
165
|
"prettier": "^3.8.1",
|
|
155
166
|
"react": "^19.0.0",
|
|
156
167
|
"size-limit": "^12.0.0",
|
|
157
|
-
"tsdown": "^0.
|
|
168
|
+
"tsdown": "^0.21.7",
|
|
158
169
|
"typescript": "^5.9.3",
|
|
159
170
|
"typescript-eslint": "^8.56.0",
|
|
160
171
|
"vitest": "^4.0.18"
|
|
@@ -170,13 +181,13 @@
|
|
|
170
181
|
"name": "main (import *)",
|
|
171
182
|
"path": "dist/index.js",
|
|
172
183
|
"import": "*",
|
|
173
|
-
"limit": "
|
|
184
|
+
"limit": "50 kB"
|
|
174
185
|
},
|
|
175
186
|
{
|
|
176
187
|
"name": "core (import *)",
|
|
177
188
|
"path": "dist/core/index.js",
|
|
178
189
|
"import": "*",
|
|
179
|
-
"limit": "
|
|
190
|
+
"limit": "47.5 kB"
|
|
180
191
|
},
|
|
181
192
|
{
|
|
182
193
|
"name": "static",
|
|
@@ -193,7 +204,7 @@
|
|
|
193
204
|
"path",
|
|
194
205
|
"crypto"
|
|
195
206
|
],
|
|
196
|
-
"limit": "
|
|
207
|
+
"limit": "29.5 kB"
|
|
197
208
|
},
|
|
198
209
|
{
|
|
199
210
|
"name": "babel-plugin",
|
|
@@ -204,7 +215,7 @@
|
|
|
204
215
|
"path",
|
|
205
216
|
"crypto"
|
|
206
217
|
],
|
|
207
|
-
"limit": "
|
|
218
|
+
"limit": "43.5 kB"
|
|
208
219
|
}
|
|
209
220
|
]
|
|
210
221
|
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { getRegisteredSSRCollector } from "../ssr/ssr-collector-ref.js";
|
|
2
|
-
|
|
3
|
-
//#region src/hooks/resolve-ssr-collector.ts
|
|
4
|
-
/**
|
|
5
|
-
* Resolve the SSR collector from React context or AsyncLocalStorage.
|
|
6
|
-
* Returns null on the client (no collector available).
|
|
7
|
-
*/
|
|
8
|
-
function resolveSSRCollector(reactContext) {
|
|
9
|
-
if (reactContext) return reactContext;
|
|
10
|
-
return getRegisteredSSRCollector();
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
//#endregion
|
|
14
|
-
export { resolveSSRCollector };
|
|
15
|
-
//# sourceMappingURL=resolve-ssr-collector.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-ssr-collector.js","names":[],"sources":["../../src/hooks/resolve-ssr-collector.ts"],"sourcesContent":["import type { ServerStyleCollector } from '../ssr/collector';\nimport { getRegisteredSSRCollector } from '../ssr/ssr-collector-ref';\n\n/**\n * Resolve the SSR collector from React context or AsyncLocalStorage.\n * Returns null on the client (no collector available).\n */\nexport function resolveSSRCollector(\n reactContext: ServerStyleCollector | null,\n): ServerStyleCollector | null {\n if (reactContext) return reactContext;\n return getRegisteredSSRCollector();\n}\n"],"mappings":";;;;;;;AAOA,SAAgB,oBACd,cAC6B;AAC7B,KAAI,aAAc,QAAO;AACzB,QAAO,2BAA2B"}
|
package/dist/ssr/context.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ServerStyleCollector } from "./collector.js";
|
|
2
|
-
import * as react from "react";
|
|
3
|
-
|
|
4
|
-
//#region src/ssr/context.d.ts
|
|
5
|
-
declare const TastySSRContext: react.Context<ServerStyleCollector | null>;
|
|
6
|
-
//#endregion
|
|
7
|
-
export { TastySSRContext };
|
|
8
|
-
//# sourceMappingURL=context.d.ts.map
|
package/dist/styles/align.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
//#region src/styles/align.d.ts
|
|
2
|
-
declare function alignStyle({
|
|
3
|
-
align
|
|
4
|
-
}: {
|
|
5
|
-
align?: string;
|
|
6
|
-
}): {
|
|
7
|
-
'align-items': string;
|
|
8
|
-
'align-content': string;
|
|
9
|
-
} | undefined;
|
|
10
|
-
declare namespace alignStyle {
|
|
11
|
-
var __lookupStyles: string[];
|
|
12
|
-
}
|
|
13
|
-
//#endregion
|
|
14
|
-
export { alignStyle };
|
|
15
|
-
//# sourceMappingURL=align.d.ts.map
|
package/dist/styles/align.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
//#region src/styles/align.ts
|
|
2
|
-
function alignStyle({ align }) {
|
|
3
|
-
if (typeof align !== "string") return;
|
|
4
|
-
if (!align) return;
|
|
5
|
-
return {
|
|
6
|
-
"align-items": align,
|
|
7
|
-
"align-content": align
|
|
8
|
-
};
|
|
9
|
-
}
|
|
10
|
-
alignStyle.__lookupStyles = ["align"];
|
|
11
|
-
|
|
12
|
-
//#endregion
|
|
13
|
-
export { alignStyle };
|
|
14
|
-
//# sourceMappingURL=align.js.map
|
package/dist/styles/align.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"align.js","names":[],"sources":["../../src/styles/align.ts"],"sourcesContent":["export function alignStyle({ align }: { align?: string }) {\n if (typeof align !== 'string') return;\n\n if (!align) return;\n\n return {\n 'align-items': align,\n 'align-content': align,\n };\n}\n\nalignStyle.__lookupStyles = ['align'];\n"],"mappings":";AAAA,SAAgB,WAAW,EAAE,SAA6B;AACxD,KAAI,OAAO,UAAU,SAAU;AAE/B,KAAI,CAAC,MAAO;AAEZ,QAAO;EACL,eAAe;EACf,iBAAiB;EAClB;;AAGH,WAAW,iBAAiB,CAAC,QAAQ"}
|
package/dist/styles/justify.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
//#region src/styles/justify.d.ts
|
|
2
|
-
declare function justifyStyle({
|
|
3
|
-
justify
|
|
4
|
-
}: {
|
|
5
|
-
justify?: string;
|
|
6
|
-
}): {
|
|
7
|
-
'justify-items': string;
|
|
8
|
-
'justify-content': string;
|
|
9
|
-
} | undefined;
|
|
10
|
-
declare namespace justifyStyle {
|
|
11
|
-
var __lookupStyles: string[];
|
|
12
|
-
}
|
|
13
|
-
//#endregion
|
|
14
|
-
export { justifyStyle };
|
|
15
|
-
//# sourceMappingURL=justify.d.ts.map
|
package/dist/styles/justify.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
//#region src/styles/justify.ts
|
|
2
|
-
function justifyStyle({ justify }) {
|
|
3
|
-
if (typeof justify !== "string") return;
|
|
4
|
-
if (!justify) return;
|
|
5
|
-
return {
|
|
6
|
-
"justify-items": justify,
|
|
7
|
-
"justify-content": justify
|
|
8
|
-
};
|
|
9
|
-
}
|
|
10
|
-
justifyStyle.__lookupStyles = ["justify"];
|
|
11
|
-
|
|
12
|
-
//#endregion
|
|
13
|
-
export { justifyStyle };
|
|
14
|
-
//# sourceMappingURL=justify.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"justify.js","names":[],"sources":["../../src/styles/justify.ts"],"sourcesContent":["export function justifyStyle({ justify }: { justify?: string }) {\n if (typeof justify !== 'string') return;\n\n if (!justify) return;\n\n return {\n 'justify-items': justify,\n 'justify-content': justify,\n };\n}\n\njustifyStyle.__lookupStyles = ['justify'];\n"],"mappings":";AAAA,SAAgB,aAAa,EAAE,WAAiC;AAC9D,KAAI,OAAO,YAAY,SAAU;AAEjC,KAAI,CAAC,QAAS;AAEd,QAAO;EACL,iBAAiB;EACjB,mBAAmB;EACpB;;AAGH,aAAa,iBAAiB,CAAC,UAAU"}
|