@ray-js/framework-shared 1.6.18 → 1.6.20-alpha.0

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.
@@ -1,6 +1,5 @@
1
1
  import "core-js/modules/esnext.iterator.constructor.js";
2
2
  import "core-js/modules/esnext.iterator.for-each.js";
3
- import "core-js/modules/web.dom-collections.iterator.js";
4
3
  export class Emitter {
5
4
  constructor() {
6
5
  this.listeners = {};
@@ -1,5 +1,3 @@
1
- import "core-js/modules/es.regexp.exec.js";
2
- import "core-js/modules/es.string.replace.js";
3
1
  import "core-js/modules/esnext.iterator.constructor.js";
4
2
  import "core-js/modules/esnext.iterator.reduce.js";
5
3
  export const isPlatformSpecifyProp = prop => prop.match(/^(ali|wechat|toutiao)-/);
@@ -1,9 +1,6 @@
1
- import "core-js/modules/es.regexp.exec.js";
2
- import "core-js/modules/es.string.replace.js";
3
1
  import "core-js/modules/esnext.iterator.constructor.js";
4
2
  import "core-js/modules/esnext.iterator.filter.js";
5
3
  import "core-js/modules/esnext.iterator.for-each.js";
6
- import "core-js/modules/web.dom-collections.iterator.js";
7
4
  import { isWeb } from '@ray-js/env';
8
5
  import { isUnitlessNumber } from './CSSProperty';
9
6
 
@@ -28,15 +25,15 @@ export function inlineStyle() {
28
25
  else if (!(key in isUnitlessNumber)) {
29
26
  if (!Number.isNaN(Number(value))) {
30
27
  if (isWeb) {
31
- style[key] = "".concat(value / 100, "rem");
28
+ style[key] = `${value / 100}rem`;
32
29
  } else {
33
- style[key] = "".concat(value, "rpx");
30
+ style[key] = `${value}rpx`;
34
31
  }
35
32
  } else if (/\b([.\d]+)rpx\b/.test(value) && isWeb) {
36
33
  // TODO: 支持 native 的样式抹平
37
34
  style[key] = value.replace(/\b([.\d]+)rpx\b/g, (match, x) => {
38
35
  const size = Number(x);
39
- return "".concat(size / 100, "rem");
36
+ return `${size / 100}rem`;
40
37
  });
41
38
  }
42
39
  }
@@ -1,10 +1,8 @@
1
1
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
- import "core-js/modules/es.json.stringify.js";
3
2
  import "core-js/modules/esnext.iterator.constructor.js";
4
3
  import "core-js/modules/esnext.iterator.filter.js";
5
4
  import "core-js/modules/esnext.iterator.find.js";
6
5
  import "core-js/modules/esnext.iterator.map.js";
7
- import "core-js/modules/web.dom-collections.iterator.js";
8
6
  import { match, parse } from 'path-to-regexp';
9
7
  export function normalizeTabBar(tabBar, routes) {
10
8
  let list = tabBar.list;
@@ -33,7 +31,7 @@ export function normalizeTabBar(tabBar, routes) {
33
31
  tab = _objectSpread({}, tab);
34
32
  const m = routes.find(i => tab.pagePath === i.path);
35
33
  if (!m) {
36
- 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)));
34
+ throw new Error(`tabBar.list[${index}].pagePath: ${tab.pagePath} 需要在路由配置中: ${JSON.stringify(routes, null, 2)}`);
37
35
  }
38
36
  if (!tab.route) {
39
37
  // 判断 routes[number].route 是否为模式匹配规则
@@ -42,7 +40,7 @@ export function normalizeTabBar(tabBar, routes) {
42
40
  // 判断是否能被路由命中
43
41
  const matched = match((_m$route = m.route) !== null && _m$route !== void 0 ? _m$route : m.path)(tab.route);
44
42
  if (!matched) {
45
- 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)));
43
+ console.warn(`tabBar.list[${index}]\n.route: ${tab.route}\n.pagePath: ${tab.pagePath}\n应被路由命中: \n${JSON.stringify(m, null, 2)}`);
46
44
  return;
47
45
  }
48
46
  // 判断是否还被其他路由命中
@@ -52,7 +50,7 @@ export function normalizeTabBar(tabBar, routes) {
52
50
  });
53
51
  const unusable = otherMatched.filter(r => r.path !== tab.pagePath);
54
52
  if (unusable.length) {
55
- 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');
53
+ 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');
56
54
  return;
57
55
  }
58
56
  return tab;
@@ -1,9 +1,6 @@
1
- import "core-js/modules/es.regexp.exec.js";
2
- import "core-js/modules/es.string.replace.js";
3
1
  import "core-js/modules/esnext.iterator.constructor.js";
4
2
  import "core-js/modules/esnext.iterator.filter.js";
5
3
  import "core-js/modules/esnext.iterator.reduce.js";
6
- import "core-js/modules/web.dom-collections.iterator.js";
7
4
  const vendorPrefixes = ['webkit', 'moz', 'ms', 'o'];
8
5
  const transformReactStyleKey = key => {
9
6
  var _styleValue;
@@ -12,7 +9,7 @@ const transformReactStyleKey = key => {
12
9
  return key;
13
10
  }
14
11
  let styleValue = key.replace(/\.?([A-Z]+)/g, function (_x, y) {
15
- return "-".concat(y.toLowerCase());
12
+ return `-${y.toLowerCase()}`;
16
13
  });
17
14
 
18
15
  // vendor prefix
@@ -20,7 +17,7 @@ const transformReactStyleKey = key => {
20
17
  const firstWord = styleValue.split('-').filter(s => s)[0];
21
18
  styleValue = styleValue.replace(/^-/, '');
22
19
  if (vendorPrefixes.find(prefix => prefix === firstWord)) {
23
- styleValue = "-".concat(styleValue);
20
+ styleValue = `-${styleValue}`;
24
21
  }
25
22
  }
26
23
  return styleValue;
@@ -31,6 +28,6 @@ export const plainStyle = style => {
31
28
  }
32
29
  return Object.keys(style).reduce((acc, key) => {
33
30
  const value = style[key];
34
- return [...acc, "".concat(transformReactStyleKey(key), ":").concat(value, ";")];
31
+ return [...acc, `${transformReactStyleKey(key)}:${value};`];
35
32
  }, []).join('\n');
36
33
  };
@@ -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
  /**
@@ -6,7 +6,6 @@ import "core-js/modules/esnext.iterator.filter.js";
6
6
  import "core-js/modules/esnext.iterator.for-each.js";
7
7
  import "core-js/modules/esnext.iterator.map.js";
8
8
  import "core-js/modules/esnext.iterator.reduce.js";
9
- import "core-js/modules/web.dom-collections.iterator.js";
10
9
  import * as React from 'react';
11
10
  import { isWeb } from '@ray-js/env';
12
11
  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.6.18",
3
+ "version": "1.6.20-alpha.0",
4
4
  "description": "Ray shared for framework",
5
5
  "keywords": [
6
6
  "ray"
@@ -24,16 +24,16 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "@ray-core/wechat": "^0.4.8",
27
- "@ray-js/env": "1.6.18",
28
- "@ray-js/types": "1.6.18",
27
+ "@ray-js/env": "1.6.20-alpha.0",
28
+ "@ray-js/types": "1.6.20-alpha.0",
29
29
  "path-to-regexp": "^6.3.0"
30
30
  },
31
31
  "devDependencies": {
32
- "@ray-js/cli": "1.6.18"
32
+ "@ray-js/cli": "1.6.20-alpha.0"
33
33
  },
34
34
  "publishConfig": {
35
35
  "access": "public",
36
36
  "registry": "https://registry.npmjs.com"
37
37
  },
38
- "gitHead": "537ce09350475f32d1ac01abd36cc9171f9c7ecd"
38
+ "gitHead": "6111376e4f7189596d01d840c06e43284eb74d2e"
39
39
  }