@tuya-miniapp/smart-ui 1.2.2 → 1.3.0-beta-2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. package/dist/action-sheet/index.js +7 -3
  2. package/dist/battery/index.js +5 -3
  3. package/dist/calendar/calendar.wxml +1 -0
  4. package/dist/calendar/components/month/index.d.ts +1 -0
  5. package/dist/calendar/components/month/index.js +11 -3
  6. package/dist/calendar/components/month/index.wxs +1 -1
  7. package/dist/calendar/index.js +13 -3
  8. package/dist/calendar/index.wxs +1 -1
  9. package/dist/calendar/utils.d.ts +1 -0
  10. package/dist/calendar/utils.js +11 -1
  11. package/dist/common/theme/dark.d.ts +344 -0
  12. package/dist/common/theme/dark.js +343 -0
  13. package/dist/common/theme/light.d.ts +344 -0
  14. package/dist/common/theme/light.js +343 -0
  15. package/dist/config-provider/index.wxs +7 -2
  16. package/dist/wxs/is-app-theme-var.wxs +8 -0
  17. package/dist/wxs/style.wxs +4 -0
  18. package/dist/wxs/utils.wxs +3 -1
  19. package/lib/action-sheet/index.js +7 -3
  20. package/lib/battery/index.js +5 -3
  21. package/lib/calendar/calendar.wxml +1 -0
  22. package/lib/calendar/components/month/index.d.ts +1 -0
  23. package/lib/calendar/components/month/index.js +10 -2
  24. package/lib/calendar/components/month/index.wxs +1 -1
  25. package/lib/calendar/index.js +13 -3
  26. package/lib/calendar/index.wxs +1 -1
  27. package/lib/calendar/utils.d.ts +1 -0
  28. package/lib/calendar/utils.js +13 -2
  29. package/lib/common/theme/dark.d.ts +344 -0
  30. package/lib/common/theme/dark.js +345 -0
  31. package/lib/common/theme/light.d.ts +344 -0
  32. package/lib/common/theme/light.js +345 -0
  33. package/lib/config-provider/index.wxs +7 -2
  34. package/lib/wxs/is-app-theme-var.wxs +8 -0
  35. package/lib/wxs/style.wxs +4 -0
  36. package/lib/wxs/utils.wxs +3 -1
  37. package/package.json +1 -1
@@ -1,6 +1,7 @@
1
1
  /* eslint-disable */
2
2
  var object = require('../wxs/object.wxs');
3
3
  var style = require('../wxs/style.wxs');
4
+ var utils = require('../wxs/utils.wxs');
4
5
 
5
6
  function kebabCase(word) {
6
7
  var newWord = word
@@ -16,8 +17,12 @@ function kebabCase(word) {
16
17
  function mapThemeVarsToCSSVars(themeVars) {
17
18
  var cssVars = {};
18
19
  object.keys(themeVars).forEach(function (key) {
19
- var cssVarsKey = '--' + kebabCase(key);
20
- cssVars[cssVarsKey] = themeVars[key];
20
+ if (utils.isAppThemeVar(key)) {
21
+ cssVars[key] = themeVars[key];
22
+ } else {
23
+ var cssVarsKey = '--' + kebabCase(key);
24
+ cssVars[cssVarsKey] = themeVars[key];
25
+ }
21
26
  });
22
27
 
23
28
  return style(cssVars);
@@ -0,0 +1,8 @@
1
+ /**
2
+ * 是否为 App 主题变量
3
+ */
4
+ function isAppThemeVar(key) {
5
+ return key.indexOf('--app') === 0;
6
+ }
7
+
8
+ module.exports = isAppThemeVar;
package/lib/wxs/style.wxs CHANGED
@@ -1,4 +1,5 @@
1
1
  /* eslint-disable */
2
+ var utils = require('./utils.wxs');
2
3
  var object = require('./object.wxs');
3
4
  var array = require('./array.wxs');
4
5
 
@@ -31,6 +32,9 @@ function style(styles) {
31
32
  return styles[key] != null && styles[key] !== '';
32
33
  })
33
34
  .map(function (key) {
35
+ if (utils.isAppThemeVar(key)) {
36
+ return [key, styles[key]].join(':');
37
+ }
34
38
  return [kebabCase(key), [styles[key]]].join(':');
35
39
  })
36
40
  .join(';');
package/lib/wxs/utils.wxs CHANGED
@@ -2,9 +2,11 @@
2
2
  var bem = require('./bem.wxs');
3
3
  var memoize = require('./memoize.wxs');
4
4
  var addUnit = require('./add-unit.wxs');
5
+ var isAppThemeVar = require('./is-app-theme-var.wxs');
5
6
 
6
7
  module.exports = {
7
8
  bem: memoize(bem),
8
9
  memoize: memoize,
9
- addUnit: addUnit
10
+ addUnit: addUnit,
11
+ isAppThemeVar: isAppThemeVar,
10
12
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tuya-miniapp/smart-ui",
3
- "version": "1.2.2",
3
+ "version": "1.3.0-beta-2",
4
4
  "author": "MiniApp Team",
5
5
  "license": "MIT",
6
6
  "miniprogram": "lib",