@codeandmoney/soelma 0.0.0-dev.6 → 0.0.0-dev.8
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/appearance/index.d.ts +1 -1
- package/appearance/index.js +2 -2
- package/appearance/init.js +2 -2
- package/context.d.ts +1 -1
- package/dark-mode/index.d.ts +1 -1
- package/dark-mode/index.js +2 -2
- package/dark-mode/init.js +2 -2
- package/dimensions/index.js +1 -1
- package/dimensions/init.js +2 -2
- package/i18n.d.ts +1 -1
- package/i18n.js +1 -1
- package/index.d.ts +6 -6
- package/index.js +4 -4
- package/{makeUseStyles/createUseStylesTheme.js → make-use-styles/create-use-styles-theme.js} +22 -5
- package/{makeUseStyles/createUseStylesWithoutTheme.js → make-use-styles/create-use-styles-without-theme.js} +4 -3
- package/make-use-styles/index.d.ts +20 -0
- package/make-use-styles/index.js +12 -0
- package/{makeUseStyles → make-use-styles}/utils.js +5 -10
- package/package.json +1 -1
- package/safe-area/{eventEmitter.js → event-emitter.js} +1 -1
- package/safe-area/index.d.ts +2 -2
- package/safe-area/index.js +3 -3
- package/safe-area/init.js +2 -2
- package/safe-area/{SafeAreaProvider.js → safe-area-provider.js} +2 -2
- package/safe-area/state.d.ts +6 -1
- package/safe-area/{StylexSaveAreaConsumer.js → stylex-save-area-consumer.js} +1 -1
- package/{useColorTransition.d.ts → use-color-transition.d.ts} +1 -1
- package/{useColorTransition.js → use-color-transition.js} +1 -1
- package/{useTheme.d.ts → use-theme.d.ts} +1 -1
- package/{withStyles.js → with-styles.js} +1 -1
- package/makeUseStyles/index.d.ts +0 -22
- package/makeUseStyles/index.js +0 -12
- /package/{createEventEmitter.d.ts → create-event-emitter.d.ts} +0 -0
- /package/{createEventEmitter.js → create-event-emitter.js} +0 -0
- /package/{DefaultTheme.d.ts → default-theme.d.ts} +0 -0
- /package/{DefaultTheme.js → default-theme.js} +0 -0
- /package/{dependencyRegistry.d.ts → dependency-registry.d.ts} +0 -0
- /package/{dependencyRegistry.js → dependency-registry.js} +0 -0
- /package/{dependencyUsage.d.ts → dependency-usage.d.ts} +0 -0
- /package/{dependencyUsage.js → dependency-usage.js} +0 -0
- /package/{makeUseStyles → make-use-styles}/test-type.js +0 -0
- /package/{makeUseStyles → make-use-styles}/types.d.ts +0 -0
- /package/{makeUseStyles → make-use-styles}/types.js +0 -0
- /package/{makeUseStyles → make-use-styles}/types.ts +0 -0
- /package/safe-area/{eventEmitter.d.ts → event-emitter.d.ts} +0 -0
- /package/safe-area/{SafeAreaProvider.d.ts → safe-area-provider.d.ts} +0 -0
- /package/safe-area/{StylexSaveAreaConsumer.d.ts → stylex-save-area-consumer.d.ts} +0 -0
- /package/{useTheme.js → use-theme.js} +0 -0
- /package/{withStyles.d.ts → with-styles.d.ts} +0 -0
package/appearance/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./init";
|
|
2
2
|
export type ColorSchemeName = "light" | "dark" | "default";
|
|
3
|
-
export declare function appearance<T>({ dark, light, default: defaultScheme
|
|
3
|
+
export declare function appearance<T>({ dark, light, default: defaultScheme }: {
|
|
4
4
|
[mode in ColorSchemeName]?: T;
|
|
5
5
|
}): T | undefined;
|
|
6
6
|
export declare const darkAppearance: <T>(dark: T) => T | undefined;
|
package/appearance/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "./init";
|
|
2
2
|
import { Appearance } from "react-native";
|
|
3
|
-
import { onUse } from "../
|
|
3
|
+
import { onUse } from "../dependency-usage";
|
|
4
4
|
import { UI_MODE_DEPENDENCY_KEY } from "./consts";
|
|
5
|
-
export function appearance({ dark, light, default: defaultScheme
|
|
5
|
+
export function appearance({ dark, light, default: defaultScheme }) {
|
|
6
6
|
onUse(UI_MODE_DEPENDENCY_KEY);
|
|
7
7
|
// Note: getColorScheme() will always return light when debugging with Chrome.
|
|
8
8
|
if (Appearance.getColorScheme() === "light") {
|
package/appearance/init.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Appearance } from "react-native";
|
|
2
|
-
import { addDependency } from "../
|
|
3
|
-
import { createEventEmitter } from "../
|
|
2
|
+
import { addDependency } from "../dependency-registry";
|
|
3
|
+
import { createEventEmitter } from "../create-event-emitter";
|
|
4
4
|
import { UI_MODE_DEPENDENCY_KEY } from "./consts";
|
|
5
5
|
const { on, emit } = createEventEmitter(UI_MODE_DEPENDENCY_KEY);
|
|
6
6
|
addDependency(UI_MODE_DEPENDENCY_KEY, (handler) => on(handler));
|
package/context.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { DefaultTheme } from "./
|
|
1
|
+
import { DefaultTheme } from "./default-theme";
|
|
2
2
|
export declare const themeContext: import("react").Context<DefaultTheme | null>;
|
|
3
3
|
export declare const ThemeProvider: import("react").Provider<DefaultTheme | null>, ThemeConsumer: import("react").Consumer<DefaultTheme | null>;
|
package/dark-mode/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./init";
|
|
2
2
|
export type UiType = "dark" | "light";
|
|
3
|
-
export declare function uiMode<T>({ dark, light
|
|
3
|
+
export declare function uiMode<T>({ dark, light }: {
|
|
4
4
|
[mode in UiType]?: T;
|
|
5
5
|
}): T | undefined;
|
|
6
6
|
export declare const darkUiMode: <T>(dark: T) => T | undefined;
|
package/dark-mode/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "./init";
|
|
2
|
-
import { onUse } from "../
|
|
2
|
+
import { onUse } from "../dependency-usage";
|
|
3
3
|
import { UI_MODE_DEPENDENCY_KEY } from "./consts";
|
|
4
4
|
import { state } from "./state";
|
|
5
|
-
export function uiMode({ dark, light
|
|
5
|
+
export function uiMode({ dark, light }) {
|
|
6
6
|
onUse(UI_MODE_DEPENDENCY_KEY);
|
|
7
7
|
if (state.mode === "dark") {
|
|
8
8
|
return dark;
|
package/dark-mode/init.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { eventEmitter } from "react-native-dark-mode";
|
|
2
|
-
import { addDependency } from "../
|
|
3
|
-
import { createEventEmitter } from "../
|
|
2
|
+
import { addDependency } from "../dependency-registry";
|
|
3
|
+
import { createEventEmitter } from "../create-event-emitter";
|
|
4
4
|
import { UI_MODE_DEPENDENCY_KEY } from "./consts";
|
|
5
5
|
import { state } from "./state";
|
|
6
6
|
const { on, emit } = createEventEmitter(UI_MODE_DEPENDENCY_KEY);
|
package/dimensions/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./init";
|
|
2
2
|
import { Dimensions } from "react-native";
|
|
3
|
-
import { onUse } from "../
|
|
3
|
+
import { onUse } from "../dependency-usage";
|
|
4
4
|
import { WINDOW_DEPENDENCY_KEY, SCREEN_DEPENDENCY_KEY } from "./consts";
|
|
5
5
|
const get = (dim) => Dimensions.get(dim);
|
|
6
6
|
export function getWindowDimensions() {
|
package/dimensions/init.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Dimensions } from "react-native";
|
|
2
|
-
import { createEventEmitter } from "../
|
|
3
|
-
import { addDependency } from "../
|
|
2
|
+
import { createEventEmitter } from "../create-event-emitter";
|
|
3
|
+
import { addDependency } from "../dependency-registry";
|
|
4
4
|
import { SCREEN_DEPENDENCY_KEY, WINDOW_DEPENDENCY_KEY } from "./consts";
|
|
5
5
|
const { get, addEventListener } = Dimensions;
|
|
6
6
|
const state = { window: get("window"), screen: get("screen") };
|
package/i18n.d.ts
CHANGED
package/i18n.js
CHANGED
package/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { useTheme } from "./
|
|
2
|
-
export { withStyles } from "./
|
|
1
|
+
export { useTheme } from "./use-theme";
|
|
2
|
+
export { withStyles } from "./with-styles";
|
|
3
3
|
export { ThemeProvider, ThemeConsumer } from "./context";
|
|
4
|
-
export { useColorTransition } from "./
|
|
5
|
-
export { makeUseStyles } from "./
|
|
6
|
-
export type { DefaultTheme } from "./
|
|
7
|
-
export type { InferInjectedStyledProps } from "./
|
|
4
|
+
export { useColorTransition } from "./use-color-transition";
|
|
5
|
+
export { makeUseStyles } from "./make-use-styles";
|
|
6
|
+
export type { DefaultTheme } from "./default-theme";
|
|
7
|
+
export type { InferInjectedStyledProps } from "./with-styles";
|
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { useTheme } from "./
|
|
2
|
-
export { withStyles } from "./
|
|
1
|
+
export { useTheme } from "./use-theme";
|
|
2
|
+
export { withStyles } from "./with-styles";
|
|
3
3
|
export { ThemeProvider, ThemeConsumer } from "./context";
|
|
4
|
-
export { useColorTransition } from "./
|
|
5
|
-
export { makeUseStyles } from "./
|
|
4
|
+
export { useColorTransition } from "./use-color-transition";
|
|
5
|
+
export { makeUseStyles } from "./make-use-styles";
|
package/{makeUseStyles/createUseStylesTheme.js → make-use-styles/create-use-styles-theme.js}
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { StyleSheet } from "react-native";
|
|
2
|
-
import { useTheme } from "../
|
|
3
|
-
import { resetUsing } from "../
|
|
2
|
+
import { useTheme } from "../use-theme";
|
|
3
|
+
import { resetUsing } from "../dependency-usage";
|
|
4
4
|
import { getDependenciesKeys, useForceUpdate, subscribe } from "./utils";
|
|
5
5
|
|
|
6
|
-
export function createUseStylesTheme(getStyles) {
|
|
6
|
+
export function createUseStylesTheme(getStyles, getVariants) {
|
|
7
7
|
const scope = {
|
|
8
8
|
styles: new WeakMap(),
|
|
9
9
|
forceUpdate: [],
|
|
@@ -28,7 +28,7 @@ export function createUseStylesTheme(getStyles) {
|
|
|
28
28
|
return style;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
function useStyles(variants) {
|
|
32
32
|
const theme = useTheme();
|
|
33
33
|
|
|
34
34
|
useForceUpdate(scope);
|
|
@@ -37,6 +37,23 @@ export function createUseStylesTheme(getStyles) {
|
|
|
37
37
|
scope.styles.set(theme, initStyle(theme));
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
if (getVariants) {
|
|
41
|
+
const configVariants = getVariants(theme);
|
|
42
|
+
const requestedVarians = {};
|
|
43
|
+
|
|
44
|
+
for (const key in variants) {
|
|
45
|
+
const value = configVariants[key][variants[key]];
|
|
46
|
+
Object.assign(requestedVarians, value);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return {
|
|
50
|
+
...scope.styles.get(theme),
|
|
51
|
+
...StyleSheet.create({ variants: requestedVarians }),
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
40
55
|
return scope.styles.get(theme);
|
|
41
|
-
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return useStyles;
|
|
42
59
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { StyleSheet } from "react-native";
|
|
2
|
-
import { resetUsing } from "../
|
|
2
|
+
import { resetUsing } from "../dependency-usage";
|
|
3
3
|
import { getDependenciesKeys, subscribe, useForceUpdate } from "./utils";
|
|
4
4
|
|
|
5
|
-
export function createUseStylesWithoutTheme(getStyles,
|
|
5
|
+
export function createUseStylesWithoutTheme(getStyles, getVariants) {
|
|
6
6
|
const scope = {
|
|
7
7
|
style: null,
|
|
8
8
|
variants: null,
|
|
@@ -32,7 +32,8 @@ export function createUseStylesWithoutTheme(getStyles, configVariants) {
|
|
|
32
32
|
function useStyles(variants) {
|
|
33
33
|
useForceUpdate(scope);
|
|
34
34
|
|
|
35
|
-
if (
|
|
35
|
+
if (getVariants) {
|
|
36
|
+
const configVariants = getVariants();
|
|
36
37
|
const requestedVarians = {};
|
|
37
38
|
|
|
38
39
|
for (const key in variants) {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { StyleSheet } from "react-native";
|
|
2
|
+
import { DefaultTheme } from "../default-theme";
|
|
3
|
+
|
|
4
|
+
export function makeUseStyles<
|
|
5
|
+
Theme extends DefaultTheme,
|
|
6
|
+
T extends StyleSheet.NamedStyles<T> | StyleSheet.NamedStyles<any>,
|
|
7
|
+
VariantsConfig extends Record<string, StyleSheet.NamedStyles<any>> | undefined = undefined,
|
|
8
|
+
>(config: {
|
|
9
|
+
styles: (theme: Theme) => T | StyleSheet.NamedStyles<T>;
|
|
10
|
+
variants?: ((theme: Theme) => VariantsConfig) | undefined;
|
|
11
|
+
}): <Variants extends { [Key in keyof VariantsConfig]: keyof VariantsConfig[Key] }>(
|
|
12
|
+
variants?: Partial<Variants>,
|
|
13
|
+
) => T &
|
|
14
|
+
(VariantsConfig extends undefined
|
|
15
|
+
? {}
|
|
16
|
+
: {
|
|
17
|
+
variants: {
|
|
18
|
+
[VKey in keyof Variants]: VKey extends keyof VariantsConfig ? VariantsConfig[VKey][Variants[VKey]] : never;
|
|
19
|
+
}[keyof Variants];
|
|
20
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createUseStylesWithoutTheme } from "./create-use-styles-without-theme";
|
|
2
|
+
import { createUseStylesTheme } from "./create-use-styles-theme";
|
|
3
|
+
|
|
4
|
+
export function makeUseStyles({ styles, variants }) {
|
|
5
|
+
const hasThemeDependency = styles.length === 1;
|
|
6
|
+
|
|
7
|
+
if (!hasThemeDependency) {
|
|
8
|
+
return createUseStylesWithoutTheme(styles, variants);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
return createUseStylesTheme(styles);
|
|
12
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { optimizeDependencies } from "../dimensions/utils";
|
|
2
|
-
import { getUsing } from "../
|
|
3
|
-
import { getDependency } from "../
|
|
2
|
+
import { getUsing } from "../dependency-usage";
|
|
3
|
+
import { getDependency } from "../dependency-registry";
|
|
4
4
|
|
|
5
5
|
import { useEffect, useRef, useState } from "react";
|
|
6
6
|
|
|
@@ -17,9 +17,7 @@ export const useForceUpdate = (scope) => {
|
|
|
17
17
|
scope.forceUpdate = scope.forceUpdate.concat(forceRerender);
|
|
18
18
|
|
|
19
19
|
unsubscribeRef.current = () => {
|
|
20
|
-
scope.forceUpdate = scope.forceUpdate.filter(
|
|
21
|
-
(fn) => fn !== forceRerender,
|
|
22
|
-
);
|
|
20
|
+
scope.forceUpdate = scope.forceUpdate.filter((fn) => fn !== forceRerender);
|
|
23
21
|
};
|
|
24
22
|
}
|
|
25
23
|
|
|
@@ -32,8 +30,7 @@ export const useForceUpdate = (scope) => {
|
|
|
32
30
|
);
|
|
33
31
|
};
|
|
34
32
|
|
|
35
|
-
export const getDependenciesKeys = () =>
|
|
36
|
-
Object.keys(optimizeDependencies(getUsing())).sort();
|
|
33
|
+
export const getDependenciesKeys = () => Object.keys(optimizeDependencies(getUsing())).sort();
|
|
37
34
|
|
|
38
35
|
export const subscribe = (dependenciesKeys, handler) => {
|
|
39
36
|
if (dependenciesKeys.length === 0) {
|
|
@@ -50,9 +47,7 @@ export const subscribe = (dependenciesKeys, handler) => {
|
|
|
50
47
|
const dependencyName = dependenciesKeys[index];
|
|
51
48
|
|
|
52
49
|
if (!onChange) {
|
|
53
|
-
console.warn(
|
|
54
|
-
`[react-native-stylex] Could not find onChange handler for ${dependencyName}!`,
|
|
55
|
-
);
|
|
50
|
+
console.warn(`[react-native-stylex] Could not find onChange handler for ${dependencyName}!`);
|
|
56
51
|
}
|
|
57
52
|
|
|
58
53
|
return !!onChange;
|
package/package.json
CHANGED
package/safe-area/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./init";
|
|
2
2
|
import { EdgeInsets } from "./types";
|
|
3
|
-
export { StylexSaveAreaConsumer } from "./
|
|
4
|
-
export { SafeAreaProvider } from "./
|
|
3
|
+
export { StylexSaveAreaConsumer } from "./stylex-save-area-consumer";
|
|
4
|
+
export { SafeAreaProvider } from "./safe-area-provider";
|
|
5
5
|
export declare function getSafeArea(): EdgeInsets;
|
package/safe-area/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "./init";
|
|
2
|
-
import { onUse } from "../
|
|
2
|
+
import { onUse } from "../dependency-usage";
|
|
3
3
|
import { SAFE_AREA_DEPENDENCY_KEY } from "./consts";
|
|
4
4
|
import { state } from "./state";
|
|
5
|
-
export { StylexSaveAreaConsumer } from "./
|
|
6
|
-
export { SafeAreaProvider } from "./
|
|
5
|
+
export { StylexSaveAreaConsumer } from "./stylex-save-area-consumer";
|
|
6
|
+
export { SafeAreaProvider } from "./safe-area-provider";
|
|
7
7
|
export function getSafeArea() {
|
|
8
8
|
onUse(SAFE_AREA_DEPENDENCY_KEY);
|
|
9
9
|
return state.insets;
|
package/safe-area/init.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { addDependency } from "../
|
|
1
|
+
import { addDependency } from "../dependency-registry";
|
|
2
2
|
import { SAFE_AREA_DEPENDENCY_KEY } from "./consts";
|
|
3
|
-
import { on } from "./
|
|
3
|
+
import { on } from "./event-emitter";
|
|
4
4
|
addDependency(SAFE_AREA_DEPENDENCY_KEY, (handler) => on(handler));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { SafeAreaProvider as CoreSafeAreaProvider, initialWindowMetrics, initialWindowSafeAreaInsets
|
|
3
|
-
import { StylexSaveAreaConsumer } from "./
|
|
2
|
+
import { SafeAreaProvider as CoreSafeAreaProvider, initialWindowMetrics, initialWindowSafeAreaInsets } from "react-native-safe-area-context";
|
|
3
|
+
import { StylexSaveAreaConsumer } from "./stylex-save-area-consumer";
|
|
4
4
|
export function SafeAreaProvider(props) {
|
|
5
5
|
return (<CoreSafeAreaProvider initialSafeAreaInsets={props.initialSafeAreaInsets || initialWindowSafeAreaInsets} initialMetrics={props.initialMetrics || initialWindowMetrics} {...props}>
|
|
6
6
|
{props.children}
|
package/safe-area/state.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
2
|
-
import { emit } from "./
|
|
2
|
+
import { emit } from "./event-emitter";
|
|
3
3
|
import { state } from "./state";
|
|
4
4
|
import { useLayoutEffect } from "react";
|
|
5
5
|
export function StylexSaveAreaConsumer() {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Animated } from "react-native";
|
|
2
|
-
import { DefaultTheme } from "./
|
|
2
|
+
import { DefaultTheme } from "./default-theme";
|
|
3
3
|
export declare function useColorTransition<Theme = DefaultTheme>(colorGetterFn: (theme: Theme) => string, options?: {
|
|
4
4
|
duration: number;
|
|
5
5
|
}): Animated.AnimatedInterpolation<string>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useEffect, useMemo, useRef } from "react";
|
|
2
2
|
import { Animated } from "react-native";
|
|
3
|
-
import { useTheme } from "./
|
|
3
|
+
import { useTheme } from "./use-theme";
|
|
4
4
|
const { Value, timing } = Animated;
|
|
5
5
|
const INITIAL_VALUE = 0;
|
|
6
6
|
const defaultOptions = { duration: 250 };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { DefaultTheme } from "./
|
|
1
|
+
import type { DefaultTheme } from "./default-theme";
|
|
2
2
|
export declare const useTheme: <Theme = DefaultTheme>() => Theme;
|
package/makeUseStyles/index.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { StyleSheet } from "react-native";
|
|
2
|
-
import { DefaultTheme } from "../DefaultTheme";
|
|
3
|
-
|
|
4
|
-
export function makeUseStyles<
|
|
5
|
-
Theme extends DefaultTheme,
|
|
6
|
-
T extends StyleSheet.NamedStyles<T> | StyleSheet.NamedStyles<any>,
|
|
7
|
-
V extends Record<string, StyleSheet.NamedStyles<any>> | undefined,
|
|
8
|
-
>(
|
|
9
|
-
getStyles: (theme: Theme) => T | StyleSheet.NamedStyles<T>,
|
|
10
|
-
variants?: V | undefined,
|
|
11
|
-
): <Variants extends { [Key in keyof V]: keyof V[Key] }>(
|
|
12
|
-
variants?: Partial<Variants>,
|
|
13
|
-
) => T &
|
|
14
|
-
(V extends undefined
|
|
15
|
-
? {}
|
|
16
|
-
: {
|
|
17
|
-
variants: {
|
|
18
|
-
[VKey in keyof Variants]: VKey extends keyof V
|
|
19
|
-
? V[VKey][Variants[VKey]]
|
|
20
|
-
: never;
|
|
21
|
-
}[keyof Variants];
|
|
22
|
-
});
|
package/makeUseStyles/index.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { createUseStylesWithoutTheme } from "./createUseStylesWithoutTheme";
|
|
2
|
-
import { createUseStylesTheme } from "./createUseStylesTheme";
|
|
3
|
-
|
|
4
|
-
export function makeUseStyles(getStyles, variants) {
|
|
5
|
-
const hasThemeDependency = getStyles.length === 1;
|
|
6
|
-
|
|
7
|
-
if (!hasThemeDependency) {
|
|
8
|
-
return createUseStylesWithoutTheme(getStyles, variants);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
return createUseStylesTheme(getStyles);
|
|
12
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|