@hi-ui/highlighter 4.0.5 → 4.0.6

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/CHANGELOG.md ADDED
@@ -0,0 +1,16 @@
1
+ # @hi-ui/highlighter
2
+
3
+ ## 4.0.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [#2672](https://github.com/XiaoMi/hiui/pull/2672) [`1ebe27830`](https://github.com/XiaoMi/hiui/commit/1ebe2783098b3a8cd980bd10076d67635463800e) Thanks [@zyprepare](https://github.com/zyprepare)! - build: 升级到 rollup3,重新构建发布组件
8
+
9
+ - Updated dependencies [[`1ebe27830`](https://github.com/XiaoMi/hiui/commit/1ebe2783098b3a8cd980bd10076d67635463800e)]:
10
+ - @hi-ui/core@4.0.6
11
+ - @hi-ui/classname@4.0.2
12
+ - @hi-ui/env@4.0.2
13
+
14
+ ## 4.0.5
15
+
16
+ 更新版本为 4.0.5
@@ -9,66 +9,44 @@
9
9
  */
10
10
  'use strict';
11
11
 
12
- var _typeof = require("@babel/runtime/helpers/typeof");
13
-
14
- Object.defineProperty(exports, '__esModule', {
15
- value: true
16
- });
17
-
18
12
  var tslib = require('tslib');
19
-
20
13
  var React = require('react');
21
-
22
14
  var classname = require('@hi-ui/classname');
23
-
24
15
  var env = require('@hi-ui/env');
25
-
26
- function _interopDefaultLegacy(e) {
27
- return e && _typeof(e) === 'object' && 'default' in e ? e : {
28
- 'default': e
29
- };
30
- }
31
-
32
- var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
33
-
34
16
  var HIGHLIGHTER_PREFIX = classname.getPrefixCls('highlighter');
35
17
  /**
36
18
  * 高亮文本内容
37
19
  */
38
-
39
20
  var Highlighter = /*#__PURE__*/React.forwardRef(function (_a, ref) {
40
21
  var _a$prefixCls = _a.prefixCls,
41
- prefixCls = _a$prefixCls === void 0 ? HIGHLIGHTER_PREFIX : _a$prefixCls,
42
- className = _a.className,
43
- keyword = _a.keyword,
44
- _a$children = _a.children,
45
- children = _a$children === void 0 ? null : _a$children,
46
- rest = tslib.__rest(_a, ["prefixCls", "className", "keyword", "children"]);
47
-
22
+ prefixCls = _a$prefixCls === void 0 ? HIGHLIGHTER_PREFIX : _a$prefixCls,
23
+ className = _a.className,
24
+ keyword = _a.keyword,
25
+ _a$children = _a.children,
26
+ children = _a$children === void 0 ? null : _a$children,
27
+ rest = tslib.__rest(_a, ["prefixCls", "className", "keyword", "children"]);
48
28
  if (!keyword) return children;
49
- if (typeof children !== 'string') return children; // 支持多个匹配高亮
50
-
51
- var parts = children.split(keyword); // 未匹配到
52
-
29
+ if (typeof children !== 'string') return children;
30
+ // 支持多个匹配高亮
31
+ var parts = children.split(keyword);
32
+ // 未匹配到
53
33
  if (parts.length < 2) return children;
54
34
  var lastPart = parts.pop();
55
- var cls = classname.cx(prefixCls, className); // TODO: 容器宽度有限但文本过长时,自动适配关键词到可见区域
56
-
57
- return /*#__PURE__*/React__default["default"].createElement("span", Object.assign({
35
+ var cls = classname.cx(prefixCls, className);
36
+ // TODO: 容器宽度有限但文本过长时,自动适配关键词到可见区域
37
+ return /*#__PURE__*/React.createElement("span", Object.assign({
58
38
  ref: ref,
59
39
  className: cls
60
40
  }, rest), parts.reduce(function (acc, part, index) {
61
41
  acc.push(part);
62
- acc.push( /*#__PURE__*/React__default["default"].createElement("span", {
42
+ acc.push( /*#__PURE__*/React.createElement("span", {
63
43
  key: index,
64
44
  className: prefixCls + "--matched"
65
45
  }, keyword));
66
46
  return acc;
67
47
  }, []), lastPart);
68
48
  });
69
-
70
49
  if (env.__DEV__) {
71
50
  Highlighter.displayName = 'Highlighter';
72
51
  }
73
-
74
52
  exports.Highlighter = Highlighter;
package/lib/cjs/index.js CHANGED
@@ -12,10 +12,7 @@
12
12
  Object.defineProperty(exports, '__esModule', {
13
13
  value: true
14
14
  });
15
-
16
15
  require('./styles/index.scss.js');
17
-
18
16
  var Highlighter = require('./Highlighter.js');
19
-
20
17
  exports.Highlighter = Highlighter.Highlighter;
21
18
  exports["default"] = Highlighter.Highlighter;
@@ -12,10 +12,7 @@
12
12
  Object.defineProperty(exports, '__esModule', {
13
13
  value: true
14
14
  });
15
- var css_248z = ".hi-v4-highlighter--matched {color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa)); }";
16
-
17
- var __styleInject__ = require('inject-head-style')["default"];
18
-
15
+ var css_248z = ".hi-v4-highlighter--matched {color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));}";
16
+ var __styleInject__ = require('style-inject')["default"];
19
17
  __styleInject__(css_248z);
20
-
21
18
  exports["default"] = css_248z;
@@ -15,25 +15,23 @@ var HIGHLIGHTER_PREFIX = getPrefixCls('highlighter');
15
15
  /**
16
16
  * 高亮文本内容
17
17
  */
18
-
19
18
  var Highlighter = /*#__PURE__*/forwardRef(function (_a, ref) {
20
19
  var _a$prefixCls = _a.prefixCls,
21
- prefixCls = _a$prefixCls === void 0 ? HIGHLIGHTER_PREFIX : _a$prefixCls,
22
- className = _a.className,
23
- keyword = _a.keyword,
24
- _a$children = _a.children,
25
- children = _a$children === void 0 ? null : _a$children,
26
- rest = __rest(_a, ["prefixCls", "className", "keyword", "children"]);
27
-
20
+ prefixCls = _a$prefixCls === void 0 ? HIGHLIGHTER_PREFIX : _a$prefixCls,
21
+ className = _a.className,
22
+ keyword = _a.keyword,
23
+ _a$children = _a.children,
24
+ children = _a$children === void 0 ? null : _a$children,
25
+ rest = __rest(_a, ["prefixCls", "className", "keyword", "children"]);
28
26
  if (!keyword) return children;
29
- if (typeof children !== 'string') return children; // 支持多个匹配高亮
30
-
31
- var parts = children.split(keyword); // 未匹配到
32
-
27
+ if (typeof children !== 'string') return children;
28
+ // 支持多个匹配高亮
29
+ var parts = children.split(keyword);
30
+ // 未匹配到
33
31
  if (parts.length < 2) return children;
34
32
  var lastPart = parts.pop();
35
- var cls = cx(prefixCls, className); // TODO: 容器宽度有限但文本过长时,自动适配关键词到可见区域
36
-
33
+ var cls = cx(prefixCls, className);
34
+ // TODO: 容器宽度有限但文本过长时,自动适配关键词到可见区域
37
35
  return /*#__PURE__*/React.createElement("span", Object.assign({
38
36
  ref: ref,
39
37
  className: cls
@@ -46,9 +44,7 @@ var Highlighter = /*#__PURE__*/forwardRef(function (_a, ref) {
46
44
  return acc;
47
45
  }, []), lastPart);
48
46
  });
49
-
50
47
  if (__DEV__) {
51
48
  Highlighter.displayName = 'Highlighter';
52
49
  }
53
-
54
50
  export { Highlighter };
@@ -7,9 +7,7 @@
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
9
  */
10
- import __styleInject__ from 'inject-head-style';
11
- var css_248z = ".hi-v4-highlighter--matched {color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa)); }";
12
-
10
+ import __styleInject__ from 'style-inject';
11
+ var css_248z = ".hi-v4-highlighter--matched {color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));}";
13
12
  __styleInject__(css_248z);
14
-
15
13
  export { css_248z as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hi-ui/highlighter",
3
- "version": "4.0.5",
3
+ "version": "4.0.6",
4
4
  "description": "A sub-package for @hi-ui/hiui.",
5
5
  "keywords": [],
6
6
  "author": "HiUI <mi-hiui@xiaomi.com>",
@@ -43,20 +43,18 @@
43
43
  "url": "https://github.com/XiaoMi/hiui/issues"
44
44
  },
45
45
  "dependencies": {
46
- "@hi-ui/classname": "^4.0.1",
47
- "@hi-ui/env": "^4.0.1"
46
+ "@hi-ui/classname": "^4.0.2",
47
+ "@hi-ui/env": "^4.0.2"
48
48
  },
49
49
  "peerDependencies": {
50
- "@hi-ui/core": ">=4.0.0",
50
+ "@hi-ui/core": ">=4.0.6",
51
51
  "react": ">=16.8.6",
52
52
  "react-dom": ">=16.8.6"
53
53
  },
54
54
  "devDependencies": {
55
- "@hi-ui/core": "^4.0.4",
56
- "@hi-ui/core-css": "^4.0.1",
57
- "@hi-ui/hi-build": "^4.0.1",
55
+ "@hi-ui/core": "^4.0.6",
56
+ "@hi-ui/core-css": "^4.1.3",
58
57
  "react": "^17.0.1",
59
58
  "react-dom": "^17.0.1"
60
- },
61
- "gitHead": "686243832edd8a2d114ac385d0910838233c1e85"
59
+ }
62
60
  }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2018 Xiaomi
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.