esoftplay 0.0.119-r → 0.0.119-u
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/bin/router.js +1 -1
- package/global.ts +11 -12
- package/import_migrator.mjs +4 -4
- package/modules/lib/dialog.tsx +2 -4
- package/modules/lib/image.tsx +2 -2
- package/modules/lib/locale.ts +2 -1
- package/modules/lib/net_status.tsx +2 -1
- package/modules/lib/notification.ts +2 -1
- package/modules/lib/notify.ts +1 -1
- package/modules/lib/progress.tsx +1 -1
- package/modules/lib/theme.tsx +2 -1
- package/modules/lib/toast.tsx +1 -2
- package/modules/lib/utils.ts +2 -1
- package/modules/user/class.ts +1 -1
- package/modules/user/index.tsx +1 -1
- package/modules/user/notification.tsx +2 -1
- package/modules/user/routes.ts +2 -2
- package/package.json +1 -1
package/bin/router.js
CHANGED
|
@@ -385,7 +385,7 @@ import { AntDesignTypes, EntypoTypes, EvilIconsTypes, FeatherTypes, FontAwesomeT
|
|
|
385
385
|
|
|
386
386
|
declare module "esoftplay" {
|
|
387
387
|
var _global: any;
|
|
388
|
-
function useGlobalState<S>(initialState?: S, option?: useGlobalOption): useGlobalReturn<S>;
|
|
388
|
+
// function useGlobalState<S>(initialState?: S, option?: useGlobalOption): useGlobalReturn<S>;
|
|
389
389
|
function usePersistState<S>(key: string, initialState?: S | (() => S)): [S, (a: S | ((b: S )=> S)) => S | undefined, (a?: (x: S) => void) => void, () => void];
|
|
390
390
|
function useSafeState<S>(initialState?: S | (() => S)): [S, (a: S | ((b: S )=> S)) => S | undefined];
|
|
391
391
|
function applyStyle<T>(style: T): T;
|
package/global.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
2
|
+
import { UserData } from 'esoftplay/cache/user/data.import';
|
|
2
3
|
import * as R from 'react';
|
|
3
4
|
import { fastFilter, fastLoop } from './fast';
|
|
4
5
|
const _global = require('./_global')
|
|
@@ -25,21 +26,21 @@ export interface useGlobalConnect<T> {
|
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
_global.useGlobalUserDelete = {}
|
|
28
|
-
let useGlobalSubscriber = {}
|
|
29
|
+
let useGlobalSubscriber: any = {}
|
|
29
30
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
reset = () => {
|
|
34
|
-
this.idx = 0
|
|
35
|
-
}
|
|
31
|
+
let idx = 0
|
|
32
|
+
const Context = {
|
|
33
|
+
reset: () => idx = 0
|
|
36
34
|
}
|
|
37
35
|
|
|
38
|
-
export const globalIdx =
|
|
36
|
+
export const globalIdx = Context
|
|
39
37
|
export default function useGlobalState<T>(initValue: T, o?: useGlobalOption): useGlobalReturn<T> {
|
|
40
38
|
const Storage = require('./storage').default;
|
|
41
39
|
const STORAGE = o?.inFile ? new Storage() : AsyncStorage
|
|
42
|
-
const _idx =
|
|
40
|
+
const _idx = idx
|
|
41
|
+
if (!useGlobalSubscriber) {
|
|
42
|
+
useGlobalSubscriber = {}
|
|
43
|
+
}
|
|
43
44
|
if (!useGlobalSubscriber[_idx])
|
|
44
45
|
useGlobalSubscriber[_idx] = [];
|
|
45
46
|
let value: T = initValue;
|
|
@@ -67,8 +68,6 @@ export default function useGlobalState<T>(initValue: T, o?: useGlobalOption): us
|
|
|
67
68
|
set(initValue)
|
|
68
69
|
}
|
|
69
70
|
if (o?.persistKey) {
|
|
70
|
-
const esp = require('./esp').default;
|
|
71
|
-
const UserData = esp.mod('user/data')
|
|
72
71
|
if (UserData)
|
|
73
72
|
UserData?.register?.(o?.persistKey)
|
|
74
73
|
}
|
|
@@ -157,6 +156,6 @@ export default function useGlobalState<T>(initValue: T, o?: useGlobalOption): us
|
|
|
157
156
|
return children ? R.cloneElement(children) : null
|
|
158
157
|
}
|
|
159
158
|
|
|
160
|
-
|
|
159
|
+
idx++
|
|
161
160
|
return { useState, get, set, useSelector, reset: del, connect: _connect };
|
|
162
161
|
}
|
package/import_migrator.mjs
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import fs from 'fs'
|
|
2
2
|
const pattern = new RegExp(/\n{0,}import ((.*)) from (?:"esoftplay"|'esoftplay');?/gs)
|
|
3
|
+
const globalPattern = new RegExp(/((?:, useGlobalState|useGlobalState,|\{\s{0,}useGlobalState\s{0,}\}))/gs)
|
|
3
4
|
if (fs.existsSync('./modules')) {
|
|
4
5
|
fs.readdirSync('./modules').forEach((module) => {
|
|
5
6
|
if (!module.startsWith('.')) {
|
|
6
7
|
fs.readdirSync('./modules/' + module).forEach((task) => {
|
|
7
|
-
// if (task == 'card.tsx') {
|
|
8
8
|
var dFile = fs.readFileSync('./modules/' + module + '/' + task, { encoding: 'utf8' })
|
|
9
9
|
const matchs = dFile.match(pattern)
|
|
10
|
+
const matchGlobal = dFile.match(globalPattern)
|
|
10
11
|
if (matchs) {
|
|
11
12
|
let espMod = []
|
|
12
13
|
let nonEspMod = []
|
|
@@ -33,11 +34,10 @@ if (fs.existsSync('./modules')) {
|
|
|
33
34
|
})
|
|
34
35
|
}
|
|
35
36
|
dFile = dFile.replace(cmatch, "\nimport { " + espMod.join(", ") + " } from 'esoftplay';\n" + adder)
|
|
37
|
+
if (matchGlobal)
|
|
38
|
+
dFile = dFile.replace(matchGlobal, "\nimport useGlobalState from 'esoftplay/global';\n")
|
|
36
39
|
fs.writeFileSync('./modules/' + module + '/' + task, dFile, { encoding: 'utf8' })
|
|
37
|
-
// }
|
|
38
|
-
|
|
39
40
|
}
|
|
40
|
-
// return
|
|
41
41
|
})
|
|
42
42
|
}
|
|
43
43
|
})
|
package/modules/lib/dialog.tsx
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
// noPage
|
|
2
|
-
import { useGlobalState } from 'esoftplay';
|
|
3
|
-
|
|
4
2
|
import { LibComponent } from 'esoftplay/cache/lib/component.import';
|
|
5
|
-
import { LibIcon } from 'esoftplay/cache/lib/icon.import';
|
|
6
|
-
import { LibIconStyle } from 'esoftplay/cache/lib/icon.import';
|
|
3
|
+
import { LibIcon, LibIconStyle } from 'esoftplay/cache/lib/icon.import';
|
|
7
4
|
import { LibStyle } from 'esoftplay/cache/lib/style.import';
|
|
8
5
|
import { LibTextstyle } from 'esoftplay/cache/lib/textstyle.import';
|
|
9
6
|
import { LibTheme } from 'esoftplay/cache/lib/theme.import';
|
|
7
|
+
import useGlobalState from 'esoftplay/global';
|
|
10
8
|
|
|
11
9
|
import React from 'react';
|
|
12
10
|
import { BackHandler, Keyboard, TouchableOpacity, View } from 'react-native';
|
package/modules/lib/image.tsx
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// noPage
|
|
2
|
-
import { esp
|
|
2
|
+
import { esp } from 'esoftplay';
|
|
3
3
|
import { LibComponent } from 'esoftplay/cache/lib/component.import';
|
|
4
4
|
import { LibCurl } from 'esoftplay/cache/lib/curl.import';
|
|
5
5
|
import { LibIcon } from 'esoftplay/cache/lib/icon.import';
|
|
6
6
|
import { LibNavigation } from 'esoftplay/cache/lib/navigation.import';
|
|
7
7
|
import { LibProgress } from 'esoftplay/cache/lib/progress.import';
|
|
8
8
|
import { LibStyle } from 'esoftplay/cache/lib/style.import';
|
|
9
|
-
|
|
9
|
+
import useGlobalState from 'esoftplay/global';
|
|
10
10
|
import { Camera } from 'expo-camera';
|
|
11
11
|
import * as ImageManipulator from 'expo-image-manipulator';
|
|
12
12
|
import { SaveFormat } from 'expo-image-manipulator';
|
package/modules/lib/locale.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// noPage
|
|
2
|
-
import { useGlobalReturn
|
|
2
|
+
import { useGlobalReturn } from 'esoftplay';
|
|
3
3
|
import { LibComponent } from 'esoftplay/cache/lib/component.import';
|
|
4
|
+
import useGlobalState from 'esoftplay/global';
|
|
4
5
|
|
|
5
6
|
import React from "react";
|
|
6
7
|
import { Animated, Text } from "react-native";
|
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
import { useGlobalReturn } from 'esoftplay';
|
|
3
3
|
// noPage
|
|
4
4
|
|
|
5
|
-
import { esp
|
|
5
|
+
import { esp } from 'esoftplay';
|
|
6
6
|
import { LibCrypt } from 'esoftplay/cache/lib/crypt.import';
|
|
7
7
|
import { LibCurl } from 'esoftplay/cache/lib/curl.import';
|
|
8
8
|
import { LibNavigation } from 'esoftplay/cache/lib/navigation.import';
|
|
9
9
|
import { LibObject } from 'esoftplay/cache/lib/object.import';
|
|
10
10
|
import { UserClass } from 'esoftplay/cache/user/class.import';
|
|
11
11
|
import { UserNotification } from 'esoftplay/cache/user/notification.import';
|
|
12
|
+
import useGlobalState from 'esoftplay/global';
|
|
12
13
|
|
|
13
14
|
import { fastFilter } from "esoftplay/fast";
|
|
14
15
|
import Constants from 'expo-constants';
|
package/modules/lib/notify.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// useLibs
|
|
2
|
-
import { useGlobalState } from 'esoftplay';
|
|
3
2
|
import { LibCrypt } from 'esoftplay/cache/lib/crypt.import';
|
|
4
3
|
import { LibObject } from 'esoftplay/cache/lib/object.import';
|
|
4
|
+
import useGlobalState from 'esoftplay/global';
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
export interface LibNotifyItem {
|
package/modules/lib/progress.tsx
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// noPage
|
|
2
|
-
import { useGlobalState } from 'esoftplay';
|
|
3
2
|
import { LibComponent } from 'esoftplay/cache/lib/component.import';
|
|
4
3
|
import { LibStyle } from 'esoftplay/cache/lib/style.import';
|
|
5
4
|
import { LibTextstyle } from 'esoftplay/cache/lib/textstyle.import';
|
|
6
5
|
import { LibTheme } from 'esoftplay/cache/lib/theme.import';
|
|
6
|
+
import useGlobalState from 'esoftplay/global';
|
|
7
7
|
|
|
8
8
|
import React from 'react';
|
|
9
9
|
import { ActivityIndicator, BackHandler, View } from 'react-native';
|
package/modules/lib/theme.tsx
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// noPage
|
|
2
|
-
import { esp
|
|
2
|
+
import { esp } from 'esoftplay';
|
|
3
3
|
import { LibNavigation } from 'esoftplay/cache/lib/navigation.import';
|
|
4
4
|
import { LibStyle } from 'esoftplay/cache/lib/style.import';
|
|
5
|
+
import useGlobalState from 'esoftplay/global';
|
|
5
6
|
|
|
6
7
|
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
7
8
|
const { colorPrimary, colorAccent } = LibStyle
|
package/modules/lib/toast.tsx
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
// withHooks
|
|
2
2
|
// noPage
|
|
3
|
-
import { useGlobalState } from 'esoftplay';
|
|
4
3
|
import { LibStyle } from 'esoftplay/cache/lib/style.import';
|
|
5
|
-
|
|
4
|
+
import useGlobalState from 'esoftplay/global';
|
|
6
5
|
import React, { useEffect } from 'react';
|
|
7
6
|
import { Text } from 'react-native';
|
|
8
7
|
import Animated, { interpolate, useAnimatedProps, useSharedValue, withTiming } from 'react-native-reanimated';
|
package/modules/lib/utils.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// noPage
|
|
2
|
-
import { esp
|
|
2
|
+
import { esp } from 'esoftplay';
|
|
3
3
|
import { LibToastProperty } from 'esoftplay/cache/lib/toast.import';
|
|
4
4
|
import { fastFilter, fastLoop } from 'esoftplay/fast';
|
|
5
|
+
import useGlobalState from 'esoftplay/global';
|
|
5
6
|
import moment from "esoftplay/moment";
|
|
6
7
|
import * as Application from 'expo-application';
|
|
7
8
|
import * as Clipboard from 'expo-clipboard';
|
package/modules/user/class.ts
CHANGED
|
@@ -7,10 +7,10 @@ import { LibNotification } from 'esoftplay/cache/lib/notification.import';
|
|
|
7
7
|
import { UserClass } from 'esoftplay/cache/user/class.import';
|
|
8
8
|
import { UserData } from 'esoftplay/cache/user/data.import';
|
|
9
9
|
|
|
10
|
+
import useGlobalState from 'esoftplay/global';
|
|
10
11
|
import Constants from 'expo-constants';
|
|
11
12
|
import * as Notifications from 'expo-notifications';
|
|
12
13
|
import { Platform } from 'react-native';
|
|
13
|
-
import useGlobalState from '../../global';
|
|
14
14
|
import moment from "../../moment";
|
|
15
15
|
|
|
16
16
|
const state = useGlobalState?.(null, { persistKey: "user" })
|
package/modules/user/index.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// withHooks
|
|
2
2
|
// noPage
|
|
3
|
-
import { esp, useSafeState } from 'esoftplay';
|
|
3
|
+
import { esp, useSafeState, _global } from 'esoftplay';
|
|
4
4
|
import { LibDialog } from 'esoftplay/cache/lib/dialog.import';
|
|
5
5
|
import { LibImage } from 'esoftplay/cache/lib/image.import';
|
|
6
6
|
import { LibNet_status } from 'esoftplay/cache/lib/net_status.import';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//
|
|
2
|
-
import { useGlobalReturn
|
|
2
|
+
import { useGlobalReturn } from 'esoftplay';
|
|
3
3
|
import { LibComponent } from 'esoftplay/cache/lib/component.import';
|
|
4
4
|
import { LibIcon } from 'esoftplay/cache/lib/icon.import';
|
|
5
5
|
import { LibList } from 'esoftplay/cache/lib/list.import';
|
|
@@ -7,6 +7,7 @@ import { LibNotification } from 'esoftplay/cache/lib/notification.import';
|
|
|
7
7
|
import { LibStatusbar } from 'esoftplay/cache/lib/statusbar.import';
|
|
8
8
|
import { LibStyle } from 'esoftplay/cache/lib/style.import';
|
|
9
9
|
import { UserNotification_item } from 'esoftplay/cache/user/notification_item.import';
|
|
10
|
+
import useGlobalState from 'esoftplay/global';
|
|
10
11
|
|
|
11
12
|
import { Pressable, Text, TouchableOpacity, View } from "react-native";
|
|
12
13
|
//@ts-ignore
|
package/modules/user/routes.ts
CHANGED