@tenphi/tasty 2.11.1 → 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-DYA5AOwr.d.ts → collector-BPzZezAG.d.ts} +44 -7
- package/dist/{collector-AHZaBSv8.js → collector-D14DcZx9.js} +75 -14
- package/dist/collector-D14DcZx9.js.map +1 -0
- package/dist/{config-YDAcLaVf.js → config-CCcE_tqx.js} +2312 -1131
- package/dist/config-CCcE_tqx.js.map +1 -0
- package/dist/{config-BtK9fUaz.d.ts → config-D2INrjr_.d.ts} +252 -25
- package/dist/core/index.d.ts +5 -5
- package/dist/core/index.js +6 -6
- package/dist/{core-CS4bzqGu.js → core-B5d0IPi2.js} +85 -133
- package/dist/core-B5d0IPi2.js.map +1 -0
- package/dist/{css-writer-BXSANVrq.js → css-writer-B5DBoxhf.js} +54 -15
- package/dist/css-writer-B5DBoxhf.js.map +1 -0
- package/dist/{format-rules-CYriCDwq.js → format-rules-BbKDjsfO.js} +2 -2
- package/dist/{format-rules-CYriCDwq.js.map → format-rules-BbKDjsfO.js.map} +1 -1
- package/dist/{hydrate-GVTorHpU.js → hydrate-CwALW3J9.js} +3 -11
- package/dist/{hydrate-GVTorHpU.js.map → hydrate-CwALW3J9.js.map} +1 -1
- package/dist/{index-BYtnj_gA.d.ts → index-BAAbdfRs.d.ts} +228 -153
- package/dist/{index-B9ih23uv.d.ts → index-l_NdJSUS.d.ts} +172 -61
- package/dist/index.d.ts +5 -5
- package/dist/index.js +191 -56
- package/dist/index.js.map +1 -1
- package/dist/{keyframes-CtcSlw4k.js → keyframes-B8M1FmtE.js} +10 -181
- package/dist/keyframes-B8M1FmtE.js.map +1 -0
- package/dist/{merge-styles-D4ITH4bc.js → merge-styles--1zOSFlS.js} +2 -2
- package/dist/{merge-styles-D4ITH4bc.js.map → merge-styles--1zOSFlS.js.map} +1 -1
- package/dist/{merge-styles-BZV-XAwX.d.ts → merge-styles-NEvqayL_.d.ts} +2 -2
- package/dist/{resolve-recipes-llr0COs8.js → resolve-recipes-Caix5NnH.js} +3 -3
- package/dist/{resolve-recipes-llr0COs8.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 +46 -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 +82 -3
- 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-AHZaBSv8.js.map +0 -1
- package/dist/config-YDAcLaVf.js.map +0 -1
- package/dist/core-CS4bzqGu.js.map +0 -1
- package/dist/css-writer-BXSANVrq.js.map +0 -1
- package/dist/keyframes-CtcSlw4k.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;
|
|
@@ -20,6 +67,19 @@ declare class SheetManager {
|
|
|
20
67
|
* abstracting away adopted vs style-element modes.
|
|
21
68
|
*/
|
|
22
69
|
getCSSSheet(sheetInfo: SheetInfo): CSSStyleSheet | null;
|
|
70
|
+
/**
|
|
71
|
+
* Record an inserted rule text at its rule index (text mode only).
|
|
72
|
+
*
|
|
73
|
+
* `textRules` mirrors the sheet's rule order. `textContent` cannot be edited
|
|
74
|
+
* rule-by-rule the way CSSOM can, so keeping the texts is what makes
|
|
75
|
+
* deletion possible at all in this mode.
|
|
76
|
+
*/
|
|
77
|
+
private trackTextRule;
|
|
78
|
+
/**
|
|
79
|
+
* Remove rule indices from a text-mode sheet and rewrite the element's text.
|
|
80
|
+
* Returns the indices that were actually removed.
|
|
81
|
+
*/
|
|
82
|
+
private deleteTextRules;
|
|
23
83
|
/**
|
|
24
84
|
* Determine the injection mode for a root.
|
|
25
85
|
* ShadowRoot uses adopted stylesheets when supported; Document uses <style> elements.
|
|
@@ -105,7 +165,7 @@ declare class SheetManager {
|
|
|
105
165
|
/**
|
|
106
166
|
* Get CSS text from all sheets (for SSR)
|
|
107
167
|
*/
|
|
108
|
-
|
|
168
|
+
getCSSText(registry: RootRegistry): string;
|
|
109
169
|
/**
|
|
110
170
|
* Get cache performance metrics
|
|
111
171
|
*/
|
|
@@ -254,13 +314,13 @@ declare class StyleInjector {
|
|
|
254
314
|
/**
|
|
255
315
|
* Get CSS text from all sheets (for SSR)
|
|
256
316
|
*/
|
|
257
|
-
|
|
317
|
+
getCSSText(options?: {
|
|
258
318
|
root?: Document | ShadowRoot;
|
|
259
319
|
}): string;
|
|
260
320
|
/**
|
|
261
321
|
* Get CSS only for the provided tasty classNames (e.g., ["t0","t3"])
|
|
262
322
|
*/
|
|
263
|
-
|
|
323
|
+
getCSSTextForClasses(classNames: Iterable<string>, options?: {
|
|
264
324
|
root?: Document | ShadowRoot;
|
|
265
325
|
}): string;
|
|
266
326
|
/**
|
|
@@ -322,11 +382,28 @@ declare class StyleInjector {
|
|
|
322
382
|
/**
|
|
323
383
|
* Inject a CSS @counter-style rule.
|
|
324
384
|
*
|
|
325
|
-
* Permanent and global — no dispose or ref-counting.
|
|
326
|
-
*
|
|
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).
|
|
327
390
|
*/
|
|
328
391
|
counterStyle(name: string, descriptors: CounterStyleDescriptors, options?: {
|
|
329
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;
|
|
330
407
|
}): void;
|
|
331
408
|
/**
|
|
332
409
|
* Inject keyframes and return object with toString() and dispose()
|
|
@@ -377,6 +454,21 @@ declare class StyleInjector {
|
|
|
377
454
|
destroy(root?: Document | ShadowRoot): void;
|
|
378
455
|
}
|
|
379
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
|
|
380
472
|
//#region src/utils/color-space.d.ts
|
|
381
473
|
type ColorSpace = 'rgb' | 'hsl' | 'oklch';
|
|
382
474
|
//#endregion
|
|
@@ -441,8 +533,12 @@ declare function generateTypographyTokens(presets: Record<string, TypographyPres
|
|
|
441
533
|
interface TastyPlugin {
|
|
442
534
|
/** Unique name for the plugin (used for debugging and conflict detection) */
|
|
443
535
|
name: string;
|
|
444
|
-
/**
|
|
445
|
-
|
|
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;
|
|
446
542
|
/** Custom units that transform numeric values (e.g., `2x` → `calc(2 * var(--gap))`) */
|
|
447
543
|
units?: Record<string, string | UnitHandler>;
|
|
448
544
|
/** Custom state aliases (e.g., `'@mobile': '@media(w < 768px)'`) */
|
|
@@ -461,6 +557,32 @@ interface TastyPlugin {
|
|
|
461
557
|
* ```
|
|
462
558
|
*/
|
|
463
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[];
|
|
464
586
|
/**
|
|
465
587
|
* Design tokens injected as CSS custom properties on `:root`.
|
|
466
588
|
* Values are parsed through the Tasty DSL. Supports state maps.
|
|
@@ -492,6 +614,19 @@ interface TastyPlugin {
|
|
|
492
614
|
* Supports the full Tasty style syntax.
|
|
493
615
|
*/
|
|
494
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>;
|
|
495
630
|
}
|
|
496
631
|
/**
|
|
497
632
|
* A factory function that creates a TastyPlugin.
|
|
@@ -502,13 +637,13 @@ interface TastyPlugin {
|
|
|
502
637
|
* // Plugin without options
|
|
503
638
|
* const okhslPlugin: TastyPluginFactory = () => ({
|
|
504
639
|
* name: 'okhsl',
|
|
505
|
-
*
|
|
640
|
+
* functions: { okhsl: okhslFunction },
|
|
506
641
|
* });
|
|
507
642
|
*
|
|
508
643
|
* // Plugin with options
|
|
509
644
|
* const debugPlugin: TastyPluginFactory<{ verbose: boolean }> = (options) => ({
|
|
510
645
|
* name: 'debug',
|
|
511
|
-
*
|
|
646
|
+
* functions: { debug: createDebugFunc(options.verbose) },
|
|
512
647
|
* });
|
|
513
648
|
* ```
|
|
514
649
|
*/
|
|
@@ -545,11 +680,28 @@ interface TastyConfig {
|
|
|
545
680
|
*/
|
|
546
681
|
units?: Record<string, string | UnitHandler>;
|
|
547
682
|
/**
|
|
548
|
-
* Custom functions
|
|
549
|
-
*
|
|
550
|
-
*
|
|
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
|
+
* ```
|
|
551
703
|
*/
|
|
552
|
-
|
|
704
|
+
functions?: FunctionsConfig;
|
|
553
705
|
/**
|
|
554
706
|
* Color space used for decomposed color token companion variables.
|
|
555
707
|
* Controls the CSS function and suffix for alpha composition.
|
|
@@ -565,7 +717,7 @@ interface TastyConfig {
|
|
|
565
717
|
* Automatically infer and register CSS @property declarations
|
|
566
718
|
* from custom property values found in styles, keyframes, and global config.
|
|
567
719
|
* Covers all types: \<color\>, \<number\>, \<length\>, \<angle\>, \<percentage\>, \<time\>.
|
|
568
|
-
* When false, only explicitly declared @
|
|
720
|
+
* When false, only explicitly declared @property are registered.
|
|
569
721
|
* @default true
|
|
570
722
|
*/
|
|
571
723
|
autoPropertyTypes?: boolean;
|
|
@@ -597,7 +749,7 @@ interface TastyConfig {
|
|
|
597
749
|
* `'ts'` (overridable via the same option) so its classes can't
|
|
598
750
|
* collide with runtime classes when both are loaded on the same page.
|
|
599
751
|
*
|
|
600
|
-
* Must match `^[a-zA-
|
|
752
|
+
* Must match `^[a-zA-Z_][a-zA-Z0-9_-]{0,31}$`. Locked once styles
|
|
601
753
|
* have been generated.
|
|
602
754
|
*
|
|
603
755
|
* @default 't'
|
|
@@ -673,7 +825,7 @@ interface TastyConfig {
|
|
|
673
825
|
* @example
|
|
674
826
|
* ```ts
|
|
675
827
|
* configure({
|
|
676
|
-
*
|
|
828
|
+
* fontFaces: {
|
|
677
829
|
* 'Brand Sans': [
|
|
678
830
|
* { src: 'url("/fonts/brand-regular.woff2") format("woff2")', fontWeight: 400, fontDisplay: 'swap' },
|
|
679
831
|
* { src: 'url("/fonts/brand-bold.woff2") format("woff2")', fontWeight: 700, fontDisplay: 'swap' },
|
|
@@ -683,7 +835,7 @@ interface TastyConfig {
|
|
|
683
835
|
* });
|
|
684
836
|
* ```
|
|
685
837
|
*/
|
|
686
|
-
|
|
838
|
+
fontFaces?: Record<string, FontFaceInput>;
|
|
687
839
|
/**
|
|
688
840
|
* Global @counter-style definitions.
|
|
689
841
|
* Keys are counter-style names, values are descriptor objects.
|
|
@@ -691,13 +843,32 @@ interface TastyConfig {
|
|
|
691
843
|
* @example
|
|
692
844
|
* ```ts
|
|
693
845
|
* configure({
|
|
694
|
-
*
|
|
846
|
+
* counterStyles: {
|
|
695
847
|
* thumbs: { system: 'cyclic', symbols: '"👍"', suffix: '" "' },
|
|
696
848
|
* },
|
|
697
849
|
* });
|
|
698
850
|
* ```
|
|
699
851
|
*/
|
|
700
|
-
|
|
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
|
+
};
|
|
701
872
|
/**
|
|
702
873
|
* Custom style handlers that transform style properties into CSS declarations.
|
|
703
874
|
* Handlers replace built-in handlers for the same style name.
|
|
@@ -727,6 +898,56 @@ interface TastyConfig {
|
|
|
727
898
|
* ```
|
|
728
899
|
*/
|
|
729
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[];
|
|
730
951
|
/**
|
|
731
952
|
* Design tokens injected as CSS custom properties on `:root`.
|
|
732
953
|
* Values are parsed through the Tasty DSL. Supports state maps
|
|
@@ -782,7 +1003,7 @@ interface TastyConfig {
|
|
|
782
1003
|
/**
|
|
783
1004
|
* Predefined style recipes -- named style bundles that can be applied via `recipe` style property.
|
|
784
1005
|
* Recipe values are flat tasty styles (no sub-element keys). They may contain base styles,
|
|
785
|
-
* tokens (`$name`/`#name` definitions), local states, `@keyframes`, and `@
|
|
1006
|
+
* tokens (`$name`/`#name` definitions), local states, `@keyframes`, and `@property`.
|
|
786
1007
|
*
|
|
787
1008
|
* Components reference recipes via: `recipe: 'name1 name2'` in their styles.
|
|
788
1009
|
* Use `/` to separate base recipes from post recipes: `recipe: 'base1 base2 / post1'`.
|
|
@@ -878,13 +1099,19 @@ declare function getGlobalKeyframes(): Record<string, KeyframesSteps> | null;
|
|
|
878
1099
|
* Returns null if no font faces configured.
|
|
879
1100
|
* Reads from globalThis first for cross-module SSR support.
|
|
880
1101
|
*/
|
|
881
|
-
declare function
|
|
1102
|
+
declare function getGlobalFontFaces(): Record<string, FontFaceInput> | null;
|
|
882
1103
|
/**
|
|
883
1104
|
* Get global counter-style configuration.
|
|
884
1105
|
* Returns null if no counter styles configured.
|
|
885
1106
|
* Reads from globalThis first for cross-module SSR support.
|
|
886
1107
|
*/
|
|
887
|
-
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;
|
|
888
1115
|
/**
|
|
889
1116
|
* Check if any global recipes are configured.
|
|
890
1117
|
* Fast path: returns false if no recipes were ever set.
|
|
@@ -941,5 +1168,5 @@ declare function getNamePrefix(): string;
|
|
|
941
1168
|
*/
|
|
942
1169
|
declare function resetConfig(): void;
|
|
943
1170
|
//#endregion
|
|
944
|
-
export {
|
|
945
|
-
//# 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 };
|