pixuireactcomponents 1.3.62 → 1.3.64

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.
@@ -0,0 +1,41 @@
1
+ div {
2
+ display: flex;
3
+ box-sizing: border-box;
4
+ flex-shrink: 0;
5
+ word-break: break-word;
6
+ }
7
+
8
+ text {
9
+ /* display: flex; */
10
+ word-break: break-word;
11
+ flex-shrink: 0;
12
+
13
+ }
14
+
15
+ .frame {
16
+ display: flex;
17
+ flex-direction: column;
18
+ /* flex-basis: content; */
19
+ /*justify-content: space-evenly;*/
20
+ width: 100%;
21
+ height: 100%;
22
+ }
23
+
24
+ strong {
25
+ word-break: break-all;
26
+ font-weight: bold;
27
+ }
28
+
29
+ /* 斜体 */
30
+ /* em{ 单独到业务样式里设置,否则会导致不支持的业务崩掉
31
+ font-style: italic;
32
+ } */
33
+ /* 下划线 */
34
+ u {
35
+ text-decoration: underline;
36
+ }
37
+
38
+ /* 删除线 */
39
+ s {
40
+ text-decoration: line-through;
41
+ }
package/index.d.ts CHANGED
@@ -12,5 +12,6 @@ export { AsyncTaskProcessor } from "./src/components/tools/AsyncTaskProcessor";
12
12
  export { assetCache } from "./src/components/tools/assetCache";
13
13
  export { frameAnimationJs } from "./src/components/js/frameAnimationJs/frameAnimationJs";
14
14
  export { ScrollBar } from "./src/components/react/app/scrollBar/ScrollBar";
15
+ export { tools } from "./src/components/tools/tools";
15
16
  export { Slider, SliderProps } from "./src/components/react/app/slider/Slider";
16
17
  export { ImgPreLoader, PreLoadPic } from "./src/components/tools/ImgPreLoader";
package/index.js CHANGED
@@ -15,3 +15,4 @@ export { AsyncTaskProcessor } from './src/components/tools/AsyncTaskProcessor';
15
15
  export { assetCache } from './src/components/tools/assetCache';
16
16
  export { frameAnimationJs } from './src/components/js/frameAnimationJs/frameAnimationJs';
17
17
  export { ScrollBar } from './src/components/react/app/scrollBar/ScrollBar';
18
+ export { tools } from './src/components/tools/tools';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pixuireactcomponents",
3
- "version": "1.3.62",
3
+ "version": "1.3.64",
4
4
  "description": "pixui react components",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -19,7 +19,7 @@ import { createRef, h } from 'preact';
19
19
  */
20
20
  export var FrameAnimation = function (props) {
21
21
  var _a, _b;
22
- props.preloadCount = Math.max(props.preloadCount || 5, 5);
22
+ props.preloadCount = Math.max(props.preloadCount || 3, 3);
23
23
  var totalTime = props.totalTime, width = props.width, height = props.height, srcArr = props.srcArr, onShow = props.onShow, preloadCount = props.preloadCount, loop = (_a = props.loop, _a === void 0 ? false : _a), onFinish = props.onFinish, showLastFrame = (_b = props.showLastFrame, _b === void 0 ? true : _b), rootId = props.rootId, rootClassName = props.rootClassName;
24
24
  var cRefArr = useRef(Array.from({ length: preloadCount }, function () { return createRef(); })).current;
25
25
  var imgEleArr = useRef(Array.from({ length: preloadCount }, function (v, i) {
@@ -36,7 +36,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
36
36
  };
37
37
  import { h } from 'preact';
38
38
  import { useState, useEffect, useRef } from 'preact/hooks';
39
- import { utils } from './utils';
39
+ import { tools } from './tools';
40
40
  import { TaskProcessor } from './AsyncTaskProcessor';
41
41
  export function ImgPreLoader() { }
42
42
  /**
@@ -50,8 +50,8 @@ ImgPreLoader.preLoadUrl = function (url) { return __awaiter(void 0, void 0, void
50
50
  console.log('utils.preLoadUrl', url);
51
51
  post = url.substring(url.length - 3, url.length);
52
52
  if (!(post == 'png' || post == 'jpg')) return [3 /*break*/, 2];
53
- fileName_1 = utils.getHashStr(url);
54
- return [4 /*yield*/, utils.readCookie(fileName_1)];
53
+ fileName_1 = tools.getHashStr(url);
54
+ return [4 /*yield*/, tools.readCookie(fileName_1)];
55
55
  case 1:
56
56
  stashed = _a.sent();
57
57
  if (stashed != '') {
@@ -64,7 +64,7 @@ ImgPreLoader.preLoadUrl = function (url) { return __awaiter(void 0, void 0, void
64
64
  xhr_1.onload = function () {
65
65
  if (xhr_1.status === 200) {
66
66
  console.log('utils.preLoadUrl 缓存完成', url, 'filename: ', fileName_1);
67
- utils.writeCookie(fileName_1, "data:image/".concat(post, ";base64,") + Buffer.from(xhr_1.response, 'binary').toString('base64'));
67
+ tools.writeCookie(fileName_1, "data:image/".concat(post, ";base64,") + Buffer.from(xhr_1.response, 'binary').toString('base64'));
68
68
  }
69
69
  else {
70
70
  console.warn('utils.preLoadUrl statue!=200', xhr_1.status);
@@ -89,7 +89,7 @@ var getPreLoadUrl = function (url) { return __awaiter(void 0, void 0, void 0, fu
89
89
  var res;
90
90
  return __generator(this, function (_a) {
91
91
  switch (_a.label) {
92
- case 0: return [4 /*yield*/, utils.readCookie(utils.getHashStr(url))];
92
+ case 0: return [4 /*yield*/, tools.readCookie(tools.getHashStr(url))];
93
93
  case 1:
94
94
  res = _a.sent();
95
95
  console.log('utils.getPreLoadUrl', url, res == '' ? '未缓存' : '已缓存');
@@ -36,7 +36,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
36
36
  };
37
37
  import { GameletAPI } from 'gamelet-pixui-frame';
38
38
  import path from 'path';
39
- import { utils } from './utils';
39
+ import { tools } from './tools';
40
40
  import { LibMgr } from '../../../lib/loadlib/lib_mgr';
41
41
  var assetPrefix = 'cacheAsset';
42
42
  var isJssdkEnv = function () {
@@ -122,6 +122,6 @@ var getLocalPath = function (url) {
122
122
  if (!lib.dirExists(filePath)) {
123
123
  lib.makeDir(filePath);
124
124
  }
125
- var fileName = utils.getHashStr(assetPrefix + url) + path.extname(url);
125
+ var fileName = tools.getHashStr(assetPrefix + url) + path.extname(url);
126
126
  return path.join(filePath, fileName);
127
127
  };
@@ -1,6 +1,7 @@
1
- export declare function utils(): void;
2
- export declare namespace utils {
1
+ export declare function tools(): void;
2
+ export declare namespace tools {
3
3
  var writeCookie: (key: string, value: string) => Promise<void>;
4
4
  var readCookie: (key: string) => Promise<string>;
5
5
  var getHashStr: (str: string) => string;
6
+ var convertRichText: (str: string) => string;
6
7
  }
@@ -36,8 +36,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
36
36
  };
37
37
  import { GameletAPI } from 'gamelet-pixui-frame';
38
38
  import { sha1 } from './Sha1';
39
- export function utils() { }
40
- utils.writeCookie = function (key, value) {
39
+ export function tools() { }
40
+ tools.writeCookie = function (key, value) {
41
41
  return __awaiter(this, void 0, void 0, function () {
42
42
  var ud;
43
43
  return __generator(this, function (_a) {
@@ -52,7 +52,7 @@ utils.writeCookie = function (key, value) {
52
52
  });
53
53
  });
54
54
  };
55
- utils.readCookie = function (key) {
55
+ tools.readCookie = function (key) {
56
56
  return __awaiter(this, void 0, void 0, function () {
57
57
  var ud, data;
58
58
  return __generator(this, function (_a) {
@@ -72,6 +72,25 @@ utils.readCookie = function (key) {
72
72
  /**
73
73
  * 哈希生成一个长度20的字符串
74
74
  */
75
- utils.getHashStr = function (str) {
75
+ tools.getHashStr = function (str) {
76
76
  return sha1(str).substring(0, 20);
77
77
  };
78
+ tools.convertRichText = function (str) {
79
+ var res = str
80
+ .replaceAll(/<img([^>]*)>/g, '<img$1></img>') //传过来的这两个标签会少结束标签
81
+ .replaceAll(/<h[1,2,3,4,5,6]><br><\/h[1,2,3,4,5,6]>/g, '<br /><div style = "width:50px;height:15px;" />')
82
+ .replaceAll(/<br>/g, '<br /><div style = "width:50px;height:15px;" />')
83
+ .replaceAll(/<p/g, '<text')
84
+ .replaceAll(/<\/p>/g, '</text>') //包text否则会丢break word
85
+ .replaceAll(/<span/g, '<text')
86
+ .replaceAll(/<\/span>/g, '</text>') //包text否则会丢break word
87
+ .replaceAll(/&nbsp;/g, ' '); //单一行只有nbsp的时候,会整个解析不出来,pixui innerHtml bug
88
+ for (var i = 1; i <= 6; i++) {
89
+ res = res.replaceAll("<h".concat(i, ">"), "<h".concat(i, "><text>"));
90
+ res = res.replaceAll("</h".concat(i, ">"), "</text></h".concat(i, ">"));
91
+ }
92
+ for (var i = 1; i < 10; i++) {
93
+ res = res.replaceAll("class=\"ql-indent-".concat(i, "\""), " style=\"padding-left: ".concat(i * 2, "rem;\""));
94
+ }
95
+ return res;
96
+ };