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

@rpxl/recast

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rpxl/recast - npm Package Compare versions

Comparing version 3.0.0 to 3.1.5

6

dist/cjs/createRecastComponent.d.ts

@@ -0,6 +1,6 @@

import type { ExtractModifierProps, ExtractVariantProps, RecastStyles } from "./types.js";
import React from "react";
import type { Variants, Modifiers, RecastStyles, ExtractVariantProps } from "./types.js";
export declare const createRecastComponent: <P, BaseTheme>(Component: React.ComponentType<P>) => {
recast: <V extends Variants<BaseTheme, V>, M extends Modifiers<BaseTheme, M>>(styles: RecastStyles<BaseTheme, V, M>) => React.ForwardRefExoticComponent<React.PropsWithoutRef<Omit<P, "variants" | "modifiers" | "themekey"> & Partial<Record<keyof M, boolean>> & ExtractVariantProps<Variants<BaseTheme, V>>> & React.RefAttributes<React.ElementRef<React.ComponentType<P>>>>;
validate: <V_1 extends Variants<BaseTheme, V_1>, M_1 extends Modifiers<BaseTheme, M_1>>(styles: RecastStyles<BaseTheme, V_1, M_1>) => RecastStyles<BaseTheme, V_1, M_1>;
recast: <V extends { [K in keyof V]: Record<keyof V[K], BaseTheme>; }, M extends { [K_1 in keyof M]: BaseTheme; }>(styles: RecastStyles<BaseTheme, V, M>) => React.ForwardRefExoticComponent<React.PropsWithoutRef<Omit<P, "variants" | "modifiers" | "themekey"> & ExtractModifierProps<{ [K_2 in keyof M]: BaseTheme; }> & ExtractVariantProps<{ [K_3 in keyof V]: Record<keyof V[K_3], BaseTheme>; }>> & React.RefAttributes<React.ElementRef<React.ComponentType<P>>>>;
validate: <V_1 extends import("./types.js").Variants<BaseTheme, V_1>, M_1 extends import("./types.js").Modifiers<BaseTheme, M_1>>(styles: RecastStyles<BaseTheme, V_1, M_1>) => RecastStyles<BaseTheme, V_1, M_1>;
};

@@ -28,5 +28,5 @@ "use strict";

const react_1 = __importStar(require("react"));
const recastThemeInstance_js_1 = require("./recastThemeInstance.js");
const generateRandomId_js_1 = require("./utils/generateRandomId.js");
const omit_js_1 = require("./utils/omit.js");
const recastThemeInstance_js_1 = require("./recastThemeInstance.js");
const validateRecastStyles_js_1 = require("./validateRecastStyles.js");

@@ -33,0 +33,0 @@ const createRecastComponent = (Component) => {

export type RecastBaseTheme<B extends string> = Partial<Record<B, string | string[]>>;
export type RecastStyles<BaseTheme, V, M> = {
defaults?: Defaults<V, M>;
defaults?: {
variants?: Omit<{
[K in keyof V]?: keyof V[K];
}, MaybeVariants<V>>;
modifiers?: (keyof M)[];
};
base?: BaseTheme;
variants?: Variants<BaseTheme, V>;
modifiers?: Modifiers<BaseTheme, M>;
conditionals?: Conditionals<BaseTheme, V, M>;
variants?: {
[K in keyof V]: Record<keyof V[K], BaseTheme>;
};
modifiers?: {
[K in keyof M]: BaseTheme;
};
conditionals?: Conditional<BaseTheme, V, M>[];
};

@@ -15,3 +24,3 @@ export type Nullish = null | undefined;

}, MaybeVariants<V>>;
modifiers?: Array<keyof M>;
modifiers?: (keyof M)[];
};

@@ -24,4 +33,8 @@ export type Variants<BaseTheme, V> = {

} : never;
export type Modifiers<BaseTheme, M> = Record<keyof M, BaseTheme>;
export type ExtractModifierProps<M> = Partial<Record<keyof M, boolean>>;
export type Modifiers<BaseTheme, M> = {
[K in keyof M]: BaseTheme;
};
export type ExtractModifierProps<M> = {
[K in keyof M]?: boolean;
};
export type Conditional<BaseTheme, V, M> = {

@@ -31,3 +44,3 @@ variants?: V extends object ? {

} : never;
modifiers?: keyof M | Array<keyof M>;
modifiers?: keyof M | (keyof M)[];
classes: Partial<Record<keyof BaseTheme, string | string[]>>;

@@ -34,0 +47,0 @@ };

@@ -0,6 +1,6 @@

import type { ExtractModifierProps, ExtractVariantProps, RecastStyles } from "./types.js";
import React from "react";
import type { Variants, Modifiers, RecastStyles, ExtractVariantProps } from "./types.js";
export declare const createRecastComponent: <P, BaseTheme>(Component: React.ComponentType<P>) => {
recast: <V extends Variants<BaseTheme, V>, M extends Modifiers<BaseTheme, M>>(styles: RecastStyles<BaseTheme, V, M>) => React.ForwardRefExoticComponent<React.PropsWithoutRef<Omit<P, "variants" | "modifiers" | "themekey"> & Partial<Record<keyof M, boolean>> & ExtractVariantProps<Variants<BaseTheme, V>>> & React.RefAttributes<React.ElementRef<React.ComponentType<P>>>>;
validate: <V_1 extends Variants<BaseTheme, V_1>, M_1 extends Modifiers<BaseTheme, M_1>>(styles: RecastStyles<BaseTheme, V_1, M_1>) => RecastStyles<BaseTheme, V_1, M_1>;
recast: <V extends { [K in keyof V]: Record<keyof V[K], BaseTheme>; }, M extends { [K_1 in keyof M]: BaseTheme; }>(styles: RecastStyles<BaseTheme, V, M>) => React.ForwardRefExoticComponent<React.PropsWithoutRef<Omit<P, "variants" | "modifiers" | "themekey"> & ExtractModifierProps<{ [K_2 in keyof M]: BaseTheme; }> & ExtractVariantProps<{ [K_3 in keyof V]: Record<keyof V[K_3], BaseTheme>; }>> & React.RefAttributes<React.ElementRef<React.ComponentType<P>>>>;
validate: <V_1 extends import("./types.js").Variants<BaseTheme, V_1>, M_1 extends import("./types.js").Modifiers<BaseTheme, M_1>>(styles: RecastStyles<BaseTheme, V_1, M_1>) => RecastStyles<BaseTheme, V_1, M_1>;
};
import React, { forwardRef } from "react";
import { setTheme } from "./recastThemeInstance.js";
import { generateRandomId } from "./utils/generateRandomId.js";
import { omit } from "./utils/omit.js";
import { setTheme } from "./recastThemeInstance.js";
import { validateRecastStyles } from "./validateRecastStyles.js";

@@ -6,0 +6,0 @@ export const createRecastComponent = (Component) => {

export type RecastBaseTheme<B extends string> = Partial<Record<B, string | string[]>>;
export type RecastStyles<BaseTheme, V, M> = {
defaults?: Defaults<V, M>;
defaults?: {
variants?: Omit<{
[K in keyof V]?: keyof V[K];
}, MaybeVariants<V>>;
modifiers?: (keyof M)[];
};
base?: BaseTheme;
variants?: Variants<BaseTheme, V>;
modifiers?: Modifiers<BaseTheme, M>;
conditionals?: Conditionals<BaseTheme, V, M>;
variants?: {
[K in keyof V]: Record<keyof V[K], BaseTheme>;
};
modifiers?: {
[K in keyof M]: BaseTheme;
};
conditionals?: Conditional<BaseTheme, V, M>[];
};

@@ -15,3 +24,3 @@ export type Nullish = null | undefined;

}, MaybeVariants<V>>;
modifiers?: Array<keyof M>;
modifiers?: (keyof M)[];
};

@@ -24,4 +33,8 @@ export type Variants<BaseTheme, V> = {

} : never;
export type Modifiers<BaseTheme, M> = Record<keyof M, BaseTheme>;
export type ExtractModifierProps<M> = Partial<Record<keyof M, boolean>>;
export type Modifiers<BaseTheme, M> = {
[K in keyof M]: BaseTheme;
};
export type ExtractModifierProps<M> = {
[K in keyof M]?: boolean;
};
export type Conditional<BaseTheme, V, M> = {

@@ -31,3 +44,3 @@ variants?: V extends object ? {

} : never;
modifiers?: keyof M | Array<keyof M>;
modifiers?: keyof M | (keyof M)[];
classes: Partial<Record<keyof BaseTheme, string | string[]>>;

@@ -34,0 +47,0 @@ };

{
"name": "@rpxl/recast",
"license": "MIT",
"version": "3.0.0",
"version": "3.1.5",
"type": "module",

@@ -34,3 +34,2 @@ "sideEffects": false,

"server",
"../../README.md",
"!**/__tests__/**"

@@ -50,12 +49,2 @@ ],

},
"scripts": {
"prebuild": "rimraf dist",
"build": "npm run build:esm && npm run build:cjs",
"build:esm": "tsc --outDir dist/esm",
"build:cjs": "tsc --project ./tsconfig.cjs.json --outDir dist/cjs",
"test": "jest",
"test:watch": "jest --watch",
"test:coverage": "jest --coverage",
"test:coverage:watch": "jest --coverage --watch"
},
"devDependencies": {

@@ -85,3 +74,14 @@ "@testing-library/react": "^14.1.2",

"typescript": "5.3.3"
},
"scripts": {
"prebuild": "rimraf dist",
"dev": "tsc --outDir dist/esm --watch",
"build": "pnpm run build:esm && pnpm run build:cjs",
"build:esm": "tsc --outDir dist/esm",
"build:cjs": "tsc --project ./tsconfig.cjs.json --outDir dist/cjs",
"test": "jest",
"test:watch": "jest --watch",
"test:coverage": "jest --coverage",
"test:coverage:watch": "jest --coverage --watch"
}
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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