@bifrostui/utils 1.4.7-beta.0 → 2.0.0-beta.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/dist/directionLocationUtil.d.ts +12 -27
- package/dist/directionLocationUtil.js +55 -101
- package/dist/getBoundingClientRect/index.miniapp.d.ts +2 -1
- package/dist/getBoundingClientRect/index.miniapp.js +5 -34
- package/dist/getRootElement/index.d.ts +2 -0
- package/dist/{getRootContainer → getRootElement}/index.js +8 -8
- package/dist/getRootElement/index.miniapp.d.ts +3 -0
- package/dist/{getRootContainer → getRootElement}/index.miniapp.js +4 -4
- package/dist/hooks/index.d.ts +2 -2
- package/dist/hooks/index.js +0 -8
- package/dist/hooks/useDidMountEffect.d.ts +1 -1
- package/dist/hooks/useTouchEmulator.d.ts +1 -7
- package/dist/hooks/useTouchEmulator.js +10 -36
- package/dist/index.d.ts +3 -4
- package/dist/index.js +3 -18
- package/dist/isMini.d.ts +1 -2
- package/dist/isMini.js +0 -3
- package/es/directionLocationUtil.d.ts +12 -27
- package/es/directionLocationUtil.js +55 -91
- package/es/getBoundingClientRect/index.miniapp.d.ts +2 -1
- package/es/getBoundingClientRect/index.miniapp.js +5 -34
- package/es/getRootElement/index.d.ts +2 -0
- package/es/getRootElement/index.js +9 -0
- package/es/getRootElement/index.miniapp.d.ts +3 -0
- package/es/{getRootContainer → getRootElement}/index.miniapp.js +4 -4
- package/es/hooks/index.d.ts +2 -2
- package/es/hooks/index.js +1 -10
- package/es/hooks/useDidMountEffect.d.ts +1 -1
- package/es/hooks/useTouchEmulator.d.ts +1 -7
- package/es/hooks/useTouchEmulator.js +10 -29
- package/es/index.d.ts +3 -4
- package/es/index.js +2 -15
- package/es/isMini.d.ts +1 -2
- package/es/isMini.js +0 -2
- package/package.json +1 -1
- package/dist/domUtils/index.d.ts +0 -12
- package/dist/domUtils/index.js +0 -46
- package/dist/domUtils/index.miniapp.d.ts +0 -2
- package/dist/domUtils/index.miniapp.js +0 -86
- package/dist/getRootContainer/index.d.ts +0 -2
- package/dist/getRootContainer/index.miniapp.d.ts +0 -3
- package/es/domUtils/index.d.ts +0 -12
- package/es/domUtils/index.js +0 -22
- package/es/domUtils/index.miniapp.d.ts +0 -2
- package/es/domUtils/index.miniapp.js +0 -54
- package/es/getRootContainer/index.d.ts +0 -2
- package/es/getRootContainer/index.js +0 -9
- package/es/getRootContainer/index.miniapp.d.ts +0 -3
package/dist/domUtils/index.js
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
var __defProp = Object.defineProperty;
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
5
|
-
var __export = (target, all) => {
|
6
|
-
for (var name in all)
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
8
|
-
};
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
11
|
-
for (let key of __getOwnPropNames(from))
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
14
|
-
}
|
15
|
-
return to;
|
16
|
-
};
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
18
|
-
var domUtils_exports = {};
|
19
|
-
__export(domUtils_exports, {
|
20
|
-
getClientRect: () => getClientRect,
|
21
|
-
getScrollRect: () => getScrollRect
|
22
|
-
});
|
23
|
-
module.exports = __toCommonJS(domUtils_exports);
|
24
|
-
const getClientRect = () => {
|
25
|
-
const width = window.innerWidth || document.documentElement.clientWidth;
|
26
|
-
const height = window.innerHeight || document.documentElement.clientHeight;
|
27
|
-
return Promise.resolve({
|
28
|
-
width,
|
29
|
-
height,
|
30
|
-
left: 0,
|
31
|
-
top: 0,
|
32
|
-
right: width,
|
33
|
-
bottom: height
|
34
|
-
});
|
35
|
-
};
|
36
|
-
const getScrollRect = () => {
|
37
|
-
return Promise.resolve({
|
38
|
-
top: window.scrollY >= 0 && window.scrollY || document.documentElement.scrollTop,
|
39
|
-
left: window.scrollX >= 0 && window.scrollX || document.documentElement.scrollLeft
|
40
|
-
});
|
41
|
-
};
|
42
|
-
// Annotate the CommonJS export names for ESM import in node:
|
43
|
-
0 && (module.exports = {
|
44
|
-
getClientRect,
|
45
|
-
getScrollRect
|
46
|
-
});
|
@@ -1,86 +0,0 @@
|
|
1
|
-
var __create = Object.create;
|
2
|
-
var __defProp = Object.defineProperty;
|
3
|
-
var __defProps = Object.defineProperties;
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
5
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
6
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
7
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
8
|
-
var __getProtoOf = Object.getPrototypeOf;
|
9
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
10
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
11
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
12
|
-
var __spreadValues = (a, b) => {
|
13
|
-
for (var prop in b || (b = {}))
|
14
|
-
if (__hasOwnProp.call(b, prop))
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
16
|
-
if (__getOwnPropSymbols)
|
17
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
18
|
-
if (__propIsEnum.call(b, prop))
|
19
|
-
__defNormalProp(a, prop, b[prop]);
|
20
|
-
}
|
21
|
-
return a;
|
22
|
-
};
|
23
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
24
|
-
var __export = (target, all) => {
|
25
|
-
for (var name in all)
|
26
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
27
|
-
};
|
28
|
-
var __copyProps = (to, from, except, desc) => {
|
29
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
30
|
-
for (let key of __getOwnPropNames(from))
|
31
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
32
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
33
|
-
}
|
34
|
-
return to;
|
35
|
-
};
|
36
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
37
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
38
|
-
// file that has been converted to a CommonJS file using a Babel-
|
39
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
40
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
41
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
42
|
-
mod
|
43
|
-
));
|
44
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
45
|
-
var index_miniapp_exports = {};
|
46
|
-
__export(index_miniapp_exports, {
|
47
|
-
getClientRect: () => getClientRect,
|
48
|
-
getScrollRect: () => getScrollRect
|
49
|
-
});
|
50
|
-
module.exports = __toCommonJS(index_miniapp_exports);
|
51
|
-
var import_taro = __toESM(require("@tarojs/taro"));
|
52
|
-
const getClientRect = () => {
|
53
|
-
return new Promise((resolve, reject) => {
|
54
|
-
try {
|
55
|
-
const res = import_taro.default.getSystemInfoSync();
|
56
|
-
const width = res.windowWidth;
|
57
|
-
const height = res.windowHeight;
|
58
|
-
const clientInfo = __spreadProps(__spreadValues({}, res), {
|
59
|
-
width,
|
60
|
-
height,
|
61
|
-
left: 0,
|
62
|
-
top: 0,
|
63
|
-
right: width,
|
64
|
-
bottom: height
|
65
|
-
});
|
66
|
-
resolve(clientInfo);
|
67
|
-
} catch (error) {
|
68
|
-
reject(error);
|
69
|
-
}
|
70
|
-
});
|
71
|
-
};
|
72
|
-
const getScrollRect = () => {
|
73
|
-
return new Promise((resolve) => {
|
74
|
-
import_taro.default.createSelectorQuery().selectViewport().scrollOffset().exec((res) => {
|
75
|
-
resolve({
|
76
|
-
top: res[0].scrollTop,
|
77
|
-
left: res[0].scrollLeft
|
78
|
-
});
|
79
|
-
});
|
80
|
-
});
|
81
|
-
};
|
82
|
-
// Annotate the CommonJS export names for ESM import in node:
|
83
|
-
0 && (module.exports = {
|
84
|
-
getClientRect,
|
85
|
-
getScrollRect
|
86
|
-
});
|
package/es/domUtils/index.d.ts
DELETED
package/es/domUtils/index.js
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
const getClientRect = () => {
|
2
|
-
const width = window.innerWidth || document.documentElement.clientWidth;
|
3
|
-
const height = window.innerHeight || document.documentElement.clientHeight;
|
4
|
-
return Promise.resolve({
|
5
|
-
width,
|
6
|
-
height,
|
7
|
-
left: 0,
|
8
|
-
top: 0,
|
9
|
-
right: width,
|
10
|
-
bottom: height
|
11
|
-
});
|
12
|
-
};
|
13
|
-
const getScrollRect = () => {
|
14
|
-
return Promise.resolve({
|
15
|
-
top: window.scrollY >= 0 && window.scrollY || document.documentElement.scrollTop,
|
16
|
-
left: window.scrollX >= 0 && window.scrollX || document.documentElement.scrollLeft
|
17
|
-
});
|
18
|
-
};
|
19
|
-
export {
|
20
|
-
getClientRect,
|
21
|
-
getScrollRect
|
22
|
-
};
|
@@ -1,54 +0,0 @@
|
|
1
|
-
var __defProp = Object.defineProperty;
|
2
|
-
var __defProps = Object.defineProperties;
|
3
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
4
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
8
|
-
var __spreadValues = (a, b) => {
|
9
|
-
for (var prop in b || (b = {}))
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
12
|
-
if (__getOwnPropSymbols)
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
14
|
-
if (__propIsEnum.call(b, prop))
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
16
|
-
}
|
17
|
-
return a;
|
18
|
-
};
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
20
|
-
import Taro from "@tarojs/taro";
|
21
|
-
const getClientRect = () => {
|
22
|
-
return new Promise((resolve, reject) => {
|
23
|
-
try {
|
24
|
-
const res = Taro.getSystemInfoSync();
|
25
|
-
const width = res.windowWidth;
|
26
|
-
const height = res.windowHeight;
|
27
|
-
const clientInfo = __spreadProps(__spreadValues({}, res), {
|
28
|
-
width,
|
29
|
-
height,
|
30
|
-
left: 0,
|
31
|
-
top: 0,
|
32
|
-
right: width,
|
33
|
-
bottom: height
|
34
|
-
});
|
35
|
-
resolve(clientInfo);
|
36
|
-
} catch (error) {
|
37
|
-
reject(error);
|
38
|
-
}
|
39
|
-
});
|
40
|
-
};
|
41
|
-
const getScrollRect = () => {
|
42
|
-
return new Promise((resolve) => {
|
43
|
-
Taro.createSelectorQuery().selectViewport().scrollOffset().exec((res) => {
|
44
|
-
resolve({
|
45
|
-
top: res[0].scrollTop,
|
46
|
-
left: res[0].scrollLeft
|
47
|
-
});
|
48
|
-
});
|
49
|
-
});
|
50
|
-
};
|
51
|
-
export {
|
52
|
-
getClientRect,
|
53
|
-
getScrollRect
|
54
|
-
};
|
@@ -1,9 +0,0 @@
|
|
1
|
-
const getRootContainer = (rootCon, defaultCon) => {
|
2
|
-
const rootElement = typeof rootCon === "function" ? rootCon() : rootCon;
|
3
|
-
const defaultRootElement = document.body;
|
4
|
-
return rootElement || defaultCon || defaultRootElement;
|
5
|
-
};
|
6
|
-
var getRootContainer_default = getRootContainer;
|
7
|
-
export {
|
8
|
-
getRootContainer_default as default
|
9
|
-
};
|