@admin-layout/gluestack-ui-mobile 12.2.4-alpha.0 → 12.2.4-alpha.12

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 (42) hide show
  1. package/CHANGELOG.md +32 -8
  2. package/lib/components/ErrorBounday.js.map +1 -1
  3. package/lib/components/Fallback.js +11 -11
  4. package/lib/components/Fallback.js.map +1 -1
  5. package/lib/components/Layout/components/BasicLayout.js +1 -5
  6. package/lib/components/Layout/components/BasicLayout.js.map +1 -1
  7. package/lib/components/Layout/components/BottomTabBar.js +2 -2
  8. package/lib/components/Layout/components/BottomTabBar.js.map +1 -1
  9. package/lib/components/Layout/components/Sample.js.map +1 -1
  10. package/lib/components/Layout/components/SideBar.js +5 -6
  11. package/lib/components/Layout/components/SideBar.js.map +1 -1
  12. package/lib/components/NavigationComponent.js +1 -1
  13. package/lib/components/NavigationComponent.js.map +1 -1
  14. package/lib/components/ToastAlert.d.ts +1 -1
  15. package/lib/components/ToastAlert.js +2 -2
  16. package/lib/components/ToastAlert.js.map +1 -1
  17. package/lib/components/UnAuthenticatedComponent.js +1 -1
  18. package/lib/components/UnAuthenticatedComponent.js.map +1 -1
  19. package/lib/components/WithPermission.d.ts +1 -1
  20. package/lib/containers/layout/BasicLayout.js +3 -3
  21. package/lib/containers/layout/BasicLayout.js.map +1 -1
  22. package/lib/containers/layout/DrawerBottomNavigationConfig.d.ts +21 -21
  23. package/lib/containers/layout/DrawerConfig.d.ts +14 -14
  24. package/lib/containers/layout/ProLayout.js.map +1 -1
  25. package/lib/index.js.map +1 -1
  26. package/lib/tailwind-base-config.d.ts +2 -1
  27. package/lib/utils/generateMobileNavigations.js +36 -30
  28. package/lib/utils/generateMobileNavigations.js.map +1 -1
  29. package/package.json +4 -4
  30. package/src/components/ErrorBounday.tsx +19 -19
  31. package/src/components/Fallback.tsx +54 -58
  32. package/src/components/Layout/components/BasicLayout.tsx +2 -6
  33. package/src/components/Layout/components/BottomTabBar.tsx +98 -99
  34. package/src/components/Layout/components/Sample.tsx +1 -1
  35. package/src/components/Layout/components/SideBar.tsx +10 -14
  36. package/src/components/NavigationComponent.tsx +3 -1
  37. package/src/components/ToastAlert.tsx +11 -11
  38. package/src/components/UnAuthenticatedComponent.tsx +16 -26
  39. package/src/containers/layout/BasicLayout.tsx +3 -3
  40. package/src/containers/layout/ProLayout.tsx +1 -1
  41. package/src/index.ts +1 -2
  42. package/src/utils/generateMobileNavigations.ts +43 -34
package/src/index.ts CHANGED
@@ -5,7 +5,7 @@ import { settingsReducer } from './redux/settings';
5
5
  import { useAfterInteractions } from './hooks/use-after-interactions';
6
6
  import useIsReady from './hooks/useIsReady';
7
7
  import routeConfigKeyReplace from './utils/routeConfigKeyReplace';
8
- import {getReplacedRouteConfig} from './utils/getReplacedRouteConfig'
8
+ import { getReplacedRouteConfig } from './utils/getReplacedRouteConfig';
9
9
  import LayoutFeature, { ProLayout, AppFeatures, AppLayout } from './containers/layout/module';
10
10
  import { useLayoutSetting, LayoutSettingProps } from './hooks/useLayoutSetting';
11
11
  import i18next from './config/i18next';
@@ -21,7 +21,6 @@ export * from '@gluestack-ui/config';
21
21
  export * from '@gluestack-style/react';
22
22
  //............................gluestack-ui....///
23
23
 
24
-
25
24
  export {
26
25
  useLayoutSetting,
27
26
  LayoutSettingProps,
@@ -224,8 +224,10 @@ export class GenerateMobileNavigations {
224
224
  const outputFile = path.join(appDirPath, `/${mainRoutesFileName}`);
225
225
  const allFilteredRoutes = [];
226
226
  try {
227
- const execResult = await this.#execPromise(tscCommand);
228
- if (execResult && fs.existsSync(mainRoutesJsFile)) {
227
+ // Try to compile TypeScript if a compute.ts file exists, but don't fail
228
+ // the JSON generation if compilation fails and a compute.js is already present.
229
+ await this.#execPromise(tscCommand);
230
+ if (fs.existsSync(mainRoutesJsFile)) {
229
231
  const jsFiledata = fs.readFileSync(mainRoutesJsFile, 'utf8');
230
232
  const noCommentsData = jsFiledata
231
233
  .replace(/\/\/.*$/gm, '') // Remove single-line comments
@@ -242,32 +244,39 @@ export class GenerateMobileNavigations {
242
244
  } else {
243
245
  const newFilePath = mainRoutesJsFile.replace('.js', '.mjs');
244
246
  const renameFileResponse = await this.#renameFile(mainRoutesJsFile, newFilePath);
245
- if (renameFileResponse) {
246
- if (fs.existsSync(mainRoutesMjsFile)) {
247
- // Dynamically import the JS file assuming it exports filteredRoutes
248
- const module = await import(mainRoutesMjsFile); // file is already absolute
249
- if (module.filteredRoutes) {
250
- const newRoutes =
251
- module?.filteredRoutes?.map((filteredRoute) => {
252
- const routConfig: any = Object.values(filteredRoute)[0];
253
- const importPath = routConfig.component
254
- .toString()
255
- .match(/import\(['"](.*)['"]\)/)[1];
256
- // routConfig.componentPath = `../.${importPath}`;
247
+ if (renameFileResponse && fs.existsSync(mainRoutesMjsFile)) {
248
+ // Dynamically import the JS file assuming it exports filteredRoutes
249
+ const module = await import(mainRoutesMjsFile); // file is already absolute
250
+ if (module.filteredRoutes) {
251
+ const newRoutes =
252
+ module.filteredRoutes.map((filteredRoute) => {
253
+ // filteredRoute is of the form { [path]: routeConfig }
254
+ const routConfig: any = Object.values(filteredRoute)[0];
255
+ const importMatch = routConfig.component
256
+ ?.toString()
257
+ ?.match(/import\(['"](.*)['"]\)/);
258
+
259
+ if (importMatch && importMatch[1]) {
260
+ const importPath = importMatch[1]; // e.g. './pages/Home'
261
+ // Make the component path importable from files under `app/`
262
+ // (like `stack/index.js`), which live one level deeper.
263
+ // Example: '.././pages/Home.js'
257
264
  routConfig.componentPath = `.${importPath}.js`;
258
- return { [routConfig.path]: routConfig };
259
- }) ?? [];
260
- allFilteredRoutes.push(...newRoutes);
261
- try {
262
- const writeFileResponse = await this.#writeFile(
263
- outputFile,
264
- JSON.stringify(allFilteredRoutes, null, 2),
265
- );
266
-
267
- if (writeFileResponse) fs.unlinkSync(mainRoutesMjsFile);
268
- } catch (error) {
269
- console.log('Error creating main routes file', error);
270
- }
265
+ }
266
+
267
+ return { [routConfig.path]: routConfig };
268
+ }) ?? [];
269
+
270
+ allFilteredRoutes.push(...newRoutes);
271
+ try {
272
+ const writeFileResponse = await this.#writeFile(
273
+ outputFile,
274
+ JSON.stringify(allFilteredRoutes, null, 2),
275
+ );
276
+
277
+ if (writeFileResponse) fs.unlinkSync(mainRoutesMjsFile);
278
+ } catch (error) {
279
+ console.log('Error creating main routes file', error);
271
280
  }
272
281
  }
273
282
  }
@@ -391,7 +400,7 @@ export class GenerateMobileNavigations {
391
400
  `.replace(/,(\s*)$/, ''); // Removes trailing comma
392
401
 
393
402
  // Use Prettier to format the code
394
- classStructure = prettier.format(classStructure, { parser: 'babel' });
403
+ classStructure = await prettier.format(classStructure, { parser: 'babel' });
395
404
 
396
405
  const appFeatures = importStatements + '\n' + classStructure;
397
406
 
@@ -541,7 +550,7 @@ export class GenerateMobileNavigations {
541
550
  `.replace(/,(\s*)$/, ''); // Removes trailing comma
542
551
 
543
552
  // Use Prettier to format the code
544
- classStructure = prettier.format(classStructure, { parser: 'babel' });
553
+ classStructure = await prettier.format(classStructure, { parser: 'babel' });
545
554
 
546
555
  const appFeatures = importStatements + '\n' + classStructure;
547
556
 
@@ -611,7 +620,7 @@ export class GenerateMobileNavigations {
611
620
  `.replace(/,(\s*)$/, ''); // Removes trailing comma
612
621
 
613
622
  // Use Prettier to format the code
614
- classStructure = prettier.format(classStructure, { parser: 'babel' });
623
+ classStructure = await prettier.format(classStructure, { parser: 'babel' });
615
624
 
616
625
  const appFeatures = importStatements + '\n' + classStructure;
617
626
 
@@ -798,7 +807,7 @@ export class GenerateMobileNavigations {
798
807
  }
799
808
  stackNavigator = importStatements + '\n' + moduleRender;
800
809
  let stackNavigation = stackNavigator;
801
- stackNavigation = prettier.format(stackNavigation, { parser: 'babel' });
810
+ stackNavigation = await prettier.format(stackNavigation, { parser: 'babel' });
802
811
  const stackDirName = path.dirname(stackDirPath);
803
812
  try {
804
813
  const isDirCreated = await this.#makeDir(stackDirName);
@@ -978,7 +987,7 @@ export class GenerateMobileNavigations {
978
987
  moduleNavigation = importStatements + '\n' + moduleRender;
979
988
  const drawerNavigator = moduleNavigation;
980
989
  let drawerNavigation = drawerNavigator;
981
- drawerNavigation = prettier.format(drawerNavigation, { parser: 'babel' });
990
+ drawerNavigation = await prettier.format(drawerNavigation, { parser: 'babel' });
982
991
  const drawerDirName = path.dirname(drawerDirPath);
983
992
  try {
984
993
  const isDirCreated = await this.#makeDir(drawerDirName);
@@ -1248,7 +1257,7 @@ export class GenerateMobileNavigations {
1248
1257
  moduleNavigation = importStatements + '\n' + moduleRender;
1249
1258
  const bottomTabNavigator = moduleNavigation;
1250
1259
  let bottomTabNavigation = bottomTabNavigator;
1251
- bottomTabNavigation = prettier.format(bottomTabNavigation, { parser: 'babel' });
1260
+ bottomTabNavigation = await prettier.format(bottomTabNavigation, { parser: 'babel' });
1252
1261
  const bottomDirName = path.dirname(bottomDirPath);
1253
1262
  try {
1254
1263
  const isDirCreated = await this.#makeDir(bottomDirName);
@@ -1675,7 +1684,7 @@ export class GenerateMobileNavigations {
1675
1684
  export default AppNavigations;
1676
1685
  `;
1677
1686
  appNavigation = importStatements + '\n' + rootComponent + '\n' + appComponent;
1678
- appNavigation = prettier.format(appNavigation, { parser: 'babel' });
1687
+ appNavigation = await prettier.format(appNavigation, { parser: 'babel' });
1679
1688
  try {
1680
1689
  await this.#writeFile(navigationDirPath, appNavigation);
1681
1690
  } catch (error) {