@tarojs/router 4.0.0-alpha.35 → 4.0.0-alpha.36

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/dist/index.cjs.js CHANGED
@@ -45,7 +45,7 @@ body {
45
45
  /**
46
46
  * 插入路由相关样式
47
47
  */
48
- function loadRouterStyle(enableTabBar, enableWindowScroll, enhanceAnimation) {
48
+ function loadRouterStyle(enableTabBar, enableWindowScroll) {
49
49
  const css = `
50
50
  .taro_router {
51
51
  position: relative;
@@ -73,15 +73,11 @@ ${enableTabBar ? `
73
73
  }
74
74
 
75
75
  ` : ''}
76
- ${enhanceAnimation
77
- ? `.taro_page_shade:has(+.taro_page_stationed),
76
+ .taro_page_shade:has(+.taro_page_stationed),
78
77
  .taro_page_shade.taro_tabbar_page,
79
78
  .taro_router > .taro_page.taro_page_show.taro_page_stationed:not(.taro_page_shade):not(.taro_tabbar_page):not(:last-child):has(+.taro_page_stationed) {
80
79
  display: none;
81
- }` : ` .taro_page_shade,
82
- .taro_router > .taro_page.taro_page_show.taro_page_stationed:not(.taro_page_shade):not(.taro_tabbar_page):not(:last-child) {
83
- display: none;
84
- }`}
80
+ }
85
81
  `;
86
82
  addStyle(css);
87
83
  }
@@ -1276,7 +1272,7 @@ class PageHandler {
1276
1272
  this.pathname = exports.history.location.pathname;
1277
1273
  // Note: 注入页面样式
1278
1274
  this.animation && loadAnimateStyle(this.animationDuration);
1279
- loadRouterStyle(this.tabBarList.length > 1, this.usingWindowScroll, this.router.enhanceAnimation);
1275
+ loadRouterStyle(this.tabBarList.length > 1, this.usingWindowScroll);
1280
1276
  }
1281
1277
  onReady(page, onLoad = true) {
1282
1278
  var _a;
@@ -1400,7 +1396,7 @@ class PageHandler {
1400
1396
  }
1401
1397
  }
1402
1398
  hide(page, animation = false) {
1403
- var _a, _b, _c, _d, _e, _f, _g, _h;
1399
+ var _a, _b, _c, _d, _e, _f, _g;
1404
1400
  if (!page)
1405
1401
  return;
1406
1402
  // NOTE: 修复多页并发问题,此处可能因为路由跳转过快,执行时页面可能还没有创建成功
@@ -1425,7 +1421,6 @@ class PageHandler {
1425
1421
  this.hideTimer = null;
1426
1422
  (_g = (_f = (_e = this.lastHidePage) === null || _e === void 0 ? void 0 : _e.classList) === null || _f === void 0 ? void 0 : _f.add) === null || _g === void 0 ? void 0 : _g.call(_f, 'taro_page_shade');
1427
1423
  }
1428
- (_h = page.onHide) === null || _h === void 0 ? void 0 : _h.call(page);
1429
1424
  pageEl.classList.add('taro_page_shade');
1430
1425
  this.lastHidePage = pageEl;
1431
1426
  }
@@ -1712,8 +1707,7 @@ function handleAppMount(config, _, appId = config.appId || 'app') {
1712
1707
  app.id = appId;
1713
1708
  isPosition = false;
1714
1709
  }
1715
- const appWrapper = ((app === null || app === void 0 ? void 0 : app.parentNode) || (app === null || app === void 0 ? void 0 : app.parentElement) || document.body);
1716
- document.body.classList.add('taro-app-wrap');
1710
+ const appWrapper = (app === null || app === void 0 ? void 0 : app.parentNode) || (app === null || app === void 0 ? void 0 : app.parentElement) || document.body;
1717
1711
  app.classList.add('taro_router');
1718
1712
  if (!isPosition)
1719
1713
  appWrapper.appendChild(app);
@@ -1727,8 +1721,7 @@ function handleAppMountWithTabbar(config, history, appId = config.appId || 'app'
1727
1721
  app.id = appId;
1728
1722
  isPosition = false;
1729
1723
  }
1730
- const appWrapper = ((app === null || app === void 0 ? void 0 : app.parentNode) || (app === null || app === void 0 ? void 0 : app.parentElement) || document.body);
1731
- document.body.classList.add('taro-app-wrap');
1724
+ const appWrapper = (app === null || app === void 0 ? void 0 : app.parentNode) || (app === null || app === void 0 ? void 0 : app.parentElement) || document.body;
1732
1725
  app.classList.add('taro_router');
1733
1726
  const container = document.createElement('div');
1734
1727
  container.classList.add('taro-tabbar__container');
package/dist/index.esm.js CHANGED
@@ -44,7 +44,7 @@ body {
44
44
  /**
45
45
  * 插入路由相关样式
46
46
  */
47
- function loadRouterStyle(enableTabBar, enableWindowScroll, enhanceAnimation) {
47
+ function loadRouterStyle(enableTabBar, enableWindowScroll) {
48
48
  const css = `
49
49
  .taro_router {
50
50
  position: relative;
@@ -72,15 +72,11 @@ ${enableTabBar ? `
72
72
  }
73
73
 
74
74
  ` : ''}
75
- ${enhanceAnimation
76
- ? `.taro_page_shade:has(+.taro_page_stationed),
75
+ .taro_page_shade:has(+.taro_page_stationed),
77
76
  .taro_page_shade.taro_tabbar_page,
78
77
  .taro_router > .taro_page.taro_page_show.taro_page_stationed:not(.taro_page_shade):not(.taro_tabbar_page):not(:last-child):has(+.taro_page_stationed) {
79
78
  display: none;
80
- }` : ` .taro_page_shade,
81
- .taro_router > .taro_page.taro_page_show.taro_page_stationed:not(.taro_page_shade):not(.taro_tabbar_page):not(:last-child) {
82
- display: none;
83
- }`}
79
+ }
84
80
  `;
85
81
  addStyle(css);
86
82
  }
@@ -1275,7 +1271,7 @@ class PageHandler {
1275
1271
  this.pathname = history.location.pathname;
1276
1272
  // Note: 注入页面样式
1277
1273
  this.animation && loadAnimateStyle(this.animationDuration);
1278
- loadRouterStyle(this.tabBarList.length > 1, this.usingWindowScroll, this.router.enhanceAnimation);
1274
+ loadRouterStyle(this.tabBarList.length > 1, this.usingWindowScroll);
1279
1275
  }
1280
1276
  onReady(page, onLoad = true) {
1281
1277
  var _a;
@@ -1399,7 +1395,7 @@ class PageHandler {
1399
1395
  }
1400
1396
  }
1401
1397
  hide(page, animation = false) {
1402
- var _a, _b, _c, _d, _e, _f, _g, _h;
1398
+ var _a, _b, _c, _d, _e, _f, _g;
1403
1399
  if (!page)
1404
1400
  return;
1405
1401
  // NOTE: 修复多页并发问题,此处可能因为路由跳转过快,执行时页面可能还没有创建成功
@@ -1424,7 +1420,6 @@ class PageHandler {
1424
1420
  this.hideTimer = null;
1425
1421
  (_g = (_f = (_e = this.lastHidePage) === null || _e === void 0 ? void 0 : _e.classList) === null || _f === void 0 ? void 0 : _f.add) === null || _g === void 0 ? void 0 : _g.call(_f, 'taro_page_shade');
1426
1422
  }
1427
- (_h = page.onHide) === null || _h === void 0 ? void 0 : _h.call(page);
1428
1423
  pageEl.classList.add('taro_page_shade');
1429
1424
  this.lastHidePage = pageEl;
1430
1425
  }
@@ -1711,8 +1706,7 @@ function handleAppMount(config, _, appId = config.appId || 'app') {
1711
1706
  app.id = appId;
1712
1707
  isPosition = false;
1713
1708
  }
1714
- const appWrapper = ((app === null || app === void 0 ? void 0 : app.parentNode) || (app === null || app === void 0 ? void 0 : app.parentElement) || document.body);
1715
- document.body.classList.add('taro-app-wrap');
1709
+ const appWrapper = (app === null || app === void 0 ? void 0 : app.parentNode) || (app === null || app === void 0 ? void 0 : app.parentElement) || document.body;
1716
1710
  app.classList.add('taro_router');
1717
1711
  if (!isPosition)
1718
1712
  appWrapper.appendChild(app);
@@ -1726,8 +1720,7 @@ function handleAppMountWithTabbar(config, history, appId = config.appId || 'app'
1726
1720
  app.id = appId;
1727
1721
  isPosition = false;
1728
1722
  }
1729
- const appWrapper = ((app === null || app === void 0 ? void 0 : app.parentNode) || (app === null || app === void 0 ? void 0 : app.parentElement) || document.body);
1730
- document.body.classList.add('taro-app-wrap');
1723
+ const appWrapper = (app === null || app === void 0 ? void 0 : app.parentNode) || (app === null || app === void 0 ? void 0 : app.parentElement) || document.body;
1731
1724
  app.classList.add('taro_router');
1732
1725
  const container = document.createElement('div');
1733
1726
  container.classList.add('taro-tabbar__container');
package/dist/index.js CHANGED
@@ -16,8 +16,7 @@ function handleAppMount(config, _, appId = config.appId || 'app') {
16
16
  app.id = appId;
17
17
  isPosition = false;
18
18
  }
19
- const appWrapper = ((app === null || app === void 0 ? void 0 : app.parentNode) || (app === null || app === void 0 ? void 0 : app.parentElement) || document.body);
20
- document.body.classList.add('taro-app-wrap');
19
+ const appWrapper = (app === null || app === void 0 ? void 0 : app.parentNode) || (app === null || app === void 0 ? void 0 : app.parentElement) || document.body;
21
20
  app.classList.add('taro_router');
22
21
  if (!isPosition)
23
22
  appWrapper.appendChild(app);
@@ -31,8 +30,7 @@ function handleAppMountWithTabbar(config, history, appId = config.appId || 'app'
31
30
  app.id = appId;
32
31
  isPosition = false;
33
32
  }
34
- const appWrapper = ((app === null || app === void 0 ? void 0 : app.parentNode) || (app === null || app === void 0 ? void 0 : app.parentElement) || document.body);
35
- document.body.classList.add('taro-app-wrap');
33
+ const appWrapper = (app === null || app === void 0 ? void 0 : app.parentNode) || (app === null || app === void 0 ? void 0 : app.parentElement) || document.body;
36
34
  app.classList.add('taro_router');
37
35
  const container = document.createElement('div');
38
36
  container.classList.add('taro-tabbar__container');
@@ -123,7 +123,7 @@ class PageHandler {
123
123
  this.pathname = history.location.pathname;
124
124
  // Note: 注入页面样式
125
125
  this.animation && loadAnimateStyle(this.animationDuration);
126
- loadRouterStyle(this.tabBarList.length > 1, this.usingWindowScroll, this.router.enhanceAnimation);
126
+ loadRouterStyle(this.tabBarList.length > 1, this.usingWindowScroll);
127
127
  }
128
128
  onReady(page, onLoad = true) {
129
129
  var _a;
@@ -247,7 +247,7 @@ class PageHandler {
247
247
  }
248
248
  }
249
249
  hide(page, animation = false) {
250
- var _a, _b, _c, _d, _e, _f, _g, _h;
250
+ var _a, _b, _c, _d, _e, _f, _g;
251
251
  if (!page)
252
252
  return;
253
253
  // NOTE: 修复多页并发问题,此处可能因为路由跳转过快,执行时页面可能还没有创建成功
@@ -272,7 +272,6 @@ class PageHandler {
272
272
  this.hideTimer = null;
273
273
  (_g = (_f = (_e = this.lastHidePage) === null || _e === void 0 ? void 0 : _e.classList) === null || _f === void 0 ? void 0 : _f.add) === null || _g === void 0 ? void 0 : _g.call(_f, 'taro_page_shade');
274
274
  }
275
- (_h = page.onHide) === null || _h === void 0 ? void 0 : _h.call(page);
276
275
  pageEl.classList.add('taro_page_shade');
277
276
  this.lastHidePage = pageEl;
278
277
  }
package/dist/style.d.ts CHANGED
@@ -5,7 +5,7 @@ export declare function loadAnimateStyle(ms?: number): void;
5
5
  /**
6
6
  * 插入路由相关样式
7
7
  */
8
- export declare function loadRouterStyle(enableTabBar: boolean, enableWindowScroll: boolean, enhanceAnimation?: boolean): void;
8
+ export declare function loadRouterStyle(enableTabBar: boolean, enableWindowScroll: boolean): void;
9
9
  /**
10
10
  * 插入导航栏相关的样式
11
11
  */
package/dist/style.js CHANGED
@@ -34,7 +34,7 @@ body {
34
34
  /**
35
35
  * 插入路由相关样式
36
36
  */
37
- function loadRouterStyle(enableTabBar, enableWindowScroll, enhanceAnimation) {
37
+ function loadRouterStyle(enableTabBar, enableWindowScroll) {
38
38
  const css = `
39
39
  .taro_router {
40
40
  position: relative;
@@ -62,15 +62,11 @@ ${enableTabBar ? `
62
62
  }
63
63
 
64
64
  ` : ''}
65
- ${enhanceAnimation
66
- ? `.taro_page_shade:has(+.taro_page_stationed),
65
+ .taro_page_shade:has(+.taro_page_stationed),
67
66
  .taro_page_shade.taro_tabbar_page,
68
67
  .taro_router > .taro_page.taro_page_show.taro_page_stationed:not(.taro_page_shade):not(.taro_tabbar_page):not(:last-child):has(+.taro_page_stationed) {
69
68
  display: none;
70
- }` : ` .taro_page_shade,
71
- .taro_router > .taro_page.taro_page_show.taro_page_stationed:not(.taro_page_shade):not(.taro_tabbar_page):not(:last-child) {
72
- display: none;
73
- }`}
69
+ }
74
70
  `;
75
71
  addStyle(css);
76
72
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tarojs/router",
3
- "version": "4.0.0-alpha.35",
3
+ "version": "4.0.0-alpha.36",
4
4
  "description": "Taro-router",
5
5
  "author": "O2Team",
6
6
  "license": "MIT",
@@ -34,15 +34,15 @@
34
34
  "universal-router": "^9.2.0"
35
35
  },
36
36
  "devDependencies": {
37
- "@tarojs/components": "4.0.0-alpha.35",
38
- "@tarojs/runtime": "4.0.0-alpha.35",
39
- "@tarojs/taro": "4.0.0-alpha.35",
40
- "@tarojs/shared": "4.0.0-alpha.35"
37
+ "@tarojs/components": "4.0.0-alpha.36",
38
+ "@tarojs/runtime": "4.0.0-alpha.36",
39
+ "@tarojs/taro": "4.0.0-alpha.36",
40
+ "@tarojs/shared": "4.0.0-alpha.36"
41
41
  },
42
42
  "peerDependencies": {
43
- "@tarojs/shared": "4.0.0-alpha.35",
44
- "@tarojs/taro": "4.0.0-alpha.35",
45
- "@tarojs/runtime": "4.0.0-alpha.35"
43
+ "@tarojs/runtime": "4.0.0-alpha.36",
44
+ "@tarojs/taro": "4.0.0-alpha.36",
45
+ "@tarojs/shared": "4.0.0-alpha.36"
46
46
  },
47
47
  "scripts": {
48
48
  "prod": "pnpm run build",
package/types/router.d.ts CHANGED
@@ -12,8 +12,6 @@ export interface Router {
12
12
  customRoutes?: Record<string, string | string[]>
13
13
  pathname: string
14
14
  forcePath?: string
15
- /** 加上这个参数,可以解决返回页面的时候白屏的问题,但是某些不支持 :has() 选择器的浏览器会有问题 */
16
- enhanceAnimation?: boolean
17
15
  }
18
16
 
19
17
  export interface SpaRouterConfig extends AppConfig {