@tenphi/tasty 2.11.2 → 3.0.0
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 +32 -7
- package/dist/astro-B53trJyX.js +156 -0
- package/dist/astro-B53trJyX.js.map +1 -0
- package/dist/babel-HlEpSZrj.d.ts +83 -0
- package/dist/{collector-yqgjGje7.d.ts → collector-BPzZezAG.d.ts} +36 -5
- package/dist/{collector-D0cgyN6N.js → collector-D14DcZx9.js} +65 -10
- package/dist/collector-D14DcZx9.js.map +1 -0
- package/dist/{config-_cYm9LPl.js → config-CCcE_tqx.js} +2906 -1778
- package/dist/config-CCcE_tqx.js.map +1 -0
- package/dist/{config-V0XC9iz_.d.ts → config-D2INrjr_.d.ts} +239 -25
- package/dist/core/index.d.ts +5 -5
- package/dist/core/index.js +6 -6
- package/dist/{core-DdjoZG0r.js → core-B5d0IPi2.js} +69 -131
- package/dist/core-B5d0IPi2.js.map +1 -0
- package/dist/{css-writer-DTUwLjgD.js → css-writer-B5DBoxhf.js} +54 -15
- package/dist/css-writer-B5DBoxhf.js.map +1 -0
- package/dist/{format-rules-Bu_qoamZ.js → format-rules-BbKDjsfO.js} +2 -2
- package/dist/{format-rules-Bu_qoamZ.js.map → format-rules-BbKDjsfO.js.map} +1 -1
- package/dist/{hydrate-CKk-rgmY.js → hydrate-CwALW3J9.js} +3 -11
- package/dist/{hydrate-CKk-rgmY.js.map → hydrate-CwALW3J9.js.map} +1 -1
- package/dist/{index-BjnGYI5D.d.ts → index-BAAbdfRs.d.ts} +217 -150
- package/dist/{index-tRick_JW.d.ts → index-l_NdJSUS.d.ts} +161 -61
- package/dist/index.d.ts +5 -5
- package/dist/index.js +75 -11
- package/dist/index.js.map +1 -1
- package/dist/{keyframes-5LJYS8_P.js → keyframes-B8M1FmtE.js} +10 -181
- package/dist/keyframes-B8M1FmtE.js.map +1 -0
- package/dist/{merge-styles-Blrs8kLM.js → merge-styles--1zOSFlS.js} +2 -2
- package/dist/{merge-styles-Blrs8kLM.js.map → merge-styles--1zOSFlS.js.map} +1 -1
- package/dist/{merge-styles-DDss7wRH.d.ts → merge-styles-NEvqayL_.d.ts} +2 -2
- package/dist/{resolve-recipes-DR5cSG3X.js → resolve-recipes-Caix5NnH.js} +3 -3
- package/dist/{resolve-recipes-DR5cSG3X.js.map → resolve-recipes-Caix5NnH.js.map} +1 -1
- package/dist/ssr/astro-client.js +1 -1
- package/dist/ssr/astro-middleware.js +1 -1
- package/dist/ssr/astro-middleware.js.map +1 -1
- package/dist/ssr/astro.d.ts +1 -5
- package/dist/ssr/astro.js +2 -147
- package/dist/ssr/index.d.ts +2 -9
- package/dist/ssr/index.js +4 -4
- package/dist/ssr/index.js.map +1 -1
- package/dist/ssr/next.d.ts +1 -1
- package/dist/ssr/next.js +5 -6
- package/dist/ssr/next.js.map +1 -1
- package/dist/static/index.d.ts +2 -2
- package/dist/static/index.js +1 -1
- package/dist/zero/babel.d.ts +2 -80
- package/dist/zero/babel.js +27 -23
- package/dist/zero/babel.js.map +1 -1
- package/dist/zero/index.d.ts +16 -2
- package/dist/zero/index.js +2 -2
- package/dist/zero/next.d.ts +1 -1
- package/dist/zero/next.js +1 -1
- package/dist/zero/next.js.map +1 -1
- package/docs/README.md +3 -1
- package/docs/ai-agents.md +21 -7
- package/docs/configuration.md +220 -30
- package/docs/debug.md +7 -7
- package/docs/design-system.md +2 -2
- package/docs/dsl.md +68 -8
- package/docs/injector.md +31 -4
- package/docs/methodology.md +1 -1
- package/docs/migration-v3.md +285 -0
- package/docs/pipeline.md +3 -3
- package/docs/plugins.md +349 -0
- package/docs/react-api.md +61 -1
- package/docs/ssr.md +40 -33
- package/docs/styles.md +27 -9
- package/docs/tasty-static.md +8 -6
- package/package.json +7 -7
- package/tasty.config.ts +4 -0
- package/dist/collector-D0cgyN6N.js.map +0 -1
- package/dist/config-_cYm9LPl.js.map +0 -1
- package/dist/core-DdjoZG0r.js.map +0 -1
- package/dist/css-writer-DTUwLjgD.js.map +0 -1
- package/dist/keyframes-5LJYS8_P.js.map +0 -1
- package/dist/ssr/astro.js.map +0 -1
|
@@ -1,5 +1,52 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Dt as SheetInfo, Et as RuleInfo, Ot as StyleInjectorConfig, P as StyleHandlerDefinition, St as PropertyDefinition, Tt as RootRegistry, b as Styles, bt as KeyframesResult, dt as FunctionDefinition, gt as InjectResult, h as ConfigTokens, ht as GlobalInjectResult, it as UnitHandler, kt as StyleRule, lt as FontFaceDescriptors, mt as GCOptions, n as StyleResult, nt as StyleDetails, ot as CacheMetrics, pt as GCConfig, st as CounterStyleDescriptors, ut as FontFaceInput, v as RecipeStyles, wt as RawCSSResult, xt as KeyframesSteps, yt as KeyframesInfo } from "./index-l_NdJSUS.js";
|
|
2
2
|
|
|
3
|
+
//#region src/prop-handlers.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Props middleware for tasty components.
|
|
6
|
+
*
|
|
7
|
+
* A prop handler receives a component's props and returns them, changed or not.
|
|
8
|
+
* That makes it the extension point for props that are *not* style properties:
|
|
9
|
+
* it can read a custom prop, strip it so it never reaches the DOM, and fold its
|
|
10
|
+
* meaning into `styles`, `mods`, `tokens`, `variant`, or `as`.
|
|
11
|
+
*
|
|
12
|
+
* ```ts
|
|
13
|
+
* configure({
|
|
14
|
+
* propHandlers: {
|
|
15
|
+
* glaze: (props) => {
|
|
16
|
+
* const { glaze, ...rest } = props;
|
|
17
|
+
* if (!glaze) return rest;
|
|
18
|
+
* return { ...rest, styles: mergeStyles(glazeStyles(glaze), rest.styles) };
|
|
19
|
+
* },
|
|
20
|
+
* },
|
|
21
|
+
* });
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* Handlers run on every render of every tasty component, so the registry is a
|
|
25
|
+
* pre-composed chain that is `null` while nothing is registered — the cost when
|
|
26
|
+
* unused is one property load and one branch.
|
|
27
|
+
*/
|
|
28
|
+
/** Props object handed to a prop handler. Deliberately untyped: handlers see everything. */
|
|
29
|
+
type PropHandlerProps = Record<string, unknown>;
|
|
30
|
+
/**
|
|
31
|
+
* Props middleware: props in, props out. Returning nothing means "unchanged".
|
|
32
|
+
*
|
|
33
|
+
* Must be a **pure function** and must not mutate its input. Style values are
|
|
34
|
+
* cached by object identity, so mutating a value object in place produces a stale
|
|
35
|
+
* class name and stale CSS. Return fresh (ideally frozen, ideally memoized)
|
|
36
|
+
* objects instead.
|
|
37
|
+
*/
|
|
38
|
+
type PropHandler = (props: PropHandlerProps) => PropHandlerProps | void | null;
|
|
39
|
+
/**
|
|
40
|
+
* How a prop handler is declared. The map key is both its name and, by default,
|
|
41
|
+
* the prop that triggers it.
|
|
42
|
+
*
|
|
43
|
+
* - `fn` — triggered when a prop matching the key is present
|
|
44
|
+
* - `['glaze', fn]` — triggered by the named prop
|
|
45
|
+
* - `[['glaze', 'tone'], fn]` — triggered by any of them
|
|
46
|
+
* - `['*', fn]` — unconditional; runs on every render of every component
|
|
47
|
+
*/
|
|
48
|
+
type PropHandlerDefinition = PropHandler | [string, PropHandler] | [string[], PropHandler];
|
|
49
|
+
//#endregion
|
|
3
50
|
//#region src/injector/sheet-manager.d.ts
|
|
4
51
|
declare class SheetManager {
|
|
5
52
|
private rootRegistries;
|
|
@@ -118,7 +165,7 @@ declare class SheetManager {
|
|
|
118
165
|
/**
|
|
119
166
|
* Get CSS text from all sheets (for SSR)
|
|
120
167
|
*/
|
|
121
|
-
|
|
168
|
+
getCSSText(registry: RootRegistry): string;
|
|
122
169
|
/**
|
|
123
170
|
* Get cache performance metrics
|
|
124
171
|
*/
|
|
@@ -267,13 +314,13 @@ declare class StyleInjector {
|
|
|
267
314
|
/**
|
|
268
315
|
* Get CSS text from all sheets (for SSR)
|
|
269
316
|
*/
|
|
270
|
-
|
|
317
|
+
getCSSText(options?: {
|
|
271
318
|
root?: Document | ShadowRoot;
|
|
272
319
|
}): string;
|
|
273
320
|
/**
|
|
274
321
|
* Get CSS only for the provided tasty classNames (e.g., ["t0","t3"])
|
|
275
322
|
*/
|
|
276
|
-
|
|
323
|
+
getCSSTextForClasses(classNames: Iterable<string>, options?: {
|
|
277
324
|
root?: Document | ShadowRoot;
|
|
278
325
|
}): string;
|
|
279
326
|
/**
|
|
@@ -335,11 +382,28 @@ declare class StyleInjector {
|
|
|
335
382
|
/**
|
|
336
383
|
* Inject a CSS @counter-style rule.
|
|
337
384
|
*
|
|
338
|
-
* Permanent and global — no dispose or ref-counting.
|
|
339
|
-
*
|
|
385
|
+
* Permanent and global — no dispose or ref-counting. Deduplicates by name.
|
|
386
|
+
* By default a definition overrides a previously injected one of the same
|
|
387
|
+
* name. Pass `weak: true` for global `configure()` definitions, which must
|
|
388
|
+
* never clobber an existing rule (so component-local definitions win
|
|
389
|
+
* regardless of injection order).
|
|
340
390
|
*/
|
|
341
391
|
counterStyle(name: string, descriptors: CounterStyleDescriptors, options?: {
|
|
342
392
|
root?: Document | ShadowRoot;
|
|
393
|
+
weak?: boolean;
|
|
394
|
+
}): void;
|
|
395
|
+
/**
|
|
396
|
+
* Inject a CSS @function rule (custom function).
|
|
397
|
+
*
|
|
398
|
+
* Permanent and global — no dispose or ref-counting. Deduplicates by function
|
|
399
|
+
* name. By default a definition overrides a previously injected one of the
|
|
400
|
+
* same name. Pass `weak: true` for global `configure()` definitions, which
|
|
401
|
+
* must never clobber an existing rule (so component-local definitions win
|
|
402
|
+
* regardless of injection order).
|
|
403
|
+
*/
|
|
404
|
+
func(name: string, definition: FunctionDefinition, options?: {
|
|
405
|
+
root?: Document | ShadowRoot;
|
|
406
|
+
weak?: boolean;
|
|
343
407
|
}): void;
|
|
344
408
|
/**
|
|
345
409
|
* Inject keyframes and return object with toString() and dispose()
|
|
@@ -390,6 +454,21 @@ declare class StyleInjector {
|
|
|
390
454
|
destroy(root?: Document | ShadowRoot): void;
|
|
391
455
|
}
|
|
392
456
|
//#endregion
|
|
457
|
+
//#region src/functions/index.d.ts
|
|
458
|
+
/**
|
|
459
|
+
* A parse-time function: receives the parsed (comma-separated) argument groups
|
|
460
|
+
* and returns a CSS value string. This is the JS flavor of the unified
|
|
461
|
+
* `functions` config (bare-name keys), distinct from declarative `@function`
|
|
462
|
+
* definitions (`$$`-prefixed keys).
|
|
463
|
+
*/
|
|
464
|
+
type ParseFunction = (groups: StyleDetails[]) => string;
|
|
465
|
+
/**
|
|
466
|
+
* The unified `functions` map: keys are either bare names (parse functions,
|
|
467
|
+
* value is a function) or `$$name`/`$name`/`--name` (declarative CSS functions,
|
|
468
|
+
* value is a {@link FunctionDefinition} object).
|
|
469
|
+
*/
|
|
470
|
+
type FunctionsConfig = Record<string, FunctionDefinition | ParseFunction>;
|
|
471
|
+
//#endregion
|
|
393
472
|
//#region src/utils/color-space.d.ts
|
|
394
473
|
type ColorSpace = 'rgb' | 'hsl' | 'oklch';
|
|
395
474
|
//#endregion
|
|
@@ -454,8 +533,12 @@ declare function generateTypographyTokens(presets: Record<string, TypographyPres
|
|
|
454
533
|
interface TastyPlugin {
|
|
455
534
|
/** Unique name for the plugin (used for debugging and conflict detection) */
|
|
456
535
|
name: string;
|
|
457
|
-
/**
|
|
458
|
-
|
|
536
|
+
/**
|
|
537
|
+
* Custom functions (unified map). Bare keys map to parse functions
|
|
538
|
+
* `(groups) => string`; `$$name` keys map to declarative CSS `@function`
|
|
539
|
+
* definitions. See {@link FunctionsConfig}.
|
|
540
|
+
*/
|
|
541
|
+
functions?: FunctionsConfig;
|
|
459
542
|
/** Custom units that transform numeric values (e.g., `2x` → `calc(2 * var(--gap))`) */
|
|
460
543
|
units?: Record<string, string | UnitHandler>;
|
|
461
544
|
/** Custom state aliases (e.g., `'@mobile': '@media(w < 768px)'`) */
|
|
@@ -474,6 +557,32 @@ interface TastyPlugin {
|
|
|
474
557
|
* ```
|
|
475
558
|
*/
|
|
476
559
|
handlers?: Record<string, StyleHandlerDefinition>;
|
|
560
|
+
/**
|
|
561
|
+
* Props middleware for every tasty component — props in, props out. The
|
|
562
|
+
* extension point for props that are not style properties: read a custom prop,
|
|
563
|
+
* strip it so it never reaches the DOM, and fold its meaning into `styles`,
|
|
564
|
+
* `mods`, `tokens`, `variant`, or `as`.
|
|
565
|
+
*
|
|
566
|
+
* Must be pure and must not mutate its input.
|
|
567
|
+
* See {@link TastyConfig.propHandlers}.
|
|
568
|
+
* @example
|
|
569
|
+
* ```ts
|
|
570
|
+
* propHandlers: {
|
|
571
|
+
* glaze: (props) => {
|
|
572
|
+
* const { glaze, ...rest } = props;
|
|
573
|
+
* if (!glaze) return rest;
|
|
574
|
+
* return { ...rest, styles: mergeStyles(glazeStyles(glaze), rest.styles) };
|
|
575
|
+
* },
|
|
576
|
+
* }
|
|
577
|
+
* ```
|
|
578
|
+
*/
|
|
579
|
+
propHandlers?: Record<string, PropHandlerDefinition>;
|
|
580
|
+
/**
|
|
581
|
+
* Style properties exposed as top-level props on every tasty component, in
|
|
582
|
+
* addition to the built-in base styles.
|
|
583
|
+
* See {@link TastyConfig.baseStyleProps}.
|
|
584
|
+
*/
|
|
585
|
+
baseStyleProps?: readonly string[];
|
|
477
586
|
/**
|
|
478
587
|
* Design tokens injected as CSS custom properties on `:root`.
|
|
479
588
|
* Values are parsed through the Tasty DSL. Supports state maps.
|
|
@@ -505,6 +614,19 @@ interface TastyPlugin {
|
|
|
505
614
|
* Supports the full Tasty style syntax.
|
|
506
615
|
*/
|
|
507
616
|
globalStyles?: Record<string, Styles>;
|
|
617
|
+
/**
|
|
618
|
+
* Global CSS `@property` definitions. A plugin whose handler or prop handler
|
|
619
|
+
* emits a custom property usually wants one, so the property animates and
|
|
620
|
+
* inherits correctly instead of being treated as an untyped string.
|
|
621
|
+
* See {@link TastyConfig.properties}.
|
|
622
|
+
*/
|
|
623
|
+
properties?: Record<string, PropertyDefinition>;
|
|
624
|
+
/** Global keyframes, injected only when referenced. See {@link TastyConfig.keyframes}. */
|
|
625
|
+
keyframes?: Record<string, KeyframesSteps>;
|
|
626
|
+
/** Global `@font-face` definitions. See {@link TastyConfig.fontFaces}. */
|
|
627
|
+
fontFaces?: Record<string, FontFaceInput>;
|
|
628
|
+
/** Global `@counter-style` definitions. See {@link TastyConfig.counterStyles}. */
|
|
629
|
+
counterStyles?: Record<string, CounterStyleDescriptors>;
|
|
508
630
|
}
|
|
509
631
|
/**
|
|
510
632
|
* A factory function that creates a TastyPlugin.
|
|
@@ -515,13 +637,13 @@ interface TastyPlugin {
|
|
|
515
637
|
* // Plugin without options
|
|
516
638
|
* const okhslPlugin: TastyPluginFactory = () => ({
|
|
517
639
|
* name: 'okhsl',
|
|
518
|
-
*
|
|
640
|
+
* functions: { okhsl: okhslFunction },
|
|
519
641
|
* });
|
|
520
642
|
*
|
|
521
643
|
* // Plugin with options
|
|
522
644
|
* const debugPlugin: TastyPluginFactory<{ verbose: boolean }> = (options) => ({
|
|
523
645
|
* name: 'debug',
|
|
524
|
-
*
|
|
646
|
+
* functions: { debug: createDebugFunc(options.verbose) },
|
|
525
647
|
* });
|
|
526
648
|
* ```
|
|
527
649
|
*/
|
|
@@ -558,11 +680,28 @@ interface TastyConfig {
|
|
|
558
680
|
*/
|
|
559
681
|
units?: Record<string, string | UnitHandler>;
|
|
560
682
|
/**
|
|
561
|
-
* Custom functions
|
|
562
|
-
*
|
|
563
|
-
*
|
|
683
|
+
* Custom functions (merged with existing). A single map holds both flavors,
|
|
684
|
+
* discriminated by value type:
|
|
685
|
+
*
|
|
686
|
+
* - **Bare key + function value** — a parse-time function that processes the
|
|
687
|
+
* parsed argument groups and returns a CSS value. Called as `name(...)`.
|
|
688
|
+
* - **`$$name` key + object value** — a declarative CSS `@function`
|
|
689
|
+
* definition. Called as `$$name(...)` (→ native `--name(...)`).
|
|
690
|
+
*
|
|
691
|
+
* A key whose prefix does not match its value type (object under a bare key,
|
|
692
|
+
* or function under a `$$` key) is ignored with a dev warning.
|
|
693
|
+
*
|
|
694
|
+
* @example
|
|
695
|
+
* ```ts
|
|
696
|
+
* configure({
|
|
697
|
+
* functions: {
|
|
698
|
+
* double: (groups) => `calc(2 * ${groups[0].output})`, // parse function
|
|
699
|
+
* $$negative: { args: ['$value'], result: '(-1 * $value)' }, // CSS function
|
|
700
|
+
* },
|
|
701
|
+
* });
|
|
702
|
+
* ```
|
|
564
703
|
*/
|
|
565
|
-
|
|
704
|
+
functions?: FunctionsConfig;
|
|
566
705
|
/**
|
|
567
706
|
* Color space used for decomposed color token companion variables.
|
|
568
707
|
* Controls the CSS function and suffix for alpha composition.
|
|
@@ -578,7 +717,7 @@ interface TastyConfig {
|
|
|
578
717
|
* Automatically infer and register CSS @property declarations
|
|
579
718
|
* from custom property values found in styles, keyframes, and global config.
|
|
580
719
|
* Covers all types: \<color\>, \<number\>, \<length\>, \<angle\>, \<percentage\>, \<time\>.
|
|
581
|
-
* When false, only explicitly declared @
|
|
720
|
+
* When false, only explicitly declared @property are registered.
|
|
582
721
|
* @default true
|
|
583
722
|
*/
|
|
584
723
|
autoPropertyTypes?: boolean;
|
|
@@ -610,7 +749,7 @@ interface TastyConfig {
|
|
|
610
749
|
* `'ts'` (overridable via the same option) so its classes can't
|
|
611
750
|
* collide with runtime classes when both are loaded on the same page.
|
|
612
751
|
*
|
|
613
|
-
* Must match `^[a-zA-
|
|
752
|
+
* Must match `^[a-zA-Z_][a-zA-Z0-9_-]{0,31}$`. Locked once styles
|
|
614
753
|
* have been generated.
|
|
615
754
|
*
|
|
616
755
|
* @default 't'
|
|
@@ -686,7 +825,7 @@ interface TastyConfig {
|
|
|
686
825
|
* @example
|
|
687
826
|
* ```ts
|
|
688
827
|
* configure({
|
|
689
|
-
*
|
|
828
|
+
* fontFaces: {
|
|
690
829
|
* 'Brand Sans': [
|
|
691
830
|
* { src: 'url("/fonts/brand-regular.woff2") format("woff2")', fontWeight: 400, fontDisplay: 'swap' },
|
|
692
831
|
* { src: 'url("/fonts/brand-bold.woff2") format("woff2")', fontWeight: 700, fontDisplay: 'swap' },
|
|
@@ -696,7 +835,7 @@ interface TastyConfig {
|
|
|
696
835
|
* });
|
|
697
836
|
* ```
|
|
698
837
|
*/
|
|
699
|
-
|
|
838
|
+
fontFaces?: Record<string, FontFaceInput>;
|
|
700
839
|
/**
|
|
701
840
|
* Global @counter-style definitions.
|
|
702
841
|
* Keys are counter-style names, values are descriptor objects.
|
|
@@ -704,13 +843,32 @@ interface TastyConfig {
|
|
|
704
843
|
* @example
|
|
705
844
|
* ```ts
|
|
706
845
|
* configure({
|
|
707
|
-
*
|
|
846
|
+
* counterStyles: {
|
|
708
847
|
* thumbs: { system: 'cyclic', symbols: '"👍"', suffix: '" "' },
|
|
709
848
|
* },
|
|
710
849
|
* });
|
|
711
850
|
* ```
|
|
712
851
|
*/
|
|
713
|
-
|
|
852
|
+
counterStyles?: Record<string, CounterStyleDescriptors>;
|
|
853
|
+
/**
|
|
854
|
+
* Opt-in polyfills for not-yet-baseline CSS features. Each key toggles a
|
|
855
|
+
* feature polyfill; all default to `false`.
|
|
856
|
+
*
|
|
857
|
+
* - `functions` — polyfill CSS `@function` by inlining every `$$name(...)`
|
|
858
|
+
* call into plain CSS (calc/var/color-mix) at parse time instead of
|
|
859
|
+
* emitting the native `@function` at-rule. Enables `@function` usage in
|
|
860
|
+
* browsers that don't support it yet (Firefox/Safari). Note this is the
|
|
861
|
+
* `functions` *feature toggle*, distinct from the top-level `functions`
|
|
862
|
+
* definitions map.
|
|
863
|
+
*
|
|
864
|
+
* @example
|
|
865
|
+
* ```ts
|
|
866
|
+
* configure({ polyfills: { functions: true } });
|
|
867
|
+
* ```
|
|
868
|
+
*/
|
|
869
|
+
polyfills?: {
|
|
870
|
+
functions?: boolean;
|
|
871
|
+
};
|
|
714
872
|
/**
|
|
715
873
|
* Custom style handlers that transform style properties into CSS declarations.
|
|
716
874
|
* Handlers replace built-in handlers for the same style name.
|
|
@@ -740,6 +898,56 @@ interface TastyConfig {
|
|
|
740
898
|
* ```
|
|
741
899
|
*/
|
|
742
900
|
handlers?: Record<string, StyleHandlerDefinition>;
|
|
901
|
+
/**
|
|
902
|
+
* Props middleware for every tasty component. A prop handler receives the
|
|
903
|
+
* component's props and returns them, changed or not — the extension point for
|
|
904
|
+
* props that are not style properties.
|
|
905
|
+
*
|
|
906
|
+
* The map key is the handler's name and, by default, the prop that triggers it.
|
|
907
|
+
* Use `['*', fn]` for an unconditional handler, or `[['a', 'b'], fn]` to trigger
|
|
908
|
+
* on any of several props.
|
|
909
|
+
*
|
|
910
|
+
* Handlers must be pure and must not mutate their input: style values are cached
|
|
911
|
+
* by object identity, so mutating one in place yields stale CSS. Memoize the
|
|
912
|
+
* styles you build per input value.
|
|
913
|
+
*
|
|
914
|
+
* Not applicable to zero-runtime mode — `tastyStatic()` takes styles objects, not
|
|
915
|
+
* props, so there is nothing for middleware to run on. Components rendered
|
|
916
|
+
* through `tasty()` are unaffected and keep the runtime injector.
|
|
917
|
+
*
|
|
918
|
+
* @example
|
|
919
|
+
* ```ts
|
|
920
|
+
* configure({
|
|
921
|
+
* propHandlers: {
|
|
922
|
+
* glaze: (props) => {
|
|
923
|
+
* const { glaze, ...rest } = props;
|
|
924
|
+
* if (!glaze) return rest;
|
|
925
|
+
* return { ...rest, styles: mergeStyles(glazeStyles(glaze), rest.styles) };
|
|
926
|
+
* },
|
|
927
|
+
* },
|
|
928
|
+
* });
|
|
929
|
+
*
|
|
930
|
+
* <Element glaze="purple" />
|
|
931
|
+
* ```
|
|
932
|
+
*/
|
|
933
|
+
propHandlers?: Record<string, PropHandlerDefinition>;
|
|
934
|
+
/**
|
|
935
|
+
* Style properties exposed as top-level props on **every** tasty component, in
|
|
936
|
+
* addition to the built-in base styles, without each component listing them in
|
|
937
|
+
* `styleProps`.
|
|
938
|
+
*
|
|
939
|
+
* Augment `TastyBaseStylePropNames` to type them. Each name costs one property
|
|
940
|
+
* check per render of every component, so keep the list short; the effect is
|
|
941
|
+
* app-global and cannot be scoped to a subtree.
|
|
942
|
+
*
|
|
943
|
+
* @example
|
|
944
|
+
* ```ts
|
|
945
|
+
* configure({ baseStyleProps: ['radius', 'shadow'] });
|
|
946
|
+
*
|
|
947
|
+
* <Card radius="1r" shadow />
|
|
948
|
+
* ```
|
|
949
|
+
*/
|
|
950
|
+
baseStyleProps?: readonly string[];
|
|
743
951
|
/**
|
|
744
952
|
* Design tokens injected as CSS custom properties on `:root`.
|
|
745
953
|
* Values are parsed through the Tasty DSL. Supports state maps
|
|
@@ -795,7 +1003,7 @@ interface TastyConfig {
|
|
|
795
1003
|
/**
|
|
796
1004
|
* Predefined style recipes -- named style bundles that can be applied via `recipe` style property.
|
|
797
1005
|
* Recipe values are flat tasty styles (no sub-element keys). They may contain base styles,
|
|
798
|
-
* tokens (`$name`/`#name` definitions), local states, `@keyframes`, and `@
|
|
1006
|
+
* tokens (`$name`/`#name` definitions), local states, `@keyframes`, and `@property`.
|
|
799
1007
|
*
|
|
800
1008
|
* Components reference recipes via: `recipe: 'name1 name2'` in their styles.
|
|
801
1009
|
* Use `/` to separate base recipes from post recipes: `recipe: 'base1 base2 / post1'`.
|
|
@@ -891,13 +1099,19 @@ declare function getGlobalKeyframes(): Record<string, KeyframesSteps> | null;
|
|
|
891
1099
|
* Returns null if no font faces configured.
|
|
892
1100
|
* Reads from globalThis first for cross-module SSR support.
|
|
893
1101
|
*/
|
|
894
|
-
declare function
|
|
1102
|
+
declare function getGlobalFontFaces(): Record<string, FontFaceInput> | null;
|
|
895
1103
|
/**
|
|
896
1104
|
* Get global counter-style configuration.
|
|
897
1105
|
* Returns null if no counter styles configured.
|
|
898
1106
|
* Reads from globalThis first for cross-module SSR support.
|
|
899
1107
|
*/
|
|
900
|
-
declare function
|
|
1108
|
+
declare function getGlobalCounterStyles(): Record<string, CounterStyleDescriptors> | null;
|
|
1109
|
+
/**
|
|
1110
|
+
* Get global @function configuration.
|
|
1111
|
+
* Returns null if no functions configured.
|
|
1112
|
+
* Reads from globalThis first for cross-module SSR support.
|
|
1113
|
+
*/
|
|
1114
|
+
declare function getGlobalFunctions(): Record<string, FunctionDefinition> | null;
|
|
901
1115
|
/**
|
|
902
1116
|
* Check if any global recipes are configured.
|
|
903
1117
|
* Fast path: returns false if no recipes were ever set.
|
|
@@ -954,5 +1168,5 @@ declare function getNamePrefix(): string;
|
|
|
954
1168
|
*/
|
|
955
1169
|
declare function resetConfig(): void;
|
|
956
1170
|
//#endregion
|
|
957
|
-
export {
|
|
958
|
-
//# sourceMappingURL=config-
|
|
1171
|
+
export { ParseFunction as C, PropHandlerDefinition as D, PropHandler as E, PropHandlerProps as O, FunctionsConfig as S, SheetManager as T, TastyPluginFactory as _, getGlobalFontFaces as a, generateTypographyTokens as b, getGlobalRecipes as c, hasGlobalRecipes as d, hasStylesGenerated as f, TastyPlugin as g, resetConfig as h, getGlobalCounterStyles as i, getNamePrefix as l, isTestEnvironment as m, configure as n, getGlobalFunctions as o, isConfigLocked as p, getConfig as r, getGlobalKeyframes as s, TastyConfig as t, hasGlobalKeyframes as u, TypographyPreset as v, StyleInjector as w, ColorSpace as x, TypographyTokenValue as y };
|
|
1172
|
+
//# sourceMappingURL=config-D2INrjr_.d.ts.map
|
package/dist/core/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { S as
|
|
3
|
-
import { $
|
|
4
|
-
import { t as mergeStyles } from "../merge-styles-
|
|
5
|
-
export { APPEARANCE_CHUNK_STYLES, type AtRuleContext, BASE_STYLES, BLOCK_INNER_STYLES, BLOCK_OUTER_STYLES, BLOCK_STYLES, type BaseStyleProps, type BlockInnerStyleProps, type BlockOuterStyleProps, type BlockStyleProps,
|
|
1
|
+
import { C as ParseFunction, D as PropHandlerDefinition, E as PropHandler, O as PropHandlerProps, S as FunctionsConfig, T as SheetManager, _ as TastyPluginFactory, a as getGlobalFontFaces, b as generateTypographyTokens, c as getGlobalRecipes, d as hasGlobalRecipes, f as hasStylesGenerated, g as TastyPlugin, h as resetConfig, i as getGlobalCounterStyles, l as getNamePrefix, m as isTestEnvironment, n as configure, o as getGlobalFunctions, p as isConfigLocked, r as getConfig, s as getGlobalKeyframes, t as TastyConfig, u as hasGlobalKeyframes, v as TypographyPreset, w as StyleInjector, x as ColorSpace, y as TypographyTokenValue } from "../config-D2INrjr_.js";
|
|
2
|
+
import { $ as StyleParser, A as ParsedColor, At as StyleUsage, B as StyleValueStateMap, C as SuffixForSelector, Ct as PropertyOptions, D as CSSMap, Dt as SheetInfo, E as AnyStyleHandler, Et as RuleInfo, F as StyleHandlerProps, G as parseColor, H as getGlobalParser, I as StyleHandlerResult, J as getNamedColorHex, K as parseStyle, L as StyleMap, M as ResolvedStyleValue, N as StyleHandler, O as CUSTOM_UNITS, Ot as StyleInjectorConfig, P as StyleHandlerDefinition, Q as strToRgb, R as StylePropValue, S as StylesWithoutSelectors, St as PropertyDefinition, T as TastyPresetNames, Tt as RootRegistry, U as getGlobalPredefinedTokens, V as filterMods, W as normalizeColorTokenValue, X as hexToRgb, Y as getRgbValuesFromRgbaString, Z as hslToRgbValues, _ as NotSelector, _t as InjectionMode, a as ParseStateKeyOptions, at as CSSProperties, b as Styles, bt as KeyframesResult, c as ParsedAdvancedState, ct as DisposeFunction, d as getGlobalPredefinedStates, dt as FunctionDefinition, et as ParserOptions, f as setGlobalPredefinedStates, ft as FunctionParameter, g as NoType, gt as InjectResult, h as ConfigTokens, i as renderStyles, it as UnitHandler, j as RawStyleHandler, k as DIRECTIONS, kt as StyleRule, l as StateParserContext, lt as FontFaceDescriptors, m as ConfigTokenValue, mt as GCOptions, n as StyleResult, nt as StyleDetails, o as parseStateKey, ot as CacheMetrics, p as ConditionNode, pt as GCConfig, q as stringifyStyles, r as isSelector, rt as StyleDetailsPart, s as AtRuleContext, st as CounterStyleDescriptors, t as RenderResult, tt as ProcessedStyle, u as createStateParserContext, ut as FontFaceInput, v as RecipeStyles, vt as KeyframesCacheEntry, w as TastyNamedColors, wt as RawCSSResult, x as StylesInterface, xt as KeyframesSteps, y as Selector, yt as KeyframesInfo, z as StyleValue } from "../index-l_NdJSUS.js";
|
|
3
|
+
import { $ as okhstFunction, $t as TagName, A as keyframes, B as ChunkInfo, Bt as BlockOuterStyleProps, C as getCSSTextForNode, D as injectRawCSS, E as injectGlobal, F as ComputeStylesOptions, G as DIMENSION_CHUNK_STYLES, Gt as ExtraBaseStyleProps, H as APPEARANCE_CHUNK_STYLES, Ht as ColorStyleProps, I as ComputeStylesResult, J as LAYOUT_CHUNK_STYLES, Jt as ModValue, K as DISPLAY_CHUNK_STYLES, Kt as FlowStyleProps, L as computeStyles, M as touch, N as ChunkSheetRegistry, O as injector, P as chunkSheetRegistry, Q as createColorFunc, Qt as ShortGridStyles, R as defineHandler, Rt as BaseStyleProps, S as getCSSText, T as inject, U as CHUNK_NAMES, Ut as ContainerStyleProps, V as categorizeStyleKeys, Vt as BlockStyleProps, W as ChunkName, Wt as DimensionStyleProps, X as STYLE_TO_CHUNK, Xt as OuterStyleProps, Y as POSITION_CHUNK_STYLES, Yt as Mods, Z as resolveFunctionColor, Zt as PositionStyleProps, _ as createInjector, _n as POSITION_STYLES, a as DebugOptions, an as TokenValue, b as func, bn as DEFAULT_ZERO_NAME_PREFIX, c as tastyDebug, cn as BLOCK_INNER_STYLES, d as dotize, dn as COLOR_STYLES, en as TastyBaseStylePropNames, et as okhstPlugin, f as _modAttrs, fn as CONTAINER_STYLES, g as counterStyle, gn as OUTER_STYLES, h as cleanup, hn as INNER_STYLES, i as DebugChunkInfo, in as TextStyleProps, j as property, k as isPropertyDefined, l as processTokens, ln as BLOCK_OUTER_STYLES, m as filterBaseProps, mn as FLOW_STYLES, n as CacheStatus, nn as TastyExtensionConfig, nt as okhslPlugin, o as InspectResult, on as Tokens, p as color, pn as DIMENSION_STYLES, q as FONT_CHUNK_STYLES, qt as InnerStyleProps, r as ChunkBreakdown, rn as TastyThemeNames, s as Summary, sn as BASE_STYLES, t as CSSOptions, tn as TastyCustomProps, tt as okhslFunction, u as resolveRecipes, un as BLOCK_STYLES, v as destroy, vn as TEXT_STYLES, w as getRawCSSText, x as gc, y as fontFace, yn as DEFAULT_NAME_PREFIX, z as styleHandlers, zt as BlockInnerStyleProps } from "../index-BAAbdfRs.js";
|
|
4
|
+
import { t as mergeStyles } from "../merge-styles-NEvqayL_.js";
|
|
5
|
+
export { APPEARANCE_CHUNK_STYLES, type AnyStyleHandler, type AtRuleContext, BASE_STYLES, BLOCK_INNER_STYLES, BLOCK_OUTER_STYLES, BLOCK_STYLES, type BaseStyleProps, type BlockInnerStyleProps, type BlockOuterStyleProps, type BlockStyleProps, CHUNK_NAMES, COLOR_STYLES, CONTAINER_STYLES, type CSSMap, CSSOptions, type CSSProperties, CUSTOM_UNITS, type CacheMetrics, CacheStatus, ChunkBreakdown, type ChunkInfo, type ChunkName, ChunkSheetRegistry, type ColorSpace, type ColorStyleProps, type ComputeStylesOptions, type ComputeStylesResult, type ConditionNode, type ConfigTokenValue, type ConfigTokens, type ContainerStyleProps, type CounterStyleDescriptors, DEFAULT_NAME_PREFIX, DEFAULT_ZERO_NAME_PREFIX, DIMENSION_CHUNK_STYLES, DIMENSION_STYLES, DIRECTIONS, DISPLAY_CHUNK_STYLES, DebugChunkInfo, DebugOptions, type DimensionStyleProps, type DisposeFunction, type ExtraBaseStyleProps, FLOW_STYLES, FONT_CHUNK_STYLES, type FlowStyleProps, type FontFaceDescriptors, type FontFaceInput, type FunctionDefinition, type FunctionParameter, type FunctionsConfig, type GCConfig, type GCOptions, INNER_STYLES, type InjectResult, type InjectionMode, type InnerStyleProps, InspectResult, type KeyframesCacheEntry, type KeyframesInfo, type KeyframesResult, type KeyframesSteps, LAYOUT_CHUNK_STYLES, type ModValue, type Mods, type NoType, type NotSelector, OUTER_STYLES, type OuterStyleProps, POSITION_CHUNK_STYLES, POSITION_STYLES, type ParseFunction, type ParseStateKeyOptions, type ParsedAdvancedState, type ParsedColor, type ParserOptions, type PositionStyleProps, type ProcessedStyle, type PropHandler, type PropHandlerDefinition, type PropHandlerProps, type PropertyDefinition, type PropertyOptions, type RawCSSResult, type RawStyleHandler, type RecipeStyles, type RenderResult, type ResolvedStyleValue, type RootRegistry, type RuleInfo, STYLE_TO_CHUNK, type Selector, type SheetInfo, SheetManager, type ShortGridStyles, type StateParserContext, type StyleDetails, type StyleDetailsPart, type StyleHandler, type StyleHandlerDefinition, type StyleHandlerProps, type StyleHandlerResult, StyleInjector, type StyleInjectorConfig, type StyleMap, StyleParser, type StylePropValue, type StyleResult, type StyleRule, type StyleUsage, type StyleValue, type StyleValueStateMap, type Styles, type StylesInterface, type StylesWithoutSelectors, type SuffixForSelector, Summary, TEXT_STYLES, type TagName, type TastyBaseStylePropNames, type TastyConfig, type TastyCustomProps, type TastyExtensionConfig, type TastyNamedColors, type TastyPlugin, type TastyPluginFactory, type TastyPresetNames, type TastyThemeNames, type TextStyleProps, type TokenValue, type Tokens, TypographyPreset, TypographyTokenValue, type UnitHandler, categorizeStyleKeys, chunkSheetRegistry, cleanup, color, computeStyles, configure, counterStyle, createColorFunc, createInjector, createStateParserContext, defineHandler, destroy, dotize, filterBaseProps, filterMods, fontFace, func, gc, generateTypographyTokens, getCSSText, getCSSTextForNode, getConfig, getGlobalCounterStyles, getGlobalFontFaces, getGlobalFunctions, getGlobalKeyframes, getGlobalParser, getGlobalPredefinedStates, getGlobalPredefinedTokens, getGlobalRecipes, getNamePrefix, getNamedColorHex, getRawCSSText, getRgbValuesFromRgbaString, hasGlobalKeyframes, hasGlobalRecipes, hasStylesGenerated, hexToRgb, hslToRgbValues, inject, injectGlobal, injectRawCSS, injector, isConfigLocked, isPropertyDefined, isSelector, isTestEnvironment, keyframes, mergeStyles, _modAttrs as modAttrs, normalizeColorTokenValue, okhslFunction, okhslPlugin, okhstFunction, okhstPlugin, parseColor, parseStateKey, parseStyle, processTokens, property, renderStyles, resetConfig, resolveFunctionColor, resolveRecipes, setGlobalPredefinedStates, strToRgb, stringifyStyles, styleHandlers, tastyDebug, touch };
|
package/dist/core/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
import {
|
|
3
|
-
import { A as property,
|
|
4
|
-
import { t as mergeStyles } from "../merge-styles
|
|
5
|
-
import { t as resolveRecipes } from "../resolve-recipes-
|
|
6
|
-
export { APPEARANCE_CHUNK_STYLES, BASE_STYLES, BLOCK_INNER_STYLES, BLOCK_OUTER_STYLES, BLOCK_STYLES,
|
|
1
|
+
import { $ as SheetManager, $t as getNamedColorHex, A as FLOW_STYLES, B as createStateParserContext, Bt as stringifyStyles, C as BASE_STYLES, Ct as LAYOUT_CHUNK_STYLES, D as COLOR_STYLES, E as BLOCK_STYLES, Ft as getGlobalParser, G as StyleInjector, Gt as createColorFunc, Ht as okhstPlugin, I as isSelector, It as getGlobalPredefinedTokens, L as renderStyles, Lt as normalizeColorTokenValue, M as OUTER_STYLES, Mt as CUSTOM_UNITS, N as POSITION_STYLES, Nt as DIRECTIONS, O as CONTAINER_STYLES, P as TEXT_STYLES, Pt as filterMods, R as parseStateKey, Rt as parseColor, St as FONT_CHUNK_STYLES, T as BLOCK_OUTER_STYLES, Tt as STYLE_TO_CHUNK, U as getGlobalPredefinedStates, Ut as okhslFunction, Vt as okhstFunction, W as setGlobalPredefinedStates, Wt as okhslPlugin, a as getGlobalCounterStyles, at as DEFAULT_NAME_PREFIX, b as resetConfig, bt as DIMENSION_CHUNK_STYLES, en as getRgbValuesFromRgbaString, f as getNamePrefix, g as isConfigLocked, h as hasStylesGenerated, in as resolveFunctionColor, j as INNER_STYLES, k as DIMENSION_STYLES, l as getGlobalKeyframes, m as hasGlobalRecipes, n as getConfig, nn as hslToRgbValues, nt as styleHandlers, o as getGlobalFontFaces, ot as DEFAULT_ZERO_NAME_PREFIX, p as hasGlobalKeyframes, qt as StyleParser, rn as strToRgb, s as getGlobalFunctions, t as configure, tn as hexToRgb, tt as defineHandler, u as getGlobalRecipes, v as isTestEnvironment, vt as APPEARANCE_CHUNK_STYLES, w as BLOCK_INNER_STYLES, wt as POSITION_CHUNK_STYLES, x as generateTypographyTokens, xt as DISPLAY_CHUNK_STYLES, yt as CHUNK_NAMES, zt as parseStyle } from "../config-CCcE_tqx.js";
|
|
2
|
+
import { l as categorizeStyleKeys } from "../keyframes-B8M1FmtE.js";
|
|
3
|
+
import { A as property, C as getRawCSSText, D as injector, E as injectRawCSS, M as ChunkSheetRegistry, N as chunkSheetRegistry, O as isPropertyDefined, S as getCSSTextForNode, T as injectGlobal, _ as destroy, a as color, b as gc, g as createInjector, h as counterStyle, i as _modAttrs, j as touch, k as keyframes, m as cleanup, n as processTokens, o as filterBaseProps, r as dotize, s as computeStyles, t as tastyDebug, v as fontFace, w as inject, x as getCSSText, y as func } from "../core-B5d0IPi2.js";
|
|
4
|
+
import { t as mergeStyles } from "../merge-styles--1zOSFlS.js";
|
|
5
|
+
import { t as resolveRecipes } from "../resolve-recipes-Caix5NnH.js";
|
|
6
|
+
export { APPEARANCE_CHUNK_STYLES, BASE_STYLES, BLOCK_INNER_STYLES, BLOCK_OUTER_STYLES, BLOCK_STYLES, CHUNK_NAMES, COLOR_STYLES, CONTAINER_STYLES, CUSTOM_UNITS, ChunkSheetRegistry, DEFAULT_NAME_PREFIX, DEFAULT_ZERO_NAME_PREFIX, DIMENSION_CHUNK_STYLES, DIMENSION_STYLES, DIRECTIONS, DISPLAY_CHUNK_STYLES, FLOW_STYLES, FONT_CHUNK_STYLES, INNER_STYLES, LAYOUT_CHUNK_STYLES, OUTER_STYLES, POSITION_CHUNK_STYLES, POSITION_STYLES, STYLE_TO_CHUNK, SheetManager, StyleInjector, StyleParser, TEXT_STYLES, categorizeStyleKeys, chunkSheetRegistry, cleanup, color, computeStyles, configure, counterStyle, createColorFunc, createInjector, createStateParserContext, defineHandler, destroy, dotize, filterBaseProps, filterMods, fontFace, func, gc, generateTypographyTokens, getCSSText, getCSSTextForNode, getConfig, getGlobalCounterStyles, getGlobalFontFaces, getGlobalFunctions, getGlobalKeyframes, getGlobalParser, getGlobalPredefinedStates, getGlobalPredefinedTokens, getGlobalRecipes, getNamePrefix, getNamedColorHex, getRawCSSText, getRgbValuesFromRgbaString, hasGlobalKeyframes, hasGlobalRecipes, hasStylesGenerated, hexToRgb, hslToRgbValues, inject, injectGlobal, injectRawCSS, injector, isConfigLocked, isPropertyDefined, isSelector, isTestEnvironment, keyframes, mergeStyles, _modAttrs as modAttrs, normalizeColorTokenValue, okhslFunction, okhslPlugin, okhstFunction, okhstPlugin, parseColor, parseStateKey, parseStyle, processTokens, property, renderStyles, resetConfig, resolveFunctionColor, resolveRecipes, setGlobalPredefinedStates, strToRgb, stringifyStyles, styleHandlers, tastyDebug, touch };
|