native-variants 0.1.51 → 0.1.53

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.
Files changed (40) hide show
  1. package/dist/index.d.ts +8 -4
  2. package/dist/index.js +8 -4
  3. package/dist/index.js.map +1 -1
  4. package/dist/lib/cn.d.ts +2 -0
  5. package/dist/{cn.js → lib/cn.js} +6 -3
  6. package/dist/lib/cn.js.map +1 -0
  7. package/dist/lib/create-nva.d.ts +11 -0
  8. package/dist/lib/create-nva.js +101 -0
  9. package/dist/lib/create-nva.js.map +1 -0
  10. package/dist/lib/media-query.d.ts +2 -0
  11. package/dist/lib/media-query.js +19 -0
  12. package/dist/lib/media-query.js.map +1 -0
  13. package/dist/provider/create-provider.d.ts +7 -0
  14. package/dist/provider/create-provider.js +1 -0
  15. package/dist/provider/create-provider.jsx +24 -0
  16. package/dist/provider/create-provider.jsx.map +1 -0
  17. package/dist/types.d.ts +40 -0
  18. package/dist/{props.js → types.js} +1 -1
  19. package/dist/types.js.map +1 -0
  20. package/dist/utils/alpha.d.ts +1 -0
  21. package/dist/utils/alpha.js +13 -0
  22. package/dist/utils/alpha.js.map +1 -0
  23. package/dist/utils/compose-refs.d.ts +3 -0
  24. package/dist/utils/compose-refs.js +37 -0
  25. package/dist/utils/compose-refs.js.map +1 -0
  26. package/dist/utils/compose-text.d.ts +3 -0
  27. package/dist/utils/compose-text.js +29 -0
  28. package/dist/utils/compose-text.js.map +1 -0
  29. package/package.json +48 -48
  30. package/dist/cn.d.ts +0 -2
  31. package/dist/cn.js.map +0 -1
  32. package/dist/create-provider.d.ts +0 -8
  33. package/dist/create-provider.js +0 -1
  34. package/dist/create-provider.jsx +0 -26
  35. package/dist/create-provider.jsx.map +0 -1
  36. package/dist/nv.d.ts +0 -6
  37. package/dist/nv.js +0 -83
  38. package/dist/nv.js.map +0 -1
  39. package/dist/props.d.ts +0 -27
  40. package/dist/props.js.map +0 -1
package/dist/index.d.ts CHANGED
@@ -1,4 +1,8 @@
1
- export * from "./cn.js";
2
- export * from "./nv.js";
3
- export * from "./props.js";
4
- export * from './create-provider.js';
1
+ export * from "./lib/cn.js";
2
+ export * from "./lib/create-nva.js";
3
+ export * from "./lib/media-query.js";
4
+ export * from "./provider/create-provider.js";
5
+ export * from "./types.js";
6
+ export * from "./utils/alpha.js";
7
+ export * from "./utils/compose-refs.js";
8
+ export * from "./utils/compose-text.js";
package/dist/index.js CHANGED
@@ -14,8 +14,12 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./cn.js"), exports);
18
- __exportStar(require("./nv.js"), exports);
19
- __exportStar(require("./props.js"), exports);
20
- __exportStar(require("./create-provider.js"), exports);
17
+ __exportStar(require("./lib/cn.js"), exports);
18
+ __exportStar(require("./lib/create-nva.js"), exports);
19
+ __exportStar(require("./lib/media-query.js"), exports);
20
+ __exportStar(require("./provider/create-provider.js"), exports);
21
+ __exportStar(require("./types.js"), exports);
22
+ __exportStar(require("./utils/alpha.js"), exports);
23
+ __exportStar(require("./utils/compose-refs.js"), exports);
24
+ __exportStar(require("./utils/compose-text.js"), exports);
21
25
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uCAAqB;AACrB,uCAAqB;AACrB,0CAAwB;AACxB,oDAAiC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,mDAAiC;AACjC,oDAAkC;AAClC,6DAA2C;AAC3C,0CAAwB;AACxB,gDAA8B;AAC9B,uDAAqC;AACrC,uDAAqC"}
@@ -0,0 +1,2 @@
1
+ import { StyleProp } from "react-native";
2
+ export declare function cn<T extends object>(...styles: StyleProp<T>[]): T;
@@ -4,9 +4,12 @@ exports.cn = cn;
4
4
  function flattenStyle(style) {
5
5
  if (!style)
6
6
  return [];
7
- if (Array.isArray(style))
8
- return style.flat().filter(Boolean);
9
- //@ts-ignore
7
+ if (Array.isArray(style)) {
8
+ return style.flat
9
+ ? style.flat().filter(Boolean)
10
+ : style.filter(Boolean);
11
+ }
12
+ // @ts-ignore
10
13
  return [style];
11
14
  }
12
15
  function cn(...styles) {
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cn.js","sourceRoot":"","sources":["../../src/lib/cn.ts"],"names":[],"mappings":";;AAaA,gBAKC;AAhBD,SAAS,YAAY,CAAI,KAAmB;IAC1C,IAAI,CAAC,KAAK;QAAE,OAAO,EAAE,CAAC;IACtB,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC,IAAI;YACf,CAAC,CAAE,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,OAAO,CAAS;YACvC,CAAC,CAAE,KAAK,CAAC,MAAM,CAAC,OAAO,CAAS,CAAC;IACrC,CAAC;IACD,aAAa;IACb,OAAO,CAAC,KAAK,CAAC,CAAC;AACjB,CAAC;AAED,SAAgB,EAAE,CAAmB,GAAG,MAAsB;IAC5D,OAAO,MAAM;SACV,OAAO,CAAC,YAAY,CAAC;SACrB,MAAM,CAAC,CAAC,CAAC,EAAU,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;SAC1B,MAAM,CAAI,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,GAAG,EAAE,GAAG,KAAK,EAAE,CAAC,EAAE,EAAO,CAAC,CAAC;AAChE,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { Base, Config, DefaultVariants, DefineConfig, Theme, Variants } from "../types.js";
2
+ export declare function styled<S extends string, V extends Variants<S>>(config: Config<S, V>): (props?: DefaultVariants<S, V>) => Base<S>;
3
+ export declare function createNVA<Tokens extends Theme>({ theme, }?: {
4
+ theme?: Tokens;
5
+ }): {
6
+ theme: Tokens;
7
+ styled: {
8
+ <S extends string, V extends Variants<S>>(config: Config<S, V>): (props?: DefaultVariants<S, V>) => Base<S>;
9
+ <S extends string, V extends Variants<S>>(configFactory: (defineConfig: DefineConfig, theme: Tokens) => Config<S, V>): (props?: DefaultVariants<S, V>) => Base<S>;
10
+ };
11
+ };
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.styled = styled;
4
+ exports.createNVA = createNVA;
5
+ function cache(fn) {
6
+ const memo = new Map();
7
+ return ((...args) => {
8
+ const key = JSON.stringify(args);
9
+ if (memo.has(key))
10
+ return memo.get(key);
11
+ const result = fn(...args);
12
+ memo.set(key, result);
13
+ return result;
14
+ });
15
+ }
16
+ function variant(slot, variants, props) {
17
+ let style = {};
18
+ for (const key in variants) {
19
+ if (Object.prototype.hasOwnProperty.call(props, key)) {
20
+ const value = props[key];
21
+ const variantConfig = variants[key];
22
+ const styleForValue = variantConfig?.[value]?.[slot];
23
+ if (styleForValue) {
24
+ style = { ...style, ...styleForValue };
25
+ }
26
+ }
27
+ }
28
+ return style;
29
+ }
30
+ function compound(slot, compoundVariants, props) {
31
+ let style = {};
32
+ for (const cv of compoundVariants) {
33
+ const { css, ...conds } = cv;
34
+ const isMatch = Object.entries(conds).every(([k, v]) => props[k] === v);
35
+ if (isMatch && css?.[slot]) {
36
+ style = { ...style, ...css[slot] };
37
+ }
38
+ }
39
+ return style;
40
+ }
41
+ function set(slot, base, variants, compoundVariants, props) {
42
+ return {
43
+ ...base?.[slot],
44
+ ...variant(slot, variants, props),
45
+ ...compound(slot, compoundVariants, props),
46
+ };
47
+ }
48
+ function styled(config) {
49
+ const { slots, base = {}, variants = {}, defaultVariants = {}, compoundVariants = [], } = config;
50
+ const computeStyles = (props) => {
51
+ const resolvedProps = { ...defaultVariants };
52
+ // Override only explicitly defined variant props, keeping defaults untouched
53
+ if (props) {
54
+ for (const key in props) {
55
+ const value = props[key];
56
+ if (value !== undefined) {
57
+ //@ts-ignore
58
+ resolvedProps[key] = value;
59
+ }
60
+ }
61
+ }
62
+ const result = {};
63
+ for (const slot of slots) {
64
+ result[slot] = set(slot, base, variants, compoundVariants, resolvedProps);
65
+ }
66
+ return result;
67
+ };
68
+ const cachedComputeStyles = cache(computeStyles);
69
+ return cachedComputeStyles;
70
+ }
71
+ function createNVA({ theme, } = {}) {
72
+ function styled(configOrFactory) {
73
+ const defineConfig = (config) => config;
74
+ const config = typeof configOrFactory === "function"
75
+ ? configOrFactory(defineConfig, theme)
76
+ : configOrFactory;
77
+ const { slots, base = {}, variants = {}, defaultVariants = {}, compoundVariants = [], } = config;
78
+ const computeStyles = (props) => {
79
+ const resolvedProps = { ...defaultVariants };
80
+ if (props) {
81
+ for (const key in props) {
82
+ if (props[key] !== undefined) {
83
+ // @ts-ignore
84
+ resolvedProps[key] = props[key];
85
+ }
86
+ }
87
+ }
88
+ const result = {};
89
+ for (const slot of slots) {
90
+ result[slot] = set(slot, base, variants, compoundVariants, resolvedProps);
91
+ }
92
+ return result;
93
+ };
94
+ return cache(computeStyles);
95
+ }
96
+ return {
97
+ theme: theme,
98
+ styled,
99
+ };
100
+ }
101
+ //# sourceMappingURL=create-nva.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-nva.js","sourceRoot":"","sources":["../../src/lib/create-nva.ts"],"names":[],"mappings":";;AA4EA,wBAqCC;AAED,8BAkEC;AA1KD,SAAS,KAAK,CAAoC,EAAK;IACrD,MAAM,IAAI,GAAG,IAAI,GAAG,EAAyB,CAAC;IAC9C,OAAO,CAAC,CAAC,GAAG,IAAmB,EAAE,EAAE;QACjC,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACjC,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,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CAAC,aAAa,CAAC,CAAC;IAC9B,CAAC;IAED,OAAO;QACL,KAAK,EAAE,KAAM;QACb,MAAM;KACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const wq: (widthPercent: number | string) => number;
2
+ export declare const hq: (heightPercent: number | string) => number;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.hq = exports.wq = void 0;
4
+ const react_native_1 = require("react-native");
5
+ let screenWidth = react_native_1.Dimensions.get("window").width;
6
+ let screenHeight = react_native_1.Dimensions.get("window").height;
7
+ const wq = (widthPercent) => {
8
+ const elemWidth = typeof widthPercent === "number" ? widthPercent : parseFloat(widthPercent);
9
+ return react_native_1.PixelRatio.roundToNearestPixel((screenWidth * elemWidth) / 100);
10
+ };
11
+ exports.wq = wq;
12
+ const hq = (heightPercent) => {
13
+ const elemHeight = typeof heightPercent === "number"
14
+ ? heightPercent
15
+ : parseFloat(heightPercent);
16
+ return react_native_1.PixelRatio.roundToNearestPixel((screenHeight * elemHeight) / 100);
17
+ };
18
+ exports.hq = hq;
19
+ //# sourceMappingURL=media-query.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"media-query.js","sourceRoot":"","sources":["../../src/lib/media-query.ts"],"names":[],"mappings":";;;AAAA,+CAAsD;AAEtD,IAAI,WAAW,GAAG,yBAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC;AACjD,IAAI,YAAY,GAAG,yBAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC;AAE5C,MAAM,EAAE,GAAG,CAAC,YAA6B,EAAU,EAAE;IAC1D,MAAM,SAAS,GACb,OAAO,YAAY,KAAK,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;IAE7E,OAAO,yBAAU,CAAC,mBAAmB,CAAC,CAAC,WAAW,GAAG,SAAS,CAAC,GAAG,GAAG,CAAC,CAAC;AACzE,CAAC,CAAC;AALW,QAAA,EAAE,MAKb;AAEK,MAAM,EAAE,GAAG,CAAC,aAA8B,EAAU,EAAE;IAC3D,MAAM,UAAU,GACd,OAAO,aAAa,KAAK,QAAQ;QAC/B,CAAC,CAAC,aAAa;QACf,CAAC,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IAEhC,OAAO,yBAAU,CAAC,mBAAmB,CAAC,CAAC,YAAY,GAAG,UAAU,CAAC,GAAG,GAAG,CAAC,CAAC;AAC3E,CAAC,CAAC;AAPW,QAAA,EAAE,MAOb"}
@@ -0,0 +1,7 @@
1
+ import { PropsWithChildren } from "react";
2
+ export declare const createCTX: <T>() => {
3
+ CTXProvider: ({ children, props, }: PropsWithChildren & {
4
+ props: T;
5
+ }) => import("react").JSX.Element;
6
+ useCTX: () => T | undefined;
7
+ };
@@ -0,0 +1 @@
1
+ import{createContext,useContext,useMemo}from"react";export const createCTX=()=>{const Context=createContext(undefined);const CTXProvider=({children,props})=>{const value=useMemo(()=>({props}),[props]);return React.createElement(Context.Provider,{value:value},children)};const useCTX=()=>{const context=useContext(Context);if(!context){return undefined}return context.props};return{CTXProvider,useCTX}};
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createCTX = void 0;
4
+ const react_1 = require("react");
5
+ const createCTX = () => {
6
+ const Context = (0, react_1.createContext)(undefined);
7
+ const CTXProvider = ({ children, props, }) => {
8
+ const value = (0, react_1.useMemo)(() => ({ props }), [props]);
9
+ return <Context.Provider value={value}>{children}</Context.Provider>;
10
+ };
11
+ const useCTX = () => {
12
+ const context = (0, react_1.useContext)(Context);
13
+ if (!context) {
14
+ return undefined;
15
+ }
16
+ return context.props;
17
+ };
18
+ return {
19
+ CTXProvider,
20
+ useCTX,
21
+ };
22
+ };
23
+ exports.createCTX = createCTX;
24
+ //# sourceMappingURL=create-provider.jsx.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-provider.jsx","sourceRoot":"","sources":["../../src/provider/create-provider.tsx"],"names":[],"mappings":";;;AAAA,iCAA8E;AAMvE,MAAM,SAAS,GAAG,GAAO,EAAE;IAChC,MAAM,OAAO,GAAG,IAAA,qBAAa,EAAgC,SAAS,CAAC,CAAC;IAExE,MAAM,WAAW,GAAG,CAAC,EACnB,QAAQ,EACR,KAAK,GAGN,EAAE,EAAE;QACH,MAAM,KAAK,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;QAElD,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IACvE,CAAC,CAAC;IAEF,MAAM,MAAM,GAAG,GAAkB,EAAE;QACjC,MAAM,OAAO,GAAG,IAAA,kBAAU,EAAC,OAAO,CAAC,CAAC;QAEpC,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,OAAO,OAAO,CAAC,KAAU,CAAC;IAC5B,CAAC,CAAC;IAEF,OAAO;QACL,WAAW;QACX,MAAM;KACP,CAAC;AACJ,CAAC,CAAC;AA5BW,QAAA,SAAS,aA4BpB"}
@@ -0,0 +1,40 @@
1
+ import { FlexStyle, ImageStyle, TextStyle, TransformsStyle, ViewStyle } from "react-native";
2
+ export type Styles = Partial<ViewStyle & TextStyle & ImageStyle & FlexStyle & TransformsStyle>;
3
+ export type Base<S extends string> = Partial<Record<S, Styles>>;
4
+ export type DefaultVariants<S extends string, V extends Variants<S>> = {
5
+ [K in keyof V]?: keyof V[K] | boolean;
6
+ };
7
+ export type CompoundVariant<S extends string, V extends Variants<S>> = {
8
+ css?: Partial<Record<S, Styles>>;
9
+ } & {
10
+ [K in keyof V]?: keyof V[K];
11
+ };
12
+ export type Variants<S extends string> = {
13
+ [K in string]?: {
14
+ [K in string]: {
15
+ [key in S]?: Styles;
16
+ };
17
+ };
18
+ };
19
+ export type MappedVariants<V> = Partial<{
20
+ [K in keyof V]: keyof V[K];
21
+ }>;
22
+ export type DefineConfig = <S extends string, V extends Variants<S>>(config: Config<S, V>) => Config<S, V>;
23
+ export type Config<S extends string, V extends Variants<S>> = {
24
+ slots: S[];
25
+ base?: Base<S>;
26
+ variants?: V;
27
+ defaultVariants?: DefaultVariants<S, V>;
28
+ compoundVariants?: CompoundVariant<S, V>[];
29
+ };
30
+ export type VariantProps<T extends (...args: any[]) => any> = T extends (props?: infer P) => any ? Partial<P> : never;
31
+ export type Theme<C = any, S = any, F = any, R = any, T = any, Z = any, O = any, L = any> = {
32
+ colors?: C;
33
+ spacing?: S;
34
+ fontSizes?: F;
35
+ radii?: R;
36
+ shadows?: T;
37
+ zIndex?: Z;
38
+ opacity?: O;
39
+ lineHeights?: L;
40
+ };
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=props.js.map
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ export declare function alpha(hex: string, opacity: number): string;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.alpha = alpha;
4
+ function alpha(hex, opacity) {
5
+ if (!/^#([0-9a-f]{6})$/i.test(hex)) {
6
+ throw new Error("Hex color must be in the format #RRGGBB.");
7
+ }
8
+ const alpha = Math.round((opacity / 100) * 255)
9
+ .toString(16)
10
+ .padStart(2, "0");
11
+ return `${hex}${alpha}`;
12
+ }
13
+ //# sourceMappingURL=alpha.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alpha.js","sourceRoot":"","sources":["../../src/utils/alpha.ts"],"names":[],"mappings":";;AAAA,sBAUC;AAVD,SAAgB,KAAK,CAAC,GAAW,EAAE,OAAe;IAChD,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;IAC9D,CAAC;IAED,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;SAC5C,QAAQ,CAAC,EAAE,CAAC;SACZ,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAEpB,OAAO,GAAG,GAAG,GAAG,KAAK,EAAE,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,3 @@
1
+ type PossibleRef<T> = React.Ref<T> | undefined;
2
+ export declare function composeRefs<T>(...refs: PossibleRef<T>[]): React.RefCallback<T>;
3
+ export {};
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.composeRefs = composeRefs;
4
+ function setRef(ref, value) {
5
+ if (typeof ref === "function") {
6
+ return ref(value);
7
+ }
8
+ else if (ref !== null && ref !== undefined) {
9
+ ref.current = value;
10
+ }
11
+ }
12
+ function composeRefs(...refs) {
13
+ return (node) => {
14
+ let hasCleanup = false;
15
+ const cleanups = refs.map((ref) => {
16
+ const cleanup = setRef(ref, node);
17
+ if (!hasCleanup && typeof cleanup == "function") {
18
+ hasCleanup = true;
19
+ }
20
+ return cleanup;
21
+ });
22
+ if (hasCleanup) {
23
+ return () => {
24
+ for (let i = 0; i < cleanups.length; i++) {
25
+ const cleanup = cleanups[i];
26
+ if (typeof cleanup == "function") {
27
+ cleanup();
28
+ }
29
+ else {
30
+ setRef(refs[i], null);
31
+ }
32
+ }
33
+ };
34
+ }
35
+ };
36
+ }
37
+ //# sourceMappingURL=compose-refs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compose-refs.js","sourceRoot":"","sources":["../../src/utils/compose-refs.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+ import { Styles } from "../types.js";
3
+ export declare function composeText(style?: Styles): Partial<TextStyle>;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.composeText = composeText;
4
+ const textStyleKeys = [
5
+ "color",
6
+ "fontSize",
7
+ "fontWeight",
8
+ "fontStyle",
9
+ "textAlign",
10
+ "textAlignVertical",
11
+ "letterSpacing",
12
+ "lineHeight",
13
+ "textDecorationLine",
14
+ "textDecorationColor",
15
+ "textDecorationStyle",
16
+ "fontFamily",
17
+ "includeFontPadding",
18
+ "textTransform",
19
+ "writingDirection",
20
+ "textShadowColor",
21
+ "textShadowOffset",
22
+ "textShadowRadius",
23
+ ];
24
+ function composeText(style) {
25
+ if (!style)
26
+ return {};
27
+ return Object.fromEntries(Object.entries(style).filter(([key]) => textStyleKeys.includes(key)));
28
+ }
29
+ //# sourceMappingURL=compose-text.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compose-text.js","sourceRoot":"","sources":["../../src/utils/compose-text.ts"],"names":[],"mappings":";;AAwBA,kCAQC;AA7BD,MAAM,aAAa,GAAwB;IACzC,OAAO;IACP,UAAU;IACV,YAAY;IACZ,WAAW;IACX,WAAW;IACX,mBAAmB;IACnB,eAAe;IACf,YAAY;IACZ,oBAAoB;IACpB,qBAAqB;IACrB,qBAAqB;IACrB,YAAY;IACZ,oBAAoB;IACpB,eAAe;IACf,kBAAkB;IAClB,iBAAiB;IACjB,kBAAkB;IAClB,kBAAkB;CACnB,CAAC;AAEF,SAAgB,WAAW,CAAC,KAAc;IACxC,IAAI,CAAC,KAAK;QAAE,OAAO,EAAE,CAAC;IAEtB,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CACrC,aAAa,CAAC,QAAQ,CAAC,GAAsB,CAAC,CAC/C,CACF,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,48 +1,48 @@
1
- {
2
- "name": "native-variants",
3
- "version": "0.1.51",
4
- "description": "A library for handling variants in React Native components with theme support.",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
7
- "files": [
8
- "dist"
9
- ],
10
- "publishConfig": {
11
- "access": "public"
12
- },
13
- "scripts": {
14
- "build": "swc src -d dist --copy-files --strip-leading-paths --delete-dir-on-start --ignore */.{spec,test}.ts && tsc && tsc-alias --project tsconfig.build.json",
15
- "lint": "eslint src/**/*.ts",
16
- "deploy": "npm version patch && npm publish --access public"
17
- },
18
- "keywords": [
19
- "slots",
20
- "variants",
21
- "style-sheet",
22
- "react-native",
23
- "coumpound-variants"
24
- ],
25
- "author": "matheusscode <matheussdev3@gmail.com>",
26
- "license": "MIT",
27
- "devDependencies": {
28
- "@eslint/js": "^9.17.0",
29
- "@swc/cli": "0.6.0",
30
- "@swc/core": "^1.10.1",
31
- "@types/react": "^19.0.7",
32
- "@types/react-native": "^0.73.0",
33
- "@typescript-eslint/eslint-plugin": "^8.18.0",
34
- "@typescript-eslint/parser": "^8.18.0",
35
- "eslint": "^9.17.0",
36
- "prettier": "^3.4.2",
37
- "prettier-plugin-organize-imports": "^4.1.0",
38
- "ts-node": "^10.9.2",
39
- "tsc-alias": "^1.8.10",
40
- "typescript": "^5.7.2",
41
- "typescript-eslint": "^8.18.0"
42
- },
43
- "peerDependencies": {
44
- "react": "^19.0.0",
45
- "react-native": "0.78.0"
46
- },
47
- "packageManager": "yarn@1.22.22"
48
- }
1
+ {
2
+ "name": "native-variants",
3
+ "version": "0.1.53",
4
+ "description": "A library for handling variants in React Native components with theme support.",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "publishConfig": {
11
+ "access": "public"
12
+ },
13
+ "scripts": {
14
+ "build": "swc src -d dist --copy-files --strip-leading-paths --delete-dir-on-start --ignore */.{spec,test}.ts && tsc && tsc-alias --project tsconfig.build.json",
15
+ "lint": "eslint src/**/*.ts",
16
+ "deploy": "npm version patch && npm publish --access public"
17
+ },
18
+ "keywords": [
19
+ "slots",
20
+ "variants",
21
+ "style-sheet",
22
+ "react-native",
23
+ "coumpound-variants"
24
+ ],
25
+ "author": "matheusscode <matheussdev3@gmail.com>",
26
+ "license": "MIT",
27
+ "devDependencies": {
28
+ "@eslint/js": "^9.17.0",
29
+ "@swc/cli": "0.6.0",
30
+ "@swc/core": "^1.10.1",
31
+ "@types/react": "^19.0.7",
32
+ "@types/react-native": "^0.73.0",
33
+ "@typescript-eslint/eslint-plugin": "^8.18.0",
34
+ "@typescript-eslint/parser": "^8.18.0",
35
+ "eslint": "^9.17.0",
36
+ "prettier": "^3.4.2",
37
+ "prettier-plugin-organize-imports": "^4.1.0",
38
+ "ts-node": "^10.9.2",
39
+ "tsc-alias": "^1.8.10",
40
+ "typescript": "^5.7.2",
41
+ "typescript-eslint": "^8.18.0"
42
+ },
43
+ "peerDependencies": {
44
+ "react": "19.0.0",
45
+ "react-native": "0.80.2"
46
+ },
47
+ "packageManager": "yarn@1.22.22"
48
+ }
package/dist/cn.d.ts DELETED
@@ -1,2 +0,0 @@
1
- import { StyleProp } from "react-native";
2
- export declare function cn<T>(...styles: StyleProp<T>[]): T;
package/dist/cn.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"cn.js","sourceRoot":"","sources":["../src/cn.ts"],"names":[],"mappings":";;AASA,gBAKC;AAZD,SAAS,YAAY,CAAI,KAAmB;IAC1C,IAAI,CAAC,KAAK;QAAE,OAAO,EAAE,CAAC;IACtB,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,OAAO,CAAQ,CAAC;IACrE,YAAY;IACZ,OAAO,CAAC,KAAK,CAAC,CAAC;AACjB,CAAC;AAED,SAAgB,EAAE,CAAI,GAAG,MAAsB;IAC7C,OAAO,MAAM;SACV,OAAO,CAAC,YAAY,CAAC;SACrB,MAAM,CAAC,CAAC,CAAC,EAAU,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;SAC1B,MAAM,CAAI,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,GAAG,EAAE,GAAG,KAAK,EAAE,CAAC,EAAE,EAAO,CAAC,CAAC;AAChE,CAAC"}
@@ -1,8 +0,0 @@
1
- import React from "react";
2
- export declare const createVariantsProvider: <T>() => {
3
- Provider: ({ children, variants, }: {
4
- variants: T;
5
- children: React.ReactNode;
6
- }) => React.JSX.Element;
7
- useVariants: () => T;
8
- };
@@ -1 +0,0 @@
1
- import React from"react";export const createVariantsProvider=()=>{const Context=React.createContext(undefined);const Provider=({children,variants})=>{return React.createElement(Context.Provider,{value:{variants}},children)};const useVariants=()=>{const context=React.useContext(Context);if(!context){throw new Error("useVariants must be used within its Provider")}return context.variants};return{Provider,useVariants}};
@@ -1,26 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.createVariantsProvider = void 0;
7
- const react_1 = __importDefault(require("react"));
8
- const createVariantsProvider = () => {
9
- const Context = react_1.default.createContext(undefined);
10
- const Provider = ({ children, variants, }) => {
11
- return <Context.Provider value={{ variants }}>{children}</Context.Provider>;
12
- };
13
- const useVariants = () => {
14
- const context = react_1.default.useContext(Context);
15
- if (!context) {
16
- throw new Error("useVariants must be used within its Provider");
17
- }
18
- return context.variants;
19
- };
20
- return {
21
- Provider,
22
- useVariants,
23
- };
24
- };
25
- exports.createVariantsProvider = createVariantsProvider;
26
- //# sourceMappingURL=create-provider.jsx.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-provider.jsx","sourceRoot":"","sources":["../src/create-provider.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAMnB,MAAM,sBAAsB,GAAG,GAAO,EAAE;IAC7C,MAAM,OAAO,GAAG,eAAK,CAAC,aAAa,CACjC,SAAS,CACV,CAAC;IAEF,MAAM,QAAQ,GAAG,CAAC,EAChB,QAAQ,EACR,QAAQ,GAIT,EAAE,EAAE;QACH,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC9E,CAAC,CAAC;IAEF,MAAM,WAAW,GAAG,GAAG,EAAE;QACvB,MAAM,OAAO,GAAG,eAAK,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QAE1C,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;QAClE,CAAC;QAED,OAAO,OAAO,CAAC,QAAQ,CAAC;IAC1B,CAAC,CAAC;IAEF,OAAO;QACL,QAAQ;QACR,WAAW;KACZ,CAAC;AACJ,CAAC,CAAC;AA7BW,QAAA,sBAAsB,0BA6BjC"}
package/dist/nv.d.ts DELETED
@@ -1,6 +0,0 @@
1
- import type { Component, MappedVariants, Variants } from "./props.js";
2
- declare function nv<S extends string, V extends Variants<S>, D extends MappedVariants<V> = MappedVariants<V>>(config: Component<S, V>): {
3
- (props?: Partial<D>): Record<S, Partial<import("react-native").ViewStyle & import("react-native").TextStyle & import("react-native").ImageStyle & import("react-native").FlexStyle & import("react-native").TransformsStyle>>;
4
- variants: Record<keyof V, string[]>;
5
- };
6
- export { nv };
package/dist/nv.js DELETED
@@ -1,83 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.nv = nv;
4
- const react_1 = require("react");
5
- function normalizeProps(defaults, props) {
6
- const merged = { ...defaults };
7
- Object.entries(props).forEach(([key, value]) => {
8
- if (value !== undefined) {
9
- // @ts-ignore
10
- merged[key] = value;
11
- }
12
- });
13
- Object.keys(merged).forEach((key) => {
14
- const value = merged[key];
15
- if (typeof value === "boolean") {
16
- // @ts-ignore
17
- merged[key] = value ? "true" : "false";
18
- }
19
- });
20
- return merged;
21
- }
22
- function initializeBaseStyles(slots, base) {
23
- const styles = {};
24
- const usedSlots = new Set();
25
- slots.forEach((slot) => {
26
- styles[slot] = { ...(base?.[slot] || {}) };
27
- usedSlots.add(slot);
28
- });
29
- return [styles, usedSlots];
30
- }
31
- function applyVariants(variants, props, styles, usedSlots) {
32
- Object.keys(variants).forEach((variantKey) => {
33
- const selectedValue = props[variantKey];
34
- const variant = variants[variantKey];
35
- //@ts-ignore
36
- if (selectedValue && variant?.[selectedValue]) {
37
- //@ts-ignore
38
- const variantStyles = variant[selectedValue];
39
- for (const slot in variantStyles) {
40
- styles[slot] = {
41
- ...styles[slot],
42
- ...variantStyles[slot],
43
- };
44
- usedSlots.add(slot);
45
- }
46
- }
47
- });
48
- }
49
- function applyCompoundVariants(compoundVariants, props = {}, styles = {}, usedSlots) {
50
- compoundVariants?.forEach((compoundVariant) => {
51
- const matches = Object.entries(compoundVariant).every(([key, value]) => key === "css" || props[key] === value);
52
- if (matches && compoundVariant.cs) {
53
- for (const slot in compoundVariant.css) {
54
- styles[slot] = {
55
- ...styles[slot],
56
- ...compoundVariant.css[slot],
57
- };
58
- usedSlots?.add(slot);
59
- }
60
- }
61
- });
62
- }
63
- function nv(config) {
64
- const { slots, variants, base, compoundVariants, defaultVariants } = config;
65
- const componentFunction = (props = {}) => {
66
- const computeStyles = () => {
67
- const mergedProps = normalizeProps(defaultVariants || {}, props);
68
- const [styles, usedSlots] = initializeBaseStyles(slots, base);
69
- if (variants) {
70
- applyVariants(variants, mergedProps, styles, usedSlots);
71
- }
72
- applyCompoundVariants(compoundVariants || [], mergedProps, styles, usedSlots);
73
- return styles;
74
- };
75
- return (0, react_1.useMemo)(computeStyles, [JSON.stringify(props)]);
76
- };
77
- componentFunction.variants = Object.fromEntries(Object.entries(variants || {}).map(([key, value]) => [
78
- key,
79
- Object.keys(value),
80
- ]));
81
- return componentFunction;
82
- }
83
- //# sourceMappingURL=nv.js.map
package/dist/nv.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"nv.js","sourceRoot":"","sources":["../src/nv.ts"],"names":[],"mappings":";;AA4IS,gBAAE;AA5IX,iCAAgC;AAUhC,SAAS,cAAc,CAAmB,QAAW,EAAE,KAAiB;IACtE,MAAM,MAAM,GAAG,EAAE,GAAG,QAAQ,EAAE,CAAC;IAE/B,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;QAC7C,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,aAAa;YACb,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QACtB,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;QAClC,MAAM,KAAK,GAAG,MAAM,CAAC,GAAc,CAAC,CAAC;QACrC,IAAI,OAAO,KAAK,KAAK,SAAS,EAAE,CAAC;YAC/B,aAAa;YACb,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;QACzC,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,oBAAoB,CAC3B,KAAU,EACV,IAAc;IAEd,MAAM,MAAM,GAA+B,EAAE,CAAC;IAC9C,MAAM,SAAS,GAAgB,IAAI,GAAG,EAAE,CAAC;IAEzC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QACrB,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC;QAC3C,SAAS,CAAC,GAAG,CAAC,IAAI,C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CAAC,IAAI,CAAC,KAAM,CAAC;KACpB,CAAC,CAC0B,CAAC;IAE/B,OAAO,iBAAiB,CAAC;AAC3B,CAAC"}
package/dist/props.d.ts DELETED
@@ -1,27 +0,0 @@
1
- import type { FlexStyle, ImageStyle, TextStyle, TransformsStyle, ViewStyle } from "react-native";
2
- type Styles = Partial<ViewStyle & TextStyle & ImageStyle & FlexStyle & TransformsStyle>;
3
- type Base<S extends string> = Partial<Record<S, Styles>>;
4
- type Variants<S extends string> = {
5
- [K in string]?: Record<string, Partial<Record<S, Styles>>>;
6
- };
7
- type MappedVariants<V> = Partial<{
8
- [K in keyof V]: keyof V[K] | boolean;
9
- }>;
10
- type DefaultVariants<S extends string, V extends Variants<S>> = {
11
- [K in keyof V]?: keyof V[K] | boolean;
12
- };
13
- type CompoundVariant<S extends string, V extends Variants<S>> = {
14
- css?: Partial<Record<S, Styles>>;
15
- } & {
16
- [K in keyof V]?: keyof V[K];
17
- };
18
- type Component<S extends string, V extends Variants<S>> = {
19
- slots: S[];
20
- base?: Base<S>;
21
- variants?: V;
22
- defaultVariants?: DefaultVariants<S, V>;
23
- compoundVariants?: CompoundVariant<S, V>[];
24
- };
25
- type VariantProps<T extends (...args: any[]) => any> = T extends (props?: infer P) => any ? Partial<P> : never;
26
- type AnyStyle = Partial<ViewStyle & TextStyle & ImageStyle & FlexStyle & TransformsStyle>;
27
- export { AnyStyle, Base, Component, CompoundVariant, MappedVariants, Styles, VariantProps, Variants, };
package/dist/props.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"props.js","sourceRoot":"","sources":["../src/props.ts"],"names":[],"mappings":""}