@codeandmoney/soelma 0.0.0-dev.0 → 0.0.0-dev.10
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/.eslintrc.js +1 -5
- package/biome.jsonc +73 -0
- package/example/AppStyleX/app.json +4 -16
- package/example/AppStyleX/babel.config.js +1 -1
- package/example/AppStyleX/index.js +3 -3
- package/example/AppStyleX/metro.config.js +1 -4
- package/example/AppStyleX/src/App.tsx +7 -10
- package/example/AppStyleX/src/BottomNav/index.tsx +9 -15
- package/example/AppStyleX/src/Circle/index.tsx +6 -6
- package/example/AppStyleX/src/Circle/styles.ts +4 -4
- package/example/AppStyleX/src/Root/index.tsx +12 -18
- package/example/AppStyleX/src/Root/styles.ts +5 -5
- package/example/AppStyleX/src/ToggleButton/index.tsx +10 -24
- package/example/AppStyleX/src/ToggleButton/styles.ts +13 -15
- package/example/AppStyleX/src/style-system/hooks/useAnimatedBgColor.ts +2 -2
- package/example/AppStyleX/src/style-system/hooks/useAnimatedTextColor.ts +2 -2
- package/example/AppStyleX/src/style-system/hooks/useIsDark.ts +2 -2
- package/example/AppStyleX/src/style-system/palette.ts +6 -6
- package/example/AppStyleX/src/style-system/theme.ts +2 -2
- package/example/AppStyleX/src/style-system/utils.ts +4 -7
- package/example/AppStyleX/src/stylex.d.ts +3 -3
- package/package.json +15 -11
- package/src/appearance/index.ts +5 -12
- package/src/appearance/init.ts +2 -2
- package/src/context.ts +2 -5
- package/src/dark-mode/index.ts +2 -5
- package/src/dark-mode/init.ts +2 -2
- package/src/{dependencyUsage.ts → dependency-usage.ts} +0 -10
- package/src/dimensions/index.ts +1 -1
- package/src/dimensions/init.ts +5 -10
- package/src/dimensions/utils.ts +1 -3
- package/src/i18n.ts +1 -4
- package/src/index.ts +6 -6
- package/src/{makeUseStyles/createUseStylesTheme.js → make-use-styles/create-use-styles-theme.js} +23 -6
- package/src/{makeUseStyles/createUseStylesTheme.test.js → make-use-styles/create-use-styles-theme.test.js} +1 -1
- package/src/{makeUseStyles/createUseStylesWithoutTheme.js → make-use-styles/create-use-styles-without-theme.js} +20 -4
- package/src/make-use-styles/index.d.ts +20 -0
- package/src/make-use-styles/index.js +12 -0
- package/src/make-use-styles/types.ts +43 -0
- package/src/{makeUseStyles → make-use-styles}/utils.js +7 -12
- package/src/media-query/base.ts +19 -30
- package/src/media-query/breakpoints.ts +12 -37
- package/src/orientation.ts +3 -7
- package/src/safe-area/{eventEmitter.ts → event-emitter.ts} +1 -1
- package/src/safe-area/index.tsx +3 -3
- package/src/safe-area/init.tsx +2 -2
- package/src/safe-area/safe-area-provider.tsx +18 -0
- package/src/safe-area/{StylexSaveAreaConsumer.ts → stylex-save-area-consumer.ts} +4 -5
- package/src/safe-area/types.ts +2 -2
- package/src/{__tests__ → tests}/createEventEmitter.test.ts +1 -1
- package/src/{__tests__ → tests}/dependencyRegistry.test.ts +1 -1
- package/src/{__tests__ → tests}/dependencyUsage.test.ts +1 -1
- package/src/{__tests__ → tests}/dimensions.test.ts +4 -7
- package/src/{__tests__ → tests}/makeUseStyles.types-test.ts +1 -1
- package/src/{__tests__ → tests}/media-query.test.ts +1 -9
- package/src/{__tests__ → tests}/useTheme.test.ts +1 -1
- package/src/{__tests__ → tests}/withStyles.types-test.tsx +7 -8
- package/src/{useColorTransition.ts → use-color-transition.ts} +3 -3
- package/src/{useTheme.ts → use-theme.ts} +2 -4
- package/src/with-styles.tsx +22 -0
- package/tsconfig.build.json +31 -0
- package/src/makeUseStyles/index.d.ts +0 -7
- package/src/makeUseStyles/index.js +0 -12
- package/src/safe-area/SafeAreaProvider.tsx +0 -17
- package/src/withStyles.tsx +0 -35
- /package/src/{createEventEmitter.ts → create-event-emitter.ts} +0 -0
- /package/src/{DefaultTheme.ts → default-theme.ts} +0 -0
- /package/src/{dependencyRegistry.ts → dependency-registry.ts} +0 -0
- /package/src/{makeUseStyles/createUseStylesWithoutTheme.test.js → make-use-styles/create-use-styles-without-theme.test.js} +0 -0
- /package/src/{makeUseStyles → make-use-styles}/index.test.js +0 -0
- /package/src/{makeUseStyles → make-use-styles}/test-type.js +0 -0
- /package/src/{__tests__ → tests}/createBreakpoints.test.ts +0 -0
- /package/src/{__tests__ → tests}/createBreakpointsMatcher.test.ts +0 -0
- /package/src/{__tests__ → tests}/createBreakpointsMatcher.types-test.ts +0 -0
- /package/src/{__tests__ → tests}/dark-mode.test.ts +0 -0
- /package/src/{__tests__ → tests}/orientation.test.ts +0 -0
package/.eslintrc.js
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
parser: "@typescript-eslint/parser",
|
|
3
|
-
extends: [
|
|
4
|
-
"plugin:react/recommended",
|
|
5
|
-
"plugin:@typescript-eslint/recommended",
|
|
6
|
-
"prettier",
|
|
7
|
-
],
|
|
3
|
+
extends: ["plugin:react/recommended", "plugin:@typescript-eslint/recommended", "prettier"],
|
|
8
4
|
parserOptions: {
|
|
9
5
|
ecmaVersion: 2020,
|
|
10
6
|
sourceType: "module",
|
package/biome.jsonc
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://biomejs.dev/schemas/2.2.5/schema.json",
|
|
3
|
+
"vcs": {
|
|
4
|
+
"enabled": false,
|
|
5
|
+
"clientKind": "git",
|
|
6
|
+
"useIgnoreFile": false
|
|
7
|
+
},
|
|
8
|
+
"files": {
|
|
9
|
+
"ignoreUnknown": false,
|
|
10
|
+
"maxSize": 1001048576
|
|
11
|
+
},
|
|
12
|
+
"formatter": {
|
|
13
|
+
"enabled": true,
|
|
14
|
+
"indentStyle": "space",
|
|
15
|
+
"lineWidth": 160,
|
|
16
|
+
"includes": ["**", "!**/*/routeTree.gen.ts"],
|
|
17
|
+
"formatWithErrors": true
|
|
18
|
+
},
|
|
19
|
+
"css": {
|
|
20
|
+
"parser": {
|
|
21
|
+
"tailwindDirectives": true
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"linter": {
|
|
25
|
+
"enabled": true,
|
|
26
|
+
"rules": {
|
|
27
|
+
"recommended": true,
|
|
28
|
+
"complexity": {
|
|
29
|
+
"noVoid": "off",
|
|
30
|
+
"noArguments": "error",
|
|
31
|
+
"noBannedTypes": "error",
|
|
32
|
+
"noCommaOperator": "error",
|
|
33
|
+
"noEmptyTypeParameters": "error",
|
|
34
|
+
"noExtraBooleanCast": "off",
|
|
35
|
+
"noFlatMapIdentity": "error",
|
|
36
|
+
"noForEach": "error",
|
|
37
|
+
"noImplicitCoercions": "error",
|
|
38
|
+
"noStaticOnlyClass": "error",
|
|
39
|
+
"noUselessCatch": "error",
|
|
40
|
+
"noUselessConstructor": "error",
|
|
41
|
+
"noUselessContinue": "error",
|
|
42
|
+
"noUselessFragments": "error",
|
|
43
|
+
"noUselessLabel": "error",
|
|
44
|
+
"useArrowFunction": "off",
|
|
45
|
+
"useOptionalChain": "error",
|
|
46
|
+
"useSimpleNumberKeys": "error",
|
|
47
|
+
"useWhile": "error"
|
|
48
|
+
},
|
|
49
|
+
"suspicious": {
|
|
50
|
+
"noVar": "error",
|
|
51
|
+
"useAwait": "error",
|
|
52
|
+
"useDefaultSwitchClauseLast": "error"
|
|
53
|
+
},
|
|
54
|
+
"correctness": {
|
|
55
|
+
"noUnusedVariables": "off",
|
|
56
|
+
"noVoidTypeReturn": "off"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
"javascript": {
|
|
61
|
+
"formatter": {
|
|
62
|
+
"quoteStyle": "double"
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
"assist": {
|
|
66
|
+
"enabled": true,
|
|
67
|
+
"actions": {
|
|
68
|
+
"source": {
|
|
69
|
+
"organizeImports": "on"
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -8,21 +8,9 @@
|
|
|
8
8
|
}
|
|
9
9
|
],
|
|
10
10
|
"resources": {
|
|
11
|
-
"android": [
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
]
|
|
15
|
-
"ios": [
|
|
16
|
-
"dist/assets",
|
|
17
|
-
"dist/main.ios.jsbundle"
|
|
18
|
-
],
|
|
19
|
-
"macos": [
|
|
20
|
-
"dist/assets",
|
|
21
|
-
"dist/main.macos.jsbundle"
|
|
22
|
-
],
|
|
23
|
-
"windows": [
|
|
24
|
-
"dist/assets",
|
|
25
|
-
"dist/main.windows.bundle"
|
|
26
|
-
]
|
|
11
|
+
"android": ["dist/res", "dist/main.android.jsbundle"],
|
|
12
|
+
"ios": ["dist/assets", "dist/main.ios.jsbundle"],
|
|
13
|
+
"macos": ["dist/assets", "dist/main.macos.jsbundle"],
|
|
14
|
+
"windows": ["dist/assets", "dist/main.windows.bundle"]
|
|
27
15
|
}
|
|
28
16
|
}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* @format
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import {AppRegistry} from
|
|
6
|
-
import {App} from
|
|
7
|
-
import {name as appName} from
|
|
5
|
+
import { AppRegistry } from "react-native";
|
|
6
|
+
import { App } from "./src/App";
|
|
7
|
+
import { name as appName } from "./app.json";
|
|
8
8
|
|
|
9
9
|
AppRegistry.registerComponent(appName, () => App);
|
|
@@ -44,10 +44,7 @@ const config = {
|
|
|
44
44
|
|
|
45
45
|
try {
|
|
46
46
|
// Starting with react-native 0.72, we are required to provide a full config.
|
|
47
|
-
const {
|
|
48
|
-
getDefaultConfig,
|
|
49
|
-
mergeConfig,
|
|
50
|
-
} = require("@react-native/metro-config");
|
|
47
|
+
const { getDefaultConfig, mergeConfig } = require("@react-native/metro-config");
|
|
51
48
|
module.exports = mergeConfig(getDefaultConfig(__dirname), config);
|
|
52
49
|
} catch (_) {
|
|
53
50
|
module.exports = config;
|
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
import React, {useState} from
|
|
2
|
-
import {ThemeProvider} from
|
|
3
|
-
import {SafeAreaProvider} from
|
|
4
|
-
import {StylexSaveAreaConsumer} from
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import { ThemeProvider } from "react-native-stylex";
|
|
3
|
+
import { SafeAreaProvider } from "react-native-safe-area-context";
|
|
4
|
+
import { StylexSaveAreaConsumer } from "react-native-stylex/safe-area";
|
|
5
5
|
|
|
6
|
-
import {darkTheme, lightTheme} from
|
|
6
|
+
import { darkTheme, lightTheme } from "./style-system/theme";
|
|
7
7
|
|
|
8
|
-
import {Root} from
|
|
8
|
+
import { Root } from "./Root";
|
|
9
9
|
|
|
10
10
|
export const App = () => {
|
|
11
11
|
const [theme, setTheme] = useState(lightTheme);
|
|
12
|
-
const toggleTheme = () =>
|
|
13
|
-
setTheme((currentTheme) =>
|
|
14
|
-
currentTheme === darkTheme ? lightTheme : darkTheme,
|
|
15
|
-
);
|
|
12
|
+
const toggleTheme = () => setTheme((currentTheme) => (currentTheme === darkTheme ? lightTheme : darkTheme));
|
|
16
13
|
|
|
17
14
|
return (
|
|
18
15
|
<SafeAreaProvider>
|
|
@@ -1,31 +1,25 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import {Animated} from
|
|
3
|
-
import {useColorTransition} from
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Animated } from "react-native";
|
|
3
|
+
import { useColorTransition } from "react-native-stylex";
|
|
4
4
|
|
|
5
|
-
import {useAnimatedBgColor} from
|
|
6
|
-
import {useAnimatedTextColor} from
|
|
5
|
+
import { useAnimatedBgColor } from "../style-system/hooks/useAnimatedBgColor";
|
|
6
|
+
import { useAnimatedTextColor } from "../style-system/hooks/useAnimatedTextColor";
|
|
7
7
|
|
|
8
|
-
import {useStyles} from
|
|
8
|
+
import { useStyles } from "./styles";
|
|
9
9
|
|
|
10
10
|
export const BottomNav = () => {
|
|
11
11
|
const styles = useStyles();
|
|
12
12
|
const bgStyle = useAnimatedBgColor();
|
|
13
13
|
const textStyle = useAnimatedTextColor();
|
|
14
14
|
const skipAnimatedStyle = {
|
|
15
|
-
color: useColorTransition(({palette, utils}) =>
|
|
16
|
-
utils.fade(palette.text, 0.5),
|
|
17
|
-
),
|
|
15
|
+
color: useColorTransition(({ palette, utils }) => utils.fade(palette.text, 0.5)),
|
|
18
16
|
};
|
|
19
17
|
|
|
20
18
|
return (
|
|
21
19
|
<>
|
|
22
|
-
<Animated.Text style={[styles.skipBtn, skipAnimatedStyle]}>
|
|
23
|
-
Skip
|
|
24
|
-
</Animated.Text>
|
|
20
|
+
<Animated.Text style={[styles.skipBtn, skipAnimatedStyle]}>Skip</Animated.Text>
|
|
25
21
|
<Animated.View style={[styles.nextButton, bgStyle]}>
|
|
26
|
-
<Animated.Text style={[styles.nextButtonText, textStyle]}>
|
|
27
|
-
→
|
|
28
|
-
</Animated.Text>
|
|
22
|
+
<Animated.Text style={[styles.nextButtonText, textStyle]}>→</Animated.Text>
|
|
29
23
|
</Animated.View>
|
|
30
24
|
</>
|
|
31
25
|
);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import React, {useEffect, useRef} from
|
|
2
|
-
import {Animated, View} from
|
|
1
|
+
import React, { useEffect, useRef } from "react";
|
|
2
|
+
import { Animated, View } from "react-native";
|
|
3
3
|
|
|
4
|
-
import {useIsDark} from
|
|
5
|
-
import {useAnimatedBgColor} from
|
|
4
|
+
import { useIsDark } from "../style-system/hooks/useIsDark";
|
|
5
|
+
import { useAnimatedBgColor } from "../style-system/hooks/useAnimatedBgColor";
|
|
6
6
|
|
|
7
|
-
import {useStyles} from
|
|
7
|
+
import { useStyles } from "./styles";
|
|
8
8
|
|
|
9
|
-
const {Value, timing} = Animated;
|
|
9
|
+
const { Value, timing } = Animated;
|
|
10
10
|
|
|
11
11
|
export const Circle = () => {
|
|
12
12
|
const styles = useStyles();
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {makeUseStyles} from
|
|
1
|
+
import { makeUseStyles } from "react-native-stylex";
|
|
2
2
|
|
|
3
|
-
export const useStyles = makeUseStyles(({palette}) => ({
|
|
3
|
+
export const useStyles = makeUseStyles(({ palette }) => ({
|
|
4
4
|
root: {
|
|
5
|
-
alignSelf:
|
|
5
|
+
alignSelf: "center",
|
|
6
6
|
},
|
|
7
7
|
circle: {
|
|
8
8
|
width: 150,
|
|
@@ -12,7 +12,7 @@ export const useStyles = makeUseStyles(({palette}) => ({
|
|
|
12
12
|
marginBottom: 80,
|
|
13
13
|
},
|
|
14
14
|
overlay: {
|
|
15
|
-
position:
|
|
15
|
+
position: "absolute",
|
|
16
16
|
right: -20,
|
|
17
17
|
top: -20,
|
|
18
18
|
width: 145,
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import {Animated} from
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Animated } from "react-native";
|
|
3
3
|
|
|
4
|
-
import {useAnimatedBgColor} from
|
|
5
|
-
import {useAnimatedTextColor} from
|
|
4
|
+
import { useAnimatedBgColor } from "../style-system/hooks/useAnimatedBgColor";
|
|
5
|
+
import { useAnimatedTextColor } from "../style-system/hooks/useAnimatedTextColor";
|
|
6
6
|
|
|
7
|
-
import {ToggleButton} from
|
|
8
|
-
import {BottomNav} from
|
|
9
|
-
import {Circle} from
|
|
7
|
+
import { ToggleButton } from "../ToggleButton";
|
|
8
|
+
import { BottomNav } from "../BottomNav";
|
|
9
|
+
import { Circle } from "../Circle";
|
|
10
10
|
|
|
11
|
-
import {useStyles} from
|
|
11
|
+
import { useStyles } from "./styles";
|
|
12
12
|
|
|
13
13
|
interface Props {
|
|
14
14
|
toggleTheme: () => void;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
// Concept: https://dribbble.com/shots/5846239-Light-dark-toggle-switch-InVision-Studio
|
|
18
|
-
export const Root = ({toggleTheme}: Props) => {
|
|
18
|
+
export const Root = ({ toggleTheme }: Props) => {
|
|
19
19
|
const styles = useStyles();
|
|
20
20
|
const bgStyle = useAnimatedBgColor();
|
|
21
21
|
const textStyle = useAnimatedTextColor();
|
|
@@ -24,15 +24,9 @@ export const Root = ({toggleTheme}: Props) => {
|
|
|
24
24
|
<Animated.View style={[styles.root, bgStyle]}>
|
|
25
25
|
<Circle />
|
|
26
26
|
|
|
27
|
-
<Animated.Text style={[styles.title, textStyle]}>
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
<Animated.Text style={[styles.text, textStyle]}>
|
|
31
|
-
Pop or subtle. Day or night.
|
|
32
|
-
</Animated.Text>
|
|
33
|
-
<Animated.Text style={[styles.text, textStyle]}>
|
|
34
|
-
Customize your interface.
|
|
35
|
-
</Animated.Text>
|
|
27
|
+
<Animated.Text style={[styles.title, textStyle]}>Choose a style</Animated.Text>
|
|
28
|
+
<Animated.Text style={[styles.text, textStyle]}>Pop or subtle. Day or night.</Animated.Text>
|
|
29
|
+
<Animated.Text style={[styles.text, textStyle]}>Customize your interface.</Animated.Text>
|
|
36
30
|
|
|
37
31
|
<ToggleButton onPress={toggleTheme} />
|
|
38
32
|
<BottomNav />
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import {makeUseStyles} from
|
|
1
|
+
import { makeUseStyles } from "react-native-stylex";
|
|
2
2
|
|
|
3
3
|
export const useStyles = makeUseStyles(() => ({
|
|
4
4
|
root: {
|
|
5
5
|
flex: 1,
|
|
6
|
-
justifyContent:
|
|
6
|
+
justifyContent: "center",
|
|
7
7
|
},
|
|
8
8
|
title: {
|
|
9
|
-
textAlign:
|
|
9
|
+
textAlign: "center",
|
|
10
10
|
fontSize: 26,
|
|
11
|
-
fontWeight:
|
|
11
|
+
fontWeight: "600",
|
|
12
12
|
marginBottom: 16,
|
|
13
13
|
},
|
|
14
14
|
text: {
|
|
15
|
-
textAlign:
|
|
15
|
+
textAlign: "center",
|
|
16
16
|
fontSize: 20,
|
|
17
17
|
},
|
|
18
18
|
}));
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import React, {useEffect, useRef} from
|
|
2
|
-
import {Animated, View, Pressable, Text} from
|
|
3
|
-
import {useColorTransition} from
|
|
1
|
+
import React, { useEffect, useRef } from "react";
|
|
2
|
+
import { Animated, View, Pressable, Text } from "react-native";
|
|
3
|
+
import { useColorTransition } from "react-native-stylex";
|
|
4
4
|
|
|
5
|
-
import {useIsDark} from
|
|
5
|
+
import { useIsDark } from "../style-system/hooks/useIsDark";
|
|
6
6
|
|
|
7
|
-
import {useStyles, ROOT_WIDTH} from
|
|
7
|
+
import { useStyles, ROOT_WIDTH } from "./styles";
|
|
8
8
|
|
|
9
|
-
const {Value, spring} = Animated;
|
|
9
|
+
const { Value, spring } = Animated;
|
|
10
10
|
const HALF_ROOT_WIDTH = ROOT_WIDTH / 2;
|
|
11
11
|
|
|
12
12
|
interface Props {
|
|
13
13
|
onPress: () => void;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
export const ToggleButton = ({onPress}: Props) => {
|
|
16
|
+
export const ToggleButton = ({ onPress }: Props) => {
|
|
17
17
|
const styles = useStyles();
|
|
18
18
|
const isDark = useIsDark();
|
|
19
19
|
const bgStyle = {
|
|
20
|
-
backgroundColor: useColorTransition(({palette}) => palette.bg),
|
|
20
|
+
backgroundColor: useColorTransition(({ palette }) => palette.bg),
|
|
21
21
|
};
|
|
22
22
|
const animatedOffset = useRef(new Value(0));
|
|
23
23
|
const animatedStyle = {
|
|
@@ -43,22 +43,8 @@ export const ToggleButton = ({onPress}: Props) => {
|
|
|
43
43
|
<View style={styles.root}>
|
|
44
44
|
<Animated.View style={[styles.activeBg, animatedStyle, bgStyle]} />
|
|
45
45
|
<View style={styles.labelsRoot}>
|
|
46
|
-
<Text
|
|
47
|
-
|
|
48
|
-
styles.labelText,
|
|
49
|
-
styles.lightLabelText,
|
|
50
|
-
!isDark && styles.activeLabelText,
|
|
51
|
-
]}>
|
|
52
|
-
Light
|
|
53
|
-
</Text>
|
|
54
|
-
<Text
|
|
55
|
-
style={[
|
|
56
|
-
styles.labelText,
|
|
57
|
-
styles.darkLabelText,
|
|
58
|
-
isDark && styles.activeLabelText,
|
|
59
|
-
]}>
|
|
60
|
-
Dark
|
|
61
|
-
</Text>
|
|
46
|
+
<Text style={[styles.labelText, styles.lightLabelText, !isDark && styles.activeLabelText]}>Light</Text>
|
|
47
|
+
<Text style={[styles.labelText, styles.darkLabelText, isDark && styles.activeLabelText]}>Dark</Text>
|
|
62
48
|
</View>
|
|
63
49
|
</View>
|
|
64
50
|
</Pressable>
|
|
@@ -1,24 +1,22 @@
|
|
|
1
|
-
import {makeUseStyles} from
|
|
2
|
-
import {StyleSheet, Platform} from
|
|
1
|
+
import { makeUseStyles } from "react-native-stylex";
|
|
2
|
+
import { StyleSheet, Platform } from "react-native";
|
|
3
3
|
|
|
4
4
|
export const ROOT_WIDTH = 280;
|
|
5
5
|
|
|
6
|
-
export const useStyles = makeUseStyles(({palette, utils}) => ({
|
|
6
|
+
export const useStyles = makeUseStyles(({ palette, utils }) => ({
|
|
7
7
|
root: {
|
|
8
8
|
marginTop: 36,
|
|
9
|
-
alignSelf:
|
|
9
|
+
alignSelf: "center",
|
|
10
10
|
height: 60,
|
|
11
11
|
borderRadius: 60,
|
|
12
12
|
width: ROOT_WIDTH,
|
|
13
|
-
backgroundColor: utils.isDark(palette.bg)
|
|
14
|
-
? utils.lighten(palette.bg, 0.3)
|
|
15
|
-
: utils.darken(palette.bg, 0.3),
|
|
13
|
+
backgroundColor: utils.isDark(palette.bg) ? utils.lighten(palette.bg, 0.3) : utils.darken(palette.bg, 0.3),
|
|
16
14
|
},
|
|
17
15
|
activeBg: {
|
|
18
|
-
width:
|
|
19
|
-
height:
|
|
16
|
+
width: "50%",
|
|
17
|
+
height: "100%",
|
|
20
18
|
borderRadius: 60,
|
|
21
|
-
position:
|
|
19
|
+
position: "absolute",
|
|
22
20
|
top: 0,
|
|
23
21
|
left: 0,
|
|
24
22
|
backgroundColor: palette.bg,
|
|
@@ -39,15 +37,15 @@ export const useStyles = makeUseStyles(({palette, utils}) => ({
|
|
|
39
37
|
elevation: 5,
|
|
40
38
|
},
|
|
41
39
|
labelText: {
|
|
42
|
-
position:
|
|
43
|
-
height:
|
|
44
|
-
width:
|
|
40
|
+
position: "absolute",
|
|
41
|
+
height: "100%",
|
|
42
|
+
width: "50%",
|
|
45
43
|
top: 0,
|
|
46
44
|
|
|
47
45
|
fontSize: 20,
|
|
48
|
-
fontWeight:
|
|
46
|
+
fontWeight: "700",
|
|
49
47
|
color: utils.fade(palette.text, 0.5),
|
|
50
|
-
textAlign:
|
|
48
|
+
textAlign: "center",
|
|
51
49
|
...Platform.select({
|
|
52
50
|
web: {
|
|
53
51
|
lineHeight: 60,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {useColorTransition} from
|
|
1
|
+
import { useColorTransition } from "react-native-stylex";
|
|
2
2
|
|
|
3
3
|
export const useAnimatedBgColor = () => ({
|
|
4
|
-
backgroundColor: useColorTransition(({palette}) => palette.bg),
|
|
4
|
+
backgroundColor: useColorTransition(({ palette }) => palette.bg),
|
|
5
5
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {useColorTransition} from
|
|
1
|
+
import { useColorTransition } from "react-native-stylex";
|
|
2
2
|
|
|
3
3
|
export const useAnimatedTextColor = () => ({
|
|
4
|
-
color: useColorTransition(({palette}) => palette.text),
|
|
4
|
+
color: useColorTransition(({ palette }) => palette.text),
|
|
5
5
|
});
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export const lightPalette = {
|
|
2
|
-
text:
|
|
3
|
-
bg:
|
|
4
|
-
accent:
|
|
2
|
+
text: "#000",
|
|
3
|
+
bg: "#fff",
|
|
4
|
+
accent: "#ff643d",
|
|
5
5
|
};
|
|
6
6
|
|
|
7
7
|
export const darkPalette = {
|
|
8
|
-
text:
|
|
9
|
-
bg:
|
|
10
|
-
accent:
|
|
8
|
+
text: "#fff",
|
|
9
|
+
bg: "#262431",
|
|
10
|
+
accent: "#8d8aff",
|
|
11
11
|
};
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import Color from
|
|
1
|
+
import Color from "color";
|
|
2
2
|
|
|
3
3
|
export const utils = {
|
|
4
4
|
isDark: (color: string): boolean => Color(color).isDark(),
|
|
5
|
-
fade: (color: string, alpha: number): string =>
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Color(color).lighten(val).string(),
|
|
9
|
-
darken: (color: string, val: number): string =>
|
|
10
|
-
Color(color).darken(val).string(),
|
|
5
|
+
fade: (color: string, alpha: number): string => Color(color).alpha(alpha).string(),
|
|
6
|
+
lighten: (color: string, val: number): string => Color(color).lighten(val).string(),
|
|
7
|
+
darken: (color: string, val: number): string => Color(color).darken(val).string(),
|
|
11
8
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type {Theme} from
|
|
1
|
+
import "react-native-stylex";
|
|
2
|
+
import type { Theme } from "./style-system/theme";
|
|
3
3
|
|
|
4
|
-
declare module
|
|
4
|
+
declare module "react-native-stylex" {
|
|
5
5
|
export interface DefaultTheme extends Theme {}
|
|
6
6
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codeandmoney/soelma",
|
|
3
|
-
"publishConfig": {
|
|
4
|
-
|
|
3
|
+
"publishConfig": {
|
|
4
|
+
"access": "public"
|
|
5
|
+
},
|
|
6
|
+
"version": "0.0.0-dev.10",
|
|
5
7
|
"private": false,
|
|
6
8
|
"main": "index.js",
|
|
7
9
|
"types": "index.d.ts",
|
|
@@ -10,9 +12,10 @@
|
|
|
10
12
|
"license": "MIT",
|
|
11
13
|
"scripts": {
|
|
12
14
|
"prebuild": "rm -rf lib",
|
|
13
|
-
"build": "tsc",
|
|
14
|
-
"postbuild": "mkdir lib/
|
|
15
|
+
"build": "tsc -p ./tsconfig.build.json",
|
|
16
|
+
"postbuild": "mkdir -p lib/make-use-styles && cp src/make-use-styles/* lib/make-use-styles && rm -rf lib/**/*test.* && prettier --write lib/**/*.{js,ts}",
|
|
15
17
|
"clean-publish": "yarn test && yarn build && node ./node_modules/clean-publish/clear-package-json.js package.json > lib/package.json && cp CHANGELOG.md LICENSE README.md lib",
|
|
18
|
+
"pub": "yarn build && node ./node_modules/clean-publish/clear-package-json.js package.json > lib/package.json && cp CHANGELOG.md LICENSE README.md lib",
|
|
16
19
|
"publish-next": "yarn clean-publish && cd lib && npm publish --tag next",
|
|
17
20
|
"presize": "yarn build",
|
|
18
21
|
"postinstall": "rm -rf node_modules/@types/node node_modules/@types/yauzl node_modules/@types/graceful-fs",
|
|
@@ -34,10 +37,11 @@
|
|
|
34
37
|
}
|
|
35
38
|
},
|
|
36
39
|
"devDependencies": {
|
|
40
|
+
"@react-native/babel-preset": "^0.83.0",
|
|
37
41
|
"@size-limit/preset-app": "^11.0.1",
|
|
38
42
|
"@testing-library/react-hooks": "^8.0.1",
|
|
39
|
-
"@types/jest": "^
|
|
40
|
-
"@types/react": "^
|
|
43
|
+
"@types/jest": "^30.0.0",
|
|
44
|
+
"@types/react": "^19.2.7",
|
|
41
45
|
"@typescript-eslint/eslint-plugin": "^6.14.0",
|
|
42
46
|
"@typescript-eslint/parser": "^6.14.0",
|
|
43
47
|
"clean-publish": "^4.2.0",
|
|
@@ -47,12 +51,12 @@
|
|
|
47
51
|
"eslint-plugin-react": "^7.33.2",
|
|
48
52
|
"jest": "^29.7.0",
|
|
49
53
|
"prettier": "^3.1.1",
|
|
50
|
-
"react": "^
|
|
51
|
-
"react-native": "^0.
|
|
54
|
+
"react": "^19.2.3",
|
|
55
|
+
"react-native": "^0.83.0",
|
|
52
56
|
"react-native-dark-mode": "^0.2.2",
|
|
53
|
-
"react-native-safe-area-context": "^
|
|
54
|
-
"react-native-test-app": "^
|
|
55
|
-
"react-test-renderer": "^
|
|
57
|
+
"react-native-safe-area-context": "^5.6.2",
|
|
58
|
+
"react-native-test-app": "^5.0.5",
|
|
59
|
+
"react-test-renderer": "^19.2.3",
|
|
56
60
|
"size-limit": "^11.0.1",
|
|
57
61
|
"typescript": "^5.3.3"
|
|
58
62
|
}
|
package/src/appearance/index.ts
CHANGED
|
@@ -2,17 +2,13 @@ import "./init";
|
|
|
2
2
|
|
|
3
3
|
import { Appearance } from "react-native";
|
|
4
4
|
|
|
5
|
-
import { onUse } from "../
|
|
5
|
+
import { onUse } from "../dependency-usage";
|
|
6
6
|
|
|
7
7
|
import { UI_MODE_DEPENDENCY_KEY } from "./consts";
|
|
8
8
|
|
|
9
9
|
export type ColorSchemeName = "light" | "dark" | "default";
|
|
10
10
|
|
|
11
|
-
export function appearance<T>({
|
|
12
|
-
dark,
|
|
13
|
-
light,
|
|
14
|
-
default: defaultScheme,
|
|
15
|
-
}: { [mode in ColorSchemeName]?: T }): T | undefined {
|
|
11
|
+
export function appearance<T>({ dark, light, default: defaultScheme }: { [mode in ColorSchemeName]?: T }): T | undefined {
|
|
16
12
|
onUse(UI_MODE_DEPENDENCY_KEY);
|
|
17
13
|
|
|
18
14
|
// Note: getColorScheme() will always return light when debugging with Chrome.
|
|
@@ -27,11 +23,8 @@ export function appearance<T>({
|
|
|
27
23
|
return defaultScheme;
|
|
28
24
|
}
|
|
29
25
|
|
|
30
|
-
export const darkAppearance = <T>(dark: T): T | undefined =>
|
|
31
|
-
appearance<T>({ dark });
|
|
26
|
+
export const darkAppearance = <T>(dark: T): T | undefined => appearance<T>({ dark });
|
|
32
27
|
|
|
33
|
-
export const lightAppearance = <T>(light: T): T | undefined =>
|
|
34
|
-
appearance<T>({ light });
|
|
28
|
+
export const lightAppearance = <T>(light: T): T | undefined => appearance<T>({ light });
|
|
35
29
|
|
|
36
|
-
export const noPreferenceAppearance = <T>(defaultScheme: T): T | undefined =>
|
|
37
|
-
appearance<T>({ default: defaultScheme });
|
|
30
|
+
export const noPreferenceAppearance = <T>(defaultScheme: T): T | undefined => appearance<T>({ default: defaultScheme });
|
package/src/appearance/init.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Appearance } from "react-native";
|
|
2
2
|
|
|
3
|
-
import { addDependency } from "../
|
|
4
|
-
import { createEventEmitter } from "../
|
|
3
|
+
import { addDependency } from "../dependency-registry";
|
|
4
|
+
import { createEventEmitter } from "../create-event-emitter";
|
|
5
5
|
|
|
6
6
|
import { UI_MODE_DEPENDENCY_KEY } from "./consts";
|
|
7
7
|
|
package/src/context.ts
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { createContext } from "react";
|
|
2
|
-
import { DefaultTheme } from "./
|
|
2
|
+
import { DefaultTheme } from "./default-theme";
|
|
3
3
|
|
|
4
4
|
export const themeContext = createContext<DefaultTheme | null>(null);
|
|
5
5
|
|
|
6
|
-
export const {
|
|
7
|
-
Provider: ThemeProvider,
|
|
8
|
-
Consumer: ThemeConsumer,
|
|
9
|
-
} = themeContext;
|
|
6
|
+
export const { Provider: ThemeProvider, Consumer: ThemeConsumer } = themeContext;
|