@tarojs/router 3.6.22-nightly.0 → 3.6.22

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.
@@ -48,7 +48,7 @@ export function createRouter(app, config, framework) {
48
48
  (_a = app.onLaunch) === null || _a === void 0 ? void 0 : _a.call(app, launchParam);
49
49
  app.onError && window.addEventListener('error', e => { var _a; return (_a = app.onError) === null || _a === void 0 ? void 0 : _a.call(app, e.message); });
50
50
  const render = ({ location, action }) => __awaiter(this, void 0, void 0, function* () {
51
- var _c, _d, _e, _f, _g, _h;
51
+ var _c, _d, _e, _f, _g, _h, _j, _k, _l;
52
52
  handler.pathname = decodeURI(location.pathname);
53
53
  if ((_c = window.__taroAppConfig) === null || _c === void 0 ? void 0 : _c.usingWindowScroll)
54
54
  window.scrollTo(0, 0);
@@ -77,22 +77,35 @@ export function createRouter(app, config, framework) {
77
77
  window.location.reload();
78
78
  }
79
79
  else {
80
- throw new Error(error);
80
+ throw error;
81
81
  }
82
82
  }
83
83
  if (!element)
84
84
  return;
85
85
  const pageConfig = handler.pageConfig;
86
86
  let enablePullDownRefresh = ((_e = config === null || config === void 0 ? void 0 : config.window) === null || _e === void 0 ? void 0 : _e.enablePullDownRefresh) || false;
87
+ let navigationStyle = ((_f = config === null || config === void 0 ? void 0 : config.window) === null || _f === void 0 ? void 0 : _f.navigationStyle) || 'default';
88
+ let navigationBarTextStyle = ((_g = config === null || config === void 0 ? void 0 : config.window) === null || _g === void 0 ? void 0 : _g.navigationBarTextStyle) || 'white';
89
+ let navigationBarBackgroundColor = ((_h = config === null || config === void 0 ? void 0 : config.window) === null || _h === void 0 ? void 0 : _h.navigationBarBackgroundColor) || '#000000';
87
90
  if (pageConfig) {
88
- setTitle((_f = pageConfig.navigationBarTitleText) !== null && _f !== void 0 ? _f : document.title);
91
+ setTitle((_j = pageConfig.navigationBarTitleText) !== null && _j !== void 0 ? _j : document.title);
89
92
  if (typeof pageConfig.enablePullDownRefresh === 'boolean') {
90
93
  enablePullDownRefresh = pageConfig.enablePullDownRefresh;
91
94
  }
95
+ if (typeof pageConfig.navigationStyle === 'string') {
96
+ navigationStyle = pageConfig.navigationStyle;
97
+ }
98
+ if (typeof pageConfig.navigationBarTextStyle === 'string') {
99
+ navigationBarTextStyle = pageConfig.navigationBarTextStyle;
100
+ }
101
+ if (typeof pageConfig.navigationBarBackgroundColor === 'string') {
102
+ navigationBarBackgroundColor = pageConfig.navigationBarBackgroundColor;
103
+ }
92
104
  }
105
+ eventCenter.trigger('__taroSetNavigationStyle', navigationStyle, navigationBarTextStyle, navigationBarBackgroundColor);
93
106
  const currentPage = Current.page;
94
107
  const pathname = handler.pathname;
95
- const methodName = (_g = stacks.method) !== null && _g !== void 0 ? _g : '';
108
+ const methodName = (_k = stacks.method) !== null && _k !== void 0 ? _k : '';
96
109
  const cacheTabs = stacks.getTabs();
97
110
  let shouldLoad = false;
98
111
  stacks.method = '';
@@ -158,7 +171,7 @@ export function createRouter(app, config, framework) {
158
171
  shouldLoad = true;
159
172
  }
160
173
  if (shouldLoad || stacks.length < 1) {
161
- const el = (_h = element.default) !== null && _h !== void 0 ? _h : element;
174
+ const el = (_l = element.default) !== null && _l !== void 0 ? _l : element;
162
175
  const loadConfig = Object.assign({}, pageConfig);
163
176
  const stacksIndex = stacks.length;
164
177
  delete loadConfig['path'];
package/dist/style.d.ts CHANGED
@@ -6,3 +6,4 @@ export declare function loadAnimateStyle(ms?: number): void;
6
6
  * 插入路由相关样式
7
7
  */
8
8
  export declare function loadRouterStyle(usingWindowScroll: boolean): void;
9
+ export declare function addStyle(css: any): void;
package/dist/style.js CHANGED
@@ -63,7 +63,7 @@ export function loadRouterStyle(usingWindowScroll) {
63
63
  `;
64
64
  addStyle(css);
65
65
  }
66
- function addStyle(css) {
66
+ export function addStyle(css) {
67
67
  if (!css)
68
68
  return;
69
69
  const style = document.createElement('style');
@@ -1,5 +1,3 @@
1
- import MobileDetect from 'mobile-detect';
2
- export declare function getMobileDetect(): MobileDetect;
1
+ export declare const isWeixin: () => boolean;
2
+ export declare const isDingTalk: () => boolean;
3
3
  export declare function setTitle(title: string): Promise<string>;
4
- export declare function isWeixin(): boolean;
5
- export declare function isDingTalk(): boolean;
@@ -7,16 +7,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import MobileDetect from 'mobile-detect';
11
- let md;
12
10
  let preTitle = document.title;
13
11
  let isLoadDdEntry = false;
14
- export function getMobileDetect() {
15
- if (!md) {
16
- md = new MobileDetect(navigator.userAgent);
17
- }
18
- return md;
19
- }
12
+ export const isWeixin = () => !!navigator.userAgent.match(/\bMicroMessenger\b/ig);
13
+ export const isDingTalk = () => !!navigator.userAgent.match(/\bDingTalk\b/ig);
20
14
  export function setTitle(title) {
21
15
  return __awaiter(this, void 0, void 0, function* () {
22
16
  if (preTitle === title)
@@ -34,11 +28,3 @@ export function setTitle(title) {
34
28
  return title;
35
29
  });
36
30
  }
37
- export function isWeixin() {
38
- const md = getMobileDetect();
39
- return md.match(/MicroMessenger/ig);
40
- }
41
- export function isDingTalk() {
42
- const md = getMobileDetect();
43
- return md.match(/DingTalk/ig);
44
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tarojs/router",
3
- "version": "3.6.22-nightly.0",
3
+ "version": "3.6.22",
4
4
  "description": "Taro-router",
5
5
  "browser": "dist/index.esm.js",
6
6
  "main:h5": "dist/index.js",
@@ -27,8 +27,8 @@
27
27
  "mobile-detect": "^1.4.2",
28
28
  "query-string": "^7.1.1",
29
29
  "universal-router": "^8.3.0",
30
- "@tarojs/taro": "3.6.22-nightly.0",
31
- "@tarojs/runtime": "3.6.22-nightly.0"
30
+ "@tarojs/runtime": "3.6.22",
31
+ "@tarojs/taro": "3.6.22"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@rollup/plugin-commonjs": "^20.0.0",