Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tailwind-variants

Package Overview
Dependencies
Maintainers
1
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tailwind-variants - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

32

dist/index.d.ts
import {TVConfig} from "./config";
import {ClassValue, ClassProp, OmitUndefined} from "./utils";
import {
ClassValue,
ClassProp,
OmitUndefined,
StringToBoolean,
StringArrayToFunctions,
} from "./utils";
type TVDefaultSlot = "";
type TVVariants<S extends string[]> = {
[key: string]: {
[key: string]: {[P in S[number]]?: ClassValue} | ClassValue;
[key: string]: S extends TVDefaultSlot
? ClassValue
: {[P in S[number]]?: ClassValue} | ClassValue;
};

@@ -12,3 +22,3 @@ };

{
[K in keyof V]?: keyof V[K];
[K in keyof V]?: StringToBoolean<keyof V[K]>;
} & ClassProp<{[K in S[number]]?: ClassValue} | ClassValue>

@@ -18,11 +28,14 @@ >;

type TVDefaultVariants<V extends TVVariants<S>, S extends string[]> = {
[K in keyof V]?: keyof V[K];
[K in keyof V]?: StringToBoolean<keyof V[K]>;
};
type TVReturnType<S extends string[]> = S extends string[]
? {[K in S[number]]: (slotProps: ClassProp) => string}
: (slotProps: ClassProp) => string;
type TVProps<V extends TVVariants<S>, S extends string[]> = {
[K in keyof V]?: StringToBoolean<keyof V[K]>;
} & ClassProp;
type TVReturnType<V extends TVVariants<S>, S extends string[]> = (
props?: TVProps<V, S>,
) => S extends TVDefaultSlot ? string : StringArrayToFunctions<S, ClassProp>;
export declare function tv<
S extends string,
V extends TVVariants<S[]>,

@@ -32,2 +45,3 @@ CV extends TVCompoundVariants<V, S[]>,

C extends TVConfig,
S extends string = TVDefaultSlot,
>(

@@ -42,3 +56,3 @@ options: {

config?: C,
): TVReturnType<S[]>;
): TVReturnType<V, S[]>;

@@ -45,0 +59,0 @@ export type VariantProps<Component extends (...args: any) => any> = Omit<

@@ -24,1 +24,9 @@ import {CxOptions, CxReturn} from "class-variance-authority";

export type StringToBoolean<T> = T extends "true" | "false" ? boolean : T;
export type StringArrayToFunctions<T extends string[], Props = {}> = {
[K in T[number]]: (props?: Props) => string;
};
type Slots = ["trigger", "item", "list"];
type SlotsReturnType = StringArrayToFunctions<Slots>;
{
"name": "tailwind-variants",
"version": "0.0.3",
"version": "0.0.4",
"description": "🦄 Tailwindcss first-class variant API",

@@ -5,0 +5,0 @@ "author": "Junior Garcia <jrgarciadev@gmail.com>",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc