@tuya-miniapp/smart-ui 2.10.1-beta-1 → 2.10.1-beta-3

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.
@@ -3,7 +3,8 @@ declare const tyApi: {
3
3
  selectionVibrate: () => void;
4
4
  notificationVibrate: (v: any) => void;
5
5
  nativeDisabled: (v: boolean) => void;
6
- getThemeInfo: () => any;
6
+ themeInfo: Record<string, string> | null;
7
+ getThemeInfo: () => Record<string, string> | null | undefined;
7
8
  isWX: () => boolean;
8
9
  };
9
10
  export default tyApi;
package/dist/common/ty.js CHANGED
@@ -1,4 +1,5 @@
1
- const systemInfo = wx.getSystemInfoSync();
1
+ import { getSystemInfoSync } from './version';
2
+ const systemInfo = getSystemInfoSync();
2
3
  const isIOS = systemInfo.platform === 'ios';
3
4
  const tyApi = {
4
5
  vibrateShort: (v) => {
@@ -42,12 +43,17 @@ const tyApi = {
42
43
  (_a = ty.nativeDisabled) === null || _a === void 0 ? void 0 : _a.call(ty, v);
43
44
  }
44
45
  },
46
+ themeInfo: null,
45
47
  getThemeInfo: () => {
46
48
  var _a;
49
+ if (tyApi.themeInfo) {
50
+ return tyApi.themeInfo;
51
+ }
47
52
  // @ts-ignore
48
53
  if (typeof ty !== 'undefined') {
49
54
  // @ts-ignore
50
- return (_a = ty.getThemeInfo) === null || _a === void 0 ? void 0 : _a.call(ty);
55
+ tyApi.themeInfo = (_a = ty.getThemeInfo) === null || _a === void 0 ? void 0 : _a.call(ty);
56
+ return tyApi.themeInfo;
51
57
  }
52
58
  },
53
59
  isWX: () => {
@@ -44,6 +44,7 @@ export function transition(showDefaultValue) {
44
44
  display: false,
45
45
  animating: false,
46
46
  status: '',
47
+ isShowed: false,
47
48
  },
48
49
  ready() {
49
50
  if (this.data.show === true) {
@@ -52,6 +53,11 @@ export function transition(showDefaultValue) {
52
53
  },
53
54
  methods: {
54
55
  observeShow(value, old) {
56
+ if (!this.data.isShowed && value) {
57
+ this.setData({
58
+ isShowed: true,
59
+ });
60
+ }
55
61
  if (value === old) {
56
62
  return;
57
63
  }
@@ -3,19 +3,21 @@
3
3
 
4
4
  <import src="./popup.wxml" />
5
5
 
6
- <smart-overlay
7
- wx:if="{{ overlay }}"
8
- show="{{ show }}"
9
- z-index="{{ zIndex }}"
10
- custom-style="{{ overlayStyle }}"
11
- duration="{{ duration }}"
12
- bind:click="onClickOverlay"
13
- lock-scroll="{{ lockScroll }}"
14
- root-portal="{{ rootPortal }}"
15
- />
6
+ <block wx:if="{{ isShowed }}">
7
+ <smart-overlay
8
+ wx:if="{{ overlay }}"
9
+ show="{{ show }}"
10
+ z-index="{{ zIndex }}"
11
+ custom-style="{{ overlayStyle }}"
12
+ duration="{{ duration }}"
13
+ bind:click="onClickOverlay"
14
+ lock-scroll="{{ lockScroll }}"
15
+ root-portal="{{ rootPortal }}"
16
+ />
16
17
 
17
- <root-portal wx:if="{{ rootPortal }}">
18
- <include src="./popup.wxml" />
19
- </root-portal>
18
+ <root-portal wx:if="{{ rootPortal }}">
19
+ <include src="./popup.wxml" />
20
+ </root-portal>
20
21
 
21
- <include wx:else src="./popup.wxml" />
22
+ <include wx:else src="./popup.wxml" />
23
+ </block>
@@ -3,7 +3,8 @@ declare const tyApi: {
3
3
  selectionVibrate: () => void;
4
4
  notificationVibrate: (v: any) => void;
5
5
  nativeDisabled: (v: boolean) => void;
6
- getThemeInfo: () => any;
6
+ themeInfo: Record<string, string> | null;
7
+ getThemeInfo: () => Record<string, string> | null | undefined;
7
8
  isWX: () => boolean;
8
9
  };
9
10
  export default tyApi;
package/lib/common/ty.js CHANGED
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- var systemInfo = wx.getSystemInfoSync();
3
+ var version_1 = require("./version");
4
+ var systemInfo = (0, version_1.getSystemInfoSync)();
4
5
  var isIOS = systemInfo.platform === 'ios';
5
6
  var tyApi = {
6
7
  vibrateShort: function (v) {
@@ -44,12 +45,17 @@ var tyApi = {
44
45
  (_a = ty.nativeDisabled) === null || _a === void 0 ? void 0 : _a.call(ty, v);
45
46
  }
46
47
  },
48
+ themeInfo: null,
47
49
  getThemeInfo: function () {
48
50
  var _a;
51
+ if (tyApi.themeInfo) {
52
+ return tyApi.themeInfo;
53
+ }
49
54
  // @ts-ignore
50
55
  if (typeof ty !== 'undefined') {
51
56
  // @ts-ignore
52
- return (_a = ty.getThemeInfo) === null || _a === void 0 ? void 0 : _a.call(ty);
57
+ tyApi.themeInfo = (_a = ty.getThemeInfo) === null || _a === void 0 ? void 0 : _a.call(ty);
58
+ return tyApi.themeInfo;
53
59
  }
54
60
  },
55
61
  isWX: function () {
@@ -77,6 +77,7 @@ function transition(showDefaultValue) {
77
77
  display: false,
78
78
  animating: false,
79
79
  status: '',
80
+ isShowed: false,
80
81
  },
81
82
  ready: function () {
82
83
  if (this.data.show === true) {
@@ -85,6 +86,11 @@ function transition(showDefaultValue) {
85
86
  },
86
87
  methods: {
87
88
  observeShow: function (value, old) {
89
+ if (!this.data.isShowed && value) {
90
+ this.setData({
91
+ isShowed: true,
92
+ });
93
+ }
88
94
  if (value === old) {
89
95
  return;
90
96
  }
@@ -3,19 +3,21 @@
3
3
 
4
4
  <import src="./popup.wxml" />
5
5
 
6
- <smart-overlay
7
- wx:if="{{ overlay }}"
8
- show="{{ show }}"
9
- z-index="{{ zIndex }}"
10
- custom-style="{{ overlayStyle }}"
11
- duration="{{ duration }}"
12
- bind:click="onClickOverlay"
13
- lock-scroll="{{ lockScroll }}"
14
- root-portal="{{ rootPortal }}"
15
- />
6
+ <block wx:if="{{ isShowed }}">
7
+ <smart-overlay
8
+ wx:if="{{ overlay }}"
9
+ show="{{ show }}"
10
+ z-index="{{ zIndex }}"
11
+ custom-style="{{ overlayStyle }}"
12
+ duration="{{ duration }}"
13
+ bind:click="onClickOverlay"
14
+ lock-scroll="{{ lockScroll }}"
15
+ root-portal="{{ rootPortal }}"
16
+ />
16
17
 
17
- <root-portal wx:if="{{ rootPortal }}">
18
- <include src="./popup.wxml" />
19
- </root-portal>
18
+ <root-portal wx:if="{{ rootPortal }}">
19
+ <include src="./popup.wxml" />
20
+ </root-portal>
20
21
 
21
- <include wx:else src="./popup.wxml" />
22
+ <include wx:else src="./popup.wxml" />
23
+ </block>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tuya-miniapp/smart-ui",
3
- "version": "2.10.1-beta-1",
3
+ "version": "2.10.1-beta-3",
4
4
  "author": "MiniApp Team",
5
5
  "license": "MIT",
6
6
  "miniprogram": "lib",