Skip to content

Tasty v3 - #227

Open
tenphi wants to merge 13 commits into
mainfrom
feat-function-declaration
Open

Tasty v3#227
tenphi wants to merge 13 commits into
mainfrom
feat-function-declaration

Conversation

@tenphi

@tenphi tenphi commented Jul 6, 2026

Copy link
Copy Markdown
Owner

No description provided.

tenphi and others added 8 commits June 29, 2026 15:16
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.
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

📦 Snapshot release

Published 0.0.0-snapshot.cdc961c.

pnpm add @tenphi/tasty@0.0.0-snapshot.cdc961c

tenphi and others added 3 commits July 30, 2026 14:15
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>
tenphi and others added 2 commits August 3, 2026 18:08
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>
@tenphi
tenphi deployed to release August 3, 2026 16:15 — with GitHub Actions Active
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant