@klass/preact
Advanced tools
Comparing version
@@ -1,8 +0,9 @@ | ||
import type { ConditionSchema, Fx, ComposeFn } from "@klass/core"; | ||
import type { FinalVariantsSchema, KlassedOptions, ReklassedOptions, KlassedConfig, ReklassedConfig, ComposedConfig, KlassedComponent, ReklassedComponent, ComposedComponent } from "./types"; | ||
import type { SupportedElementType } from "./types/preact"; | ||
declare function klassed<ET extends SupportedElementType, VS extends FinalVariantsSchema>(element: ET, options: KlassedOptions<VS>, config?: KlassedConfig<ET, VS>): KlassedComponent<ET, VS>; | ||
declare function reklassed<ET extends SupportedElementType, CS extends ConditionSchema, VS extends FinalVariantsSchema>(element: ET, options: ReklassedOptions<CS, VS>, config?: ReklassedConfig<ET, VS>): ReklassedComponent<ET, CS, VS>; | ||
declare function composed<ET extends SupportedElementType, Fn extends Fx>(element: ET, fn: ComposeFn<Fn>, config?: ComposedConfig<ET, Fn>): ComposedComponent<ET, Fn>; | ||
export type { KlassedComponent, ReklassedComponent, ComposedComponent }; | ||
import { FinalVariantsSchema, KlassedOptions, ComponentConfig, KlassedComponent, ReklassedOptions, ReklassedComponent, ComposedOptions, ComposedComponentConfig, ComposedComponent } from './types'; | ||
import { SupportedElementType } from './types/preact'; | ||
import type { TransformKey, EndFn, AsFn, EndFnProps, AsFnProps, VariantsSchema, StrictVariantsSchema, VariantsOf, RequiredVariantsFrom, BaseFn, VariantFn, VariantGroup, CompoundVariant, KlassOptions, KlassFn, Klass, ConditionSchema, RevariantFn, RevariantGroup, ReklassOptions, ReklassFn, Reklass, UnionToIntersection, Fx, ComposeFn, Compose } from "@klass/core"; | ||
declare const klassed: <ET extends SupportedElementType, VS extends FinalVariantsSchema>(element: ET, options: KlassedOptions<VS>, config?: ComponentConfig<ET, VS> | undefined) => KlassedComponent<ET, VS>; | ||
declare const reklassed: <ET extends SupportedElementType, CS extends ConditionSchema, VS extends FinalVariantsSchema>(element: ET, options: ReklassedOptions<CS, VS>, config?: ComponentConfig<ET, VS> | undefined) => ReklassedComponent<ET, CS, VS>; | ||
declare const composed: <ET extends SupportedElementType, Fn extends Fx>(element: ET, options: ComposedOptions<Fn>, config?: ComposedComponentConfig<ET, Fn> | undefined) => ComposedComponent<ET, Fn>; | ||
export type { TransformKey, EndFn, AsFn, EndFnProps, AsFnProps, VariantsSchema, StrictVariantsSchema, VariantsOf, RequiredVariantsFrom, BaseFn, VariantFn, VariantGroup, CompoundVariant, KlassOptions, KlassFn, Klass, ConditionSchema, RevariantFn, RevariantGroup, ReklassOptions, ReklassFn, Reklass, UnionToIntersection, Fx, ComposeFn, Compose, }; | ||
export type { KlassedComponent, ReklassedComponent, ComposedComponent } from "./types"; | ||
export { klassed, reklassed, composed }; |
@@ -1,38 +0,8 @@ | ||
import { klass as k, reklass as y } from "@klass/core"; | ||
import { typeofFunction as m } from "@klass/core/utils"; | ||
import { getVariantKeys as x, splitRestProps as C, maybeSignal as N } from "./utils.js"; | ||
import { jsx as P } from "preact/jsx-runtime"; | ||
function t(r, s, e = {}) { | ||
const { | ||
class: o, | ||
className: u, | ||
...c | ||
} = e.dp ?? {}, n = x(s.k), a = ({ | ||
as: p = r, | ||
class: f = o, | ||
className: d = u, | ||
...i | ||
}) => { | ||
const l = C(i, n, e.fp); | ||
return P(p, { | ||
...c, | ||
...l.o, | ||
class: s(l.p, N(f ?? d)) | ||
}); | ||
}; | ||
return a.fx = s, a; | ||
} | ||
function R(r, s, e) { | ||
return t(r, m(s) ? s : k(s, e), e); | ||
} | ||
function S(r, s, e) { | ||
return t(r, m(s) ? s : y(s, e), e); | ||
} | ||
function V(r, s, e) { | ||
return t(r, s, e); | ||
} | ||
import { klass as s, reklass as e, compose as o } from "@klass/core"; | ||
import { createKlassed as r, createReklassed as a, createComposed as t } from "./create.js"; | ||
const d = r(s), l = a(e), p = t(o); | ||
export { | ||
V as composed, | ||
R as klassed, | ||
S as reklassed | ||
p as composed, | ||
d as klassed, | ||
l as reklassed | ||
}; |
@@ -1,8 +0,10 @@ | ||
import type { ConditionSchema } from "@klass/core"; | ||
import { FinalVariantsSchema, KlassedOptions, ReklassedOptions } from "./../types"; | ||
import type { SupportedElementType } from "./../types/preact"; | ||
import type { KlassedConfig, ReklassedConfig, MonoKlassedComponent, MonoReklassedComponent } from "./types"; | ||
declare function klassed<ET extends SupportedElementType, VS extends FinalVariantsSchema>(element: ET, options: KlassedOptions<VS>, config?: KlassedConfig<ET, VS>): MonoKlassedComponent<ET, VS>; | ||
declare function reklassed<ET extends SupportedElementType, CS extends ConditionSchema, VS extends FinalVariantsSchema>(element: ET, options: ReklassedOptions<CS, VS>, config?: ReklassedConfig<ET, VS>): MonoReklassedComponent<ET, CS, VS>; | ||
export type { MonoKlassedComponent, MonoReklassedComponent }; | ||
export { klassed, reklassed }; | ||
import { ComponentConfig, MonoKlassedComponent, MonoReklassedComponent, ComposedComponentConfig, MonoComposedComponent } from './types'; | ||
import { FinalVariantsSchema, KlassedOptions, ReklassedOptions, ComposedOptions } from '../types'; | ||
import { SupportedElementType } from '../types/preact'; | ||
import type { TransformKey, EndFn, AsFn, EndFnProps, AsFnProps, VariantsSchema, StrictVariantsSchema, VariantsOf, RequiredVariantsFrom, BaseFn, VariantFn, VariantGroup, CompoundVariant, KlassOptions, KlassFn, Klass, ConditionSchema, RevariantFn, RevariantGroup, ReklassOptions, ReklassFn, Reklass, UnionToIntersection, Fx, ComposeFn, Compose } from "@klass/core"; | ||
declare const klassed: <ET extends SupportedElementType, VS extends FinalVariantsSchema>(element: ET, options: KlassedOptions<VS>, config?: ComponentConfig<ET, VS> | undefined) => MonoKlassedComponent<ET, VS>; | ||
declare const reklassed: <ET extends SupportedElementType, CS extends ConditionSchema, VS extends FinalVariantsSchema>(element: ET, options: ReklassedOptions<CS, VS>, config?: ComponentConfig<ET, VS> | undefined) => MonoReklassedComponent<ET, CS, VS>; | ||
declare const composed: <ET extends SupportedElementType, Fn extends Fx>(element: ET, options: ComposedOptions<Fn>, config?: ComposedComponentConfig<ET, Fn> | undefined) => MonoComposedComponent<ET, Fn>; | ||
export type { TransformKey, EndFn, AsFn, EndFnProps, AsFnProps, VariantsSchema, StrictVariantsSchema, VariantsOf, RequiredVariantsFrom, BaseFn, VariantFn, VariantGroup, CompoundVariant, KlassOptions, KlassFn, Klass, ConditionSchema, RevariantFn, RevariantGroup, ReklassOptions, ReklassFn, Reklass, UnionToIntersection, Fx, ComposeFn, Compose, }; | ||
export type { MonoKlassedComponent, MonoReklassedComponent, MonoComposedComponent } from "./types"; | ||
export { klassed, reklassed, composed }; |
@@ -1,33 +0,8 @@ | ||
import { klass as k, reklass as i } from "@klass/core"; | ||
import { typeofFunction as l } from "@klass/core/utils"; | ||
import { getVariantKeys as y, splitRestProps as x, maybeSignal as C } from "../utils.js"; | ||
import { jsx as N } from "preact/jsx-runtime"; | ||
function m(r, s, e = {}) { | ||
const { | ||
class: u, | ||
className: o, | ||
...p | ||
} = e.dp ?? {}, c = y(s.k), t = ({ | ||
class: f = u, | ||
className: n = o, | ||
...d | ||
}) => { | ||
const a = x(d, c, e.fp); | ||
return N(r, { | ||
...p, | ||
...a.o, | ||
class: s(a.p, C(f ?? n)) | ||
}); | ||
}; | ||
return t.fx = s, t; | ||
} | ||
function K(r, s, e) { | ||
return m(r, l(s) ? s : k(s, e), e); | ||
} | ||
function R(r, s, e) { | ||
return m(r, l(s) ? s : i(s, e), e); | ||
} | ||
import { klass as s, reklass as e, compose as o } from "@klass/core"; | ||
import { createKlassed as r, createReklassed as a, createComposed as t } from "./create.js"; | ||
const d = r(s), l = a(e), p = t(o); | ||
export { | ||
K as klassed, | ||
R as reklassed | ||
p as composed, | ||
d as klassed, | ||
l as reklassed | ||
}; |
import type { JSX } from "preact"; | ||
import type { EndFnProps, AsFnProps, VariantsOf, KlassFn, ConditionSchema, ReklassFn } from "@klass/core"; | ||
import type { VariantsOf, KlassFn, ConditionSchema, ReklassFn, Fx, ComposeFn } from "@klass/core"; | ||
import { FinalVariantsSchema, WithClassesValueProps, DefaultPropsConfig, ForwardPropsConfig, Base } from "./../types"; | ||
import { OverrideProps } from "./../types/utils"; | ||
import type { SignalishRecord, SupportedComponentProps, SupportedElementType } from "./../types/preact"; | ||
export type KlassedConfig<ET extends SupportedElementType, VS extends FinalVariantsSchema> = DefaultPropsConfig<SupportedComponentProps<ET>> & ForwardPropsConfig<keyof VS> & EndFnProps; | ||
export type ReklassedConfig<ET extends SupportedElementType, VS extends FinalVariantsSchema> = KlassedConfig<ET, VS> & AsFnProps; | ||
export type ComponentConfig<ET extends SupportedElementType, VS extends FinalVariantsSchema> = DefaultPropsConfig<SupportedComponentProps<ET>> & ForwardPropsConfig<keyof VS>; | ||
export type ComposedComponentConfig<ET extends SupportedElementType, Fn extends Fx> = DefaultPropsConfig<SupportedComponentProps<ET>> & ForwardPropsConfig<Fn["k"][number]>; | ||
export type MonoKlassedComponent<ET extends SupportedElementType, VS extends FinalVariantsSchema> = { | ||
(props: WithClassesValueProps<SupportedComponentProps<ET> & SignalishRecord<VariantsOf<KlassFn<VS>>>>): JSX.Element; | ||
(props: WithClassesValueProps<OverrideProps<SupportedComponentProps<ET>, SignalishRecord<VariantsOf<KlassFn<VS>>>>>): JSX.Element; | ||
} & Base<KlassFn<VS>>; | ||
export type MonoReklassedComponent<ET extends SupportedElementType, CS extends ConditionSchema, VS extends FinalVariantsSchema> = { | ||
(props: WithClassesValueProps<SupportedComponentProps<ET> & SignalishRecord<VariantsOf<ReklassFn<CS, VS>>>>): JSX.Element; | ||
(props: WithClassesValueProps<OverrideProps<SupportedComponentProps<ET>, SignalishRecord<VariantsOf<ReklassFn<CS, VS>>>>>): JSX.Element; | ||
} & Base<ReklassFn<CS, VS>>; | ||
export type MonoComposedComponent<ET extends SupportedElementType, Fn extends Fx> = { | ||
(props: WithClassesValueProps<OverrideProps<SupportedComponentProps<ET>, SignalishRecord<VariantsOf<ComposeFn<Fn>>>>>): JSX.Element; | ||
} & Base<ComposeFn<Fn>>; |
import type { JSX } from "preact"; | ||
import type { ClassValue, EndFnProps, AsFnProps, StrictVariantsSchema, KlassOptions, KlassFn, VariantsOf, ConditionSchema, ReklassOptions, ReklassFn, Fx, ComposeFn } from "@klass/core"; | ||
import type { ClassValue, StrictVariantsSchema, KlassOptions, KlassFn, VariantsOf, ConditionSchema, ReklassOptions, ReklassFn, Fx, ComposeFn } from "@klass/core"; | ||
import type { SignalishRecord, SupportedElementType, Classes, BaseComponent } from "./preact"; | ||
@@ -11,2 +11,3 @@ import type { PolymorphicComponentProps } from "./polymorphic"; | ||
export type ReklassedOptions<CS extends ConditionSchema, VS extends FinalVariantsSchema> = ReklassOptions<CS, VS> | ReklassFn<CS, VS>; | ||
export type ComposedOptions<Fn extends Fx> = Fn[] | ComposeFn<Fn>; | ||
export type DefaultPropsConfig<DP = Record<any, any>> = { | ||
@@ -18,5 +19,4 @@ dp?: DP; | ||
}; | ||
export type KlassedConfig<ET extends SupportedElementType, VS extends FinalVariantsSchema> = DefaultPropsConfig<PolymorphicComponentProps<ET, {}>> & ForwardPropsConfig<keyof VS> & EndFnProps; | ||
export type ReklassedConfig<ET extends SupportedElementType, VS extends FinalVariantsSchema> = KlassedConfig<ET, VS> & AsFnProps; | ||
export type ComposedConfig<ET extends SupportedElementType, Fn extends Fx> = DefaultPropsConfig<PolymorphicComponentProps<ET, {}>> & ForwardPropsConfig<Fn["k"][number]>; | ||
export type ComponentConfig<ET extends SupportedElementType, VS extends FinalVariantsSchema> = DefaultPropsConfig<PolymorphicComponentProps<ET, {}>> & ForwardPropsConfig<keyof VS>; | ||
export type ComposedComponentConfig<ET extends SupportedElementType, Fn extends Fx> = DefaultPropsConfig<PolymorphicComponentProps<ET, {}>> & ForwardPropsConfig<Fn["k"][number]>; | ||
export type Base<F> = BaseComponent & { | ||
@@ -23,0 +23,0 @@ fx: F; |
{ | ||
"name": "@klass/preact", | ||
"version": "4.0.0-next.24", | ||
"version": "4.0.0-next.25", | ||
"description": "Class variant utility for Preact", | ||
@@ -27,6 +27,6 @@ "keywords": [ | ||
}, | ||
"./setup": { | ||
"types": "./dist/setup.d.ts", | ||
"import": "./dist/setup.js", | ||
"require": "./dist/setup.cjs" | ||
"./create": { | ||
"types": "./dist/create.d.ts", | ||
"import": "./dist/create.js", | ||
"require": "./dist/create.cjs" | ||
}, | ||
@@ -43,6 +43,6 @@ "./utils": { | ||
}, | ||
"./mono/setup": { | ||
"types": "./dist/mono/setup.d.ts", | ||
"import": "./dist/mono/setup.js", | ||
"require": "./dist/mono/setup.cjs" | ||
"./mono/create": { | ||
"types": "./dist/mono/create.d.ts", | ||
"import": "./dist/mono/create.js", | ||
"require": "./dist/mono/create.cjs" | ||
} | ||
@@ -79,7 +79,7 @@ }, | ||
"peerDependencies": { | ||
"@klass/core": "4.0.0-next.24", | ||
"@klass/core": "4.0.0-next.25", | ||
"preact": "10.19.0 - 11.0.0" | ||
}, | ||
"devDependencies": { | ||
"@klass/core": "4.0.0-next.24", | ||
"@klass/core": "4.0.0-next.25", | ||
"preact": "^10.19.6" | ||
@@ -86,0 +86,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 2 instances in 1 package
23253
6.73%23
4.55%3
-40%232
-10.42%1
Infinity%