ranuts 0.1.0-alpha-22 → 0.1.0-alpha-23

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,107 @@
1
+ # ranuts
2
+
3
+ 实验性工具函数库,包含常用的函数和工具
4
+
5
+ ---
6
+
7
+ <a href="https://github.com/chaxus/ran"><img src="https://img.shields.io/github/actions/workflow/status/chaxus/ran/ci.yml" alt="Build Status"></a>
8
+ <a href="https://github.com/chaxus/ran"><img src="https://img.shields.io/npm/v/ranuts.svg" alt="npm-v"></a>
9
+ <a href="https://github.com/chaxus/ran"><img src="https://img.shields.io/npm/dt/ranuts.svg" alt="npm-d"></a>
10
+ <a href="https://github.com/chaxus/ran"><img src="https://img.badgesize.io/https:/unpkg.com/ranuts/dist/index.js?label=brotli&compression=brotli" alt="brotli"></a>
11
+ <a href="https://github.com/chaxus/ran"><img src="https://img.shields.io/badge/module%20formats-umd%2C%20esm-green.svg" alt="module formats: umd, esm"></a>
12
+
13
+ **中文** | [English](./readme.md)
14
+
15
+ ---
16
+
17
+ ## ⚠️ 重要说明
18
+
19
+ 这是一个**实验性工具函数库**,处于早期开发阶段。虽然功能可用,但主要用于学习和实验。
20
+
21
+ **关键要点:**
22
+
23
+ - 🚧 **早期开发**: 功能仍在开发和完善中
24
+ - 🧪 **实验性**: API 可能会频繁变化
25
+ - 📚 **学习导向**: 主要用于学习 JavaScript/TypeScript 工具函数
26
+
27
+ ## 安装
28
+
29
+ 使用 npm:
30
+
31
+ ```console
32
+ npm install ranuts@latest --save
33
+ ```
34
+
35
+ ## 文档
36
+
37
+ [一些常用的函数和工具](https://chaxus.github.io/ran/cn/src/ranuts/)
38
+
39
+ ## 使用方式
40
+
41
+ 按需导入。您可以选择:
42
+
43
+ - ranuts/utils
44
+ - ranuts/wasm
45
+ - ranuts/node
46
+ - ranuts/react
47
+ - ranuts/ml
48
+
49
+ ```js
50
+ import { str2Xml } from 'ranuts/utils';
51
+ import { readFile } from 'ranuts/node';
52
+ import { word } from 'ranuts/wasm';
53
+ import { reactify } from 'ranuts/react';
54
+ import { ocr } from 'ranuts/ml';
55
+ ```
56
+
57
+ 全量导入(全量导入会引入许多不必要的模块,建议按需导入)
58
+
59
+ - ESM
60
+
61
+ ```js
62
+ import { str2Xml } from 'ranuts';
63
+
64
+ const data = `
65
+ <svg t="1688378016663" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2608" width="128" height="128"><path d="M568 515.008l254.016-255.008q12-11.008 12-27.488t-11.488-28-28-11.488-27.488 12l-255.008 254.016-255.008-254.016q-11.008-12-27.488-12t-28 11.488-11.488 28 12 27.488l254.016 255.008-254.016 255.008q-12 11.008-12 27.488t11.488 28 28 11.488 27.488-12l255.008-255.008 255.008 255.008q11.008 12 27.488 12t28-11.488 11.488-28-12-27.488z" p-id="2609" ></path></svg>
66
+ `;
67
+
68
+ const html = str2Xml(data, 'image/svg+xml');
69
+
70
+ document.body.appendChild(html);
71
+ ```
72
+
73
+ - UMD, IIFE, CJS
74
+
75
+ ```html
76
+ <script src="./ranuts/dist/umd/index.umd.cjs"></script>
77
+
78
+ <script>
79
+ const { str2Xml } = require('ranuts')
80
+ const data = `
81
+ <svg t="1688378016663" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2608" width="128" height="128"><path d="M568 515.008l254.016-255.008q12-11.008 12-27.488t-11.488-28-28-11.488-27.488 12l-255.008 254.016-255.008-254.016q-11.008-12-27.488-12t-28 11.488-11.488 28 12 27.488l254.016 255.008-254.016 255.008q-12 11.008-12 27.488t11.488 28 28 11.488 27.488-12l255.008-255.008 255.008 255.008q11.008 12 27.488 12t28-11.488 11.488-28-12-27.488z" p-id="2609" ></path></svg>
82
+ `
83
+
84
+ const html = str2Xml(data, 'image/svg+xml');
85
+
86
+ document.body.appendChild(html);
87
+
88
+ <script>
89
+ ```
90
+
91
+ ## 贡献
92
+
93
+ 我们欢迎学习者和开发者的贡献!这是一个实验性项目,请对开发过程保持耐心。
94
+
95
+ ## 贡献者
96
+
97
+ <a href="https://github.com/chaxus/ran/graphs/contributors">
98
+ <img src="https://contrib.rocks/image?repo=chaxus/ran" />
99
+ </a>
100
+
101
+ ## 访问统计
102
+
103
+ ![](http://profile-counter.glitch.me/chaxus-ranuts/count.svg)
104
+
105
+ ## Meta
106
+
107
+ [LICENSE (MIT)](/LICENSE)
@@ -53789,14 +53789,14 @@ function requireHebrewprober() {
53789
53789
  if (finalsub >= MIN_FINAL_CHAR_DISTANCE) {
53790
53790
  return LOGICAL_HEBREW_NAME;
53791
53791
  }
53792
- if (finalsub <= -5) {
53792
+ if (finalsub <= -MIN_FINAL_CHAR_DISTANCE) {
53793
53793
  return VISUAL_HEBREW_NAME;
53794
53794
  }
53795
53795
  var modelsub = this._mLogicalProber.getConfidence() - this._mVisualProber.getConfidence();
53796
53796
  if (modelsub > MIN_MODEL_DISTANCE) {
53797
53797
  return LOGICAL_HEBREW_NAME;
53798
53798
  }
53799
- if (modelsub < -0.01) {
53799
+ if (modelsub < -MIN_MODEL_DISTANCE) {
53800
53800
  return VISUAL_HEBREW_NAME;
53801
53801
  }
53802
53802
  if (finalsub < 0) {
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { AudioRecorder, BridgeManager, Chain, Client, Mathjs, Monitor, Platform, PostMessageBridge, QuestQueue, SyncHook, TOTP, addClassToElement, addNumSym, appendUrl, audioVendor, bridgeManager, canvasVendor, cloneDeep, compose, connection, convertImageToBase64, create, createData, createDocumentFragment, createObjectURL, createSignal, currentDevice, debounce, durationHandler, encodeUrl, escapeHtml, filterObj, formatJson, generateThrottle, getAllQueryString, getCookie, getCookieByName, getFrame, getHost, getPerformance, getPixelRatio, getQuery, getStatus, getWindow, handleConsole, handleError, handleFetchHook, imageRequest, isBangDevice, isClient, isEqual, isImageSize, isMobile, isSafari, isWeiXin, localStorageGetItem, localStorageSetItem, mathjs, memoize, merge, mergeExports, networkSpeed, noop, perToNum, performanceTime, querystring, range, removeClassToElement, removeGhosting, replaceOld, report, requestUrlToBuffer, retain, scriptOnLoad, setAttributeByGlobal, setFontSize2html, status, subscribers, throttle, timeFormat, timestampToTime, transformNumber, webglVendor } from "./src/utils/index.js";
2
- import { C, a, F, H, b, E, M, R, c, d, z, e, f, g, G, x, h, D, i, j, k, l, m, n, o, B, r, p, q, s, t, u, v, w, y, A } from "./color-48RIDBG4.js";
3
- import { R as R2, S, W, a as a2, b as b2, c as c2, d as d2, g as g2, e as e2, i as i2, p as p2, f as f2, q as q2, r as r2, h as h2, j as j2, k as k2, s as s2, l as l2, t as t2, m as m2, n as n2, w as w2, o as o2 } from "./ws-CUTzWNwq.js";
2
+ import { C, a, F, H, b, E, M, R, c, d, z, e, f, g, G, x, h, D, i, j, k, l, m, n, o, B, r, p, q, s, t, u, v, w, y, A } from "./color-CRb350Dh.js";
3
+ import { R as R2, S, W, a as a2, b as b2, c as c2, d as d2, g as g2, e as e2, i as i2, p as p2, f as f2, q as q2, r as r2, h as h2, j as j2, k as k2, s as s2, l as l2, t as t2, m as m2, n as n2, w as w2, o as o2 } from "./ws-BWAdpgk6.js";
4
4
  import "node:fs";
5
5
  import { r as r3 } from "./reactify-Z-V9Vblb.js";
6
6
  import { ocr } from "./src/ml/index.js";
@@ -1,4 +1,4 @@
1
- import { R, S, W, a, b, c, d, g, e, i, p, f, q, r, h, j, k, s, l, t, m, n, w, o } from "../../ws-CUTzWNwq.js";
1
+ import { R, S, W, a, b, c, d, g, e, i, p, f, q, r, h, j, k, s, l, t, m, n, w, o } from "../../ws-BWAdpgk6.js";
2
2
  import fs from "node:fs";
3
3
  const writeFile = (path, content) => new Promise((resolve, reject) => {
4
4
  fs.writeFile(
@@ -1,8 +1,8 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
- import { y as toString, o as isString, D as getRandomString, E as MessageCodec, p as randomString } from "../../color-48RIDBG4.js";
5
- import { C, a, F, H, b, M, R, c, d, z, e, f, g, G, x, h, i, j, k, l, m, n, B, r, q, s, t, u, v, w, A } from "../../color-48RIDBG4.js";
4
+ import { y as toString, o as isString, D as getRandomString, E as MessageCodec, p as randomString } from "../../color-CRb350Dh.js";
5
+ import { C, a, F, H, b, M, R, c, d, z, e, f, g, G, x, h, i, j, k, l, m, n, B, r, q, s, t, u, v, w, A } from "../../color-CRb350Dh.js";
6
6
  const NEW_LISTENER = "NEW_LISTENER";
7
7
  class SyncHook {
8
8
  constructor() {
@@ -601,7 +601,7 @@ const isSafari = () => {
601
601
  !navigator.userAgent.includes("FxiOS")
602
602
  );
603
603
  };
604
- const DEFAULT_TIMEOUT = 2e4;
604
+ const DEFAULT_TIMEOUT = 12e4;
605
605
  class PostMessageBridge {
606
606
  constructor(targetWindow = window, targetOrigin = "*") {
607
607
  __publicField(this, "targetWindow");