@tenphi/tasty 0.0.0-snapshot.1f1c00a → 0.0.0-snapshot.1feecc6
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 +403 -380
- package/dist/babel-types-Dc5zghyE.d.ts +18 -0
- package/dist/chunks/async-storage-f9j9JRtq.js +37 -0
- package/dist/chunks/async-storage-f9j9JRtq.js.map +1 -0
- package/dist/chunks/build-config-D9Iq8QQm.js +60 -0
- package/dist/chunks/build-config-D9Iq8QQm.js.map +1 -0
- package/dist/chunks/{collector-D2ARGT2L.js → collector-Cb8ah2JF.js} +8 -6
- package/dist/chunks/collector-Cb8ah2JF.js.map +1 -0
- package/dist/chunks/{config-engine-DEmmPPdp.js → config-engine-CMYFZYQh.js} +5 -5
- package/dist/chunks/config-engine-CMYFZYQh.js.map +1 -0
- package/dist/chunks/config-file-DlZXJMj8.js +25 -0
- package/dist/chunks/config-file-DlZXJMj8.js.map +1 -0
- package/dist/chunks/{css-definitions-DotDkIXt.js → css-definitions-B4aWBkH3.js} +130 -96
- package/dist/chunks/css-definitions-B4aWBkH3.js.map +1 -0
- package/dist/chunks/{debug-D8pg9RGI.js → debug-D2Pu7Xhy.js} +6 -6
- package/dist/chunks/{debug-D8pg9RGI.js.map → debug-D2Pu7Xhy.js.map} +1 -1
- package/dist/chunks/{dsl-DRhFWQzo.js → dsl-CsFl9LGn.js} +132 -52
- package/dist/chunks/dsl-CsFl9LGn.js.map +1 -0
- package/dist/chunks/{react-runtime-BpxlOTbO.js → react-runtime-DHiopXCu.js} +193 -64
- package/dist/chunks/react-runtime-DHiopXCu.js.map +1 -0
- package/dist/chunks/{runtime-engine-CKFXUH-A.js → runtime-engine-NGCofNXy.js} +72 -53
- package/dist/chunks/runtime-engine-NGCofNXy.js.map +1 -0
- package/dist/chunks/{runtime-state-BxaLhVdP.js → runtime-state-lZjMbvwV.js} +28 -3
- package/dist/chunks/runtime-state-lZjMbvwV.js.map +1 -0
- package/dist/chunks/{style-engine-BBbBuSkT.js → style-engine-DnkV_4Jg.js} +488 -146
- package/dist/chunks/style-engine-DnkV_4Jg.js.map +1 -0
- package/dist/chunks/{zero-engine-gJrKBRiw.js → zero-engine-DcwaCvFs.js} +62 -27
- package/dist/chunks/zero-engine-DcwaCvFs.js.map +1 -0
- package/dist/{collector-w4mBj5gd.d.ts → collector-D2OT6I2G.d.ts} +2 -2
- package/dist/{config-CZWCzBr6.d.ts → config-C4ftFxgI.d.ts} +41 -23
- package/dist/core/index.d.ts +4 -4
- package/dist/core/index.js +7 -7
- package/dist/hydrate-CRyjjAyl.d.ts +22 -0
- package/dist/{index-G9JuwM9p.d.ts → index-DxQNRj50.d.ts} +65 -21
- package/dist/index.d.ts +5 -5
- package/dist/index.js +8 -8
- package/dist/{merge-styles-VXwJ0Frr.d.ts → merge-styles-D39qBtox.d.ts} +2 -2
- package/dist/ssr/astro.js +4 -4
- package/dist/ssr/client.d.ts +2 -0
- package/dist/ssr/client.js +2 -0
- package/dist/ssr/index.d.ts +3 -22
- package/dist/ssr/index.js +4 -4
- package/dist/ssr/index.js.map +1 -1
- package/dist/ssr/next-config.d.ts +1 -1
- package/dist/ssr/next-config.js +13 -18
- package/dist/ssr/next-config.js.map +1 -1
- package/dist/ssr/next.d.ts +1 -1
- package/dist/ssr/next.js +3 -3
- package/dist/static/index.d.ts +2 -2
- package/dist/{types-JEY8PVYP.d.ts → types-CYQIhUg1.d.ts} +10 -8
- package/dist/zero/babel.d.ts +73 -2
- package/dist/zero/babel.js +51 -48
- package/dist/zero/babel.js.map +1 -1
- package/dist/zero/index.d.ts +59 -3
- package/dist/zero/index.js +25 -2
- package/dist/zero/index.js.map +1 -0
- package/dist/zero/next.d.ts +2 -1
- package/dist/zero/next.js +3 -7
- package/dist/zero/next.js.map +1 -1
- package/docs/README.md +4 -1
- package/docs/adoption.md +25 -17
- package/docs/ai-agents.md +43 -34
- package/docs/comparison.md +9 -8
- package/docs/configuration.md +187 -69
- package/docs/debug.md +3 -2
- package/docs/design-system.md +117 -15
- package/docs/dsl.md +262 -116
- package/docs/getting-started.md +81 -24
- package/docs/injector.md +41 -40
- package/docs/methodology.md +46 -21
- package/docs/migration-v3.md +3 -3
- package/docs/pipeline.md +22 -19
- package/docs/plugins.md +21 -41
- package/docs/react-api.md +74 -11
- package/docs/runtime-benchmarks.md +11 -11
- package/docs/ssr.md +92 -66
- package/docs/styles.md +85 -19
- package/docs/tasty-static.md +175 -57
- package/package.json +45 -32
- package/tasty.config.ts +1 -0
- package/dist/babel-rZcEwPLM.d.ts +0 -82
- package/dist/chunks/async-storage-CG5HnUT5.js +0 -20
- package/dist/chunks/async-storage-CG5HnUT5.js.map +0 -1
- package/dist/chunks/build-config-CL4eRu2z.js +0 -42
- package/dist/chunks/build-config-CL4eRu2z.js.map +0 -1
- package/dist/chunks/collector-D2ARGT2L.js.map +0 -1
- package/dist/chunks/config-engine-DEmmPPdp.js.map +0 -1
- package/dist/chunks/css-definitions-DotDkIXt.js.map +0 -1
- package/dist/chunks/dsl-DRhFWQzo.js.map +0 -1
- package/dist/chunks/react-runtime-BpxlOTbO.js.map +0 -1
- package/dist/chunks/runtime-engine-CKFXUH-A.js.map +0 -1
- package/dist/chunks/runtime-state-BxaLhVdP.js.map +0 -1
- package/dist/chunks/style-engine-BBbBuSkT.js.map +0 -1
- package/dist/chunks/zero-engine-gJrKBRiw.js.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Et as StyleDetails, G as NoType, M as StyleResult, X as StylesInterface, Y as Styles, _ as KeyframesSteps, a as FontFaceInput, ct as StyleHandler, d as InjectOptions, dt as StyleHandlerResult, f as InjectResult, g as KeyframesResult, ht as StyleValueStateMap, i as FontFaceDescriptors, kt as CSSProperties$1, l as GCOptions, mt as StyleValue, n as CounterStyleDescriptors, nt as CSSMap, o as FunctionDefinition, ot as RawStyleHandler, pt as StylePropValue, st as ResolvedStyleValue, t as CacheMetrics, u as GlobalInjectResult, w as StyleInjectorConfig, y as PropertyOptions } from "./types-
|
|
2
|
-
import {
|
|
3
|
-
import { t as ServerStyleCollector } from "./collector-
|
|
4
|
-
import "./merge-styles-
|
|
5
|
-
import { AllHTMLAttributes, CSSProperties, ComponentType, ElementType, ForwardRefExoticComponent, JSX, PropsWithoutRef, ReactNode, RefAttributes } from "react";
|
|
1
|
+
import { Et as StyleDetails, G as NoType, M as StyleResult, X as StylesInterface, Y as Styles, _ as KeyframesSteps, a as FontFaceInput, ct as StyleHandler, d as InjectOptions, dt as StyleHandlerResult, f as InjectResult, g as KeyframesResult, ht as StyleValueStateMap, i as FontFaceDescriptors, kt as CSSProperties$1, l as GCOptions, mt as StyleValue, n as CounterStyleDescriptors, nt as CSSMap, o as FunctionDefinition, ot as RawStyleHandler, pt as StylePropValue, st as ResolvedStyleValue, t as CacheMetrics, u as GlobalInjectResult, w as StyleInjectorConfig, y as PropertyOptions } from "./types-CYQIhUg1.js";
|
|
2
|
+
import { f as TastyPluginFactory, y as StyleInjector } from "./config-C4ftFxgI.js";
|
|
3
|
+
import { t as ServerStyleCollector } from "./collector-D2OT6I2G.js";
|
|
4
|
+
import "./merge-styles-D39qBtox.js";
|
|
5
|
+
import React, { AllHTMLAttributes, CSSProperties, ComponentType, ElementType, ForwardRefExoticComponent, JSX, PropsWithoutRef, ReactNode, RefAttributes } from "react";
|
|
6
6
|
//#region src/utils/color-math.d.ts
|
|
7
7
|
/**
|
|
8
8
|
* Consolidated color conversion math.
|
|
@@ -357,13 +357,15 @@ type ResolveElementTag<T extends SubElementDefinition<any>> = T extends string ?
|
|
|
357
357
|
} ? Tag extends keyof JSX.IntrinsicElements ? Tag : 'div' : 'div';
|
|
358
358
|
/**
|
|
359
359
|
* Props for sub-element components.
|
|
360
|
-
* Combines HTML attributes with tasty-specific props (qa, qaVal, mods, tokens, isDisabled, etc.)
|
|
360
|
+
* Combines HTML attributes with tasty-specific props (qa, qaVal, mods, tokens, theme, isDisabled, etc.)
|
|
361
361
|
*/
|
|
362
362
|
type SubElementProps<Tag extends keyof JSX.IntrinsicElements = 'div'> = Omit<JSX.IntrinsicElements[Tag], 'ref' | 'color' | 'content' | 'translate'> & {
|
|
363
363
|
qa?: string;
|
|
364
364
|
qaVal?: string | number;
|
|
365
365
|
mods?: Mods;
|
|
366
366
|
tokens?: Tokens;
|
|
367
|
+
/** User-defined theme for the element. Mapped to `data-theme` attribute. */
|
|
368
|
+
theme?: BaseProps['theme'];
|
|
367
369
|
isDisabled?: boolean;
|
|
368
370
|
isHidden?: boolean;
|
|
369
371
|
isChecked?: boolean;
|
|
@@ -391,11 +393,23 @@ type TastyBaseProps<K extends StyleList, V extends VariantMap, E extends Element
|
|
|
391
393
|
tokens?: Tokens;
|
|
392
394
|
/** Sub-element definitions for compound components */
|
|
393
395
|
elements?: E;
|
|
394
|
-
} & Pick<BaseProps, 'qa' | 'qaVal'
|
|
396
|
+
} & Pick<BaseProps, 'qa' | 'qaVal'>;
|
|
397
|
+
/**
|
|
398
|
+
* The names the `variant` option of `tasty(Base, options)` accepts: the
|
|
399
|
+
* extension's own variants and the base's, as its `variant` prop does. A
|
|
400
|
+
* union, not an intersection of the two, so an extension can default to a
|
|
401
|
+
* variant only one of them defines.
|
|
402
|
+
*/
|
|
403
|
+
type ExtensionVariantName<V extends VariantMap, Props> = string extends keyof V ? 'variant' extends keyof Props ? NonNullable<Props['variant' & keyof Props]> : keyof V : keyof V | ('variant' extends keyof Props ? NonNullable<Props['variant' & keyof Props]> : never);
|
|
395
404
|
type TastyProps<K extends StyleList, V extends VariantMap, E extends ElementsDefinition = Record<string, never>, DefaultProps = AnyProps, M extends ModPropsInput = readonly never[], TP extends TokenPropsInput = readonly never[]> = TastyBaseProps<K, V, E, M, TP> & {
|
|
396
405
|
/** The tag name of the element or a React component. */
|
|
397
406
|
as?: string | ComponentType<any>;
|
|
398
|
-
|
|
407
|
+
/**
|
|
408
|
+
* The variant applied when the `variant` prop is omitted or names no
|
|
409
|
+
* variant: one of `variants`, or one of the base component's.
|
|
410
|
+
*/
|
|
411
|
+
variant?: ExtensionVariantName<V, DefaultProps>;
|
|
412
|
+
} & Partial<Omit<DefaultProps, 'as' | 'styles' | 'styleProps' | 'modProps' | 'tokenProps' | 'tokens' | 'variant'>>;
|
|
399
413
|
/**
|
|
400
414
|
* Resolves the props of a polymorphic `as` value (intrinsic tag or component).
|
|
401
415
|
* - For intrinsic tags (`'div'`, `'button'`, ...): returns `JSX.IntrinsicElements[Tag]`.
|
|
@@ -412,7 +426,7 @@ type ResolveAsProps<AsType extends ElementType> = AsType extends keyof JSX.Intri
|
|
|
412
426
|
* Note: Uses a separate index signature with `unknown` instead of an `any`
|
|
413
427
|
* record to ensure strict type checking for styles.
|
|
414
428
|
*/
|
|
415
|
-
type TastyElementOptions<K extends StyleList, V extends VariantMap, E extends ElementsDefinition = Record<string, never>, AsType extends ElementType = 'div', M extends ModPropsInput = readonly never[], TP extends TokenPropsInput = readonly never[]> = TastyBaseProps<K, V, E, M, TP> & {
|
|
429
|
+
type TastyElementOptions<K extends StyleList, V extends VariantMap, E extends ElementsDefinition = Record<string, never>, AsType extends ElementType = 'div', M extends ModPropsInput = readonly never[], TP extends TokenPropsInput = readonly never[]> = TastyBaseProps<K, V, E, M, TP> & WithVariant<V> & {
|
|
416
430
|
/** The tag name of the element or a React component. */
|
|
417
431
|
as?: AsType;
|
|
418
432
|
} & Record<string, unknown>;
|
|
@@ -443,7 +457,24 @@ type TokenPropsKeys<TP extends TokenPropsInput> = TP extends readonly (infer K)[
|
|
|
443
457
|
* is a component type with a narrower prop API.
|
|
444
458
|
*/
|
|
445
459
|
type TastyElementProps<K extends StyleList, V extends VariantMap, AsType extends ElementType = 'div', M extends ModPropsInput = readonly never[], TP extends TokenPropsInput = readonly never[]> = Omit<AllBasePropsWithMods<K, M, TP>, Exclude<keyof ResolveAsProps<AsType>, TastySpecificKeys | keyof TastyCustomProps | keyof ExtraBaseStyleProps | K[number] | ModPropsKeys<M> | TokenPropsKeys<TP>>> & WithVariant<V> & Omit<Omit<AllHTMLAttributes<HTMLElement>, keyof ResolveAsProps<AsType>> & ResolveAsProps<AsType>, TastySpecificKeys | keyof TastyCustomProps | keyof ExtraBaseStyleProps | K[number] | ModPropsKeys<M> | TokenPropsKeys<TP>>;
|
|
446
|
-
|
|
460
|
+
/** Statics React itself reads, as a type (see `REACT_STATICS`). */
|
|
461
|
+
type ReactStaticKey = '$$typeof' | 'render' | 'type' | 'compare' | 'displayName' | 'defaultProps' | 'propTypes' | 'contextType' | 'contextTypes' | 'childContextTypes' | 'getDerivedStateFromProps' | 'getDerivedStateFromError';
|
|
462
|
+
/**
|
|
463
|
+
* The statics of a component that are components themselves — a `tasty()`
|
|
464
|
+
* base's sub-elements (`Card.Title`) — which its extension keeps.
|
|
465
|
+
*/
|
|
466
|
+
type ComponentStatics<C> = { [Key in keyof C as Key extends ReactStaticKey ? never : C[Key] extends string ? never : C[Key] extends ElementType ? Key : never]: C[Key]; };
|
|
467
|
+
/** Prop names the extension form's own options claim from the base's props. */
|
|
468
|
+
type ExtensionClaimedKeys<K extends StyleList, V extends VariantMap, M extends ModPropsInput, TP extends TokenPropsInput> = K[number] | ModPropsKeys<M> | TokenPropsKeys<TP> | (string extends keyof V ? never : 'variant');
|
|
469
|
+
/**
|
|
470
|
+
* Props of a `tasty(Component, options)` extension: the base's props, plus
|
|
471
|
+
* whatever its own `styleProps`, `modProps`, `tokenProps` and `variants` add.
|
|
472
|
+
* Its variants extend the base's: `variant` accepts either set.
|
|
473
|
+
*/
|
|
474
|
+
type TastyExtensionProps<Props extends PropsWithStyles, DefaultProps extends Partial<Props>, K extends StyleList = readonly never[], V extends VariantMap = VariantMap, M extends ModPropsInput = readonly never[], TP extends TokenPropsInput = readonly never[]> = [ExtensionClaimedKeys<K, V, M, TP>] extends [never] ? TastyComponentPropsWithDefaults<Props, DefaultProps> : Omit<TastyComponentPropsWithDefaults<Props, DefaultProps>, ExtensionClaimedKeys<K, V, M, TP>> & { [key in K[number]]?: StyleValue<StylesInterface[key]> | StyleValueStateMap<StylesInterface[key]>; } & ResolveModProps<M> & ResolveTokenProps<TP> & (string extends keyof V ? unknown : {
|
|
475
|
+
variant?: keyof V | ('variant' extends keyof Props ? NonNullable<Props['variant']> : never);
|
|
476
|
+
});
|
|
477
|
+
type TastyComponentPropsWithDefaults<Props extends PropsWithStyles, DefaultProps extends Partial<Props>> = keyof DefaultProps extends never ? Props : keyof Props extends keyof DefaultProps ? Partial<Props> : { [key in Extract<keyof Props, keyof DefaultProps>]?: Props[key]; } & { [key in keyof Omit<Props, keyof DefaultProps>]: Props[key]; };
|
|
447
478
|
/**
|
|
448
479
|
* The component type returned by the `tasty(options)` element-factory overload.
|
|
449
480
|
*
|
|
@@ -459,7 +490,7 @@ type TastyComponentPropsWithDefaults<Props extends PropsWithStyles, DefaultProps
|
|
|
459
490
|
*/
|
|
460
491
|
type TastyPolymorphicComponent<DefaultAs extends ElementType, K extends StyleList, V extends VariantMap, M extends ModPropsInput, TP extends TokenPropsInput> = ForwardRefExoticComponent<PropsWithoutRef<TastyElementProps<K, V, DefaultAs, M, TP>> & RefAttributes<unknown>>;
|
|
461
492
|
declare function tasty<K extends StyleList = readonly never[], V extends VariantMap = VariantMap, E extends ElementsDefinition = Record<string, never>, AsType extends ElementType = 'div', M extends ModPropsInput = readonly never[], TP extends TokenPropsInput = readonly never[]>(options: TastyElementOptions<K, V, E, AsType, M, TP>, secondArg?: never): TastyPolymorphicComponent<AsType, K, V, M, TP> & SubElementComponents<E>;
|
|
462
|
-
declare function tasty<Props extends PropsWithStyles, DefaultProps extends Partial<Props> = Partial<Props>, K extends StyleList = readonly never[], V extends VariantMap = VariantMap, E extends ElementsDefinition = Record<string, never>, M extends ModPropsInput = readonly never[], TP extends TokenPropsInput = readonly never[]>(Component: ComponentType<Props>, options?: TastyProps<K, V, E, Props, M, TP>): ComponentType<
|
|
493
|
+
declare function tasty<Props extends PropsWithStyles, DefaultProps extends Partial<Props> = Partial<Props>, K extends StyleList = readonly never[], V extends VariantMap = VariantMap, const E extends ElementsDefinition = Record<string, never>, M extends ModPropsInput = readonly never[], TP extends TokenPropsInput = readonly never[], C extends ComponentType<Props> = ComponentType<Props>>(Component: C & ComponentType<Props>, options?: TastyProps<K, V, E, Props, M, TP>): ComponentType<TastyExtensionProps<Props, DefaultProps, K, V, M, TP>> & ComponentStatics<C> & (string extends keyof E ? unknown : SubElementComponents<E>);
|
|
463
494
|
declare const Element$1: TastyPolymorphicComponent<"div", readonly never[], VariantMap, readonly never[], readonly never[]> & SubElementComponents<Record<string, never>>;
|
|
464
495
|
//#endregion
|
|
465
496
|
//#region src/hooks/useStyles.d.ts
|
|
@@ -476,7 +507,9 @@ interface UseStylesResult {
|
|
|
476
507
|
* Thin wrapper around `computeStyles()` that adds React context-based
|
|
477
508
|
* SSR collector discovery for backward compatibility with TastyRegistry.
|
|
478
509
|
*
|
|
479
|
-
*
|
|
510
|
+
* Works in Server Components too. There, like the other style functions, it
|
|
511
|
+
* cannot emit CSS itself: the next `tasty()` element in the tree emits it, so
|
|
512
|
+
* render one after it.
|
|
480
513
|
*
|
|
481
514
|
* @example
|
|
482
515
|
* ```tsx
|
|
@@ -841,9 +874,14 @@ interface TastyBatchProviderProps {
|
|
|
841
874
|
* );
|
|
842
875
|
* ```
|
|
843
876
|
*/
|
|
844
|
-
declare function TastyBatchProvider({ children }: TastyBatchProviderProps): ReactNode;
|
|
877
|
+
declare function TastyBatchProvider({ children }: TastyBatchProviderProps): React.ReactNode;
|
|
845
878
|
//#endregion
|
|
846
879
|
//#region src/utils/get-display-name.d.ts
|
|
880
|
+
/**
|
|
881
|
+
* A readable name for a component: its `displayName`, else its function name,
|
|
882
|
+
* looking through `forwardRef()` and `memo()` to the component they wrap. A
|
|
883
|
+
* tag name names itself. Falls back to `fallbackName` when there is none.
|
|
884
|
+
*/
|
|
847
885
|
declare function getDisplayName<T>(Component: ElementType<T>, fallbackName?: string): string;
|
|
848
886
|
//#endregion
|
|
849
887
|
//#region src/index.d.ts
|
|
@@ -976,11 +1014,15 @@ declare const CHUNK_NAMES: {
|
|
|
976
1014
|
};
|
|
977
1015
|
type ChunkName = (typeof CHUNK_NAMES)[keyof typeof CHUNK_NAMES];
|
|
978
1016
|
/**
|
|
979
|
-
* Appearance chunk - visual styling
|
|
1017
|
+
* Appearance chunk - visual styling
|
|
1018
|
+
*
|
|
1019
|
+
* Handler dependencies (all styles in each handler MUST stay in this chunk):
|
|
1020
|
+
* ⚠️ fillStyle: fill, backgroundColor, image, backgroundImage,
|
|
1021
|
+
* backgroundPosition/Size/Repeat/Attachment/Origin/Clip, background
|
|
980
1022
|
*
|
|
981
1023
|
* @public
|
|
982
1024
|
*/
|
|
983
|
-
declare const APPEARANCE_CHUNK_STYLES: readonly ["fill", "color", "opacity", "border", "blockBorder", "inlineBorder", "radius", "outline", "outlineOffset", "shadow", "fade"];
|
|
1025
|
+
declare const APPEARANCE_CHUNK_STYLES: readonly ["fill", "backgroundColor", "image", "backgroundImage", "backgroundPosition", "backgroundSize", "backgroundRepeat", "backgroundAttachment", "backgroundOrigin", "backgroundClip", "background", "color", "opacity", "border", "blockBorder", "inlineBorder", "radius", "outline", "outlineOffset", "shadow", "fade"];
|
|
984
1026
|
/**
|
|
985
1027
|
* Font chunk - typography styles
|
|
986
1028
|
*
|
|
@@ -1129,7 +1171,7 @@ declare namespace fadeStyle {
|
|
|
1129
1171
|
//#endregion
|
|
1130
1172
|
//#region src/styles/fill.d.ts
|
|
1131
1173
|
declare function fillStyle({ fill, backgroundColor, image, backgroundImage, backgroundPosition, backgroundSize, backgroundRepeat, backgroundAttachment, backgroundOrigin, backgroundClip, background }: {
|
|
1132
|
-
fill?: string;
|
|
1174
|
+
fill?: string | boolean;
|
|
1133
1175
|
backgroundColor?: string;
|
|
1134
1176
|
image?: string;
|
|
1135
1177
|
backgroundImage?: string;
|
|
@@ -1237,7 +1279,7 @@ declare namespace marginStyle {
|
|
|
1237
1279
|
//#region src/styles/outline.d.ts
|
|
1238
1280
|
interface OutlineStyleProps {
|
|
1239
1281
|
outline?: string | boolean | number;
|
|
1240
|
-
outlineOffset?: string | number;
|
|
1282
|
+
outlineOffset?: string | number | boolean;
|
|
1241
1283
|
}
|
|
1242
1284
|
/**
|
|
1243
1285
|
* Generates CSS for outline property with optional offset.
|
|
@@ -1704,7 +1746,9 @@ declare function func(name: string, definition: FunctionDefinition, options?: {
|
|
|
1704
1746
|
weak?: boolean;
|
|
1705
1747
|
}): void;
|
|
1706
1748
|
/**
|
|
1707
|
-
* Get CSS text
|
|
1749
|
+
* Get the CSS text of every sheet the injector holds. Reads the live
|
|
1750
|
+
* stylesheets, so it needs a DOM: on the server, collect CSS with
|
|
1751
|
+
* `ServerStyleCollector` from `@tenphi/tasty/ssr` instead.
|
|
1708
1752
|
*/
|
|
1709
1753
|
declare function getCSSText(options?: {
|
|
1710
1754
|
root?: Document | ShadowRoot;
|
|
@@ -1771,7 +1815,7 @@ declare function destroy(root?: Document | ShadowRoot): void;
|
|
|
1771
1815
|
declare function createInjector(config?: Partial<StyleInjectorConfig>): StyleInjector;
|
|
1772
1816
|
//#endregion
|
|
1773
1817
|
//#region src/utils/filter-base-props.d.ts
|
|
1774
|
-
declare const basePropNames: readonly ["role", "title", "inert", "as", "element", "css", "qa", "mods", "qaVal", "hidden", "isHidden", "disabled", "isDisabled", "children", "style", "className", "href", "target", "tabIndex"];
|
|
1818
|
+
declare const basePropNames: readonly ["role", "title", "inert", "as", "element", "css", "qa", "mods", "qaVal", "hidden", "isHidden", "disabled", "isDisabled", "isChecked", "children", "style", "tokens", "theme", "className", "href", "target", "tabIndex"];
|
|
1775
1819
|
declare const ignoredEventPropNames: readonly ["onPress", "onHoverStart", "onHoverEnd", "onPressStart", "onPressEnd"];
|
|
1776
1820
|
interface PropsFilterOptions {
|
|
1777
1821
|
labelable?: boolean;
|
|
@@ -1916,5 +1960,5 @@ declare const tastyDebug: {
|
|
|
1916
1960
|
install(): void;
|
|
1917
1961
|
};
|
|
1918
1962
|
//#endregion
|
|
1919
|
-
export { createColorFunc as $,
|
|
1920
|
-
//# sourceMappingURL=index-
|
|
1963
|
+
export { createColorFunc as $, ModValue as $t, keyframes as A, hexToRgb as An, TastyComponentPropsWithDefaults as At, styleHandlers as B, AllBaseProps as Bt, getRawCSSText as C, TEXT_STYLES as Cn, ModPropsInput as Ct, injectRawCSS as D, isSelector as Dn, ResolveTokenProps as Dt, injectGlobal as E, hasStylesGenerated as En, ResolveModProps as Et, chunkSheetRegistry as F, TastyProps as Ft, ChunkName as G, BlockOuterStyleProps as Gt, categorizeStyleKeys as H, BasePropsWithoutChildren as Ht, ComputeStylesOptions as I, TokenPropsInput as It, FONT_CHUNK_STYLES as J, ContainerStyleProps as Jt, DIMENSION_CHUNK_STYLES as K, BlockStyleProps as Kt, ComputeStylesResult as L, VariantMap as Lt, property as M, strToRgb as Mn, TastyElementProps as Mt, touch as N, TastyExtensionProps as Nt, injector as O, getNamedColorHex as On, SubElementDefinition as Ot, ChunkSheetRegistry as P, TastyPolymorphicComponent as Pt, resolveFunctionColor as Q, InnerStyleProps as Qt, computeStyles as R, WithVariant as Rt, getCSSTextForNode as S, POSITION_STYLES as Sn, ModPropDef as St, inject as T, DEFAULT_ZERO_NAME_PREFIX as Tn, ResolveModPropDef as Tt, APPEARANCE_CHUNK_STYLES as U, BaseStyleProps as Ut, ChunkInfo as V, BaseProps as Vt, CHUNK_NAMES as W, BlockInnerStyleProps as Wt, POSITION_CHUNK_STYLES as X, ExtraBaseStyleProps as Xt, LAYOUT_CHUNK_STYLES as Y, DimensionStyleProps as Yt, STYLE_TO_CHUNK as Z, FlowStyleProps as Zt, destroy as _, CONTAINER_STYLES as _n, useStyles as _t, DebugOptions as a, TastyBaseStylePropNames as an, TastyBatchProvider as at, gc as b, INNER_STYLES as bn, Element$1 as bt, tastyDebug as c, TastyThemeNames as cn, useFunction as ct, modAttrs as d, Tokens as dn, UsePropertyOptions as dt, Mods as en, okhstFunction as et, color$1 as f, BASE_STYLES as fn, useProperty as ft, createInjector as g, COLOR_STYLES as gn, UseStylesResult as gt, counterStyle as h, BLOCK_STYLES as hn, useGlobalStyles as ht, DebugChunkInfo as i, TagName as in, getDisplayName as it, ownKeyframes as j, hslToRgbValues as jn, TastyElementOptions as jt, isPropertyDefined as k, getRgbValuesFromRgbaString as kn, SubElementProps as kt, processTokens as l, TextStyleProps as ln, useCounterStyle as lt, cleanup as m, BLOCK_OUTER_STYLES as mn, useRawCSS as mt, CacheStatus as n, PositionStyleProps as nn, okhslFunction as nt, InspectResult as o, TastyCustomProps as on, TastyBatchProviderProps as ot, filterBaseProps as p, BLOCK_INNER_STYLES as pn, useKeyframes as pt, DISPLAY_CHUNK_STYLES as q, ColorStyleProps as qt, ChunkBreakdown as r, ShortGridStyles as rn, okhslPlugin as rt, Summary as s, TastyExtensionConfig as sn, UseFunctionOptions as st, CSSOptions as t, OuterStyleProps as tn, okhstPlugin as tt, resolveRecipes as u, TokenValue as un, useFontFace as ut, fontFace as v, DIMENSION_STYLES as vn, AllBasePropsWithMods as vt, holdKeyframes as w, DEFAULT_NAME_PREFIX as wn, ResolveAsProps as wt, getCSSText as x, OUTER_STYLES as xn, ElementsDefinition as xt, func as y, FLOW_STYLES as yn, ComponentStatics as yt, defineHandler as z, tasty as zt };
|
|
1964
|
+
//# sourceMappingURL=index-DxQNRj50.d.ts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $ as TastyNamedColors, A as resetStyleBatch, B as getGlobalPredefinedStates, C as SheetInfo, Ct as StyleParser, D as QueuedWrite, Dt as StyleDetailsPart, E as StyleUsage, Et as StyleDetails, F as parseStateKey, G as NoType, H as ConditionNode, I as AtRuleContext, J as Selector, K as NotSelector, L as ParsedAdvancedState, M as StyleResult, N as renderStyles, O as flushStyles, Ot as UnitHandler, P as ParseStateKeyOptions, Q as SuffixForSelector, R as StateParserContext, S as RuleInfo, St as stringifyStyles, T as StyleRule, Tt as ProcessedStyle, U as ConfigTokenValue, V as setGlobalPredefinedStates, W as ConfigTokens, X as StylesInterface, Y as Styles, Z as StylesWithoutSelectors, _ as KeyframesSteps, _t as getGlobalParser, a as FontFaceInput, at as ParsedColor, b as RawCSSResult, bt as parseColor, c as GCConfig, ct as StyleHandler, d as InjectOptions, dt as StyleHandlerResult, et as TastyPresetNames, f as InjectResult, ft as StyleMap, g as KeyframesResult, gt as filterMods, h as KeyframesInfo, ht as StyleValueStateMap, i as FontFaceDescriptors, it as DIRECTIONS, j as RenderResult, k as hasPendingStyleWrites, kt as CSSProperties, l as GCOptions, lt as StyleHandlerDefinition, m as KeyframesCacheEntry, mt as StyleValue, n as CounterStyleDescriptors, nt as CSSMap, o as FunctionDefinition, ot as RawStyleHandler, p as InjectionMode, pt as StylePropValue, q as RecipeStyles, r as DisposeFunction, rt as CUSTOM_UNITS, s as FunctionParameter, st as ResolvedStyleValue, t as CacheMetrics, tt as AnyStyleHandler, ut as StyleHandlerProps, v as PropertyDefinition, vt as getGlobalPredefinedTokens, w as StyleInjectorConfig, wt as ParserOptions, x as RootRegistry, xt as parseStyle, y as PropertyOptions, yt as normalizeColorTokenValue, z as createStateParserContext } from "./types-
|
|
2
|
-
import { $ as createColorFunc, $t as
|
|
3
|
-
import { C as
|
|
4
|
-
import { t as mergeStyles } from "./merge-styles-
|
|
5
|
-
export { APPEARANCE_CHUNK_STYLES, type AllBaseProps, type AllBasePropsWithMods, type AnyStyleHandler, type AtRuleContext, BASE_STYLES, BLOCK_INNER_STYLES, BLOCK_OUTER_STYLES, BLOCK_STYLES, type BaseProps, type BasePropsWithoutChildren, 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, Element, type ElementsDefinition, 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 InjectOptions, type InjectResult, type InjectionMode, type InnerStyleProps, InspectResult, type KeyframesCacheEntry, type KeyframesInfo, type KeyframesResult, type KeyframesSteps, LAYOUT_CHUNK_STYLES, type ModPropDef, type ModPropsInput, 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 QueuedWrite, type RawCSSResult, type RawStyleHandler, type RecipeStyles, type RenderResult, type ResolveAsProps, type ResolveModPropDef, type ResolveModProps, type ResolveTokenProps, 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 SubElementDefinition, type SubElementProps, type SuffixForSelector, Summary, TEXT_STYLES, type TagName, type TastyBaseStylePropNames, TastyBatchProvider, type TastyBatchProviderProps, type TastyComponentPropsWithDefaults, type TastyConfig, type TastyCustomProps, type TastyElementOptions, type TastyElementProps, type TastyExtensionConfig, type TastyNamedColors, type TastyPlugin, type TastyPluginFactory, type TastyPolymorphicComponent, type TastyPresetNames, type TastyProps, type TastyThemeNames, type TextStyleProps, type TokenPropsInput, type TokenValue, type Tokens, TypographyPreset, TypographyTokenValue, type UnitHandler, type UseFunctionOptions, type UsePropertyOptions, type UseStylesResult, type VariantMap, type WithVariant, categorizeStyleKeys, chunkSheetRegistry, cleanup, color, computeStyles, configure, counterStyle, createColorFunc, createInjector, createStateParserContext, defineHandler, destroy, filterBaseProps, filterMods, flushStyles, fontFace, func, gc, generateTypographyTokens, getCSSText, getCSSTextForNode, getConfig, getDisplayName, getGlobalCounterStyles, getGlobalFontFaces, getGlobalFunctions, getGlobalKeyframes, getGlobalParser, getGlobalPredefinedStates, getGlobalPredefinedTokens, getGlobalRecipes, getNamePrefix, getNamedColorHex, getRawCSSText, getRgbValuesFromRgbaString, hasGlobalKeyframes, hasGlobalRecipes, hasPendingStyleWrites, hasStylesGenerated, hexToRgb, holdKeyframes, hslToRgbValues, inject, injectGlobal, injectRawCSS, injector, isConfigLocked, isPropertyDefined, isSelector, isTestEnvironment, keyframes, mergeStyles, modAttrs, normalizeColorTokenValue, okhslFunction, okhslPlugin, okhstFunction, okhstPlugin, ownKeyframes, parseColor, parseStateKey, parseStyle, processTokens, property, renderStyles, resetConfig, resetStyleBatch, resolveFunctionColor, resolveRecipes, setGlobalPredefinedStates, strToRgb, stringifyStyles, styleHandlers, tasty, tastyDebug, touch, useCounterStyle, useFontFace, useFunction, useGlobalStyles, useKeyframes, useProperty, useRawCSS, useStyles };
|
|
1
|
+
import { $ as TastyNamedColors, A as resetStyleBatch, B as getGlobalPredefinedStates, C as SheetInfo, Ct as StyleParser, D as QueuedWrite, Dt as StyleDetailsPart, E as StyleUsage, Et as StyleDetails, F as parseStateKey, G as NoType, H as ConditionNode, I as AtRuleContext, J as Selector, K as NotSelector, L as ParsedAdvancedState, M as StyleResult, N as renderStyles, O as flushStyles, Ot as UnitHandler, P as ParseStateKeyOptions, Q as SuffixForSelector, R as StateParserContext, S as RuleInfo, St as stringifyStyles, T as StyleRule, Tt as ProcessedStyle, U as ConfigTokenValue, V as setGlobalPredefinedStates, W as ConfigTokens, X as StylesInterface, Y as Styles, Z as StylesWithoutSelectors, _ as KeyframesSteps, _t as getGlobalParser, a as FontFaceInput, at as ParsedColor, b as RawCSSResult, bt as parseColor, c as GCConfig, ct as StyleHandler, d as InjectOptions, dt as StyleHandlerResult, et as TastyPresetNames, f as InjectResult, ft as StyleMap, g as KeyframesResult, gt as filterMods, h as KeyframesInfo, ht as StyleValueStateMap, i as FontFaceDescriptors, it as DIRECTIONS, j as RenderResult, k as hasPendingStyleWrites, kt as CSSProperties, l as GCOptions, lt as StyleHandlerDefinition, m as KeyframesCacheEntry, mt as StyleValue, n as CounterStyleDescriptors, nt as CSSMap, o as FunctionDefinition, ot as RawStyleHandler, p as InjectionMode, pt as StylePropValue, q as RecipeStyles, r as DisposeFunction, rt as CUSTOM_UNITS, s as FunctionParameter, st as ResolvedStyleValue, t as CacheMetrics, tt as AnyStyleHandler, ut as StyleHandlerProps, v as PropertyDefinition, vt as getGlobalPredefinedTokens, w as StyleInjectorConfig, wt as ParserOptions, x as RootRegistry, xt as parseStyle, y as PropertyOptions, yt as normalizeColorTokenValue, z as createStateParserContext } from "./types-CYQIhUg1.js";
|
|
2
|
+
import { $ as createColorFunc, $t as ModValue, A as keyframes, An as hexToRgb, At as TastyComponentPropsWithDefaults, B as styleHandlers, Bt as AllBaseProps, C as getRawCSSText, Cn as TEXT_STYLES, Ct as ModPropsInput, D as injectRawCSS, Dn as isSelector, Dt as ResolveTokenProps, E as injectGlobal, En as hasStylesGenerated, Et as ResolveModProps, F as chunkSheetRegistry, Ft as TastyProps, G as ChunkName, Gt as BlockOuterStyleProps, H as categorizeStyleKeys, Ht as BasePropsWithoutChildren, I as ComputeStylesOptions, It as TokenPropsInput, J as FONT_CHUNK_STYLES, Jt as ContainerStyleProps, K as DIMENSION_CHUNK_STYLES, Kt as BlockStyleProps, L as ComputeStylesResult, Lt as VariantMap, M as property, Mn as strToRgb, Mt as TastyElementProps, N as touch, Nt as TastyExtensionProps, O as injector, On as getNamedColorHex, Ot as SubElementDefinition, P as ChunkSheetRegistry, Pt as TastyPolymorphicComponent, Q as resolveFunctionColor, Qt as InnerStyleProps, R as computeStyles, Rt as WithVariant, S as getCSSTextForNode, Sn as POSITION_STYLES, St as ModPropDef, T as inject, Tn as DEFAULT_ZERO_NAME_PREFIX, Tt as ResolveModPropDef, U as APPEARANCE_CHUNK_STYLES, Ut as BaseStyleProps, V as ChunkInfo, Vt as BaseProps, W as CHUNK_NAMES, Wt as BlockInnerStyleProps, X as POSITION_CHUNK_STYLES, Xt as ExtraBaseStyleProps, Y as LAYOUT_CHUNK_STYLES, Yt as DimensionStyleProps, Z as STYLE_TO_CHUNK, Zt as FlowStyleProps, _ as destroy, _n as CONTAINER_STYLES, _t as useStyles, a as DebugOptions, an as TastyBaseStylePropNames, at as TastyBatchProvider, b as gc, bn as INNER_STYLES, bt as Element, c as tastyDebug, cn as TastyThemeNames, ct as useFunction, d as modAttrs, dn as Tokens, dt as UsePropertyOptions, en as Mods, et as okhstFunction, f as color, fn as BASE_STYLES, ft as useProperty, g as createInjector, gn as COLOR_STYLES, gt as UseStylesResult, h as counterStyle, hn as BLOCK_STYLES, ht as useGlobalStyles, i as DebugChunkInfo, in as TagName, it as getDisplayName, j as ownKeyframes, jn as hslToRgbValues, jt as TastyElementOptions, k as isPropertyDefined, kn as getRgbValuesFromRgbaString, kt as SubElementProps, l as processTokens, ln as TextStyleProps, lt as useCounterStyle, m as cleanup, mn as BLOCK_OUTER_STYLES, mt as useRawCSS, n as CacheStatus, nn as PositionStyleProps, nt as okhslFunction, o as InspectResult, on as TastyCustomProps, ot as TastyBatchProviderProps, p as filterBaseProps, pn as BLOCK_INNER_STYLES, pt as useKeyframes, q as DISPLAY_CHUNK_STYLES, qt as ColorStyleProps, r as ChunkBreakdown, rn as ShortGridStyles, rt as okhslPlugin, s as Summary, sn as TastyExtensionConfig, st as UseFunctionOptions, t as CSSOptions, tn as OuterStyleProps, tt as okhstPlugin, u as resolveRecipes, un as TokenValue, ut as useFontFace, v as fontFace, vn as DIMENSION_STYLES, vt as AllBasePropsWithMods, w as holdKeyframes, wn as DEFAULT_NAME_PREFIX, wt as ResolveAsProps, x as getCSSText, xn as OUTER_STYLES, xt as ElementsDefinition, y as func, yn as FLOW_STYLES, yt as ComponentStatics, z as defineHandler, zt as tasty } from "./index-DxQNRj50.js";
|
|
3
|
+
import { C as PropHandlerProps, D as getGlobalKeyframes, E as getGlobalFunctions, S as PropHandlerDefinition, T as getGlobalFontFaces, _ as FunctionsConfig, a as getNamePrefix, b as SheetManager, c as isConfigLocked, d as TastyPlugin, f as TastyPluginFactory, g as ColorSpace, h as generateTypographyTokens, i as getGlobalRecipes, l as isTestEnvironment, m as TypographyTokenValue, n as configure, o as hasGlobalKeyframes, p as TypographyPreset, r as getConfig, s as hasGlobalRecipes, t as TastyConfig, u as resetConfig, v as ParseFunction, w as getGlobalCounterStyles, x as PropHandler, y as StyleInjector } from "./config-C4ftFxgI.js";
|
|
4
|
+
import { t as mergeStyles } from "./merge-styles-D39qBtox.js";
|
|
5
|
+
export { APPEARANCE_CHUNK_STYLES, type AllBaseProps, type AllBasePropsWithMods, type AnyStyleHandler, type AtRuleContext, BASE_STYLES, BLOCK_INNER_STYLES, BLOCK_OUTER_STYLES, BLOCK_STYLES, type BaseProps, type BasePropsWithoutChildren, 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 ComponentStatics, 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, Element, type ElementsDefinition, 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 InjectOptions, type InjectResult, type InjectionMode, type InnerStyleProps, InspectResult, type KeyframesCacheEntry, type KeyframesInfo, type KeyframesResult, type KeyframesSteps, LAYOUT_CHUNK_STYLES, type ModPropDef, type ModPropsInput, 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 QueuedWrite, type RawCSSResult, type RawStyleHandler, type RecipeStyles, type RenderResult, type ResolveAsProps, type ResolveModPropDef, type ResolveModProps, type ResolveTokenProps, 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 SubElementDefinition, type SubElementProps, type SuffixForSelector, Summary, TEXT_STYLES, type TagName, type TastyBaseStylePropNames, TastyBatchProvider, type TastyBatchProviderProps, type TastyComponentPropsWithDefaults, type TastyConfig, type TastyCustomProps, type TastyElementOptions, type TastyElementProps, type TastyExtensionConfig, type TastyExtensionProps, type TastyNamedColors, type TastyPlugin, type TastyPluginFactory, type TastyPolymorphicComponent, type TastyPresetNames, type TastyProps, type TastyThemeNames, type TextStyleProps, type TokenPropsInput, type TokenValue, type Tokens, TypographyPreset, TypographyTokenValue, type UnitHandler, type UseFunctionOptions, type UsePropertyOptions, type UseStylesResult, type VariantMap, type WithVariant, categorizeStyleKeys, chunkSheetRegistry, cleanup, color, computeStyles, configure, counterStyle, createColorFunc, createInjector, createStateParserContext, defineHandler, destroy, filterBaseProps, filterMods, flushStyles, fontFace, func, gc, generateTypographyTokens, getCSSText, getCSSTextForNode, getConfig, getDisplayName, getGlobalCounterStyles, getGlobalFontFaces, getGlobalFunctions, getGlobalKeyframes, getGlobalParser, getGlobalPredefinedStates, getGlobalPredefinedTokens, getGlobalRecipes, getNamePrefix, getNamedColorHex, getRawCSSText, getRgbValuesFromRgbaString, hasGlobalKeyframes, hasGlobalRecipes, hasPendingStyleWrites, hasStylesGenerated, hexToRgb, holdKeyframes, hslToRgbValues, inject, injectGlobal, injectRawCSS, injector, isConfigLocked, isPropertyDefined, isSelector, isTestEnvironment, keyframes, mergeStyles, modAttrs, normalizeColorTokenValue, okhslFunction, okhslPlugin, okhstFunction, okhstPlugin, ownKeyframes, parseColor, parseStateKey, parseStyle, processTokens, property, renderStyles, resetConfig, resetStyleBatch, resolveFunctionColor, resolveRecipes, setGlobalPredefinedStates, strToRgb, stringifyStyles, styleHandlers, tasty, tastyDebug, touch, useCounterStyle, useFontFace, useFunction, useGlobalStyles, useKeyframes, useProperty, useRawCSS, useStyles };
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as getRgbValuesFromRgbaString, C as createColorFunc, M as hslToRgbValues, P as strToRgb, S as okhslPlugin, b as okhstPlugin, c as getGlobalParser, d as normalizeColorTokenValue, f as parseColor, i as DIRECTIONS, j as hexToRgb, k as getNamedColorHex, l as getGlobalPredefinedTokens, n as resolveFunctionColor, o as filterMods, p as parseStyle, r as CUSTOM_UNITS, t as color, v as stringifyStyles, w as StyleParser, x as okhslFunction, y as okhstFunction } from "./chunks/dsl-CsFl9LGn.js";
|
|
2
2
|
import { n as isSelector, t as mergeStyles } from "./chunks/shared-utils-y-HjvPN4.js";
|
|
3
|
-
import {
|
|
4
|
-
import { B as
|
|
5
|
-
import { i as generateTypographyTokens } from "./chunks/config-engine-
|
|
6
|
-
import { c as getGlobalFunctions,
|
|
7
|
-
import { A as
|
|
8
|
-
import { t as tastyDebug } from "./chunks/debug-
|
|
3
|
+
import { E as DEFAULT_ZERO_NAME_PREFIX, T as DEFAULT_NAME_PREFIX } from "./chunks/css-definitions-B4aWBkH3.js";
|
|
4
|
+
import { A as styleHandlers, B as STYLE_TO_CHUNK, E as defineHandler, F as DIMENSION_CHUNK_STYLES, G as setGlobalPredefinedStates, I as DISPLAY_CHUNK_STYLES, K as hasStylesGenerated, L as FONT_CHUNK_STYLES, N as APPEARANCE_CHUNK_STYLES, P as CHUNK_NAMES, R as LAYOUT_CHUNK_STYLES, S as parseStateKey, U as createStateParserContext, W as getGlobalPredefinedStates, _ as POSITION_STYLES, b as renderStyles, c as BLOCK_INNER_STYLES, d as COLOR_STYLES, f as CONTAINER_STYLES, g as OUTER_STYLES, h as INNER_STYLES, l as BLOCK_OUTER_STYLES, m as FLOW_STYLES, p as DIMENSION_STYLES, r as categorizeStyleKeys, s as BASE_STYLES, u as BLOCK_STYLES, v as TEXT_STYLES, z as POSITION_CHUNK_STYLES } from "./chunks/style-engine-DnkV_4Jg.js";
|
|
5
|
+
import { i as generateTypographyTokens } from "./chunks/config-engine-CMYFZYQh.js";
|
|
6
|
+
import { c as getGlobalFontFaces, l as getGlobalFunctions, s as getGlobalCounterStyles, u as getGlobalKeyframes } from "./chunks/runtime-state-lZjMbvwV.js";
|
|
7
|
+
import { A as injector, C as getCSSText, D as inject, E as holdKeyframes, F as touch, G as isConfigLocked, H as getNamePrefix, I as ChunkSheetRegistry, J as StyleInjector, K as isTestEnvironment, L as chunkSheetRegistry, M as keyframes, N as ownKeyframes, O as injectGlobal, P as property, Q as hasPendingStyleWrites, R as configure, S as gc, T as getRawCSSText, U as hasGlobalKeyframes, V as getGlobalRecipes, W as hasGlobalRecipes, Y as SheetManager, Z as flushStyles, _ as counterStyle, a as filterBaseProps, b as fontFace, et as resetStyleBatch, g as cleanup, i as modAttrs, j as isPropertyDefined, k as injectRawCSS, o as computeStyles, q as resetConfig, r as processTokens, s as resolveRecipes, v as createInjector, w as getCSSTextForNode, x as func, y as destroy, z as getConfig } from "./chunks/runtime-engine-NGCofNXy.js";
|
|
8
|
+
import { t as tastyDebug } from "./chunks/debug-D2Pu7Xhy.js";
|
|
9
9
|
import "./core/index.js";
|
|
10
|
-
import { a as useProperty, c as useGlobalStyles, d as Element, f as tasty, i as useFontFace, l as useStyles, n as useFunction, o as useKeyframes, p as getDisplayName, r as useCounterStyle, s as useRawCSS, t as TastyBatchProvider } from "./chunks/react-runtime-
|
|
10
|
+
import { a as useProperty, c as useGlobalStyles, d as Element, f as tasty, i as useFontFace, l as useStyles, n as useFunction, o as useKeyframes, p as getDisplayName, r as useCounterStyle, s as useRawCSS, t as TastyBatchProvider } from "./chunks/react-runtime-DHiopXCu.js";
|
|
11
11
|
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, Element, 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, TastyBatchProvider, categorizeStyleKeys, chunkSheetRegistry, cleanup, color, computeStyles, configure, counterStyle, createColorFunc, createInjector, createStateParserContext, defineHandler, destroy, filterBaseProps, filterMods, flushStyles, fontFace, func, gc, generateTypographyTokens, getCSSText, getCSSTextForNode, getConfig, getDisplayName, getGlobalCounterStyles, getGlobalFontFaces, getGlobalFunctions, getGlobalKeyframes, getGlobalParser, getGlobalPredefinedStates, getGlobalPredefinedTokens, getGlobalRecipes, getNamePrefix, getNamedColorHex, getRawCSSText, getRgbValuesFromRgbaString, hasGlobalKeyframes, hasGlobalRecipes, hasPendingStyleWrites, hasStylesGenerated, hexToRgb, holdKeyframes, hslToRgbValues, inject, injectGlobal, injectRawCSS, injector, isConfigLocked, isPropertyDefined, isSelector, isTestEnvironment, keyframes, mergeStyles, modAttrs, normalizeColorTokenValue, okhslFunction, okhslPlugin, okhstFunction, okhstPlugin, ownKeyframes, parseColor, parseStateKey, parseStyle, processTokens, property, renderStyles, resetConfig, resetStyleBatch, resolveFunctionColor, resolveRecipes, setGlobalPredefinedStates, strToRgb, stringifyStyles, styleHandlers, tasty, tastyDebug, touch, useCounterStyle, useFontFace, useFunction, useGlobalStyles, useKeyframes, useProperty, useRawCSS, useStyles };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Y as Styles } from "./types-
|
|
1
|
+
import { Y as Styles } from "./types-CYQIhUg1.js";
|
|
2
2
|
//#region src/utils/merge-styles.d.ts
|
|
3
3
|
declare function mergeStyles(...objects: (Styles | undefined | null)[]): Styles;
|
|
4
4
|
//#endregion
|
|
5
5
|
export { mergeStyles as t };
|
|
6
|
-
//# sourceMappingURL=merge-styles-
|
|
6
|
+
//# sourceMappingURL=merge-styles-D39qBtox.d.ts.map
|
package/dist/ssr/astro.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as ServerStyleCollector } from "../chunks/collector-
|
|
3
|
-
import {
|
|
1
|
+
import { f as getRuntimeConfigState, r as registerSSRCollectorGetterGlobal } from "../chunks/runtime-state-lZjMbvwV.js";
|
|
2
|
+
import { t as ServerStyleCollector } from "../chunks/collector-Cb8ah2JF.js";
|
|
3
|
+
import { r as runWithCollector, t as getSSRCollector } from "../chunks/async-storage-f9j9JRtq.js";
|
|
4
4
|
import { t as findUnsafeCSSResource } from "../chunks/css-resources-P7IBUUZs.js";
|
|
5
|
-
import { createHash } from "node:crypto";
|
|
6
5
|
import { join } from "node:path";
|
|
6
|
+
import { createHash } from "node:crypto";
|
|
7
7
|
import { mkdir, readFile, readdir, writeFile } from "node:fs/promises";
|
|
8
8
|
import { fileURLToPath } from "node:url";
|
|
9
9
|
//#region src/ssr/astro-extraction.ts
|
package/dist/ssr/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { i as ServerStyleArtifactKind, n as createServerStyleCollector, r as ServerStyleArtifact, t as ServerStyleCollector } from "../collector-
|
|
1
|
+
import { i as ServerStyleArtifactKind, n as createServerStyleCollector, r as ServerStyleArtifact, t as ServerStyleCollector } from "../collector-D2OT6I2G.js";
|
|
2
|
+
import { t as hydrateTastyClasses } from "../hydrate-CRyjjAyl.js";
|
|
2
3
|
//#region src/ssr/async-storage.d.ts
|
|
3
4
|
/**
|
|
4
5
|
* Run a function with a ServerStyleCollector bound to the current
|
|
@@ -12,25 +13,5 @@ export declare function runWithCollector<T>(collector: ServerStyleCollector, fn:
|
|
|
12
13
|
*/
|
|
13
14
|
export declare function getSSRCollector(): ServerStyleCollector | null;
|
|
14
15
|
//#endregion
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Client-side cache hydration for SSR/RSC.
|
|
18
|
-
*
|
|
19
|
-
* Registers class names rendered on the server with the client injector. If
|
|
20
|
-
* the runtime is not initialized yet, registration is deferred until its first
|
|
21
|
-
* use. With hash-based naming, only the class name list needs to cross the
|
|
22
|
-
* wire — no cache keys or counters.
|
|
23
|
-
*/
|
|
24
|
-
/**
|
|
25
|
-
* Hydrate the client-side style registry from the server's class name list.
|
|
26
|
-
*
|
|
27
|
-
* Call this before ReactDOM.hydrateRoot() or ensure it runs before
|
|
28
|
-
* any tasty() component renders on the client.
|
|
29
|
-
*
|
|
30
|
-
* When called without arguments, reads the class list from `window.__TASTY__`
|
|
31
|
-
* (populated by inline scripts emitted during SSR/RSC streaming).
|
|
32
|
-
*/
|
|
33
|
-
export declare function hydrateTastyClasses(classes?: string[]): void;
|
|
34
|
-
//#endregion
|
|
35
|
-
export { type ServerStyleArtifact, type ServerStyleArtifactKind, ServerStyleCollector, createServerStyleCollector };
|
|
16
|
+
export { type ServerStyleArtifact, type ServerStyleArtifactKind, ServerStyleCollector, createServerStyleCollector, hydrateTastyClasses };
|
|
36
17
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/ssr/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { r as registerSSRCollectorGetterGlobal } from "../chunks/runtime-state-
|
|
2
|
-
import { n as createServerStyleCollector, t as ServerStyleCollector } from "../chunks/collector-
|
|
3
|
-
import { n as runWithCollector, t as getSSRCollector } from "../chunks/async-storage-
|
|
1
|
+
import { r as registerSSRCollectorGetterGlobal } from "../chunks/runtime-state-lZjMbvwV.js";
|
|
2
|
+
import { n as createServerStyleCollector, t as ServerStyleCollector } from "../chunks/collector-Cb8ah2JF.js";
|
|
3
|
+
import { n as isAsyncStorageAvailable, r as runWithCollector, t as getSSRCollector } from "../chunks/async-storage-f9j9JRtq.js";
|
|
4
4
|
import { t as hydrateTastyClasses } from "../chunks/hydration-TRcz5vnk.js";
|
|
5
5
|
//#region src/ssr/index.ts
|
|
6
|
-
registerSSRCollectorGetterGlobal(getSSRCollector);
|
|
6
|
+
if (isAsyncStorageAvailable()) registerSSRCollectorGetterGlobal(getSSRCollector);
|
|
7
7
|
//#endregion
|
|
8
8
|
export { ServerStyleCollector, createServerStyleCollector, getSSRCollector, hydrateTastyClasses, runWithCollector };
|
|
9
9
|
|
package/dist/ssr/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/ssr/index.ts"],"sourcesContent":["/**\n * SSR entry point for @tenphi/tasty.\n *\n * Provides the core SSR infrastructure: ServerStyleCollector,\n * AsyncLocalStorage integration, and cache hydration.\n *\n * Import from '@tenphi/tasty/ssr'.\n */\n\n// Core collector\nexport { ServerStyleCollector, createServerStyleCollector } from './collector';\nexport type { ServerStyleArtifact, ServerStyleArtifactKind } from './collector';\n\n// AsyncLocalStorage integration for Astro / generic frameworks\nexport { runWithCollector, getSSRCollector } from './async-storage';\n\n// Client-side cache hydration\nexport { hydrateTastyClasses } from './hydrate';\n\n// Register the ALS getter so hooks can find the collector\n// without importing 'node:async_hooks' in the browser bundle.\n// Uses globalThis so the getter is visible across separate module graphs.\nimport { getSSRCollector } from './async-storage';\nimport { registerSSRCollectorGetterGlobal } from './ssr-collector-ref';\n\
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/ssr/index.ts"],"sourcesContent":["/**\n * SSR entry point for @tenphi/tasty.\n *\n * Provides the core SSR infrastructure: ServerStyleCollector,\n * AsyncLocalStorage integration, and cache hydration.\n *\n * Import from '@tenphi/tasty/ssr'.\n */\n\n// Core collector\nexport { ServerStyleCollector, createServerStyleCollector } from './collector';\nexport type { ServerStyleArtifact, ServerStyleArtifactKind } from './collector';\n\n// AsyncLocalStorage integration for Astro / generic frameworks\nexport { runWithCollector, getSSRCollector } from './async-storage';\n\n// Client-side cache hydration\nexport { hydrateTastyClasses } from './hydrate';\n\n// Register the ALS getter so hooks can find the collector\n// without importing 'node:async_hooks' in the browser bundle.\n// Uses globalThis so the getter is visible across separate module graphs.\n// A browser bundle that imports this entry has no storage to look in.\nimport { getSSRCollector, isAsyncStorageAvailable } from './async-storage';\nimport { registerSSRCollectorGetterGlobal } from './ssr-collector-ref';\n\nif (isAsyncStorageAvailable()) {\n registerSSRCollectorGetterGlobal(getSSRCollector);\n}\n"],"mappings":";;;;;AA0BA,IAAI,wBAAwB,GAC1B,iCAAiC,eAAe"}
|
package/dist/ssr/next-config.js
CHANGED
|
@@ -1,28 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { b as renderStyles } from "../chunks/style-engine-
|
|
3
|
-
import {
|
|
1
|
+
import { K as parseFunctionName, P as DEFAULT_PROPERTIES, S as formatFontFaceRule, W as formatFunctionRule, _ as formatCounterStyleRule, b as fontFaceContentHash, i as formatKeyframesCSS, m as resolveSelectorKeyframes, n as formatGlobalRules, o as formatPropertyCSS, t as createServerStyleArtifact } from "../chunks/css-definitions-B4aWBkH3.js";
|
|
2
|
+
import { b as renderStyles } from "../chunks/style-engine-DnkV_4Jg.js";
|
|
3
|
+
import { a as resetZeroConfig, n as functionsForExtraction, t as configureZero } from "../chunks/build-config-D9Iq8QQm.js";
|
|
4
|
+
import { t as loadConfigFile } from "../chunks/config-file-DlZXJMj8.js";
|
|
4
5
|
import { t as findUnsafeCSSResource } from "../chunks/css-resources-P7IBUUZs.js";
|
|
6
|
+
import { isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
5
7
|
import { createHash } from "node:crypto";
|
|
6
8
|
import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
7
|
-
import { createRequire } from "node:module";
|
|
8
|
-
import { isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
9
9
|
//#region src/ssr/next-config.ts
|
|
10
10
|
const ENV_KEY = "TASTY_NEXT_SHARED_CSS_HREF";
|
|
11
|
-
const packageRequire = createRequire(import.meta.url);
|
|
12
11
|
function loadConfig(projectDir, options) {
|
|
13
12
|
if (options.config) return options.config;
|
|
14
13
|
if (!options.configFile) throw new Error("[Tasty] withTastyNext() requires either `config` or `configFile`.");
|
|
15
|
-
|
|
16
|
-
let jitiPath;
|
|
17
|
-
try {
|
|
18
|
-
jitiPath = packageRequire.resolve("jiti");
|
|
19
|
-
} catch (error) {
|
|
20
|
-
if (error instanceof Error && "code" in error && error.code === "MODULE_NOT_FOUND") throw new Error("[Tasty] `configFile` requires the optional `jiti` package. Install `jiti` or pass the imported config through `config` instead.", { cause: error });
|
|
21
|
-
throw error;
|
|
22
|
-
}
|
|
23
|
-
const { createJiti } = packageRequire(jitiPath);
|
|
24
|
-
const loaded = createJiti(projectDir, { moduleCache: false })(configPath);
|
|
25
|
-
return loaded && typeof loaded === "object" && "default" in loaded ? loaded.default : loaded;
|
|
14
|
+
return loadConfigFile(resolve(projectDir, options.configFile), projectDir);
|
|
26
15
|
}
|
|
27
16
|
function collectSharedCSS(config) {
|
|
28
17
|
resetZeroConfig();
|
|
@@ -48,9 +37,15 @@ function collectSharedCSS(config) {
|
|
|
48
37
|
const rules = renderStyles(normalized.tokens, ":root");
|
|
49
38
|
append("global", "__global:tokens", formatGlobalRules(rules));
|
|
50
39
|
}
|
|
40
|
+
const keyframeNames = /* @__PURE__ */ new Set();
|
|
51
41
|
for (const [selector, styles] of Object.entries(normalized.globalStyles)) {
|
|
52
42
|
if (Object.keys(styles).length === 0) continue;
|
|
53
|
-
const rules = renderStyles(styles, selector);
|
|
43
|
+
const { rules, keyframes } = resolveSelectorKeyframes(styles, renderStyles(styles, selector), normalized.keyframes);
|
|
44
|
+
for (const [name, steps] of keyframes ?? []) {
|
|
45
|
+
if (keyframeNames.has(name)) continue;
|
|
46
|
+
keyframeNames.add(name);
|
|
47
|
+
append("keyframes", name, formatKeyframesCSS(name, steps));
|
|
48
|
+
}
|
|
54
49
|
append("global", `__global:styles:${selector}`, formatGlobalRules(rules));
|
|
55
50
|
}
|
|
56
51
|
for (const artifact of artifacts) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"next-config.js","names":[],"sources":["../../src/ssr/next-config.ts"],"sourcesContent":["/**\n * Next.js configuration wrapper for extracting Tasty's configured global CSS.\n *\n * Import this Node-only module from `next.config.ts`. The client-safe registry\n * remains available from `@tenphi/tasty/ssr/next`.\n */\n\nimport { createHash } from 'node:crypto';\nimport { mkdirSync, readFileSync, writeFileSync } from 'node:fs';\nimport { createRequire } from 'node:module';\nimport { isAbsolute, join, relative, resolve, sep } from 'node:path';\nimport type { createJiti as createJitiType } from 'jiti';\n\nimport type { TastyConfig } from '../config';\nimport { formatCounterStyleRule } from '../counter-style';\nimport { fontFaceContentHash, formatFontFaceRule } from '../font-face';\nimport { formatFunctionRule, parseFunctionName } from '../functions';\nimport { renderStyles } from '../pipeline';\nimport type { StyleResult } from '../pipeline';\nimport { DEFAULT_PROPERTIES } from '../properties/defaults';\nimport {\n configureZero,\n functionsForExtraction,\n resetZeroConfig,\n} from '../zero/config';\nimport { createServerStyleArtifact } from './artifacts';\nimport type { ServerStyleArtifact, ServerStyleArtifactKind } from './artifacts';\nimport { findUnsafeCSSResource } from './css-resources';\nimport { formatGlobalRules } from './format-global-rules';\nimport { formatPropertyCSS } from './format-property';\n\nconst ENV_KEY = 'TASTY_NEXT_SHARED_CSS_HREF';\nconst packageRequire = createRequire(import.meta.url);\n\ninterface NextConfig {\n basePath?: string;\n env?: Record<string, string | undefined>;\n headers?: () => Promise<NextHeader[]>;\n output?: string;\n [key: string]: unknown;\n}\n\ninterface NextHeader {\n source: string;\n headers: { key: string; value: string }[];\n [key: string]: unknown;\n}\n\nexport interface TastyNextOptions {\n /**\n * Next.js project directory. Useful when the build command runs from a\n * monorepo root rather than the app directory.\n *\n * @default process.cwd()\n */\n rootDir?: string;\n\n /**\n * Tasty configuration used to generate the shared stylesheet.\n * `config` takes precedence when both config sources are provided.\n */\n config?: TastyConfig;\n\n /**\n * Project-relative path to a TypeScript/JavaScript module whose default\n * export is a Tasty configuration object.\n *\n * @example './app/tasty.config.ts'\n */\n configFile?: string;\n\n /**\n * Filesystem directory for generated stylesheets. When it is inside the\n * project's `public` directory, its public URL is inferred automatically.\n *\n * @default 'public/_tasty'\n */\n outputDir?: string;\n\n /**\n * Root-relative URL path corresponding to `outputDir`. This is required\n * when `outputDir` is outside the project's `public` directory.\n * The Next.js `basePath` is prepended automatically.\n *\n * @default inferred from outputDir\n * @example '/assets/tasty'\n */\n publicPath?: string;\n\n /** Whether to generate and register the shared stylesheet. @default true */\n enabled?: boolean;\n}\n\nfunction loadConfig(\n projectDir: string,\n options: TastyNextOptions,\n): TastyConfig {\n if (options.config) return options.config;\n if (!options.configFile) {\n throw new Error(\n '[Tasty] withTastyNext() requires either `config` or `configFile`.',\n );\n }\n\n const configPath = resolve(projectDir, options.configFile);\n let jitiPath: string;\n try {\n jitiPath = packageRequire.resolve('jiti');\n } catch (error) {\n if (\n error instanceof Error &&\n 'code' in error &&\n error.code === 'MODULE_NOT_FOUND'\n ) {\n throw new Error(\n '[Tasty] `configFile` requires the optional `jiti` package. Install `jiti` or pass the imported config through `config` instead.',\n { cause: error },\n );\n }\n throw error;\n }\n const { createJiti } = packageRequire(jitiPath) as {\n createJiti: typeof createJitiType;\n };\n const jiti = createJiti(projectDir, { moduleCache: false });\n const loaded = jiti(configPath) as TastyConfig | { default: TastyConfig };\n\n return loaded && typeof loaded === 'object' && 'default' in loaded\n ? loaded.default\n : loaded;\n}\n\nfunction collectSharedCSS(config: TastyConfig): string {\n resetZeroConfig();\n try {\n const resolved = configureZero(config);\n const { normalized } = resolved;\n const artifacts: ServerStyleArtifact[] = [];\n const append = (\n kind: ServerStyleArtifactKind,\n key: string,\n css: string,\n ) => {\n if (!css) return;\n\n artifacts.push(\n createServerStyleArtifact(kind, key, css, artifacts.length),\n );\n };\n\n for (const [token, definition] of Object.entries({\n ...DEFAULT_PROPERTIES,\n ...normalized.properties,\n })) {\n append(\n 'property',\n `__prop:${token}`,\n formatPropertyCSS(token, definition),\n );\n }\n\n for (const [family, input] of Object.entries(normalized.fontFaces)) {\n const descriptors = Array.isArray(input) ? input : [input];\n for (const descriptor of descriptors) {\n append(\n 'font-face',\n fontFaceContentHash(family, descriptor),\n formatFontFaceRule(family, descriptor),\n );\n }\n }\n\n for (const [name, descriptors] of Object.entries(\n normalized.counterStyles,\n )) {\n append('counter-style', name, formatCounterStyleRule(name, descriptors));\n }\n\n for (const [name, definition] of Object.entries(\n functionsForExtraction(resolved) ?? {},\n )) {\n append(\n 'function',\n parseFunctionName(name),\n formatFunctionRule(name, definition),\n );\n }\n\n if (Object.keys(normalized.tokens).length > 0) {\n const rules = renderStyles(normalized.tokens, ':root') as StyleResult[];\n append('global', '__global:tokens', formatGlobalRules(rules));\n }\n\n for (const [selector, styles] of Object.entries(normalized.globalStyles)) {\n if (Object.keys(styles).length === 0) continue;\n const rules = renderStyles(styles, selector) as StyleResult[];\n append('global', `__global:styles:${selector}`, formatGlobalRules(rules));\n }\n\n for (const artifact of artifacts) {\n const unsafe = findUnsafeCSSResource(artifact.css, false);\n if (unsafe) {\n throw new Error(\n `[Tasty] Next.js shared CSS extraction cannot preserve page-relative CSS URL \"${unsafe.url}\" in ${artifact.kind} artifact ${artifact.id}. Use an absolute URL, a data URL, or a root-relative URL such as url(/path/to/asset).`,\n );\n }\n }\n\n return artifacts.map(({ css }) => css).join('\\n');\n } finally {\n resetZeroConfig();\n }\n}\n\nfunction inferPublicPath(projectDir: string, outputDir: string): string {\n const publicDir = resolve(projectDir, 'public');\n const relativePath = relative(publicDir, outputDir);\n if (\n relativePath === '..' ||\n relativePath.startsWith(`..${sep}`) ||\n isAbsolute(relativePath)\n ) {\n throw new Error(\n '[Tasty] `publicPath` is required when `outputDir` is outside the Next.js public directory.',\n );\n }\n\n return `/${relativePath.split(sep).filter(Boolean).join('/')}`;\n}\n\nfunction normalizeURLPath(path: string, option: string): string {\n if (\n !path.startsWith('/') ||\n path.startsWith('//') ||\n path.includes('?') ||\n path.includes('#') ||\n path.includes('\\\\')\n ) {\n throw new Error(`[Tasty] \\`${option}\\` must be a root-relative URL path.`);\n }\n\n let end = path.length;\n while (end > 0 && path[end - 1] === '/') end--;\n return path.slice(0, end);\n}\n\nfunction writeSharedCSS(outputDir: string, css: string): string {\n mkdirSync(outputDir, { recursive: true });\n const hash = createHash('sha256').update(css).digest('hex').slice(0, 12);\n const filename = `tasty.shared.${hash}.css`;\n\n const outputPath = join(outputDir, filename);\n let existing: string | undefined;\n try {\n existing = readFileSync(outputPath, 'utf8');\n } catch {\n // The file does not exist yet (or is unreadable); write it below.\n }\n if (existing !== css) writeFileSync(outputPath, css);\n\n return filename;\n}\n\n/**\n * Add a cacheable, content-hashed stylesheet for Tasty configuration globals.\n * Route-dependent component and hook styles continue to stream through\n * `TastyRegistry` so App Router navigation and Suspense remain correct.\n */\nexport function withTastyNext(options: TastyNextOptions) {\n return (nextConfig: NextConfig = {}): NextConfig => {\n if (options.enabled === false) return nextConfig;\n\n const projectDir = resolve(process.cwd(), options.rootDir ?? '.');\n const outputDir = resolve(projectDir, options.outputDir ?? 'public/_tasty');\n const publicPath = normalizeURLPath(\n options.publicPath ?? inferPublicPath(projectDir, outputDir),\n 'publicPath',\n );\n const basePath = normalizeURLPath(nextConfig.basePath || '/', 'basePath');\n const css = collectSharedCSS(loadConfig(projectDir, options));\n\n if (!css) return nextConfig;\n\n const filename = writeSharedCSS(outputDir, css);\n const href = `${basePath}${publicPath}/${filename}`;\n const headerSource = `${publicPath}/${filename}`;\n const existingEnv = nextConfig.env ?? {};\n const existingHeaders = nextConfig.headers;\n if (existingEnv[ENV_KEY] && existingEnv[ENV_KEY] !== href) {\n throw new Error(\n `[Tasty] Next.js env key ${ENV_KEY} is reserved by withTastyNext().`,\n );\n }\n\n const generatedConfig: NextConfig = {\n ...nextConfig,\n env: {\n ...existingEnv,\n [ENV_KEY]: href,\n },\n };\n\n // `headers()` is not emitted by Next's static export. Avoid introducing an\n // unsupported-config warning; the content hash still makes the asset safe\n // for the static host to cache immutably.\n if (nextConfig.output === 'export') return generatedConfig;\n\n return {\n ...generatedConfig,\n async headers() {\n const headers = existingHeaders ? await existingHeaders() : [];\n return [\n ...headers,\n {\n source: headerSource,\n headers: [\n {\n key: 'Cache-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WAAW,WAAW,GAAG;EACzC,MAAM,eAAe,GAAG,WAAW,GAAG;EACtC,MAAM,cAAc,WAAW,OAAO,CAAC;EACvC,MAAM,kBAAkB,WAAW;EACnC,IAAI,YAAY,YAAY,YAAY,aAAa,MACnD,MAAM,IAAI,MACR,2BAA2B,QAAQ,iCACrC;EAGF,MAAM,kBAA8B;GAClC,GAAG;GACH,KAAK;IACH,GAAG;KACF,UAAU;GACb;EACF;EAKA,IAAI,WAAW,WAAW,UAAU,OAAO;EAE3C,OAAO;GACL,GAAG;GACH,MAAM,UAAU;IAEd,OAAO,CACL,GAFc,kBAAkB,MAAM,gBAAgB,IAAI,CAAC,GAG3D;KACE,QAAQ;KACR,SAAS,CACP;MACE,KAAK;MACL,OAAO;KACT,CACF;IACF,CACF;GACF;EACF;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"next-config.js","names":[],"sources":["../../src/ssr/next-config.ts"],"sourcesContent":["/**\n * Next.js configuration wrapper for extracting Tasty's configured global CSS.\n *\n * Import this Node-only module from `next.config.ts`. The client-safe registry\n * remains available from `@tenphi/tasty/ssr/next`.\n */\n\nimport { createHash } from 'node:crypto';\nimport { mkdirSync, readFileSync, writeFileSync } from 'node:fs';\nimport { isAbsolute, join, relative, resolve, sep } from 'node:path';\n\nimport type { TastyConfig } from '../config';\nimport { formatCounterStyleRule } from '../counter-style';\nimport { fontFaceContentHash, formatFontFaceRule } from '../font-face';\nimport { formatFunctionRule, parseFunctionName } from '../functions';\nimport { resolveSelectorKeyframes } from '../keyframes';\nimport { renderStyles } from '../pipeline';\nimport type { StyleResult } from '../pipeline';\nimport { DEFAULT_PROPERTIES } from '../properties/defaults';\nimport {\n configureZero,\n functionsForExtraction,\n resetZeroConfig,\n} from '../zero/config';\nimport { loadConfigFile } from '../zero/config-file';\nimport { createServerStyleArtifact } from './artifacts';\nimport type { ServerStyleArtifact, ServerStyleArtifactKind } from './artifacts';\nimport { findUnsafeCSSResource } from './css-resources';\nimport { formatGlobalRules } from './format-global-rules';\nimport { formatKeyframesCSS } from './format-keyframes';\nimport { formatPropertyCSS } from './format-property';\n\nconst ENV_KEY = 'TASTY_NEXT_SHARED_CSS_HREF';\n\ninterface NextConfig {\n basePath?: string;\n env?: Record<string, string | undefined>;\n headers?: () => Promise<NextHeader[]>;\n output?: string;\n [key: string]: unknown;\n}\n\ninterface NextHeader {\n source: string;\n headers: { key: string; value: string }[];\n [key: string]: unknown;\n}\n\nexport interface TastyNextOptions {\n /**\n * Next.js project directory. Useful when the build command runs from a\n * monorepo root rather than the app directory.\n *\n * @default process.cwd()\n */\n rootDir?: string;\n\n /**\n * Tasty configuration used to generate the shared stylesheet.\n * `config` takes precedence when both config sources are provided.\n */\n config?: TastyConfig;\n\n /**\n * Project-relative path to a TypeScript/JavaScript module whose default\n * export is a Tasty configuration object.\n *\n * @example './app/tasty.config.ts'\n */\n configFile?: string;\n\n /**\n * Filesystem directory for generated stylesheets. When it is inside the\n * project's `public` directory, its public URL is inferred automatically.\n *\n * @default 'public/_tasty'\n */\n outputDir?: string;\n\n /**\n * Root-relative URL path corresponding to `outputDir`. This is required\n * when `outputDir` is outside the project's `public` directory.\n * The Next.js `basePath` is prepended automatically.\n *\n * @default inferred from outputDir\n * @example '/assets/tasty'\n */\n publicPath?: string;\n\n /** Whether to generate and register the shared stylesheet. @default true */\n enabled?: boolean;\n}\n\nfunction loadConfig(\n projectDir: string,\n options: TastyNextOptions,\n): TastyConfig {\n if (options.config) return options.config;\n if (!options.configFile) {\n throw new Error(\n '[Tasty] withTastyNext() requires either `config` or `configFile`.',\n );\n }\n\n return loadConfigFile<TastyConfig>(\n resolve(projectDir, options.configFile),\n projectDir,\n );\n}\n\nfunction collectSharedCSS(config: TastyConfig): string {\n resetZeroConfig();\n try {\n const resolved = configureZero(config);\n const { normalized } = resolved;\n const artifacts: ServerStyleArtifact[] = [];\n const append = (\n kind: ServerStyleArtifactKind,\n key: string,\n css: string,\n ) => {\n if (!css) return;\n\n artifacts.push(\n createServerStyleArtifact(kind, key, css, artifacts.length),\n );\n };\n\n for (const [token, definition] of Object.entries({\n ...DEFAULT_PROPERTIES,\n ...normalized.properties,\n })) {\n append(\n 'property',\n `__prop:${token}`,\n formatPropertyCSS(token, definition),\n );\n }\n\n for (const [family, input] of Object.entries(normalized.fontFaces)) {\n const descriptors = Array.isArray(input) ? input : [input];\n for (const descriptor of descriptors) {\n append(\n 'font-face',\n fontFaceContentHash(family, descriptor),\n formatFontFaceRule(family, descriptor),\n );\n }\n }\n\n for (const [name, descriptors] of Object.entries(\n normalized.counterStyles,\n )) {\n append('counter-style', name, formatCounterStyleRule(name, descriptors));\n }\n\n for (const [name, definition] of Object.entries(\n functionsForExtraction(resolved) ?? {},\n )) {\n append(\n 'function',\n parseFunctionName(name),\n formatFunctionRule(name, definition),\n );\n }\n\n if (Object.keys(normalized.tokens).length > 0) {\n const rules = renderStyles(normalized.tokens, ':root') as StyleResult[];\n append('global', '__global:tokens', formatGlobalRules(rules));\n }\n\n const keyframeNames = new Set<string>();\n for (const [selector, styles] of Object.entries(normalized.globalStyles)) {\n if (Object.keys(styles).length === 0) continue;\n const { rules, keyframes } = resolveSelectorKeyframes(\n styles,\n renderStyles(styles, selector) as StyleResult[],\n normalized.keyframes,\n );\n for (const [name, steps] of keyframes ?? []) {\n if (keyframeNames.has(name)) continue;\n keyframeNames.add(name);\n append('keyframes', name, formatKeyframesCSS(name, steps));\n }\n append('global', `__global:styles:${selector}`, formatGlobalRules(rules));\n }\n\n for (const artifact of artifacts) {\n const unsafe = findUnsafeCSSResource(artifact.css, false);\n if (unsafe) {\n throw new Error(\n `[Tasty] Next.js shared CSS extraction cannot preserve page-relative CSS URL \"${unsafe.url}\" in ${artifact.kind} artifact ${artifact.id}. Use an absolute URL, a data URL, or a root-relative URL such as url(/path/to/asset).`,\n );\n }\n }\n\n return artifacts.map(({ css }) => css).join('\\n');\n } finally {\n resetZeroConfig();\n }\n}\n\nfunction inferPublicPath(projectDir: string, outputDir: string): string {\n const publicDir = resolve(projectDir, 'public');\n const relativePath = relative(publicDir, outputDir);\n if (\n relativePath === '..' ||\n relativePath.startsWith(`..${sep}`) ||\n isAbsolute(relativePath)\n ) {\n throw new Error(\n '[Tasty] `publicPath` is required when `outputDir` is outside the Next.js public directory.',\n );\n }\n\n return `/${relativePath.split(sep).filter(Boolean).join('/')}`;\n}\n\nfunction normalizeURLPath(path: string, option: string): string {\n if (\n !path.startsWith('/') ||\n path.startsWith('//') ||\n path.includes('?') ||\n path.includes('#') ||\n path.includes('\\\\')\n ) {\n throw new Error(`[Tasty] \\`${option}\\` must be a root-relative URL path.`);\n }\n\n let end = path.length;\n while (end > 0 && path[end - 1] === '/') end--;\n return path.slice(0, end);\n}\n\nfunction writeSharedCSS(outputDir: string, css: string): string {\n mkdirSync(outputDir, { recursive: true });\n const hash = createHash('sha256').update(css).digest('hex').slice(0, 12);\n const filename = `tasty.shared.${hash}.css`;\n\n const outputPath = join(outputDir, filename);\n let existing: string | undefined;\n try {\n existing = readFileSync(outputPath, 'utf8');\n } catch {\n // The file does not exist yet (or is unreadable); write it below.\n }\n if (existing !== css) writeFileSync(outputPath, css);\n\n return filename;\n}\n\n/**\n * Add a cacheable, content-hashed stylesheet for Tasty configuration globals.\n * Route-dependent component and hook styles continue to stream through\n * `TastyRegistry` so App Router navigation and Suspense remain correct.\n */\nexport function withTastyNext(options: TastyNextOptions) {\n return (nextConfig: NextConfig = {}): NextConfig => {\n if (options.enabled === false) return nextConfig;\n\n const projectDir = resolve(process.cwd(), options.rootDir ?? '.');\n const outputDir = resolve(projectDir, options.outputDir ?? 'public/_tasty');\n const publicPath = normalizeURLPath(\n options.publicPath ?? inferPublicPath(projectDir, outputDir),\n 'publicPath',\n );\n const basePath = normalizeURLPath(nextConfig.basePath || '/', 'basePath');\n const css = collectSharedCSS(loadConfig(projectDir, options));\n\n if (!css) return nextConfig;\n\n const filename = writeSharedCSS(outputDir, css);\n const href = `${basePath}${publicPath}/${filename}`;\n const headerSource = `${publicPath}/${filename}`;\n const existingEnv = nextConfig.env ?? {};\n const existingHeaders = nextConfig.headers;\n if (existingEnv[ENV_KEY] && existingEnv[ENV_KEY] !== href) {\n throw new Error(\n `[Tasty] Next.js env key ${ENV_KEY} is reserved by withTastyNext().`,\n );\n }\n\n const generatedConfig: NextConfig = {\n ...nextConfig,\n env: {\n ...existingEnv,\n [ENV_KEY]: href,\n },\n };\n\n // `headers()` is not emitted by Next's static export. Avoid introducing an\n // unsupported-config warning; the content hash still makes the asset safe\n // for the static host to cache immutably.\n if (nextConfig.output === 'export') return generatedConfig;\n\n return {\n ...generatedConfig,\n async headers() {\n const headers = existingHeaders ? await existingHeaders() : [];\n return [\n ...headers,\n {\n source: headerSource,\n headers: [\n {\n key: 'Cache-Control',\n value: 'public, max-age=31536000, immutable',\n },\n ],\n },\n ];\n },\n };\n };\n}\n"],"mappings":";;;;;;;;;AAgCA,MAAM,UAAU;AA6DhB,SAAS,WACP,YACA,SACa;CACb,IAAI,QAAQ,QAAQ,OAAO,QAAQ;CACnC,IAAI,CAAC,QAAQ,YACX,MAAM,IAAI,MACR,mEACF;CAGF,OAAO,eACL,QAAQ,YAAY,QAAQ,UAAU,GACtC,UACF;AACF;AAEA,SAAS,iBAAiB,QAA6B;CACrD,gBAAgB;CAChB,IAAI;EACF,MAAM,WAAW,cAAc,MAAM;EACrC,MAAM,EAAE,eAAe;EACvB,MAAM,YAAmC,CAAC;EAC1C,MAAM,UACJ,MACA,KACA,QACG;GACH,IAAI,CAAC,KAAK;GAEV,UAAU,KACR,0BAA0B,MAAM,KAAK,KAAK,UAAU,MAAM,CAC5D;EACF;EAEA,KAAK,MAAM,CAAC,OAAO,eAAe,OAAO,QAAQ;GAC/C,GAAG;GACH,GAAG,WAAW;EAChB,CAAC,GACC,OACE,YACA,UAAU,SACV,kBAAkB,OAAO,UAAU,CACrC;EAGF,KAAK,MAAM,CAAC,QAAQ,UAAU,OAAO,QAAQ,WAAW,SAAS,GAAG;GAClE,MAAM,cAAc,MAAM,QAAQ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E,MAAM,YAAY,QAAQ,YAAY,QAAQ,aAAa,eAAe;EAC1E,MAAM,aAAa,iBACjB,QAAQ,cAAc,gBAAgB,YAAY,SAAS,GAC3D,YACF;EACA,MAAM,WAAW,iBAAiB,WAAW,YAAY,KAAK,UAAU;EACxE,MAAM,MAAM,iBAAiB,WAAW,YAAY,OAAO,CAAC;EAE5D,IAAI,CAAC,KAAK,OAAO;EAEjB,MAAM,WAAW,eAAe,WAAW,GAAG;EAC9C,MAAM,OAAO,GAAG,WAAW,WAAW,GAAG;EACzC,MAAM,eAAe,GAAG,WAAW,GAAG;EACtC,MAAM,cAAc,WAAW,OAAO,CAAC;EACvC,MAAM,kBAAkB,WAAW;EACnC,IAAI,YAAY,YAAY,YAAY,aAAa,MACnD,MAAM,IAAI,MACR,2BAA2B,QAAQ,iCACrC;EAGF,MAAM,kBAA8B;GAClC,GAAG;GACH,KAAK;IACH,GAAG;KACF,UAAU;GACb;EACF;EAKA,IAAI,WAAW,WAAW,UAAU,OAAO;EAE3C,OAAO;GACL,GAAG;GACH,MAAM,UAAU;IAEd,OAAO,CACL,GAFc,kBAAkB,MAAM,gBAAgB,IAAI,CAAC,GAG3D;KACE,QAAQ;KACR,SAAS,CACP;MACE,KAAK;MACL,OAAO;KACT,CACF;IACF,CACF;GACF;EACF;CACF;AACF"}
|
package/dist/ssr/next.d.ts
CHANGED
package/dist/ssr/next.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import { u as getTastySSRContext } from "../chunks/react-runtime-
|
|
4
|
-
import { t as ServerStyleCollector } from "../chunks/collector-
|
|
2
|
+
import { f as getRuntimeConfigState, n as registerSSRCollectorGetter } from "../chunks/runtime-state-lZjMbvwV.js";
|
|
3
|
+
import { u as getTastySSRContext } from "../chunks/react-runtime-DHiopXCu.js";
|
|
4
|
+
import { t as ServerStyleCollector } from "../chunks/collector-Cb8ah2JF.js";
|
|
5
5
|
import { t as hydrateTastyClasses } from "../chunks/hydration-TRcz5vnk.js";
|
|
6
6
|
import { Fragment, createElement, useState } from "react";
|
|
7
7
|
import { useServerInsertedHTML } from "next/navigation";
|
package/dist/static/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Y as Styles } from "../types-
|
|
2
|
-
import { t as mergeStyles } from "../merge-styles-
|
|
1
|
+
import { Y as Styles } from "../types-CYQIhUg1.js";
|
|
2
|
+
import { t as mergeStyles } from "../merge-styles-D39qBtox.js";
|
|
3
3
|
//#region src/static/types.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Static style definition returned by tastyStatic().
|