@amazon-devices/react-navigation__routers 2.0.1758683737

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 (60) hide show
  1. package/LICENSE +7 -0
  2. package/README.md +17 -0
  3. package/SystemBundles/b690027feea4132f8720e462805cba84c12cd0e25f99e321a1a2c8b794832a91.bundle +3515 -0
  4. package/SystemBundles/b690027feea4132f8720e462805cba84c12cd0e25f99e321a1a2c8b794832a91.map +1 -0
  5. package/SystemModules/amzn__react-navigation__routers-2.modules.txt +21 -0
  6. package/SystemModules/amzn__react-navigation__routers-2.private.modules.txt +13 -0
  7. package/SystemModules/keplerscript-system-bundle-config.json +7 -0
  8. package/THIRD_PARTY_NOTICES.txt +24 -0
  9. package/kepler-compatibility.json +8 -0
  10. package/kepler-transformed-package-info.json +3 -0
  11. package/lib/commonjs/BaseRouter.js +61 -0
  12. package/lib/commonjs/BaseRouter.js.map +1 -0
  13. package/lib/commonjs/CommonActions.js +53 -0
  14. package/lib/commonjs/CommonActions.js.map +1 -0
  15. package/lib/commonjs/DrawerRouter.js +154 -0
  16. package/lib/commonjs/DrawerRouter.js.map +1 -0
  17. package/lib/commonjs/StackRouter.js +310 -0
  18. package/lib/commonjs/StackRouter.js.map +1 -0
  19. package/lib/commonjs/TabRouter.js +253 -0
  20. package/lib/commonjs/TabRouter.js.map +1 -0
  21. package/lib/commonjs/index.js +80 -0
  22. package/lib/commonjs/index.js.map +1 -0
  23. package/lib/commonjs/types.js +6 -0
  24. package/lib/commonjs/types.js.map +1 -0
  25. package/lib/module/BaseRouter.js +55 -0
  26. package/lib/module/BaseRouter.js.map +1 -0
  27. package/lib/module/CommonActions.js +44 -0
  28. package/lib/module/CommonActions.js.map +1 -0
  29. package/lib/module/DrawerRouter.js +145 -0
  30. package/lib/module/DrawerRouter.js.map +1 -0
  31. package/lib/module/StackRouter.js +302 -0
  32. package/lib/module/StackRouter.js.map +1 -0
  33. package/lib/module/TabRouter.js +245 -0
  34. package/lib/module/TabRouter.js.map +1 -0
  35. package/lib/module/index.js +8 -0
  36. package/lib/module/index.js.map +1 -0
  37. package/lib/module/types.js +2 -0
  38. package/lib/module/types.js.map +1 -0
  39. package/lib/typescript/src/BaseRouter.d.ts +27 -0
  40. package/lib/typescript/src/BaseRouter.d.ts.map +1 -0
  41. package/lib/typescript/src/CommonActions.d.ts +56 -0
  42. package/lib/typescript/src/CommonActions.d.ts.map +1 -0
  43. package/lib/typescript/src/DrawerRouter.d.ts +53 -0
  44. package/lib/typescript/src/DrawerRouter.d.ts.map +1 -0
  45. package/lib/typescript/src/StackRouter.d.ts +69 -0
  46. package/lib/typescript/src/StackRouter.d.ts.map +1 -0
  47. package/lib/typescript/src/TabRouter.d.ts +41 -0
  48. package/lib/typescript/src/TabRouter.d.ts.map +1 -0
  49. package/lib/typescript/src/index.d.ts +11 -0
  50. package/lib/typescript/src/index.d.ts.map +1 -0
  51. package/lib/typescript/src/types.d.ts +177 -0
  52. package/lib/typescript/src/types.d.ts.map +1 -0
  53. package/package.json +1 -0
  54. package/src/BaseRouter.tsx +81 -0
  55. package/src/CommonActions.tsx +89 -0
  56. package/src/DrawerRouter.tsx +247 -0
  57. package/src/StackRouter.tsx +495 -0
  58. package/src/TabRouter.tsx +407 -0
  59. package/src/index.tsx +28 -0
  60. package/src/types.tsx +228 -0
@@ -0,0 +1,21 @@
1
+ node_modules/@amzn/react-navigation__routers_2/lib/commonjs/BaseRouter.js:ed52cec8d045963ef690
2
+ node_modules/@amzn/react-navigation__routers_2/lib/commonjs/CommonActions.js:753e4ea4136d8a647a48
3
+ node_modules/@amzn/react-navigation__routers_2/lib/commonjs/DrawerRouter.js:e439c281fd8214dde054
4
+ node_modules/@amzn/react-navigation__routers_2/lib/commonjs/TabRouter.js:51bc6144a204648d7f40
5
+ node_modules/@amzn/react-navigation__routers_2/lib/commonjs/StackRouter.js:b9c3076b2184de60772e
6
+ node_modules/@amzn/react-navigation__routers_2/lib/commonjs/index.js:ecba6c88b265e5561955
7
+ node_modules/@amzn/react-navigation__routers_2/lib/commonjs/types.js:b49427bde5b4a88de1e7
8
+ node_modules/@amzn/react-navigation__routers_2/lib/module/BaseRouter.js:95ae28b023658c6d2aff
9
+ node_modules/@amzn/react-navigation__routers_2/lib/module/CommonActions.js:f1e0b3318f7f12bf2431
10
+ node_modules/@amzn/react-navigation__routers_2/lib/module/DrawerRouter.js:4344b53816d7b780f3dd
11
+ node_modules/@amzn/react-navigation__routers_2/lib/module/TabRouter.js:20cc2f3e0ac4154b79f0
12
+ node_modules/@amzn/react-navigation__routers_2/lib/module/StackRouter.js:94f0b8bb0225084df7a9
13
+ node_modules/@amzn/react-navigation__routers_2/lib/module/index.js:36fad61dee5e550281f1
14
+ node_modules/@amzn/react-navigation__routers_2/lib/module/types.js:e32e355e493ded18598c
15
+ node_modules/@amzn/react-navigation__routers_2/src/BaseRouter.tsx:58153a28fc8e098e8bbf
16
+ node_modules/@amzn/react-navigation__routers_2/src/CommonActions.tsx:44010d2886624e71e726
17
+ node_modules/@amzn/react-navigation__routers_2/src/DrawerRouter.tsx:68ee2377a6ca7029997f
18
+ node_modules/@amzn/react-navigation__routers_2/src/TabRouter.tsx:46e9b616ece3d5066957
19
+ node_modules/@amzn/react-navigation__routers_2/src/StackRouter.tsx:97533916e76df342b455
20
+ node_modules/@amzn/react-navigation__routers_2/src/index.tsx:c7ce5eb5541f78e249bf
21
+ node_modules/@amzn/react-navigation__routers_2/src/types.tsx:9c8c9b182c731effad0e
@@ -0,0 +1,13 @@
1
+ node_modules/@react-native/js-polyfills_0.72.1/console.js:c081be8f6c0109dd350f
2
+ node_modules/@react-native/js-polyfills_0.72.1/error-guard.js:057b32c72f7f399723ba
3
+ node_modules/@react-native/js-polyfills_0.72.1/Object.es8.js:a9bf7d37774d7198840b
4
+ node_modules/nanoid_3.1.23/non-secure/index.js:e03db9aacb1ee503cd26
5
+ node_modules/@babel/runtime_7.26.0/helpers/objectWithoutProperties.js:288fc9023aadbf916360
6
+ node_modules/@babel/runtime_7.26.0/helpers/objectWithoutPropertiesLoose.js:227b8be7a5ddac0008f4
7
+ node_modules/@babel/runtime_7.26.0/helpers/toConsumableArray.js:c8d9faa50529497e8550
8
+ node_modules/@babel/runtime_7.26.0/helpers/arrayWithoutHoles.js:fedf38594225d61ce364
9
+ node_modules/@babel/runtime_7.26.0/helpers/arrayLikeToArray.js:790be5d6822a112c9007
10
+ node_modules/@babel/runtime_7.26.0/helpers/iterableToArray.js:caf268f6252e2825d074
11
+ node_modules/@babel/runtime_7.26.0/helpers/unsupportedIterableToArray.js:bb86eb755213422b1850
12
+ node_modules/@babel/runtime_7.26.0/helpers/nonIterableSpread.js:e82afc4c0fee49992755
13
+ node_modules/@babel/runtime_7.26.0/helpers/interopRequireDefault.js:e13c8413f9a5de8e772f
@@ -0,0 +1,7 @@
1
+ {
2
+ "@amzn/react-navigation__routers": {
3
+ "nameOnDevice": "index.amzn__react-navigation__routers-2.hermes.bundle",
4
+ "modulesPath": "amzn__react-navigation__routers-2.modules.txt",
5
+ "privateModulesPath": "amzn__react-navigation__routers-2.private.modules.txt"
6
+ }
7
+ }
@@ -0,0 +1,24 @@
1
+ License from package.json:
2
+ ========================================
3
+
4
+ MIT License
5
+
6
+ Copyright (c) 2017 React Navigation Contributors
7
+
8
+ Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ of this software and associated documentation files (the "Software"), to deal
10
+ in the Software without restriction, including without limitation the rights
11
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ copies of the Software, and to permit persons to whom the Software is
13
+ furnished to do so, subject to the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be included in all
16
+ copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
+ SOFTWARE.
@@ -0,0 +1,8 @@
1
+ {
2
+ "versions": {
3
+ "2.0.0": "/com.amazon.kepler.navigation__routers_2@INavigation__Routers_0",
4
+ "2.0.1756406152": "/com.amazon.kepler.navigation__routers_2@INavigation__Routers_0",
5
+ "2.0.1758654000": "/com.amazon.kepler.navigation__routers_2@INavigation__Routers_0",
6
+ "2.0.1758683737": "/com.amazon.kepler.navigation__routers_2@INavigation__Routers_0"
7
+ }
8
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "sourcePackageRef": "@amzn/react-navigation__routers"
3
+ }
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _nonSecure = require("nanoid/non-secure");
8
+ /**
9
+ * Base router object that can be used when writing custom routers.
10
+ * This provides few helper methods to handle common actions such as `RESET`.
11
+ */
12
+ const BaseRouter = {
13
+ getStateForAction(state, action) {
14
+ switch (action.type) {
15
+ case 'SET_PARAMS':
16
+ {
17
+ const index = action.source ? state.routes.findIndex(r => r.key === action.source) : state.index;
18
+ if (index === -1) {
19
+ return null;
20
+ }
21
+ return {
22
+ ...state,
23
+ routes: state.routes.map((r, i) => i === index ? {
24
+ ...r,
25
+ params: {
26
+ ...r.params,
27
+ ...action.payload.params
28
+ }
29
+ } : r)
30
+ };
31
+ }
32
+ case 'RESET':
33
+ {
34
+ const nextState = action.payload;
35
+ if (nextState.routes.length === 0 || nextState.routes.some(route => !state.routeNames.includes(route.name))) {
36
+ return null;
37
+ }
38
+ if (nextState.stale === false) {
39
+ if (state.routeNames.length !== nextState.routeNames.length || nextState.routeNames.some(name => !state.routeNames.includes(name))) {
40
+ return null;
41
+ }
42
+ return {
43
+ ...nextState,
44
+ routes: nextState.routes.map(route => route.key ? route : {
45
+ ...route,
46
+ key: `${route.name}-${(0, _nonSecure.nanoid)()}`
47
+ })
48
+ };
49
+ }
50
+ return nextState;
51
+ }
52
+ default:
53
+ return null;
54
+ }
55
+ },
56
+ shouldActionChangeFocus(action) {
57
+ return action.type === 'NAVIGATE';
58
+ }
59
+ };
60
+ var _default = exports.default = BaseRouter;
61
+ //# sourceMappingURL=BaseRouter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_nonSecure","require","BaseRouter","getStateForAction","state","action","type","index","source","routes","findIndex","r","key","map","i","params","payload","nextState","length","some","route","routeNames","includes","name","stale","nanoid","shouldActionChangeFocus","_default","exports","default"],"sourceRoot":"../../src","sources":["BaseRouter.tsx"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAQA;AACA;AACA;AACA;AACA,MAAMC,UAAU,GAAG;EACjBC,iBAAiBA,CACfC,KAAY,EACZC,MAA8B,EACM;IACpC,QAAQA,MAAM,CAACC,IAAI;MACjB,KAAK,YAAY;QAAE;UACjB,MAAMC,KAAK,GAAGF,MAAM,CAACG,MAAM,GACvBJ,KAAK,CAACK,MAAM,CAACC,SAAS,CAAEC,CAAC,IAAKA,CAAC,CAACC,GAAG,KAAKP,MAAM,CAACG,MAAM,CAAC,GACtDJ,KAAK,CAACG,KAAK;UAEf,IAAIA,KAAK,KAAK,CAAC,CAAC,EAAE;YAChB,OAAO,IAAI;UACb;UAEA,OAAO;YACL,GAAGH,KAAK;YACRK,MAAM,EAAEL,KAAK,CAACK,MAAM,CAACI,GAAG,CAAC,CAACF,CAAC,EAAEG,CAAC,KAC5BA,CAAC,KAAKP,KAAK,GACP;cAAE,GAAGI,CAAC;cAAEI,MAAM,EAAE;gBAAE,GAAGJ,CAAC,CAACI,MAAM;gBAAE,GAAGV,MAAM,CAACW,OAAO,CAACD;cAAO;YAAE,CAAC,GAC3DJ,CACN;UACF,CAAC;QACH;MAEA,KAAK,OAAO;QAAE;UACZ,MAAMM,SAAS,GAAGZ,MAAM,CAACW,OAAsC;UAE/D,IACEC,SAAS,CAACR,MAAM,CAACS,MAAM,KAAK,CAAC,IAC7BD,SAAS,CAACR,MAAM,CAACU,IAAI,CAClBC,KAAuB,IAAK,CAAChB,KAAK,CAACiB,UAAU,CAACC,QAAQ,CAACF,KAAK,CAACG,IAAI,CACpE,CAAC,EACD;YACA,OAAO,IAAI;UACb;UAEA,IAAIN,SAAS,CAACO,KAAK,KAAK,KAAK,EAAE;YAC7B,IACEpB,KAAK,CAACiB,UAAU,CAACH,MAAM,KAAKD,SAAS,CAACI,UAAU,CAACH,MAAM,IACvDD,SAAS,CAACI,UAAU,CAACF,IAAI,CACtBI,IAAI,IAAK,CAACnB,KAAK,CAACiB,UAAU,CAACC,QAAQ,CAACC,IAAI,CAC3C,CAAC,EACD;cACA,OAAO,IAAI;YACb;YAEA,OAAO;cACL,GAAGN,SAAS;cACZR,MAAM,EAAEQ,SAAS,CAACR,MAAM,CAACI,GAAG,CAAEO,KAAK,IACjCA,KAAK,CAACR,GAAG,GAAGQ,KAAK,GAAG;gBAAE,GAAGA,KAAK;gBAAER,GAAG,EAAE,GAAGQ,KAAK,CAACG,IAAI,IAAI,IAAAE,iBAAM,EAAC,CAAC;cAAG,CACnE;YACF,CAAC;UACH;UAEA,OAAOR,SAAS;QAClB;MAEA;QACE,OAAO,IAAI;IACf;EACF,CAAC;EAEDS,uBAAuBA,CAACrB,MAA8B,EAAE;IACtD,OAAOA,MAAM,CAACC,IAAI,KAAK,UAAU;EACnC;AACF,CAAC;AAAC,IAAAqB,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEa3B,UAAU","ignoreList":[]}
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.goBack = goBack;
7
+ exports.navigate = navigate;
8
+ exports.reset = reset;
9
+ exports.setParams = setParams;
10
+ function goBack() {
11
+ return {
12
+ type: 'GO_BACK'
13
+ };
14
+ }
15
+
16
+ // eslint-disable-next-line no-redeclare
17
+
18
+ // eslint-disable-next-line no-redeclare
19
+ function navigate(...args) {
20
+ if (typeof args[0] === 'string') {
21
+ return {
22
+ type: 'NAVIGATE',
23
+ payload: {
24
+ name: args[0],
25
+ params: args[1]
26
+ }
27
+ };
28
+ } else {
29
+ const payload = args[0] || {};
30
+ if (!payload.hasOwnProperty('key') && !payload.hasOwnProperty('name')) {
31
+ throw new Error('You need to specify name or key when calling navigate with an object as the argument. See https://reactnavigation.org/docs/navigation-actions#navigate for usage.');
32
+ }
33
+ return {
34
+ type: 'NAVIGATE',
35
+ payload
36
+ };
37
+ }
38
+ }
39
+ function reset(state) {
40
+ return {
41
+ type: 'RESET',
42
+ payload: state
43
+ };
44
+ }
45
+ function setParams(params) {
46
+ return {
47
+ type: 'SET_PARAMS',
48
+ payload: {
49
+ params
50
+ }
51
+ };
52
+ }
53
+ //# sourceMappingURL=CommonActions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["goBack","type","navigate","args","payload","name","params","hasOwnProperty","Error","reset","state","setParams"],"sourceRoot":"../../src","sources":["CommonActions.tsx"],"mappings":";;;;;;;;;AAgDO,SAASA,MAAMA,CAAA,EAAW;EAC/B,OAAO;IAAEC,IAAI,EAAE;EAAU,CAAC;AAC5B;;AAaA;;AAEA;AACO,SAASC,QAAQA,CAAC,GAAGC,IAAS,EAAU;EAC7C,IAAI,OAAOA,IAAI,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE;IAC/B,OAAO;MAAEF,IAAI,EAAE,UAAU;MAAEG,OAAO,EAAE;QAAEC,IAAI,EAAEF,IAAI,CAAC,CAAC,CAAC;QAAEG,MAAM,EAAEH,IAAI,CAAC,CAAC;MAAE;IAAE,CAAC;EAC1E,CAAC,MAAM;IACL,MAAMC,OAAO,GAAGD,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAE7B,IAAI,CAACC,OAAO,CAACG,cAAc,CAAC,KAAK,CAAC,IAAI,CAACH,OAAO,CAACG,cAAc,CAAC,MAAM,CAAC,EAAE;MACrE,MAAM,IAAIC,KAAK,CACb,mKACF,CAAC;IACH;IAEA,OAAO;MAAEP,IAAI,EAAE,UAAU;MAAEG;IAAQ,CAAC;EACtC;AACF;AAEO,SAASK,KAAKA,CAACC,KAA6B,EAAU;EAC3D,OAAO;IAAET,IAAI,EAAE,OAAO;IAAEG,OAAO,EAAEM;EAAM,CAAC;AAC1C;AAEO,SAASC,SAASA,CAACL,MAAc,EAAU;EAChD,OAAO;IAAEL,IAAI,EAAE,YAAY;IAAEG,OAAO,EAAE;MAAEE;IAAO;EAAE,CAAC;AACpD","ignoreList":[]}
@@ -0,0 +1,154 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.DrawerActions = void 0;
7
+ exports.default = DrawerRouter;
8
+ var _nonSecure = require("nanoid/non-secure");
9
+ var _TabRouter = _interopRequireWildcard(require("./TabRouter"));
10
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
11
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
12
+ const DrawerActions = exports.DrawerActions = {
13
+ ..._TabRouter.TabActions,
14
+ openDrawer() {
15
+ return {
16
+ type: 'OPEN_DRAWER'
17
+ };
18
+ },
19
+ closeDrawer() {
20
+ return {
21
+ type: 'CLOSE_DRAWER'
22
+ };
23
+ },
24
+ toggleDrawer() {
25
+ return {
26
+ type: 'TOGGLE_DRAWER'
27
+ };
28
+ }
29
+ };
30
+ function DrawerRouter({
31
+ defaultStatus = 'closed',
32
+ ...rest
33
+ }) {
34
+ const router = (0, _TabRouter.default)(rest);
35
+ const isDrawerInHistory = state => {
36
+ var _state$history;
37
+ return Boolean((_state$history = state.history) === null || _state$history === void 0 ? void 0 : _state$history.some(it => it.type === 'drawer'));
38
+ };
39
+ const addDrawerToHistory = state => {
40
+ if (isDrawerInHistory(state)) {
41
+ return state;
42
+ }
43
+ return {
44
+ ...state,
45
+ history: [...state.history, {
46
+ type: 'drawer',
47
+ status: defaultStatus === 'open' ? 'closed' : 'open'
48
+ }]
49
+ };
50
+ };
51
+ const removeDrawerFromHistory = state => {
52
+ if (!isDrawerInHistory(state)) {
53
+ return state;
54
+ }
55
+ return {
56
+ ...state,
57
+ history: state.history.filter(it => it.type !== 'drawer')
58
+ };
59
+ };
60
+ const openDrawer = state => {
61
+ if (defaultStatus === 'open') {
62
+ return removeDrawerFromHistory(state);
63
+ }
64
+ return addDrawerToHistory(state);
65
+ };
66
+ const closeDrawer = state => {
67
+ if (defaultStatus === 'open') {
68
+ return addDrawerToHistory(state);
69
+ }
70
+ return removeDrawerFromHistory(state);
71
+ };
72
+ return {
73
+ ...router,
74
+ type: 'drawer',
75
+ getInitialState({
76
+ routeNames,
77
+ routeParamList,
78
+ routeGetIdList
79
+ }) {
80
+ const state = router.getInitialState({
81
+ routeNames,
82
+ routeParamList,
83
+ routeGetIdList
84
+ });
85
+ return {
86
+ ...state,
87
+ default: defaultStatus,
88
+ stale: false,
89
+ type: 'drawer',
90
+ key: `drawer-${(0, _nonSecure.nanoid)()}`
91
+ };
92
+ },
93
+ getRehydratedState(partialState, {
94
+ routeNames,
95
+ routeParamList,
96
+ routeGetIdList
97
+ }) {
98
+ if (partialState.stale === false) {
99
+ return partialState;
100
+ }
101
+ let state = router.getRehydratedState(partialState, {
102
+ routeNames,
103
+ routeParamList,
104
+ routeGetIdList
105
+ });
106
+ if (isDrawerInHistory(partialState)) {
107
+ // Re-sync the drawer entry in history to correct it if it was wrong
108
+ state = removeDrawerFromHistory(state);
109
+ state = addDrawerToHistory(state);
110
+ }
111
+ return {
112
+ ...state,
113
+ default: defaultStatus,
114
+ type: 'drawer',
115
+ key: `drawer-${(0, _nonSecure.nanoid)()}`
116
+ };
117
+ },
118
+ getStateForRouteFocus(state, key) {
119
+ const result = router.getStateForRouteFocus(state, key);
120
+ return closeDrawer(result);
121
+ },
122
+ getStateForAction(state, action, options) {
123
+ switch (action.type) {
124
+ case 'OPEN_DRAWER':
125
+ return openDrawer(state);
126
+ case 'CLOSE_DRAWER':
127
+ return closeDrawer(state);
128
+ case 'TOGGLE_DRAWER':
129
+ if (isDrawerInHistory(state)) {
130
+ return removeDrawerFromHistory(state);
131
+ }
132
+ return addDrawerToHistory(state);
133
+ case 'JUMP_TO':
134
+ case 'NAVIGATE':
135
+ {
136
+ const result = router.getStateForAction(state, action, options);
137
+ if (result != null && result.index !== state.index) {
138
+ return closeDrawer(result);
139
+ }
140
+ return result;
141
+ }
142
+ case 'GO_BACK':
143
+ if (isDrawerInHistory(state)) {
144
+ return removeDrawerFromHistory(state);
145
+ }
146
+ return router.getStateForAction(state, action, options);
147
+ default:
148
+ return router.getStateForAction(state, action, options);
149
+ }
150
+ },
151
+ actionCreators: DrawerActions
152
+ };
153
+ }
154
+ //# sourceMappingURL=DrawerRouter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_nonSecure","require","_TabRouter","_interopRequireWildcard","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","DrawerActions","exports","TabActions","openDrawer","type","closeDrawer","toggleDrawer","DrawerRouter","defaultStatus","rest","router","TabRouter","isDrawerInHistory","state","_state$history","Boolean","history","some","it","addDrawerToHistory","status","removeDrawerFromHistory","filter","getInitialState","routeNames","routeParamList","routeGetIdList","stale","key","nanoid","getRehydratedState","partialState","getStateForRouteFocus","result","getStateForAction","action","options","index","actionCreators"],"sourceRoot":"../../src","sources":["DrawerRouter.tsx"],"mappings":";;;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAEA,IAAAC,UAAA,GAAAC,uBAAA,CAAAF,OAAA;AAMqB,SAAAG,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAF,wBAAAE,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,CAAA,SAAAG,CAAA,GAAAP,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAG,CAAA,KAAAA,CAAA,CAAAV,GAAA,IAAAU,CAAA,CAAAC,GAAA,IAAAP,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAG,CAAA,IAAAT,CAAA,CAAAM,CAAA,IA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