rattail 1.4.0 → 1.5.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.
- package/{lib → dist}/index.d.ts +1 -0
- package/{lib → dist}/index.js +43 -69
- package/package.json +11 -17
- package/lib/index.cjs +0 -1908
- package/lib/index.d.cts +0 -387
- package/lib/index.global.js +0 -1735
package/{lib → dist}/index.d.ts
RENAMED
package/{lib → dist}/index.js
RENAMED
|
@@ -1,24 +1,7 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
7
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
-
var __defNormalProp = (obj, key3, value) => key3 in obj ? __defProp(obj, key3, { enumerable: true, configurable: true, writable: true, value }) : obj[key3] = value;
|
|
10
|
-
var __spreadValues = (a, b) => {
|
|
11
|
-
for (var prop in b || (b = {}))
|
|
12
|
-
if (__hasOwnProp.call(b, prop))
|
|
13
|
-
__defNormalProp(a, prop, b[prop]);
|
|
14
|
-
if (__getOwnPropSymbols)
|
|
15
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
-
if (__propIsEnum.call(b, prop))
|
|
17
|
-
__defNormalProp(a, prop, b[prop]);
|
|
18
|
-
}
|
|
19
|
-
return a;
|
|
20
|
-
};
|
|
21
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
22
5
|
var __export = (target, all) => {
|
|
23
6
|
for (var name in all)
|
|
24
7
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -175,6 +158,8 @@ __export(src_exports, {
|
|
|
175
158
|
uniq: () => uniq,
|
|
176
159
|
uniqBy: () => uniqBy,
|
|
177
160
|
upperFirst: () => upperFirst,
|
|
161
|
+
uuid: () => v4,
|
|
162
|
+
uuidV6: () => v6,
|
|
178
163
|
xor: () => xor,
|
|
179
164
|
xorWith: () => xorWith
|
|
180
165
|
});
|
|
@@ -706,9 +691,8 @@ function intersection(...values) {
|
|
|
706
691
|
function groupBy(arr, fn) {
|
|
707
692
|
return arr.reduce(
|
|
708
693
|
(result, item) => {
|
|
709
|
-
var _a;
|
|
710
694
|
const key3 = fn(item);
|
|
711
|
-
(
|
|
695
|
+
(result[key3] ?? (result[key3] = [])).push(item);
|
|
712
696
|
return result;
|
|
713
697
|
},
|
|
714
698
|
{}
|
|
@@ -838,36 +822,31 @@ function objectEntries(object) {
|
|
|
838
822
|
return Object.entries(object);
|
|
839
823
|
}
|
|
840
824
|
|
|
841
|
-
// src/
|
|
842
|
-
var
|
|
843
|
-
__export(
|
|
844
|
-
cancelAnimationFrame: () => cancelAnimationFrame,
|
|
845
|
-
classes: () => classes,
|
|
846
|
-
copyText: () => copyText,
|
|
847
|
-
createCacheManager: () => createCacheManager,
|
|
848
|
-
createNamespaceFn: () => createNamespaceFn,
|
|
849
|
-
createStorage: () => createStorage,
|
|
850
|
-
doubleRaf: () => doubleRaf,
|
|
851
|
-
download: () => download,
|
|
852
|
-
duration: () => duration,
|
|
853
|
-
enumOf: () => enumOf,
|
|
854
|
-
getAllParentScroller: () => getAllParentScroller,
|
|
855
|
-
getParentScroller: () => getParentScroller,
|
|
856
|
-
getRect: () => getRect,
|
|
857
|
-
getScrollLeft: () => getScrollLeft,
|
|
858
|
-
getScrollTop: () => getScrollTop,
|
|
859
|
-
getStyle: () => getStyle,
|
|
860
|
-
inViewport: () => inViewport,
|
|
861
|
-
localStorage: () => localStorage,
|
|
825
|
+
// src/integrated/index.ts
|
|
826
|
+
var integrated_exports = {};
|
|
827
|
+
__export(integrated_exports, {
|
|
862
828
|
mitt: () => default2,
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
829
|
+
uuid: () => v4,
|
|
830
|
+
uuidV6: () => v6
|
|
831
|
+
});
|
|
832
|
+
|
|
833
|
+
// src/integrated/uuid.ts
|
|
834
|
+
import { v4, v6 } from "uuid";
|
|
835
|
+
|
|
836
|
+
// src/integrated/mitt.ts
|
|
837
|
+
var mitt_exports = {};
|
|
838
|
+
__export(mitt_exports, {
|
|
839
|
+
mitt: () => default2
|
|
870
840
|
});
|
|
841
|
+
__reExport(mitt_exports, mitt_star);
|
|
842
|
+
import * as mitt_star from "mitt";
|
|
843
|
+
import { default as default2 } from "mitt";
|
|
844
|
+
|
|
845
|
+
// src/integrated/index.ts
|
|
846
|
+
__reExport(integrated_exports, mitt_exports);
|
|
847
|
+
|
|
848
|
+
// src/index.ts
|
|
849
|
+
__reExport(src_exports, integrated_exports);
|
|
871
850
|
|
|
872
851
|
// src/util/cancelAnimationFrame.ts
|
|
873
852
|
function cancelAnimationFrame(handle) {
|
|
@@ -1063,9 +1042,10 @@ function getRect(element) {
|
|
|
1063
1042
|
width,
|
|
1064
1043
|
height
|
|
1065
1044
|
};
|
|
1066
|
-
return
|
|
1045
|
+
return {
|
|
1046
|
+
...rect,
|
|
1067
1047
|
toJSON: () => rect
|
|
1068
|
-
}
|
|
1048
|
+
};
|
|
1069
1049
|
}
|
|
1070
1050
|
return element.getBoundingClientRect();
|
|
1071
1051
|
}
|
|
@@ -1113,7 +1093,8 @@ function raf() {
|
|
|
1113
1093
|
|
|
1114
1094
|
// src/util/storage.ts
|
|
1115
1095
|
function createStorage(storage) {
|
|
1116
|
-
return
|
|
1096
|
+
return {
|
|
1097
|
+
...storage,
|
|
1117
1098
|
set(key3, value) {
|
|
1118
1099
|
if (value == null) {
|
|
1119
1100
|
return;
|
|
@@ -1134,7 +1115,7 @@ function createStorage(storage) {
|
|
|
1134
1115
|
remove(key3) {
|
|
1135
1116
|
storage.removeItem(key3);
|
|
1136
1117
|
}
|
|
1137
|
-
}
|
|
1118
|
+
};
|
|
1138
1119
|
}
|
|
1139
1120
|
var sessionStorage = createStorage(getGlobalThis().sessionStorage);
|
|
1140
1121
|
var localStorage = createStorage(getGlobalThis().localStorage);
|
|
@@ -1143,7 +1124,7 @@ var localStorage = createStorage(getGlobalThis().localStorage);
|
|
|
1143
1124
|
function tryParseJSON(json) {
|
|
1144
1125
|
try {
|
|
1145
1126
|
return JSON.parse(json);
|
|
1146
|
-
} catch
|
|
1127
|
+
} catch {
|
|
1147
1128
|
return void 0;
|
|
1148
1129
|
}
|
|
1149
1130
|
}
|
|
@@ -1242,11 +1223,11 @@ function enumOf(config) {
|
|
|
1242
1223
|
const configValues = Object.values(config);
|
|
1243
1224
|
function label(v) {
|
|
1244
1225
|
const valueObject = getValueObject(v);
|
|
1245
|
-
return
|
|
1226
|
+
return valueObject?.label ? callOrReturn(valueObject.label) : "";
|
|
1246
1227
|
}
|
|
1247
1228
|
function description(v) {
|
|
1248
1229
|
const valueObject = getValueObject(v);
|
|
1249
|
-
return
|
|
1230
|
+
return valueObject?.description ? callOrReturn(valueObject.description) : "";
|
|
1250
1231
|
}
|
|
1251
1232
|
function values() {
|
|
1252
1233
|
return configValues.map((option2) => isPlainObject(option2) ? option2.value : option2);
|
|
@@ -1300,7 +1281,8 @@ function enumOf(config) {
|
|
|
1300
1281
|
function getValueObject(v) {
|
|
1301
1282
|
return configValues.find((option2) => isPlainObject(option2) && option2.value === v);
|
|
1302
1283
|
}
|
|
1303
|
-
return
|
|
1284
|
+
return {
|
|
1285
|
+
...extractValues,
|
|
1304
1286
|
values,
|
|
1305
1287
|
label,
|
|
1306
1288
|
description,
|
|
@@ -1308,7 +1290,7 @@ function enumOf(config) {
|
|
|
1308
1290
|
descriptions,
|
|
1309
1291
|
option,
|
|
1310
1292
|
options
|
|
1311
|
-
}
|
|
1293
|
+
};
|
|
1312
1294
|
}
|
|
1313
1295
|
|
|
1314
1296
|
// src/util/motion.ts
|
|
@@ -1456,13 +1438,11 @@ function createCacheManager(options = {}) {
|
|
|
1456
1438
|
return cacheManager.has(key3);
|
|
1457
1439
|
}
|
|
1458
1440
|
function get(key3) {
|
|
1459
|
-
var _a;
|
|
1460
1441
|
purgeStale();
|
|
1461
|
-
return
|
|
1442
|
+
return cacheManager.get(key3)?.value;
|
|
1462
1443
|
}
|
|
1463
1444
|
function set2(key3, value, options2) {
|
|
1464
|
-
|
|
1465
|
-
const ttl = (_a = options2 == null ? void 0 : options2.ttl) != null ? _a : defaultTtl;
|
|
1445
|
+
const ttl = options2?.ttl ?? defaultTtl;
|
|
1466
1446
|
cacheManager.set(key3, { expiredAt: performance.now() + ttl, value });
|
|
1467
1447
|
}
|
|
1468
1448
|
function remove(key3) {
|
|
@@ -1480,14 +1460,6 @@ function createCacheManager(options = {}) {
|
|
|
1480
1460
|
};
|
|
1481
1461
|
}
|
|
1482
1462
|
|
|
1483
|
-
// src/util/index.ts
|
|
1484
|
-
__reExport(util_exports, mitt_star);
|
|
1485
|
-
import * as mitt_star from "mitt";
|
|
1486
|
-
import { default as default2 } from "mitt";
|
|
1487
|
-
|
|
1488
|
-
// src/index.ts
|
|
1489
|
-
__reExport(src_exports, util_exports);
|
|
1490
|
-
|
|
1491
1463
|
// src/collection/cloneDeepWith.ts
|
|
1492
1464
|
function cloneDeepWith(value, fn) {
|
|
1493
1465
|
const cache = /* @__PURE__ */ new WeakMap();
|
|
@@ -1733,7 +1705,7 @@ function round(val, precision = 0) {
|
|
|
1733
1705
|
return baseRound(val, precision, Math.round);
|
|
1734
1706
|
}
|
|
1735
1707
|
function baseRound(val, precision, fn) {
|
|
1736
|
-
precision = clamp(precision
|
|
1708
|
+
precision = clamp(precision ?? 0, -292, 292);
|
|
1737
1709
|
if (!precision) {
|
|
1738
1710
|
return fn(val);
|
|
1739
1711
|
}
|
|
@@ -1890,6 +1862,8 @@ export {
|
|
|
1890
1862
|
uniq,
|
|
1891
1863
|
uniqBy,
|
|
1892
1864
|
upperFirst,
|
|
1865
|
+
v4 as uuid,
|
|
1866
|
+
v6 as uuidV6,
|
|
1893
1867
|
xor,
|
|
1894
1868
|
xorWith
|
|
1895
1869
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rattail",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "A utilities library for front-end developers, lightweight and ts-friendly",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"utilities library",
|
|
@@ -19,19 +19,12 @@
|
|
|
19
19
|
"author": "haoziqaq <357229046@qq.com>",
|
|
20
20
|
"sideEffects": false,
|
|
21
21
|
"type": "module",
|
|
22
|
-
"exports":
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
"main": "lib/index.cjs",
|
|
29
|
-
"jsdelivr": "lib/index.global.js",
|
|
30
|
-
"unpkg": "lib/index.global.js",
|
|
31
|
-
"module": "lib/index.js",
|
|
32
|
-
"types": "lib/index.d.ts",
|
|
22
|
+
"exports": "./dist/index.js",
|
|
23
|
+
"main": "dist/index.js",
|
|
24
|
+
"module": "dist/index.js",
|
|
25
|
+
"types": "dist/index.d.ts",
|
|
33
26
|
"files": [
|
|
34
|
-
"
|
|
27
|
+
"dist"
|
|
35
28
|
],
|
|
36
29
|
"simple-git-hooks": {
|
|
37
30
|
"pre-commit": "pnpm exec nano-staged --allow-empty",
|
|
@@ -45,13 +38,14 @@
|
|
|
45
38
|
]
|
|
46
39
|
},
|
|
47
40
|
"dependencies": {
|
|
48
|
-
"mitt": "^3.0.1"
|
|
41
|
+
"mitt": "^3.0.1",
|
|
42
|
+
"uuid": "^13.0.0"
|
|
49
43
|
},
|
|
50
44
|
"devDependencies": {
|
|
51
45
|
"@configurajs/eslint": "^0.0.14",
|
|
52
46
|
"@configurajs/prettier": "^0.1.1",
|
|
53
47
|
"@types/node": "^22.8.1",
|
|
54
|
-
"@varlet/release": "^0.
|
|
48
|
+
"@varlet/release": "^1.0.2",
|
|
55
49
|
"@vitest/coverage-istanbul": "^2.1.3",
|
|
56
50
|
"eslint": "9.17.0",
|
|
57
51
|
"jsdom": "^25.0.1",
|
|
@@ -68,8 +62,8 @@
|
|
|
68
62
|
"pnpm": ">=9.0"
|
|
69
63
|
},
|
|
70
64
|
"scripts": {
|
|
71
|
-
"build": "tsup src/index.ts --format esm
|
|
72
|
-
"clean": "rimraf node_modules
|
|
65
|
+
"build": "tsup src/index.ts --format esm --dts --clean",
|
|
66
|
+
"clean": "rimraf node_modules dist",
|
|
73
67
|
"dev": "vitest --coverage",
|
|
74
68
|
"docs:build": "vitepress build docs",
|
|
75
69
|
"docs:dev": "vitepress dev docs",
|