@sunny-base-web/utils 0.8.78 → 0.8.79
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/dist/index.d.mts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +11 -0
- package/dist/index.mjs +10 -0
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -118,6 +118,12 @@ declare function isMacOs(): boolean;
|
|
|
118
118
|
* 这个函数通过检查navigator.userAgent字符串来判断当前运行环境。
|
|
119
119
|
*/
|
|
120
120
|
declare function isWindowsOs(): boolean;
|
|
121
|
+
/**
|
|
122
|
+
* 检测当前设备是否为平板电脑。
|
|
123
|
+
*
|
|
124
|
+
* 覆盖:iPad(含 iPadOS 13+ 报告为 Macintosh)、Android 平板、华为 MatePad/MediaPad。
|
|
125
|
+
*/
|
|
126
|
+
declare function isTablet(): boolean;
|
|
121
127
|
|
|
122
128
|
declare function cn(...inputs: ClassValue[]): string;
|
|
123
129
|
|
|
@@ -807,4 +813,4 @@ declare function stopProgress(): void;
|
|
|
807
813
|
*/
|
|
808
814
|
declare function saveAs(data: Blob | File, filename: string): void;
|
|
809
815
|
|
|
810
|
-
export { type FieldTransformOptions, type PatternKey, type RouteModuleType, type UseNamespaceReturn, applyPrimaryColor, bindMethods, cloneDeep, cn, deepMerge, filterTree, generatePrimaryColors, get, getCookie, getPattern, is, isBoolean, isEmpty, isEqual, isHttpUrl, isMacOs, isUndefined, isValidColor, isWindow, isWindowsOs, mapTree, mergeRouteModules, mergeWithArrayOverride, patterns, saveAs, set, setCookie, sortTree, startProgress, stopProgress, transformToObjectArray, transformToString, traverseTreeValues, useNamespace };
|
|
816
|
+
export { type FieldTransformOptions, type PatternKey, type RouteModuleType, type UseNamespaceReturn, applyPrimaryColor, bindMethods, cloneDeep, cn, deepMerge, filterTree, generatePrimaryColors, get, getCookie, getPattern, is, isBoolean, isEmpty, isEqual, isHttpUrl, isMacOs, isTablet, isUndefined, isValidColor, isWindow, isWindowsOs, mapTree, mergeRouteModules, mergeWithArrayOverride, patterns, saveAs, set, setCookie, sortTree, startProgress, stopProgress, transformToObjectArray, transformToString, traverseTreeValues, useNamespace };
|
package/dist/index.d.ts
CHANGED
|
@@ -118,6 +118,12 @@ declare function isMacOs(): boolean;
|
|
|
118
118
|
* 这个函数通过检查navigator.userAgent字符串来判断当前运行环境。
|
|
119
119
|
*/
|
|
120
120
|
declare function isWindowsOs(): boolean;
|
|
121
|
+
/**
|
|
122
|
+
* 检测当前设备是否为平板电脑。
|
|
123
|
+
*
|
|
124
|
+
* 覆盖:iPad(含 iPadOS 13+ 报告为 Macintosh)、Android 平板、华为 MatePad/MediaPad。
|
|
125
|
+
*/
|
|
126
|
+
declare function isTablet(): boolean;
|
|
121
127
|
|
|
122
128
|
declare function cn(...inputs: ClassValue[]): string;
|
|
123
129
|
|
|
@@ -807,4 +813,4 @@ declare function stopProgress(): void;
|
|
|
807
813
|
*/
|
|
808
814
|
declare function saveAs(data: Blob | File, filename: string): void;
|
|
809
815
|
|
|
810
|
-
export { type FieldTransformOptions, type PatternKey, type RouteModuleType, type UseNamespaceReturn, applyPrimaryColor, bindMethods, cloneDeep, cn, deepMerge, filterTree, generatePrimaryColors, get, getCookie, getPattern, is, isBoolean, isEmpty, isEqual, isHttpUrl, isMacOs, isUndefined, isValidColor, isWindow, isWindowsOs, mapTree, mergeRouteModules, mergeWithArrayOverride, patterns, saveAs, set, setCookie, sortTree, startProgress, stopProgress, transformToObjectArray, transformToString, traverseTreeValues, useNamespace };
|
|
816
|
+
export { type FieldTransformOptions, type PatternKey, type RouteModuleType, type UseNamespaceReturn, applyPrimaryColor, bindMethods, cloneDeep, cn, deepMerge, filterTree, generatePrimaryColors, get, getCookie, getPattern, is, isBoolean, isEmpty, isEqual, isHttpUrl, isMacOs, isTablet, isUndefined, isValidColor, isWindow, isWindowsOs, mapTree, mergeRouteModules, mergeWithArrayOverride, patterns, saveAs, set, setCookie, sortTree, startProgress, stopProgress, transformToObjectArray, transformToString, traverseTreeValues, useNamespace };
|
package/dist/index.js
CHANGED
|
@@ -50,6 +50,7 @@ __export(index_exports, {
|
|
|
50
50
|
isMacOs: () => isMacOs,
|
|
51
51
|
isObject: () => import_shared.isObject,
|
|
52
52
|
isString: () => import_shared.isString,
|
|
53
|
+
isTablet: () => isTablet,
|
|
53
54
|
isUndefined: () => isUndefined,
|
|
54
55
|
isValidColor: () => isValidColor,
|
|
55
56
|
isWindow: () => isWindow,
|
|
@@ -322,6 +323,15 @@ function isWindowsOs() {
|
|
|
322
323
|
const windowsRegex = /windows|win32/i;
|
|
323
324
|
return windowsRegex.test(navigator.userAgent);
|
|
324
325
|
}
|
|
326
|
+
function isTablet() {
|
|
327
|
+
if (typeof navigator === "undefined") return false;
|
|
328
|
+
const ua = navigator.userAgent;
|
|
329
|
+
if (/iPad/i.test(ua)) return true;
|
|
330
|
+
if (/Macintosh/i.test(ua) && navigator.maxTouchPoints > 0) return true;
|
|
331
|
+
if (/Android/i.test(ua) && !/Mobile/i.test(ua)) return true;
|
|
332
|
+
if (/MatePad|MediaPad/i.test(ua)) return true;
|
|
333
|
+
return false;
|
|
334
|
+
}
|
|
325
335
|
|
|
326
336
|
// src/style/index.ts
|
|
327
337
|
var import_clsx = require("clsx");
|
|
@@ -924,6 +934,7 @@ function saveAs(data, filename) {
|
|
|
924
934
|
isMacOs,
|
|
925
935
|
isObject,
|
|
926
936
|
isString,
|
|
937
|
+
isTablet,
|
|
927
938
|
isUndefined,
|
|
928
939
|
isValidColor,
|
|
929
940
|
isWindow,
|
package/dist/index.mjs
CHANGED
|
@@ -248,6 +248,15 @@ function isWindowsOs() {
|
|
|
248
248
|
const windowsRegex = /windows|win32/i;
|
|
249
249
|
return windowsRegex.test(navigator.userAgent);
|
|
250
250
|
}
|
|
251
|
+
function isTablet() {
|
|
252
|
+
if (typeof navigator === "undefined") return false;
|
|
253
|
+
const ua = navigator.userAgent;
|
|
254
|
+
if (/iPad/i.test(ua)) return true;
|
|
255
|
+
if (/Macintosh/i.test(ua) && navigator.maxTouchPoints > 0) return true;
|
|
256
|
+
if (/Android/i.test(ua) && !/Mobile/i.test(ua)) return true;
|
|
257
|
+
if (/MatePad|MediaPad/i.test(ua)) return true;
|
|
258
|
+
return false;
|
|
259
|
+
}
|
|
251
260
|
|
|
252
261
|
// src/style/index.ts
|
|
253
262
|
import { clsx } from "clsx";
|
|
@@ -849,6 +858,7 @@ export {
|
|
|
849
858
|
isMacOs,
|
|
850
859
|
isObject,
|
|
851
860
|
isString,
|
|
861
|
+
isTablet,
|
|
852
862
|
isUndefined,
|
|
853
863
|
isValidColor,
|
|
854
864
|
isWindow,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sunny-base-web/utils",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.79",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -27,14 +27,14 @@
|
|
|
27
27
|
"nprogress": "^0.2.0",
|
|
28
28
|
"tailwind-merge": "^3.4.0",
|
|
29
29
|
"vue-i18n": "^11.2.8",
|
|
30
|
-
"@sunny-base-web/constants": "^0.8.
|
|
30
|
+
"@sunny-base-web/constants": "^0.8.79"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@types/nprogress": "^0.2.3",
|
|
34
34
|
"tsup": "^8.5.1",
|
|
35
35
|
"typescript": "^5.7.2",
|
|
36
36
|
"vue-router": "^4.6.4",
|
|
37
|
-
"@sunny-base-web/tsconfig": "0.8.
|
|
37
|
+
"@sunny-base-web/tsconfig": "0.8.79"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
40
|
"build": "tsup src/index.ts --format cjs,esm --dts --clean",
|