esoftplay 0.0.120 → 0.0.121

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 (66) hide show
  1. package/bin/build.js +4 -6
  2. package/bin/cli.js +63 -0
  3. package/bin/router.js +41 -43
  4. package/error.ts +2 -1
  5. package/esp.ts +4 -4
  6. package/global.ts +18 -23
  7. package/import_migrator.mjs +5 -5
  8. package/import_translator.mjs +17 -0
  9. package/modules/lib/carrousel.tsx +5 -8
  10. package/modules/lib/carrousel_snap.tsx +5 -8
  11. package/modules/lib/crypt.js +1 -3
  12. package/modules/lib/curl.ts +6 -7
  13. package/modules/lib/datepicker.tsx +4 -4
  14. package/modules/lib/dialog.tsx +6 -6
  15. package/modules/lib/direct_image.tsx +1 -4
  16. package/modules/lib/direct_text.tsx +1 -4
  17. package/modules/lib/document.ts +4 -5
  18. package/modules/lib/editbox.tsx +109 -0
  19. package/modules/lib/effect.tsx +1 -3
  20. package/modules/lib/gallery.tsx +3 -5
  21. package/modules/lib/icon.tsx +1 -1
  22. package/modules/lib/image.tsx +7 -7
  23. package/modules/lib/image_crop.tsx +7 -7
  24. package/modules/lib/image_multi.tsx +6 -6
  25. package/modules/lib/image_shadow.tsx +2 -2
  26. package/modules/lib/infinite.tsx +9 -10
  27. package/modules/lib/input.tsx +4 -5
  28. package/modules/lib/input_base.tsx +2 -3
  29. package/modules/lib/list.tsx +1 -2
  30. package/modules/lib/loading.tsx +2 -3
  31. package/modules/lib/locale.ts +1 -2
  32. package/modules/lib/navigation.ts +5 -5
  33. package/modules/lib/net_status.tsx +2 -2
  34. package/modules/lib/notification.ts +9 -9
  35. package/modules/lib/notify.ts +2 -2
  36. package/modules/lib/picture.tsx +3 -4
  37. package/modules/lib/progress.tsx +5 -5
  38. package/modules/lib/roll.tsx +5 -6
  39. package/modules/lib/scroll.tsx +1 -3
  40. package/modules/lib/scrollpicker.tsx +5 -7
  41. package/modules/lib/skeleton.tsx +2 -3
  42. package/modules/lib/slidingup.tsx +3 -4
  43. package/modules/lib/sociallogin.tsx +4 -4
  44. package/modules/lib/tabs.tsx +5 -6
  45. package/modules/lib/textstyle.tsx +1 -3
  46. package/modules/lib/theme.tsx +2 -6
  47. package/modules/lib/timepicker.tsx +3 -3
  48. package/modules/lib/toast.tsx +2 -2
  49. package/modules/lib/updater.tsx +3 -3
  50. package/modules/lib/utils.ts +1 -1
  51. package/modules/lib/version.tsx +7 -7
  52. package/modules/lib/video.tsx +2 -4
  53. package/modules/lib/webview.tsx +1 -2
  54. package/modules/lib/workloop.tsx +3 -3
  55. package/modules/use/connect.ts +2 -3
  56. package/modules/use/curl.ts +2 -2
  57. package/modules/use/deeplink.ts +4 -4
  58. package/modules/user/class.ts +6 -6
  59. package/modules/user/data.ts +1 -1
  60. package/modules/user/hook.tsx +2 -2
  61. package/modules/user/index.tsx +16 -15
  62. package/modules/user/login.tsx +7 -6
  63. package/modules/user/notifbadge.tsx +4 -4
  64. package/modules/user/notification.tsx +9 -7
  65. package/modules/user/notification_item.tsx +6 -4
  66. package/package.json +1 -1
package/bin/build.js CHANGED
@@ -246,11 +246,11 @@ yarn-error.log\n\
246
246
  });
247
247
 
248
248
  const AppJS = `
249
- import { esp } from 'esoftplay';
250
- import { LibNotification } from 'esoftplay/cache/lib/notification.import';
249
+ import { LibNotification } from 'esoftplay/cache/lib/notification/import';
250
+ import { UserIndex } from 'esoftplay/cache/user/index/import';
251
251
  import * as ErrorReport from 'esoftplay/error';
252
252
  import * as Notifications from 'expo-notifications';
253
- import React, { useEffect, useRef } from 'react';
253
+ import React, { useEffect } from 'react';
254
254
  import { enableFreeze, enableScreens } from 'react-native-screens';
255
255
  const { globalIdx } = require('esoftplay/global');
256
256
  enableScreens();
@@ -259,14 +259,12 @@ enableFreeze();
259
259
  Notifications.addNotificationResponseReceivedListener(x => LibNotification.onAction(x));
260
260
 
261
261
  export default function App() {
262
- const Home = useRef(esp.home()).current
263
-
264
262
  useEffect(() => {
265
263
  globalIdx.reset()
266
264
  ErrorReport.getError()
267
265
  }, [])
268
266
 
269
- return (<Home />)
267
+ return (<UserIndex />)
270
268
  }`;
271
269
  let expoLib = [
272
270
  '@expo/vector-icons',
package/bin/cli.js CHANGED
@@ -643,6 +643,59 @@ function devClientPos(file) {
643
643
  }
644
644
  }
645
645
 
646
+ function cacheBuild(include = true) {
647
+ // if (include) {
648
+ // if (fs.existsSync('./esoftplay')) {
649
+ // command('rm -rf ./esoftplay')
650
+ // }
651
+ // if (!fs.existsSync('./modules_ori')) {
652
+ // command('cp -r ./modules ./modules_ori')
653
+ // }
654
+ // command('cp -r ./node_modules/esoftplay ./')
655
+
656
+
657
+ // if (fs.existsSync('./esoftplay/modules')) {
658
+ // fs.readdirSync('./esoftplay/modules').forEach((module) => {
659
+ // if (!module.startsWith('.'))
660
+ // fs.readdirSync('./esoftplay/modules/' + module).forEach((task) => {
661
+ // let file = fs.readFileSync(`./esoftplay/modules/${module}/${task}`, { encoding: 'utf8' }).replace(/esoftplay\/cache/g, "../../cache")
662
+ // fs.writeFileSync(`./esoftplay/modules/${module}/${task}`, file, { encoding: 'utf8' })
663
+ // })
664
+ // })
665
+ // }
666
+
667
+ // if (fs.existsSync('./modules')) {
668
+ // fs.readdirSync('./modules').forEach((module) => {
669
+ // if (!module.startsWith('.'))
670
+ // fs.readdirSync('./modules/' + module).forEach((task) => {
671
+ // let file = fs.readFileSync(`./modules/${module}/${task}`, { encoding: 'utf8' }).replace(/esoftplay\/cache/g, "../../esoftplay/cache")
672
+ // fs.writeFileSync(`./modules/${module}/${task}`, file, { encoding: 'utf8' })
673
+ // })
674
+ // })
675
+ // }
676
+ // if (fs.existsSync('./esoftplay/cache')) {
677
+ // fs.readdirSync('./esoftplay/cache').forEach((module) => {
678
+ // if (!module.startsWith('.'))
679
+ // if (fs.lstatSync('./esoftplay/cache/' + module).isDirectory()) {
680
+ // fs.readdirSync('./esoftplay/cache/' + module).forEach((task) => {
681
+ // fs.readdirSync(`./esoftplay/cache/${module}/${task}`).forEach((imprt) => {
682
+ // console.log(`./esoftplay/cache/${module}/${task}/import.js`)
683
+ // let file = fs.readFileSync(`./esoftplay/cache/${module}/${task}/import.js`, { encoding: 'utf8' }).replace(/\.\.\/\.\.\/\.\.\/\.\.\/\.\.\//g, "../../../../")
684
+ // file = file.replace(/\.\.\/\.\.\/\.\.\/\.\.\/node_modules\/esoftplay\//g, "../../../")
685
+ // fs.writeFileSync(`./esoftplay/cache/${module}/${task}/import.js`, file, { encoding: 'utf8' })
686
+ // })
687
+ // })
688
+ // }
689
+ // })
690
+ // }
691
+
692
+ // } else {
693
+ // command('rm -rf ./esoftplay')
694
+ // command('rm -rf ./modules')
695
+ // command('mv ./modules_ori ./modules')
696
+ // }
697
+ }
698
+
646
699
  function configAvailable(enabled) {
647
700
  if (fs.existsSync(gitignore)) {
648
701
  let _git = fs.readFileSync(gitignore, 'utf8')
@@ -689,6 +742,7 @@ function build() {
689
742
  name: "1. IOS (Development) - Simulator",
690
743
  cmd: "eas build --platform ios --profile development",
691
744
  pre: () => {
745
+ cacheBuild()
692
746
  configAvailable(true)
693
747
  devClientPre(appjson)
694
748
  jsEng(appjson, false)
@@ -701,6 +755,7 @@ function build() {
701
755
  name: "2. IOS (Preview) - Simulator",
702
756
  cmd: "eas build --platform ios --profile preview",
703
757
  pre: () => {
758
+ cacheBuild()
704
759
  configAvailable(true)
705
760
  devClientPos(appjson)
706
761
  jsEng(appjson, true)
@@ -713,6 +768,7 @@ function build() {
713
768
  name: "3. IOS (Preview) - Non Simulator",
714
769
  cmd: "eas build --platform ios --profile preview_build",
715
770
  pre: () => {
771
+ cacheBuild()
716
772
  configAvailable(true)
717
773
  devClientPos(appjson)
718
774
  jsEng(appjson, true)
@@ -725,6 +781,7 @@ function build() {
725
781
  name: "4. IOS (Production) - ipa",
726
782
  cmd: "eas build --platform ios --profile production",
727
783
  pre: () => {
784
+ cacheBuild()
728
785
  configAvailable(true)
729
786
  devClientPos(appjson)
730
787
  jsEng(appjson, true)
@@ -737,6 +794,7 @@ function build() {
737
794
  name: "5. Android (Development) - apk",
738
795
  cmd: "eas build --platform android --profile development",
739
796
  pre: () => {
797
+ cacheBuild()
740
798
  configAvailable(true)
741
799
  devClientPre(appjson)
742
800
  jsEng(appjson, false)
@@ -749,6 +807,7 @@ function build() {
749
807
  name: "6. Android (Preview) - apk",
750
808
  cmd: "eas build --platform android --profile preview",
751
809
  pre: () => {
810
+ cacheBuild()
752
811
  configAvailable(true)
753
812
  devClientPos(appjson)
754
813
  jsEng(appjson, true)
@@ -761,6 +820,7 @@ function build() {
761
820
  name: "7. Android (Production) - aab",
762
821
  cmd: "eas build --platform android --profile production",
763
822
  pre: () => {
823
+ cacheBuild()
764
824
  configAvailable(true)
765
825
  devClientPos(appjson)
766
826
  jsEng(appjson, true)
@@ -790,12 +850,15 @@ function build() {
790
850
  if (pre) pre()
791
851
  consoleSucces("⚙⚙⚙ ... \n" + cmd)
792
852
  command(cmd)
853
+ cacheBuild(false)
793
854
  configAvailable(false)
794
855
  devClientPos(appjson)
795
856
  } else if (d === false) {
796
857
  consoleError("Build Canceled")
858
+ cacheBuild(false)
797
859
  } else {
798
860
  consoleError("Build type tidak ditemukan")
861
+ cacheBuild(false)
799
862
  }
800
863
  });
801
864
 
package/bin/router.js CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  // @ts-nocheck
3
3
  /* EXECUTED ON `ESP START` TO BUILD FILE CACHES */
4
+ const { execSync } = require('child_process');
4
5
  const fs = require('fs');
5
6
  var checks = ['./node_modules/esoftplay/modules/', './modules/', './templates/'];
6
7
  var pathAsset = "./assets";
@@ -70,7 +71,7 @@ import { NavigationContainer } from '@react-navigation/native';
70
71
  import { createNativeStackNavigator } from '@react-navigation/native-stack';
71
72
  \nimport { esp, _global } from "esoftplay";\n
72
73
  ${importer}
73
- \nimport { LibNavigation } from 'esoftplay/cache/lib/navigation.import';\n
74
+ \nimport { LibNavigation } from 'esoftplay/cache/lib/navigation/import';\n
74
75
  const Stack = createNativeStackNavigator();
75
76
 
76
77
  export default function m(props): any{
@@ -444,22 +445,7 @@ declare module "esoftplay" {
444
445
  }
445
446
  interface useGlobalConnect<T> {
446
447
  render: (props: T) => any,
447
- }
448
- interface createCacheOption {
449
- persistKey?: string,
450
- inFile?: boolean,
451
- listener?: (s:any)=> void
452
- }
453
- interface createCacheReturn<T> {
454
- useCache: () => [T, (newCache: T | ((oldCache: T) => T)) => void, () => void],
455
- get: () => T,
456
- set: (newCache: T | ((oldCache: T) => T)) => void
457
- }
458
- class LibCrypt {
459
- encode(string: string): string
460
- decode(string: string): string
461
- }
462
- function createCache<S>(initialCache?: S, option?: createCacheOption): createCacheReturn<S>;`;
448
+ }`;
463
449
  for (clsName in tmpTask) {
464
450
  let ItemText = ""
465
451
  if (clsName === 'LibCrypt') {
@@ -470,7 +456,7 @@ declare module "esoftplay" {
470
456
  if (tmpTask[clsName]["class"]) {
471
457
 
472
458
  if (clsName !== "LibComponent")
473
- ItemText += "import { LibComponent } from 'esoftplay/cache/lib/component.import';\n"
459
+ ItemText += "import { LibComponent } from 'esoftplay/cache/lib/component/import';\n"
474
460
  else if (clsName === "LibComponent") {
475
461
  ItemText += "import { Component } from 'react';\n"
476
462
  }
@@ -541,15 +527,21 @@ declare module "esoftplay" {
541
527
  }
542
528
  const [module, task] = clsName.split(/(?=[A-Z])/)
543
529
  const nav = module?.toLowerCase() + '/' + task?.toLowerCase()
544
- try {
545
- fs.mkdirSync(tmpDir + module?.toLowerCase())
546
- } catch (error) { }
547
- PreText += "import '" + tmpDir + nav + ".import.d';\n"
548
- fs.writeFile(tmpDir + nav + '.import.d.ts', ItemText, { flag: 'w' }, function (err) {
549
- if (err) {
550
- return console.log(err);
551
- }
552
- });
530
+
531
+ if (module && !fs.existsSync(tmpDir + module?.toLowerCase()))
532
+ fs.mkdirSync(tmpDir + module.toLowerCase());
533
+
534
+ if (!fs.existsSync(tmpDir + nav))
535
+ fs.mkdirSync(tmpDir + nav)
536
+
537
+ PreText += "import '" + tmpDir + nav + "/import.d';\n"
538
+ if (isChange(tmpDir + nav + '/import.d.ts', ItemText)) {
539
+ fs.writeFile(tmpDir + nav + '/import.d.ts', ItemText, { flag: 'w' }, function (err) {
540
+ if (err) {
541
+ return console.log(err);
542
+ }
543
+ });
544
+ }
553
545
  }
554
546
  Text += "\n\ttype LibNavigationRoutes = \"" + Navigations.join("\" |\n\t\t\t \"") + "\"\n"
555
547
  Text += "\n\ttype AllRoutes = \"" + AllRoutes.join("\" |\n\t\t\t \"") + "\"\n"
@@ -574,10 +566,10 @@ declare module "esoftplay" {
574
566
 
575
567
  function isChange(path, compare) {
576
568
  let hasChanged = true
577
- let old = fs.existsSync(path) && fs.readFileSync(path)
578
- hasChanged = old.toString().length != compare.length
569
+ let old = fs.existsSync(path) ? fs.readFileSync(path, { encoding: 'utf8' }) : ""
570
+ hasChanged = old.length != compare.length
579
571
  if (hasChanged) {
580
- console.log(path, 'CHANGED')
572
+ console.log(path, 'CHANGED', old.length, compare.length)
581
573
  }
582
574
  return hasChanged
583
575
  }
@@ -615,7 +607,7 @@ function createRouter() {
615
607
  staticImport.push("export { default as usePersistState } from '../../../node_modules/esoftplay/persist';\n")
616
608
  staticImport.push("export { default as useSafeState } from '../../../node_modules/esoftplay/state';\n")
617
609
  staticImport.push("export { default as esp } from '../../../node_modules/esoftplay/esp';\n")
618
- staticImport.push("export { default as createCache } from '../../../node_modules/esoftplay/_cache';\n")
610
+ // staticImport.push("export { default as createCache } from '../../../node_modules/esoftplay/_cache';\n")
619
611
  staticImport.push("export { default as _global } from '../../../node_modules/esoftplay/_global';\n")
620
612
  staticImport.push("import { stable } from 'usestable';\n")
621
613
 
@@ -629,28 +621,34 @@ function createRouter() {
629
621
  Task += "\t\t" + 'case "' + nav + '":' + "\n\t\t\t" + 'Out = require("../../.' + Modules[module][task] + '")?.default' + "\n\t\t\t" + 'break;' + "\n";
630
622
  TaskProperty += "\t\t" + 'case "' + nav + '":' + "\n\t\t\t" + 'Out = require("../../.' + Modules[module][task] + '")' + "\n\t\t\t" + 'break;' + "\n";
631
623
  /* ADD ROUTER EACH FILE FOR STATIC IMPORT */
632
- var item = "import { stable } from 'usestable';\nimport { default as _" + ucword(module) + ucword(task) + " } from '../../../." + Modules[module][task] + "';\n"
624
+ var item = "import { stable } from 'usestable';\nimport { default as _" + ucword(module) + ucword(task) + " } from '../../../../." + Modules[module][task] + "';\n"
633
625
  if (HookModules.includes(nav)) {
634
626
  item += "" +
635
- "import * as " + ucword(module) + ucword(task) + SuffixHooksProperty + " from '../../../." + Modules[module][task] + "';\n" +
627
+ "import * as " + ucword(module) + ucword(task) + SuffixHooksProperty + " from '../../../../." + Modules[module][task] + "';\n" +
636
628
  "var " + ucword(module) + ucword(task) + " = stable(_" + ucword(module) + ucword(task) + "); \n" +
637
629
  "export { " + ucword(module) + ucword(task) + SuffixHooksProperty + ", " + ucword(module) + ucword(task) + " };\n"
638
630
  } else if (UseLibs.includes(nav)) {
639
631
  item += "" +
640
- "import * as " + ucword(module) + ucword(task) + SuffixHooksProperty + " from '../../../." + Modules[module][task] + "';\n" +
632
+ "import * as " + ucword(module) + ucword(task) + SuffixHooksProperty + " from '../../../../." + Modules[module][task] + "';\n" +
641
633
  "var " + ucword(module) + ucword(task) + " = _" + ucword(module) + ucword(task) + "; \n" +
642
634
  "export { " + ucword(module) + ucword(task) + SuffixHooksProperty + ", " + ucword(module) + ucword(task) + " };\n"
643
635
  } else {
644
636
  item += "export { _" + ucword(module) + ucword(task) + " as " + ucword(module) + ucword(task) + " };\n"
645
637
  }
646
- try {
647
- fs.mkdirSync(tmpDir + module)
648
- } catch (error) { }
649
- fs.writeFile(tmpDir + nav + '.import.js', item, { flag: 'w' }, function (err) {
650
- if (err) {
651
- return console.log(err);
652
- }
653
- });
638
+
639
+ if (!fs.existsSync(tmpDir + module))
640
+ fs.mkdirSync(tmpDir + module);
641
+
642
+ if (!fs.existsSync(tmpDir + nav))
643
+ fs.mkdirSync(tmpDir + nav)
644
+
645
+ if (isChange(tmpDir + nav + "/import.js", item)) {
646
+ fs.writeFile(tmpDir + nav + '/import.js', item, { flag: 'w' }, function (err) {
647
+ if (err) {
648
+ return console.log(err);
649
+ }
650
+ });
651
+ }
654
652
 
655
653
  // if (module == 'lib' && task == 'component') {
656
654
  // staticImport.splice(2, 0, item)
@@ -722,7 +720,7 @@ function createRouter() {
722
720
  const orientation = NavsOrientation[nav]
723
721
  const [module, task] = nav.split('/')
724
722
  const comp = ucword(module) + ucword(task)
725
- importer.push(`import { ${comp} } from ${'"esoftplay/cache/' + module + '/' + task + '.import"'}`)
723
+ importer.push(`import { ${comp} } from ${'"esoftplay/cache/' + module + '/' + task + '/import"'}`)
726
724
  if (orientation)
727
725
  screens.push("\t\t\t\t<Stack.Screen name={\"" + nav + "\"} options={{ orientation: '" + orientation + "' }} component={" + comp + "} />")
728
726
  else
package/error.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import AsyncStorage from '@react-native-async-storage/async-storage';
2
- import { LibCurl, UserClass } from 'esoftplay';
3
2
  import Constants from 'expo-constants';
4
3
  import { Platform } from 'react-native';
4
+ import { LibCurl } from './cache/lib/curl/import';
5
+ import { UserClass } from './cache/user/class/import';
5
6
  import esp from './esp';
6
7
  import { default as UserRoutes } from './modules/user/routes';
7
8
  let pack = require('../../package.json');
package/esp.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { LibLocale } from 'esoftplay/cache/lib/locale.import';
2
- import { UserRoutes } from 'esoftplay/cache/user/routes.import';
1
+ import { LibLocale } from 'esoftplay/cache/lib/locale/import';
2
+ import { UserRoutes } from 'esoftplay/cache/user/routes/import';
3
3
  import Constants from 'expo-constants';
4
4
  import { LogBox, Platform } from 'react-native';
5
5
  import 'react-native-reanimated';
@@ -75,7 +75,7 @@ export default class esp {
75
75
  }
76
76
 
77
77
  static versionName(): string {
78
- return (Platform.OS == 'android' ? Constants?.manifest?.android?.versionCode : Constants?.manifest?.ios?.buildNumber) + '-' + config('publish_id')
78
+ return (Platform.OS == 'android' ? Constants?.manifest?.android?.versionCode : Constants?.manifest?.ios?.buildNumber) + '-' + esp.config('publish_id')
79
79
  }
80
80
 
81
81
  static config(param?: string, ...params: string[]): any {
@@ -207,7 +207,7 @@ export default class esp {
207
207
  return navs;
208
208
  }
209
209
  static home(): any {
210
- return mod('user/index');
210
+ return esp.mod('user/index');
211
211
  }
212
212
  static routes(): any {
213
213
  return UserRoutes.state().get();
package/global.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  import AsyncStorage from '@react-native-async-storage/async-storage';
2
- import { UserData } from 'esoftplay/cache/user/data.import';
2
+ import { UserData } from 'esoftplay/cache/user/data/import';
3
+ import Storage from 'esoftplay/storage';
4
+ import _global from 'esoftplay/_global';
3
5
  import * as R from 'react';
4
6
  import { fastFilter, fastLoop } from './fast';
5
- const _global = require('./_global')
6
7
  const isEqual = require('react-fast-compare');
7
8
 
8
9
  export interface useGlobalReturn<T> {
@@ -26,34 +27,28 @@ export interface useGlobalConnect<T> {
26
27
  }
27
28
 
28
29
  _global.useGlobalUserDelete = {}
29
- let useGlobalSubscriber: any = {}
30
+ _global.useGlobalSubscriber = {}
30
31
 
31
- let idx = 0
32
- const Context = {
33
- reset: () => idx = 0
32
+ class Context {
33
+ idx = 0
34
+ increment = () => this.idx++
35
+ reset = () => {
36
+ this.idx = 0
37
+ }
34
38
  }
35
39
 
36
- export const globalIdx = Context
40
+ export const globalIdx = new Context()
37
41
  export default function useGlobalState<T>(initValue: T, o?: useGlobalOption): useGlobalReturn<T> {
38
- const Storage = require('./storage').default;
39
42
  const STORAGE = o?.inFile ? new Storage() : AsyncStorage
40
- const _idx = idx
41
- if (!useGlobalSubscriber) {
42
- useGlobalSubscriber = {}
43
- }
44
- if (!useGlobalSubscriber[_idx])
45
- useGlobalSubscriber[_idx] = [];
43
+ const _idx = o?.persistKey || globalIdx.idx
44
+ if (!_global.useGlobalSubscriber[_idx])
45
+ _global.useGlobalSubscriber[_idx] = [];
46
46
  let value: T = initValue;
47
47
 
48
48
  if (o?.persistKey) {
49
49
  let persistKey = o?.persistKey
50
50
  STORAGE.getItem(persistKey).then((p) => {
51
51
  if (p) {
52
- if (p != undefined && typeof p == 'string' && p.includes("\\\\\\\\")) {
53
- if (persistKey)
54
- STORAGE.clear()
55
- return
56
- }
57
52
  if (p != undefined && typeof p == 'string' && (p.startsWith("{") || p.startsWith("[")))
58
53
  try { set(JSON.parse(p)) } catch (error) { }
59
54
  else
@@ -78,7 +73,7 @@ export default function useGlobalState<T>(initValue: T, o?: useGlobalOption): us
78
73
  const isChange = !isEqual(value, ns)
79
74
  if (isChange) {
80
75
  value = ns
81
- fastLoop(useGlobalSubscriber?.[_idx], (c) => { c?.(ns) })
76
+ fastLoop(_global.useGlobalSubscriber?.[_idx], (c) => { c?.(ns) })
82
77
  if (o?.persistKey && ns != undefined) {
83
78
  let data: any
84
79
  switch (typeof ns) {
@@ -121,9 +116,9 @@ export default function useGlobalState<T>(initValue: T, o?: useGlobalOption): us
121
116
 
122
117
  function subscribe(func: any) {
123
118
  R.useLayoutEffect(() => {
124
- useGlobalSubscriber?.[_idx]?.push?.(func);
119
+ _global.useGlobalSubscriber?.[_idx]?.push?.(func);
125
120
  return () => {
126
- useGlobalSubscriber[_idx] = fastFilter(useGlobalSubscriber?.[_idx], (f) => f !== func)
121
+ _global.useGlobalSubscriber[_idx] = fastFilter(_global.useGlobalSubscriber?.[_idx], (f) => f !== func)
127
122
  };
128
123
  }, [func]);
129
124
  }
@@ -156,6 +151,6 @@ export default function useGlobalState<T>(initValue: T, o?: useGlobalOption): us
156
151
  return children ? R.cloneElement(children) : null
157
152
  }
158
153
 
159
- idx++
154
+ globalIdx.increment()
160
155
  return { useState, get, set, useSelector, reset: del, connect: _connect };
161
156
  }
@@ -1,5 +1,5 @@
1
1
  import fs from 'fs'
2
- const pattern = new RegExp(/\n{0,}import ((.*)) from (?:"esoftplay"|'esoftplay');?/gs)
2
+ const pattern = new RegExp(/\n{0,}import ((.*)) from (?:"esoftplay"|'esoftplay');?/gm)
3
3
  const globalPattern = new RegExp(/((?:, useGlobalState|useGlobalState,|\{\s{0,}useGlobalState\s{0,}\}))/gs)
4
4
  if (fs.existsSync('./modules')) {
5
5
  fs.readdirSync('./modules').forEach((module) => {
@@ -15,12 +15,12 @@ if (fs.existsSync('./modules')) {
15
15
  const arrModules = cmatch.substring(cmatch.indexOf('{') + 1, cmatch.lastIndexOf('}')).split(',')
16
16
  arrModules.forEach((mod) => {
17
17
  const modTrim = mod.trim()
18
- if (modTrim.match(/^[a-z]/g)) {
19
- console.log("ESP MODULE : " + modTrim)
18
+ if (modTrim.match(/^(?:_|[a-z])/g)) {
19
+ console.log("+ : " + modTrim)
20
20
  espMod.push(modTrim)
21
21
  } else {
22
22
  nonEspMod.push(modTrim)
23
- console.log("NON ESP MODULE : " + modTrim)
23
+ console.log("- : " + modTrim)
24
24
  }
25
25
  })
26
26
  let adder = ""
@@ -29,7 +29,7 @@ if (fs.existsSync('./modules')) {
29
29
  if (non) {
30
30
  const [module, task] = non.split(/(?=[A-Z])/)
31
31
  if (module && task)
32
- adder += `import { ${non} } from 'esoftplay/cache/${module.toLowerCase()}/${task.toLowerCase()}.import';\n`
32
+ adder += `import { ${non} } from 'esoftplay/cache/${module.toLowerCase()}/${task.toLowerCase()}/import';\n`
33
33
  }
34
34
  })
35
35
  }
@@ -0,0 +1,17 @@
1
+ // @ts-check
2
+
3
+ import fs from 'fs'
4
+ if (fs.existsSync('./modules')) {
5
+ fs.readdirSync('./modules').forEach((module) => {
6
+ if (!module.startsWith('.')) {
7
+ fs.readdirSync('./modules/' + module).forEach((task) => {
8
+ var dFile = fs.readFileSync('./modules/' + module + '/' + task, { encoding: 'utf8' })
9
+ // if (module == 'artist' && task == 'detail.tsx') {
10
+ dFile = dFile.replace(/esoftplay\/cache\/([a-z0-9_]+\/[a-z0-9_]+).import/g, "esoftplay/cache/$1/import")
11
+ console.log(module + '/' + task)
12
+ // }
13
+ fs.writeFileSync('./modules/' + module + '/' + task, dFile, { encoding: 'utf8' })
14
+ })
15
+ }
16
+ })
17
+ }
@@ -1,9 +1,6 @@
1
1
  // noPage
2
- import { } from 'esoftplay';
3
-
4
- import { LibComponent } from 'esoftplay/cache/lib/component.import';
5
- import { LibFocus } from 'esoftplay/cache/lib/focus.import';
6
-
2
+ import { LibComponent } from 'esoftplay/cache/lib/component/import';
3
+ import { LibFocus } from 'esoftplay/cache/lib/focus/import';
7
4
  import React from 'react';
8
5
  import { Platform, ScrollView, StyleSheet, Text, TouchableOpacity, TouchableWithoutFeedback, View } from 'react-native';
9
6
 
@@ -72,7 +69,7 @@ export default class m extends LibComponent<LibCarrouselProps, LibCarrouselState
72
69
  swipe: true,
73
70
  isLooped: true,
74
71
  };
75
-
72
+
76
73
  isBackground: boolean = false
77
74
  offset: number = 0;
78
75
  timer: any;
@@ -146,7 +143,7 @@ export default class m extends LibComponent<LibCarrouselProps, LibCarrouselState
146
143
  const { size } = this.state;
147
144
  const { children: propsChildren, isLooped, pageStyle } = this.props;
148
145
  const children = React.Children.toArray(propsChildren);
149
- const pages = [];
146
+ const pages: any[] = [];
150
147
 
151
148
  if (children && children.length > 1) {
152
149
  pages.push(...children);
@@ -338,7 +335,7 @@ export default class m extends LibComponent<LibCarrouselProps, LibCarrouselState
338
335
  }
339
336
 
340
337
  _renderBullets(pageLength: number): any {
341
- const bullets = [];
338
+ const bullets: any[] = [];
342
339
  for (let i = 0; i < pageLength; i += 1) {
343
340
  bullets.push(
344
341
  <TouchableWithoutFeedback onPress={() => this.animateToPage(i)} key={`bullet${i}`}>
@@ -1,9 +1,6 @@
1
1
  // withHooks
2
2
  // noPage
3
- import { } from 'esoftplay';
4
-
5
- import { LibFocus } from 'esoftplay/cache/lib/focus.import';
6
-
3
+ import { LibFocus } from 'esoftplay/cache/lib/focus/import';
7
4
  import React, { useEffect, useMemo, useRef } from 'react';
8
5
  import { ScrollView, View } from 'react-native';
9
6
 
@@ -124,7 +121,7 @@ export default function m(props: LibCarrousel_snapProps): any {
124
121
  }
125
122
 
126
123
  function prefixIndexs(): number[] {
127
- let out = []
124
+ let out: any[] = []
128
125
  const dataLength: number = (props.data.length || 0)
129
126
  if (props.loop) {
130
127
  if (dataLength == 1) {
@@ -146,7 +143,7 @@ export default function m(props: LibCarrousel_snapProps): any {
146
143
  }
147
144
 
148
145
  function prefix(): any {
149
- let out = []
146
+ let out: any[] = []
150
147
  if (props.loop) {
151
148
  const dataLength = props.data.length
152
149
  if (dataLength == 1) {
@@ -168,7 +165,7 @@ export default function m(props: LibCarrousel_snapProps): any {
168
165
  }
169
166
 
170
167
  function suffixIndexs(): number[] {
171
- let out = []
168
+ let out: any[] = []
172
169
  if (props.loop) {
173
170
  if (props.data.length == 1) {
174
171
  out.push(0)
@@ -188,7 +185,7 @@ export default function m(props: LibCarrousel_snapProps): any {
188
185
  }
189
186
 
190
187
  function suffix(): any {
191
- let out = []
188
+ let out: any[] = []
192
189
  if (props.loop) {
193
190
  if (props.data.length == 1) {
194
191
  out.push(renderItem(props.data[0], 'x'))