Tasty v3 - #227
Open
tenphi wants to merge 13 commits into
Open
Conversation
Add a new `@function` ancillary at-rule mirroring the existing @fontFace/@counterStyle architecture: a singular `'@function'` styles key, a `useFunction` hook, an injector `func()` method, SSR/RSC collection, zero-runtime extraction, a global `configure({ function })` registry, and `$$name(...)` invocation sugar in the parser. Functions are defined with `$$name` keys and `$name` params/local vars; result/defaults/local-var values flow through the Tasty DSL (units, color tokens, auto-calc, fallbacks). Functions are injected once, globally, and never cleaned up (like @counter-style). Co-authored-by: Cursor <cursoragent@cursor.com>
…support This update consolidates the custom function configuration under a single `functions` key, allowing both parse-time functions and CSS `@function` definitions to coexist. Additionally, an opt-in polyfill for `@function` is introduced, enabling inlining of function calls into plain CSS for broader browser compatibility. The documentation has been updated to reflect these changes, and tests have been added to ensure functionality.
…S at-rule This change updates the style key from `@properties` to `@property` across the codebase to align with the actual CSS at-rule naming. The emitted CSS remains unchanged, and the global configuration options are unaffected. This is a breaking change for any styles using the old `@properties` key, requiring updates to the new `@property` format.
…r handling This update allows custom color functions to operate as first-class citizens within the Tasty parser, eliminating the need for special-casing of `okhsl` and `okhst`. Custom functions can now be registered without modifying core code, and new helper functions `createColorFunc` and `resolveFunctionColor` have been introduced for easier plugin development. Documentation has been updated to reflect these changes, and tests have been added to ensure functionality.
…unterStyles` for consistency This update renames the configuration keys from `fontFace` to `fontFaces` and `counterStyle` to `counterStyles` across the codebase to enhance clarity and consistency with plural naming conventions. The documentation and related code have been updated accordingly, ensuring that all references are aligned with the new naming scheme.
Contributor
📦 Snapshot releasePublished |
Three workstreams for the 3.0 release. See the changesets for the full
per-change rationale.
**Strict directional syntax.** A group naming direction modifiers now takes a
single value; per-side values come from comma groups. Values and modifiers are
bucketed separately per group, so `'2x 4x top right'` and `'2x top 4x right'`
were the same input and the pairing depended on modifier order. Dev warning plus
first-value fallback, silent in production. `inset` + `dock` keeps its two-value
form; directionless groups keep plain CSS shorthand order.
**propHandlers and baseStyleProps.** `configure({ propHandlers })` registers
middleware over component props — the extension point for props that are not
style values. `configure({ baseStyleProps })` promotes style names to props on
every component; the per-factory prop list is now resolved lazily so
`configure()` may run after components are defined.
**Handler contract.** Fixes a real bug: a multi-dependency custom handler whose
dependencies straddled a chunk was invoked twice with half its inputs and could
emit stale CSS. Adds a displacement warning (overriding `fill` silently took
over `image` and the whole background-* family), `defineHandler` for dependency
inference, a widened `CSSMap`, and a camelCase-key warning. Removes the blanket
`@ts-expect-error` in the handler registry, which surfaced that `presetStyle`
was annotated with the authoring `Styles` type instead of `CSSMap`.
**Consistency pass.** Finishes `funcs` -> `functions` on the public parser
surface, drops nine dead or internal-only exports, converts the `utils/styles`
star export to an explicit list, renames `CssOptions` -> `CSSOptions`, and fixes
a behavior bug where a second `configure()` call discarded the first's
`recipes`/`keyframes`/`properties`/`fontFaces`/`counterStyles`/`@function` defs.
**Guardrails.** A public-API snapshot test records every export of every
`package.json` subpath in `src/__snapshots__/public-api.md`, so any change to the
published surface is a reviewable diff. `knip` is now correctly configured and
runs in CI — it previously declared only test files as entry points, which is
why the dead exports went unnoticed. The Tasty ESLint plugin is dogfooded on the
repo's own style objects.
New docs: `docs/plugins.md`, `docs/migration-v3.md`.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Resolves src/utils/warnings.ts: takes main's `[Tasty]` PREFIX from #249 (the point of that change) while keeping this branch's removal of the dead `deprecationWarning`, which had zero callers. The `eslint-disable no-console` goes with it — only `console.warn` remains, which the repo's no-console config already allows. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
fade: true already worked — an empty value list falls back to calc(2 * var(--gap)), a default that follows the gap token and which no explicit value can express (fade: '2x' bakes in a static 16px). But the prop type was string only, docs/ai-agents.md listed fade among the properties that reject true, and the ESLint plugin flagged it. Three of four sources disagreed with the implementation. Surfaced by @cube-dev/ui-kit, whose FadeAllDirections story relies on it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Resolves two things: - package.json size-limit: keeps this branch's higher limits. main tightened its own to 54.5/51.65/47.65 kB, which are correct for main but cannot hold v3's dev diagnostics. Re-measured after merging: 56.57/53.70/18.10/32.43/50.04 against 57/54/18.5/33/50.5. - The keyframes, global-styles and injector tests main added in #251 call `getCssText`, the v2 spelling this branch renames to `getCSSText`. Migrated, which is exactly the change the migration guide asks consumers to make. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.