@ray-js/framework-shared 1.5.0-beta.11 → 1.5.0-beta.12

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,3 @@
1
- import "core-js/modules/web.dom-collections.iterator.js";
2
1
  export class Emitter {
3
2
  constructor() {
4
3
  this.listeners = {};
@@ -1,4 +1,3 @@
1
- import "core-js/modules/es.string.replace.js";
2
1
  export const isPlatformSpecifyProp = prop => prop.match(/^(ali|wechat|toutiao)-/);
3
2
  const normalizeWebSpecifyProp = prop => prop.replace(/^web-/, '');
4
3
  export function filterProps(props) {
@@ -1,5 +1,3 @@
1
- import "core-js/modules/web.dom-collections.iterator.js";
2
- import "core-js/modules/es.string.replace.js";
3
1
  import { isWeb } from '@ray-js/env';
4
2
  import { isUnitlessNumber } from './CSSProperty';
5
3
 
@@ -24,15 +22,15 @@ export function inlineStyle() {
24
22
  else if (!(key in isUnitlessNumber)) {
25
23
  if (!Number.isNaN(Number(value))) {
26
24
  if (isWeb) {
27
- style[key] = "".concat(value / 100, "rem");
25
+ style[key] = `${value / 100}rem`;
28
26
  } else {
29
- style[key] = "".concat(value, "rpx");
27
+ style[key] = `${value}rpx`;
30
28
  }
31
29
  } else if (/\b([.\d]+)rpx\b/.test(value) && isWeb) {
32
30
  // TODO: 支持 native 的样式抹平
33
31
  style[key] = value.replace(/\b([.\d]+)rpx\b/g, (match, x) => {
34
32
  const size = Number(x);
35
- return "".concat(size / 100, "rem");
33
+ return `${size / 100}rem`;
36
34
  });
37
35
  }
38
36
  }
@@ -1,5 +1,4 @@
1
1
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
- import "core-js/modules/web.dom-collections.iterator.js";
3
2
  import { match, parse } from 'path-to-regexp';
4
3
  export function normalizeTabBar(tabBar, routes) {
5
4
  let list = tabBar.list;
@@ -28,7 +27,7 @@ export function normalizeTabBar(tabBar, routes) {
28
27
  tab = _objectSpread({}, tab);
29
28
  const m = routes.find(i => tab.pagePath === i.path);
30
29
  if (!m) {
31
- throw new Error("tabBar.list[".concat(index, "].pagePath: ").concat(tab.pagePath, " \u9700\u8981\u5728\u8DEF\u7531\u914D\u7F6E\u4E2D: ").concat(JSON.stringify(routes, null, 2)));
30
+ throw new Error(`tabBar.list[${index}].pagePath: ${tab.pagePath} 需要在路由配置中: ${JSON.stringify(routes, null, 2)}`);
32
31
  }
33
32
  if (!tab.route) {
34
33
  // 判断 routes[number].route 是否为模式匹配规则
@@ -37,7 +36,7 @@ export function normalizeTabBar(tabBar, routes) {
37
36
  // 判断是否能被路由命中
38
37
  const matched = match((_m$route = m.route) !== null && _m$route !== void 0 ? _m$route : m.path)(tab.route);
39
38
  if (!matched) {
40
- console.warn("tabBar.list[".concat(index, "]\n.route: ").concat(tab.route, "\n.pagePath: ").concat(tab.pagePath, "\n\u5E94\u88AB\u8DEF\u7531\u547D\u4E2D: \n").concat(JSON.stringify(m, null, 2)));
39
+ console.warn(`tabBar.list[${index}]\n.route: ${tab.route}\n.pagePath: ${tab.pagePath}\n应被路由命中: \n${JSON.stringify(m, null, 2)}`);
41
40
  return;
42
41
  }
43
42
  // 判断是否还被其他路由命中
@@ -47,7 +46,7 @@ export function normalizeTabBar(tabBar, routes) {
47
46
  });
48
47
  const unusable = otherMatched.filter(r => r.path !== tab.pagePath);
49
48
  if (unusable.length) {
50
- console.warn("tabBar.list[".concat(index, "]\n.route: ").concat(tab.route, "\n%c.pagePath: ").concat(tab.pagePath, "\n%c\u88AB\u5176\u5B83\u8DEF\u7531\u547D\u4E2D\uFF1A\n").concat(JSON.stringify(unusable, null, 2)), 'background:#290000;color:green', 'background:#290000;color:green', 'color:red');
49
+ console.warn(`tabBar.list[${index}]\n.route: ${tab.route}\n%c.pagePath: ${tab.pagePath}\n%c被其它路由命中:\n${JSON.stringify(unusable, null, 2)}`, 'background:#290000;color:green', 'background:#290000;color:green', 'color:red');
51
50
  return;
52
51
  }
53
52
  return tab;
@@ -1,5 +1,3 @@
1
- import "core-js/modules/es.string.replace.js";
2
- import "core-js/modules/web.dom-collections.iterator.js";
3
1
  const vendorPrefixes = ['webkit', 'moz', 'ms', 'o'];
4
2
  const transformReactStyleKey = key => {
5
3
  var _styleValue;
@@ -8,7 +6,7 @@ const transformReactStyleKey = key => {
8
6
  return key;
9
7
  }
10
8
  let styleValue = key.replace(/\.?([A-Z]+)/g, function (_x, y) {
11
- return "-".concat(y.toLowerCase());
9
+ return `-${y.toLowerCase()}`;
12
10
  });
13
11
 
14
12
  // vendor prefix
@@ -16,7 +14,7 @@ const transformReactStyleKey = key => {
16
14
  const firstWord = styleValue.split('-').filter(s => s)[0];
17
15
  styleValue = styleValue.replace(/^-/, '');
18
16
  if (vendorPrefixes.find(prefix => prefix === firstWord)) {
19
- styleValue = "-".concat(styleValue);
17
+ styleValue = `-${styleValue}`;
20
18
  }
21
19
  }
22
20
  return styleValue;
@@ -27,6 +25,6 @@ export const plainStyle = style => {
27
25
  }
28
26
  return Object.keys(style).reduce((acc, key) => {
29
27
  const value = style[key];
30
- return [...acc, "".concat(transformReactStyleKey(key), ":").concat(value, ";")];
28
+ return [...acc, `${transformReactStyleKey(key)}:${value};`];
31
29
  }, []).join('\n');
32
30
  };
@@ -1,11 +1,12 @@
1
1
  import React from 'react';
2
2
  import { plainStyle } from '../plainStyle';
3
3
  let clsxId = 0;
4
- const generateClassName = () => "placeholder-style-".concat(clsxId++);
4
+ const generateClassName = () => `placeholder-style-${clsxId++}`;
5
5
  export function useStylesheet(css) {
6
6
  const className = React.useRef(generateClassName());
7
7
  React.useEffect(() => {
8
- const styleContent = ".".concat(className.current, "::placeholder {\n").concat(plainStyle(css), "}");
8
+ const styleContent = `.${className.current}::placeholder {
9
+ ${plainStyle(css)}}`;
9
10
  const style = window.document.createElement('style');
10
11
  style.type = 'text/css';
11
12
  style.appendChild(document.createTextNode(styleContent));
@@ -1,4 +1,3 @@
1
- import "core-js/modules/web.dom-collections.iterator.js";
2
1
  import { useRef, useState } from 'react';
3
2
 
4
3
  /**
@@ -1,7 +1,6 @@
1
1
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
3
  const _excluded = ["hoverDuration", "hoverDelay"];
4
- import "core-js/modules/web.dom-collections.iterator.js";
5
4
  import * as React from 'react';
6
5
  import { isWeb } from '@ray-js/env';
7
6
  const LONG_TAP_DURATION = 350;
@@ -1,4 +1,3 @@
1
- import "core-js/modules/web.dom-collections.iterator.js";
2
1
  import { useEffect, useRef, useState } from 'react';
3
2
  const nextFrame = function () {
4
3
  let duration = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1000 / 30;
@@ -33,6 +32,6 @@ export function useTransition(options, deps) {
33
32
  updateShow(visible);
34
33
  }, [visible]);
35
34
  return [status, {
36
- animationDuration: "".concat(duration / 1000, "s")
35
+ animationDuration: `${duration / 1000}s`
37
36
  }, updateShow];
38
37
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/framework-shared",
3
- "version": "1.5.0-beta.11",
3
+ "version": "1.5.0-beta.12",
4
4
  "description": "Ray shared for framework",
5
5
  "keywords": [
6
6
  "ray"
@@ -23,17 +23,17 @@
23
23
  "watch": "ray start --type=component --emit-declaration-dev"
24
24
  },
25
25
  "dependencies": {
26
- "@ray-core/wechat": "^0.3.6",
27
- "@ray-js/env": "^1.5.0-beta.11",
28
- "@ray-js/types": "^1.5.0-beta.11",
26
+ "@ray-core/wechat": "^0.3.9",
27
+ "@ray-js/env": "^1.5.0-beta.12",
28
+ "@ray-js/types": "^1.5.0-beta.12",
29
29
  "path-to-regexp": "^6.2.1"
30
30
  },
31
31
  "devDependencies": {
32
- "@ray-js/cli": "^1.5.0-beta.11"
32
+ "@ray-js/cli": "^1.5.0-beta.12"
33
33
  },
34
34
  "publishConfig": {
35
35
  "access": "public",
36
36
  "registry": "https://registry.npmjs.org"
37
37
  },
38
- "gitHead": "4b672baff874f366149a5a3007366a2eba7e5132"
38
+ "gitHead": "7fb9ae94b8896c81a6b6556099107cb2daab9c9b"
39
39
  }