@weapp-tailwindcss/merge 1.0.5 → 1.0.7-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cva.cjs CHANGED
@@ -7,8 +7,8 @@ var _chunkSQBQEUQEcjs = require('./chunk-SQBQEUQE.cjs');
7
7
  var _classvarianceauthority = require('class-variance-authority');
8
8
  function create(options) {
9
9
  const e = _optionalChain([options, 'optionalAccess', _ => _.disableEscape]) ? _chunkSQBQEUQEcjs.noop : _chunkSQBQEUQEcjs.replaceWxml;
10
- function cva2(...inputs) {
11
- const fn = _classvarianceauthority.cva.call(void 0, ...inputs);
10
+ function cva2(base, config) {
11
+ const fn = _classvarianceauthority.cva.call(void 0, base, config);
12
12
  return (...props) => {
13
13
  return e(fn(...props));
14
14
  };
package/dist/cva.d.cts CHANGED
@@ -1,10 +1,36 @@
1
- import * as class_variance_authority_types from 'class-variance-authority/types';
2
- import * as clsx from 'clsx';
1
+ import * as CLSX from 'clsx';
3
2
  import { C as CreateOptions } from './types-CXrD0bcD.cjs';
4
3
 
4
+ type ClassValue = CLSX.ClassValue
5
+ type ClassProp = {
6
+ class: ClassValue
7
+ className?: never
8
+ } | {
9
+ class?: never
10
+ className: ClassValue
11
+ } | {
12
+ class?: never
13
+ className?: never
14
+ }
15
+ type StringToBoolean<T> = T extends 'true' | 'false' ? boolean : T
16
+
17
+ type ConfigSchema = Record<string, Record<string, ClassValue>>
18
+ type ConfigVariants<T extends ConfigSchema> = {
19
+ [Variant in keyof T]?: StringToBoolean<keyof T[Variant]> | null | undefined;
20
+ }
21
+ type ConfigVariantsMulti<T extends ConfigSchema> = {
22
+ [Variant in keyof T]?: StringToBoolean<keyof T[Variant]> | StringToBoolean<keyof T[Variant]>[] | undefined;
23
+ }
24
+ type Config<T> = T extends ConfigSchema ? {
25
+ variants?: T
26
+ defaultVariants?: ConfigVariants<T>
27
+ compoundVariants?: (T extends ConfigSchema ? (ConfigVariants<T> | ConfigVariantsMulti<T>) & ClassProp : ClassProp)[]
28
+ } : never
29
+ type Props<T> = T extends ConfigSchema ? ConfigVariants<T> & ClassProp : ClassProp
30
+
5
31
  declare function create(options?: CreateOptions): {
6
- cva: (base?: clsx.ClassValue, config?: undefined) => (...props: Parameters<(props?: class_variance_authority_types.ClassProp | undefined) => string>) => string;
32
+ cva: <T>(base?: ClassValue, config?: Config<T>) => (props?: Props<T> | undefined) => string;
7
33
  };
8
- declare const cva: (base?: clsx.ClassValue, config?: undefined) => (...props: Parameters<(props?: class_variance_authority_types.ClassProp | undefined) => string>) => string;
34
+ declare const cva: <T>(base?: ClassValue, config?: Config<T>) => (props?: Props<T> | undefined) => string;
9
35
 
10
36
  export { create, cva };
package/dist/cva.d.ts CHANGED
@@ -1,10 +1,36 @@
1
- import * as class_variance_authority_types from 'class-variance-authority/types';
2
- import * as clsx from 'clsx';
1
+ import * as CLSX from 'clsx';
3
2
  import { C as CreateOptions } from './types-CXrD0bcD.js';
4
3
 
4
+ type ClassValue = CLSX.ClassValue
5
+ type ClassProp = {
6
+ class: ClassValue
7
+ className?: never
8
+ } | {
9
+ class?: never
10
+ className: ClassValue
11
+ } | {
12
+ class?: never
13
+ className?: never
14
+ }
15
+ type StringToBoolean<T> = T extends 'true' | 'false' ? boolean : T
16
+
17
+ type ConfigSchema = Record<string, Record<string, ClassValue>>
18
+ type ConfigVariants<T extends ConfigSchema> = {
19
+ [Variant in keyof T]?: StringToBoolean<keyof T[Variant]> | null | undefined;
20
+ }
21
+ type ConfigVariantsMulti<T extends ConfigSchema> = {
22
+ [Variant in keyof T]?: StringToBoolean<keyof T[Variant]> | StringToBoolean<keyof T[Variant]>[] | undefined;
23
+ }
24
+ type Config<T> = T extends ConfigSchema ? {
25
+ variants?: T
26
+ defaultVariants?: ConfigVariants<T>
27
+ compoundVariants?: (T extends ConfigSchema ? (ConfigVariants<T> | ConfigVariantsMulti<T>) & ClassProp : ClassProp)[]
28
+ } : never
29
+ type Props<T> = T extends ConfigSchema ? ConfigVariants<T> & ClassProp : ClassProp
30
+
5
31
  declare function create(options?: CreateOptions): {
6
- cva: (base?: clsx.ClassValue, config?: undefined) => (...props: Parameters<(props?: class_variance_authority_types.ClassProp | undefined) => string>) => string;
32
+ cva: <T>(base?: ClassValue, config?: Config<T>) => (props?: Props<T> | undefined) => string;
7
33
  };
8
- declare const cva: (base?: clsx.ClassValue, config?: undefined) => (...props: Parameters<(props?: class_variance_authority_types.ClassProp | undefined) => string>) => string;
34
+ declare const cva: <T>(base?: ClassValue, config?: Config<T>) => (props?: Props<T> | undefined) => string;
9
35
 
10
36
  export { create, cva };
package/dist/cva.js CHANGED
@@ -7,8 +7,8 @@ import {
7
7
  import { cva as _cva } from "class-variance-authority";
8
8
  function create(options) {
9
9
  const e = options?.disableEscape ? noop : replaceWxml;
10
- function cva2(...inputs) {
11
- const fn = _cva(...inputs);
10
+ function cva2(base, config) {
11
+ const fn = _cva(base, config);
12
12
  return (...props) => {
13
13
  return e(fn(...props));
14
14
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@weapp-tailwindcss/merge",
3
3
  "type": "module",
4
- "version": "1.0.5",
4
+ "version": "1.0.7-alpha.0",
5
5
  "description": "weapp-tailwindcss",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -56,7 +56,7 @@
56
56
  "tailwind-merge-v2": "npm:tailwind-merge@^2.6.0"
57
57
  },
58
58
  "devDependencies": {
59
- "weapp-tailwindcss": "4.0.10"
59
+ "weapp-tailwindcss": "4.1.0-alpha.3"
60
60
  },
61
61
  "scripts": {
62
62
  "dev": "tsup --watch --sourcemap",