@admin-layout/gluestack-ui-mobile 6.5.1-alpha.0
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/CHANGELOG.md +117 -0
- package/LICENSE +21 -0
- package/README.md +4 -0
- package/assets/logo.png +0 -0
- package/babel.config.js +26 -0
- package/jest-react-navigation-setup.js +14 -0
- package/jest.config.js +39 -0
- package/jest.env.js +2 -0
- package/lib/__tests__/prolayout-layout-feature.test.d.ts +1 -0
- package/lib/__tests__/prolayout-layout-feature.test.js +202 -0
- package/lib/__tests__/prolayout-layout-feature.test.js.map +1 -0
- package/lib/components/ApplicationErrorFillWrapper.d.ts +2 -0
- package/lib/components/ApplicationErrorFillWrapper.js +7 -0
- package/lib/components/ApplicationErrorFillWrapper.js.map +1 -0
- package/lib/components/ApplicationErrorHandler.d.ts +2 -0
- package/lib/components/ApplicationErrorHandler.js +24 -0
- package/lib/components/ApplicationErrorHandler.js.map +1 -0
- package/lib/components/ErrorBounday.d.ts +18 -0
- package/lib/components/ErrorBounday.js +22 -0
- package/lib/components/ErrorBounday.js.map +1 -0
- package/lib/components/Fallback.d.ts +6 -0
- package/lib/components/Fallback.js +53 -0
- package/lib/components/Fallback.js.map +1 -0
- package/lib/components/Layout/components/BasicLayout.d.ts +5 -0
- package/lib/components/Layout/components/BasicLayout.js +28 -0
- package/lib/components/Layout/components/BasicLayout.js.map +1 -0
- package/lib/components/Layout/components/BottomTabBar.d.ts +2 -0
- package/lib/components/Layout/components/BottomTabBar.js +90 -0
- package/lib/components/Layout/components/BottomTabBar.js.map +1 -0
- package/lib/components/Layout/components/Drawer.d.ts +2 -0
- package/lib/components/Layout/components/Drawer.js +253 -0
- package/lib/components/Layout/components/Drawer.js.map +1 -0
- package/lib/components/Layout/components/Header.d.ts +2 -0
- package/lib/components/Layout/components/Header.js +130 -0
- package/lib/components/Layout/components/Header.js.map +1 -0
- package/lib/components/Layout/components/Sample.d.ts +2 -0
- package/lib/components/Layout/components/Sample.js +7 -0
- package/lib/components/Layout/components/Sample.js.map +1 -0
- package/lib/components/Layout/components/SettingDrawer/LayoutButton.d.ts +3 -0
- package/lib/components/Layout/components/SettingDrawer/LayoutButton.js +66 -0
- package/lib/components/Layout/components/SettingDrawer/LayoutButton.js.map +1 -0
- package/lib/components/Layout/components/SettingDrawer/SettingDrawer.d.ts +2 -0
- package/lib/components/Layout/components/SettingDrawer/SettingDrawer.js +23 -0
- package/lib/components/Layout/components/SettingDrawer/SettingDrawer.js.map +1 -0
- package/lib/components/Layout/components/SettingDrawer/ThemeColorButton.d.ts +3 -0
- package/lib/components/Layout/components/SettingDrawer/ThemeColorButton.js +24 -0
- package/lib/components/Layout/components/SettingDrawer/ThemeColorButton.js.map +1 -0
- package/lib/components/Layout/components/SettingDrawer/index.d.ts +1 -0
- package/lib/components/Layout/components/SettingDrawer/index.js +2 -0
- package/lib/components/Layout/components/SettingDrawer/index.js.map +1 -0
- package/lib/components/Layout/components/SideBar.d.ts +10 -0
- package/lib/components/Layout/components/SideBar.js +59 -0
- package/lib/components/Layout/components/SideBar.js.map +1 -0
- package/lib/components/Layout/components/defaultSettings.d.ts +4 -0
- package/lib/components/Layout/components/defaultSettings.js +16 -0
- package/lib/components/Layout/components/defaultSettings.js.map +1 -0
- package/lib/components/Layout/components/index.d.ts +4 -0
- package/lib/components/Layout/components/index.js +5 -0
- package/lib/components/Layout/components/index.js.map +1 -0
- package/lib/components/Layout/components/util.d.ts +1 -0
- package/lib/components/Layout/components/util.js +15 -0
- package/lib/components/Layout/components/util.js.map +1 -0
- package/lib/components/Layout/compute.d.ts +6 -0
- package/lib/components/Layout/compute.js +316 -0
- package/lib/components/Layout/compute.js.map +1 -0
- package/lib/components/Layout/compute.test.d.ts +6 -0
- package/lib/components/Layout/compute.test.js +120 -0
- package/lib/components/Layout/compute.test.js.map +1 -0
- package/lib/components/Layout/index.d.ts +4 -0
- package/lib/components/Layout/index.js +4 -0
- package/lib/components/Layout/index.js.map +1 -0
- package/lib/components/Layout/typings.d.ts +1 -0
- package/lib/components/Layout/typings.js +2 -0
- package/lib/components/Layout/typings.js.map +1 -0
- package/lib/components/NavigationComponent.d.ts +15 -0
- package/lib/components/NavigationComponent.js +120 -0
- package/lib/components/NavigationComponent.js.map +1 -0
- package/lib/components/PluginArea.d.ts +2 -0
- package/lib/components/PluginArea.js +8 -0
- package/lib/components/PluginArea.js.map +1 -0
- package/lib/components/ToastAlert.d.ts +12 -0
- package/lib/components/ToastAlert.js +17 -0
- package/lib/components/ToastAlert.js.map +1 -0
- package/lib/components/index.d.ts +9 -0
- package/lib/components/index.js +10 -0
- package/lib/components/index.js.map +1 -0
- package/lib/components/with-interactions-managed.d.ts +2 -0
- package/lib/components/with-interactions-managed.js +18 -0
- package/lib/components/with-interactions-managed.js.map +1 -0
- package/lib/config/config.d.ts +17 -0
- package/lib/config/config.js +18 -0
- package/lib/config/config.js.map +1 -0
- package/lib/config/index.d.ts +1 -0
- package/lib/config/index.js +2 -0
- package/lib/config/index.js.map +1 -0
- package/lib/constants/routes.d.ts +3 -0
- package/lib/constants/routes.js +5 -0
- package/lib/constants/routes.js.map +1 -0
- package/lib/containers/layout/BasicLayout.d.ts +7 -0
- package/lib/containers/layout/BasicLayout.js +36 -0
- package/lib/containers/layout/BasicLayout.js.map +1 -0
- package/lib/containers/layout/DrawerBottomNavigationConfig.d.ts +128 -0
- package/lib/containers/layout/DrawerBottomNavigationConfig.js +72 -0
- package/lib/containers/layout/DrawerBottomNavigationConfig.js.map +1 -0
- package/lib/containers/layout/DrawerConfig.d.ts +85 -0
- package/lib/containers/layout/DrawerConfig.js +48 -0
- package/lib/containers/layout/DrawerConfig.js.map +1 -0
- package/lib/containers/layout/Lifecycle.d.ts +13 -0
- package/lib/containers/layout/Lifecycle.js +18 -0
- package/lib/containers/layout/Lifecycle.js.map +1 -0
- package/lib/containers/layout/ProLayout.d.ts +5 -0
- package/lib/containers/layout/ProLayout.js +35 -0
- package/lib/containers/layout/ProLayout.js.map +1 -0
- package/lib/containers/layout/module.d.ts +5 -0
- package/lib/containers/layout/module.js +22 -0
- package/lib/containers/layout/module.js.map +1 -0
- package/lib/hooks/use-after-interactions.d.ts +6 -0
- package/lib/hooks/use-after-interactions.js +29 -0
- package/lib/hooks/use-after-interactions.js.map +1 -0
- package/lib/hooks/useIsReady.d.ts +2 -0
- package/lib/hooks/useIsReady.js +24 -0
- package/lib/hooks/useIsReady.js.map +1 -0
- package/lib/hooks/useLayoutSetting/index.d.ts +11 -0
- package/lib/hooks/useLayoutSetting/index.js +68 -0
- package/lib/hooks/useLayoutSetting/index.js.map +1 -0
- package/lib/index.d.ts +14 -0
- package/lib/index.js +26 -0
- package/lib/index.js.map +1 -0
- package/lib/interfaces/index.d.ts +1 -0
- package/lib/interfaces/index.js +2 -0
- package/lib/interfaces/index.js.map +1 -0
- package/lib/interfaces/settings.d.ts +4 -0
- package/lib/interfaces/settings.js +2 -0
- package/lib/interfaces/settings.js.map +1 -0
- package/lib/redux/settings.d.ts +80 -0
- package/lib/redux/settings.js +16 -0
- package/lib/redux/settings.js.map +1 -0
- package/lib/utils/ThemeColor.d.ts +8 -0
- package/lib/utils/ThemeColor.js +9 -0
- package/lib/utils/ThemeColor.js.map +1 -0
- package/lib/utils/routeConfigKeyReplace.d.ts +7 -0
- package/lib/utils/routeConfigKeyReplace.js +77 -0
- package/lib/utils/routeConfigKeyReplace.js.map +1 -0
- package/lib/utils/routeConfigKeyReplace.test.d.ts +1 -0
- package/lib/utils/routeConfigKeyReplace.test.js +102 -0
- package/lib/utils/routeConfigKeyReplace.test.js.map +1 -0
- package/package.json +40 -0
- package/src/__tests__/prolayout-layout-feature.test.tsx +207 -0
- package/src/components/ApplicationErrorFillWrapper.tsx +7 -0
- package/src/components/ApplicationErrorHandler.tsx +30 -0
- package/src/components/ErrorBounday.tsx +31 -0
- package/src/components/Fallback.tsx +65 -0
- package/src/components/Layout/README.md +11 -0
- package/src/components/Layout/components/BasicLayout.tsx +70 -0
- package/src/components/Layout/components/BottomTabBar.tsx +135 -0
- package/src/components/Layout/components/Drawer.tsx +412 -0
- package/src/components/Layout/components/Header.tsx +195 -0
- package/src/components/Layout/components/Sample.tsx +10 -0
- package/src/components/Layout/components/SettingDrawer/LayoutButton.tsx +102 -0
- package/src/components/Layout/components/SettingDrawer/SettingDrawer.tsx +60 -0
- package/src/components/Layout/components/SettingDrawer/ThemeColorButton.tsx +26 -0
- package/src/components/Layout/components/SettingDrawer/index.ts +1 -0
- package/src/components/Layout/components/SideBar.tsx +109 -0
- package/src/components/Layout/components/defaultSettings.ts +19 -0
- package/src/components/Layout/components/index.ts +4 -0
- package/src/components/Layout/components/util.ts +14 -0
- package/src/components/Layout/compute.test.tsx +129 -0
- package/src/components/Layout/compute.tsx +384 -0
- package/src/components/Layout/eslint.json +1 -0
- package/src/components/Layout/index.ts +5 -0
- package/src/components/Layout/typings.ts +1 -0
- package/src/components/NavigationComponent.tsx +154 -0
- package/src/components/PluginArea.tsx +11 -0
- package/src/components/ToastAlert.tsx +44 -0
- package/src/components/index.ts +9 -0
- package/src/components/with-interactions-managed.tsx +33 -0
- package/src/config/config.ts +17 -0
- package/src/config/index.ts +1 -0
- package/src/constants/routes.ts +3 -0
- package/src/containers/layout/BasicLayout.tsx +61 -0
- package/src/containers/layout/DrawerBottomNavigationConfig.tsx +85 -0
- package/src/containers/layout/DrawerConfig.tsx +59 -0
- package/src/containers/layout/Lifecycle.tsx +23 -0
- package/src/containers/layout/ProLayout.tsx +42 -0
- package/src/containers/layout/module.ts +24 -0
- package/src/hooks/use-after-interactions.ts +35 -0
- package/src/hooks/useIsReady.ts +31 -0
- package/src/hooks/useLayoutSetting/index.ts +99 -0
- package/src/index.ts +41 -0
- package/src/interfaces/index.ts +1 -0
- package/src/interfaces/settings.ts +5 -0
- package/src/redux/settings.ts +28 -0
- package/src/utils/ThemeColor.ts +9 -0
- package/src/utils/__snapshots__/routeConfigKeyReplace.test.ts.snap +117 -0
- package/src/utils/routeConfigKeyReplace.test.ts +114 -0
- package/src/utils/routeConfigKeyReplace.ts +74 -0
- package/tsconfig.json +37 -0
- package/types.d.ts +11 -0
- package/webpack.config.js +104 -0
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { Feature, IRouteData, getNavigation, getSortedNavigations } from '@common-stack/client-react';
|
|
2
|
+
import { createStackNavigator } from '@react-navigation/stack';
|
|
3
|
+
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
|
|
4
|
+
import { createDrawerNavigator } from '@react-navigation/drawer';
|
|
5
|
+
import routeConfigKeyReplace from './routeConfigKeyReplace';
|
|
6
|
+
import {
|
|
7
|
+
appDrawerFeature,
|
|
8
|
+
appBottomTabFeature,
|
|
9
|
+
appDrawerBottomTabFeature,
|
|
10
|
+
appBottomTabDrawerFeature,
|
|
11
|
+
appHostBottomTabFeature,
|
|
12
|
+
} from '../components/Layout/compute.test';
|
|
13
|
+
|
|
14
|
+
const MyComponent = () => {};
|
|
15
|
+
|
|
16
|
+
describe('route config key replace', () => {
|
|
17
|
+
const routerConfig = {
|
|
18
|
+
['/']: {
|
|
19
|
+
exact: false,
|
|
20
|
+
container: createStackNavigator(),
|
|
21
|
+
name: 'MainStack',
|
|
22
|
+
props: {
|
|
23
|
+
initialRouteName: 'MainStack.MainBottomTab',
|
|
24
|
+
screenOptions: {
|
|
25
|
+
headerShown: false,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
// ['//:orgName']: {
|
|
30
|
+
// exact: false,
|
|
31
|
+
// // container: createStackNavigator(),
|
|
32
|
+
// name: 'OrgNameStack',
|
|
33
|
+
// props: {
|
|
34
|
+
// initialRouteName: 'MainStack.OrgNameStack.MainDrawer',
|
|
35
|
+
// component: MyComponent,
|
|
36
|
+
// screenOptions: {
|
|
37
|
+
// headerShown: false,
|
|
38
|
+
// },
|
|
39
|
+
// },
|
|
40
|
+
// },
|
|
41
|
+
['//sample']: {
|
|
42
|
+
name: 'Sample',
|
|
43
|
+
props: {
|
|
44
|
+
priority: 1,
|
|
45
|
+
initialParams: { orgName: 'test' },
|
|
46
|
+
component: MyComponent,
|
|
47
|
+
options: {
|
|
48
|
+
headerShown: true,
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
['//:orgName/l/home']: {
|
|
53
|
+
name: 'Home',
|
|
54
|
+
props: {
|
|
55
|
+
priority: 1,
|
|
56
|
+
initialParams: { orgName: 'test' },
|
|
57
|
+
component: MyComponent,
|
|
58
|
+
options: {
|
|
59
|
+
headerShown: true,
|
|
60
|
+
tabBarLabel: 'Home',
|
|
61
|
+
headerTitle: 'Home',
|
|
62
|
+
// tabBarIcon: ({ color }) => <Ionicons name="home" size={24} color={color} />,
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
['//:orgName/l/home/:about']: {
|
|
67
|
+
exact: false,
|
|
68
|
+
name: 'About',
|
|
69
|
+
props: {
|
|
70
|
+
priority: 2,
|
|
71
|
+
initialParams: {},
|
|
72
|
+
component: MyComponent,
|
|
73
|
+
options: {
|
|
74
|
+
headerShown: true,
|
|
75
|
+
tabBarLabel: 'About',
|
|
76
|
+
headerTitle: 'About',
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
['//:orgName/l/account']: {
|
|
81
|
+
name: 'Account',
|
|
82
|
+
props: {
|
|
83
|
+
priority: 3,
|
|
84
|
+
initialParams: {},
|
|
85
|
+
component: MyComponent,
|
|
86
|
+
options: {
|
|
87
|
+
headerShown: true,
|
|
88
|
+
tabBarLabel: 'Account',
|
|
89
|
+
headerTitle: 'Account',
|
|
90
|
+
// tabBarIcon: ({ color }) => <Ionicons name="home" size={24} color={color} />,
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
it('getSortedNavigations with routeConfigKeyReplace ', () => {
|
|
97
|
+
//******************Layout Settings for test*************************/
|
|
98
|
+
// For layout 'side', keyReplaceWith='/main_drawer/',appLayout=appDrawerFeature()
|
|
99
|
+
// For layout 'mixSide', keyReplaceWith='/main_drawer/bottom_tab/',appLayout=appDrawerBottomTabFeature()
|
|
100
|
+
// For layout 'bottom', keyReplaceWith='/bottom_tab/',appLayout=appBottomTabFeature
|
|
101
|
+
// For layout 'host-bottom', keyReplaceWith='/host_tab/',appLayout=appHostBottomTabFeature
|
|
102
|
+
//*******************************************************************/
|
|
103
|
+
const routeConfigFeature = new Feature({ routeConfig: routerConfig });
|
|
104
|
+
|
|
105
|
+
let keyReplacedWith = '/bottom_tab/';
|
|
106
|
+
const appLayout = appBottomTabFeature;
|
|
107
|
+
|
|
108
|
+
const {appFeatures} = routeConfigKeyReplace(keyReplacedWith, routeConfigFeature,appLayout);
|
|
109
|
+
// const appFeatures = new Feature(appLayoutConfig, appLayoutFeatures);
|
|
110
|
+
const Render = appFeatures.getRoutes2('/', 'MainStack');
|
|
111
|
+
const configuredRoute = appFeatures.getConfiguredRoutes2('/');
|
|
112
|
+
expect(Render).toMatchSnapshot();
|
|
113
|
+
});
|
|
114
|
+
});
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { Feature } from '@common-stack/client-react';
|
|
2
|
+
const routeConfigKeyReplace = (keyReplacedWith: any, features: any,appLayout=null as any,intialRouteName='MainStack.Layout' as any) => {
|
|
3
|
+
let appLayoutFeatures = { ...features };
|
|
4
|
+
appLayoutFeatures.routeConfig = appLayoutFeatures?.routeConfig?.map((obj: any) => {
|
|
5
|
+
let rObj: any = { ...obj };
|
|
6
|
+
if (rObj.hasOwnProperty('/')) rObj['/'].props.initialRouteName = intialRouteName;
|
|
7
|
+
let objectEntries = Object.entries(rObj).map(([key, val]: any) => {
|
|
8
|
+
let objVal: any = Object.assign({}, val);
|
|
9
|
+
let initialParams = objVal?.props?.initialParams ?? {};
|
|
10
|
+
if (objVal?.props?.options) {
|
|
11
|
+
initialParams.menu_position = objVal?.menu_position ?? 'bottom';
|
|
12
|
+
initialParams.priority = objVal?.props?.options?.priority ?? 0;
|
|
13
|
+
initialParams.options = objVal.props.options ? JSON.stringify(objVal?.props?.options) : null;
|
|
14
|
+
objVal.props.initialParams = initialParams;
|
|
15
|
+
}
|
|
16
|
+
let objKey: any;
|
|
17
|
+
|
|
18
|
+
if(keyReplacedWith=='//host_tab/'){
|
|
19
|
+
objKey = key.startsWith('//:orgName/h/')
|
|
20
|
+
?key.replace('//:orgName/h/', '//:orgName'+keyReplacedWith?.replace('//','/'))
|
|
21
|
+
:key.startsWith('//h/')
|
|
22
|
+
?key.replace('//h/', keyReplacedWith)
|
|
23
|
+
:key.startsWith('//:orgName/l/')?null
|
|
24
|
+
:key.startsWith('//l/') ? null
|
|
25
|
+
:key;
|
|
26
|
+
}
|
|
27
|
+
else{
|
|
28
|
+
objKey = key.startsWith('//:orgName/l/') ? key.replace('//:orgName/l/', '//:orgName'+keyReplacedWith?.replace('//','/'))
|
|
29
|
+
: key.startsWith('//l/') ? key.replace('//l/', keyReplacedWith)
|
|
30
|
+
: key.startsWith('//:orgName/h/') ? null
|
|
31
|
+
: key.startsWith('//h/') ? null
|
|
32
|
+
: key;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return [objKey, objVal];
|
|
36
|
+
});
|
|
37
|
+
return Object.fromEntries(objectEntries);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
let appLayoutConfig:any=null;
|
|
41
|
+
if(appLayout) {
|
|
42
|
+
let layoutFeatures = [...features?.routeConfig]
|
|
43
|
+
//const intialRoutename = layoutFeatures?.map((obj:any)=>obj.hasOwnProperty('/') && obj['/'].props.initialRouteName)?.filter((obj:any)=>obj)[0]??'MainStack.MainDrawer';
|
|
44
|
+
const isOrgName = layoutFeatures?.map((obj: any)=>{
|
|
45
|
+
return Object.entries(obj).map(([key, val]: any) => {
|
|
46
|
+
if(keyReplacedWith=='//host_tab/'){
|
|
47
|
+
if(key.startsWith('//:orgName/h/')) return true;
|
|
48
|
+
else return null;
|
|
49
|
+
}
|
|
50
|
+
else{
|
|
51
|
+
if(key.startsWith('//:orgName/l/')) return true;
|
|
52
|
+
else null;
|
|
53
|
+
}
|
|
54
|
+
})
|
|
55
|
+
})?.flat(1)?.filter((obj:any)=>obj)??[];
|
|
56
|
+
appLayoutConfig = {...appLayout};
|
|
57
|
+
appLayoutConfig.routeConfig = appLayoutConfig?.routeConfig?.map((obj:any)=>{
|
|
58
|
+
let rObj: any = { ...obj };
|
|
59
|
+
//if (rObj.hasOwnProperty('/')) rObj['/'].props.initialRouteName = intialRoutename;
|
|
60
|
+
let objectEntries = Object.entries(rObj).map(([key, val]: any) => {
|
|
61
|
+
let objVal: any = Object.assign({}, val);
|
|
62
|
+
|
|
63
|
+
let objKey: any;
|
|
64
|
+
objKey = isOrgName?.length > 0 ? key.startsWith('//')? key.replace('//', '//:orgName/') : key : key;
|
|
65
|
+
return [objKey, objVal];
|
|
66
|
+
});
|
|
67
|
+
return Object.fromEntries(objectEntries);
|
|
68
|
+
})
|
|
69
|
+
}
|
|
70
|
+
const appFeatures = new Feature(appLayoutConfig, appLayoutFeatures);
|
|
71
|
+
return {appFeatures,appLayoutConfig,appLayoutFeatures};
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export default routeConfigKeyReplace;
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"module": "esnext",
|
|
4
|
+
"target": "ES2015",
|
|
5
|
+
"lib": [
|
|
6
|
+
"dom",
|
|
7
|
+
"esnext"
|
|
8
|
+
],
|
|
9
|
+
"moduleResolution": "node",
|
|
10
|
+
"jsx": "react",
|
|
11
|
+
"rootDir": "src",
|
|
12
|
+
"outDir": "lib",
|
|
13
|
+
"sourceMap": true,
|
|
14
|
+
"declaration": true,
|
|
15
|
+
"esModuleInterop": true,
|
|
16
|
+
"allowSyntheticDefaultImports": true,
|
|
17
|
+
"skipLibCheck": true,
|
|
18
|
+
"types": [
|
|
19
|
+
"@types/node",
|
|
20
|
+
"@types/jest",
|
|
21
|
+
"../../../typings",
|
|
22
|
+
// "../../../node_modules/@gluestack-ui",
|
|
23
|
+
// "../../../node_modules/@gluestack-style",
|
|
24
|
+
"./types"
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
"include": [
|
|
28
|
+
"src",
|
|
29
|
+
"./types.d.ts",
|
|
30
|
+
],
|
|
31
|
+
"exclude": [
|
|
32
|
+
"node_modules",
|
|
33
|
+
"lib",
|
|
34
|
+
"webpack.config.js",
|
|
35
|
+
"rollup.config.mjs"
|
|
36
|
+
]
|
|
37
|
+
}
|
package/types.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// import { Theme } from 'native-base';
|
|
2
|
+
// import { LayoutTheme } from '@admin-layout/client'
|
|
3
|
+
|
|
4
|
+
// 2. Get the type of the CustomTheme
|
|
5
|
+
//type CustomThemeType = Theme & LayoutTheme;
|
|
6
|
+
|
|
7
|
+
// 3. Extend the internal NativeBase Theme
|
|
8
|
+
// declare module 'native-base' {
|
|
9
|
+
|
|
10
|
+
// interface ICustomTheme extends CustomThemeType {}
|
|
11
|
+
// }
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
var nodeExternals = require("webpack-node-externals");
|
|
2
|
+
var webpack = require("webpack");
|
|
3
|
+
var path = require("path");
|
|
4
|
+
var fs = require("fs");
|
|
5
|
+
const ExtractTextPlugin = require("extract-text-webpack-plugin");
|
|
6
|
+
const lessToJs = require('less-vars-to-js');
|
|
7
|
+
// const themeVariables = lessToJs(fs.readFileSync(path.join(__dirname, './ant-theme-vars.less'), 'utf8'));
|
|
8
|
+
|
|
9
|
+
var webpack_opts = {
|
|
10
|
+
mode: "development",
|
|
11
|
+
entry: {
|
|
12
|
+
index: './src/index.ts'
|
|
13
|
+
},
|
|
14
|
+
target: "node",
|
|
15
|
+
output: {
|
|
16
|
+
path: path.join(__dirname, "lib"),
|
|
17
|
+
filename: '[name].js',
|
|
18
|
+
libraryTarget: "commonjs2"
|
|
19
|
+
},
|
|
20
|
+
resolve: {
|
|
21
|
+
extensions: [".ts", ".tsx", ".js", ".jsx", ".css"]
|
|
22
|
+
},
|
|
23
|
+
plugins: [
|
|
24
|
+
new ExtractTextPlugin("styles.css"),
|
|
25
|
+
new webpack.LoaderOptionsPlugin({
|
|
26
|
+
options: {
|
|
27
|
+
test: /\.tsx?$/,
|
|
28
|
+
ts: {
|
|
29
|
+
compiler: "typescript",
|
|
30
|
+
configFile: "tsconfig.json"
|
|
31
|
+
},
|
|
32
|
+
tslint: {
|
|
33
|
+
emitErrors: true,
|
|
34
|
+
failOnHint: true
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
})
|
|
38
|
+
],
|
|
39
|
+
devtool: "source-map",
|
|
40
|
+
module: {
|
|
41
|
+
rules: [
|
|
42
|
+
{
|
|
43
|
+
test: /\.tsx?$/,
|
|
44
|
+
use: "ts-loader"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
test: /\.jsx?$/,
|
|
48
|
+
loader: 'babel-loader',
|
|
49
|
+
exclude: /node_modules/,
|
|
50
|
+
// query: {
|
|
51
|
+
// cacheDirectory: true,
|
|
52
|
+
// presets: [
|
|
53
|
+
// require.resolve('@babel/preset-env'),
|
|
54
|
+
// require.resolve('@babel/preset-react'),
|
|
55
|
+
// ],
|
|
56
|
+
// plugins: [require.resolve('@babel/plugin-proposal-class-properties')],
|
|
57
|
+
// }
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
test: /\.(pdf|jpg|png|gif|svg|ico)$/,
|
|
61
|
+
use: [
|
|
62
|
+
{
|
|
63
|
+
loader: "url-loader"
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
test: /\.(graphql|gql)$/,
|
|
69
|
+
exclude: /node_modules/,
|
|
70
|
+
loader: "graphql-tag/loader"
|
|
71
|
+
},
|
|
72
|
+
{ test: /\.svg$/, loader: "url-loader?limit=10000" },
|
|
73
|
+
{
|
|
74
|
+
test: /\.css$/,
|
|
75
|
+
use: ExtractTextPlugin.extract({
|
|
76
|
+
fallback: "style-loader",
|
|
77
|
+
use: [
|
|
78
|
+
{ loader: "css-loader", options: { importLoaders: 1 } },
|
|
79
|
+
{
|
|
80
|
+
loader: "postcss-loader",
|
|
81
|
+
options: {
|
|
82
|
+
plugins: () => [
|
|
83
|
+
require("autoprefixer")({
|
|
84
|
+
browsers: ["> 1%", "last 2 versions"]
|
|
85
|
+
})
|
|
86
|
+
],
|
|
87
|
+
config: { path: "./src/postcss.config.js" }
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
]
|
|
91
|
+
})
|
|
92
|
+
}
|
|
93
|
+
]
|
|
94
|
+
},
|
|
95
|
+
externals: [
|
|
96
|
+
nodeExternals({
|
|
97
|
+
allowlist: [/.*\.css$/],
|
|
98
|
+
modulesDir: "../../node_modules"
|
|
99
|
+
}),
|
|
100
|
+
nodeExternals()
|
|
101
|
+
]
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
module.exports = webpack_opts;
|