@bifrostui/utils 2.0.0-alpha.0 → 2.0.0-alpha.10

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.
Files changed (70) hide show
  1. package/dist/directionLocationUtil.d.ts +27 -12
  2. package/dist/directionLocationUtil.js +101 -55
  3. package/dist/domUtils/addClass.d.ts +1 -0
  4. package/dist/domUtils/addClass.js +46 -0
  5. package/dist/domUtils/index.d.ts +3 -0
  6. package/dist/domUtils/index.js +35 -0
  7. package/dist/domUtils/index.miniapp.d.ts +3 -0
  8. package/dist/domUtils/index.miniapp.js +35 -0
  9. package/dist/domUtils/rect.d.ts +12 -0
  10. package/dist/domUtils/rect.js +46 -0
  11. package/dist/domUtils/rect.miniapp.d.ts +2 -0
  12. package/dist/domUtils/rect.miniapp.js +86 -0
  13. package/dist/domUtils/removeClass.d.ts +1 -0
  14. package/dist/domUtils/removeClass.js +47 -0
  15. package/dist/getBoundingClientRect/index.d.ts +1 -1
  16. package/dist/getBoundingClientRect/index.js +13 -0
  17. package/dist/getBoundingClientRect/index.miniapp.d.ts +1 -2
  18. package/dist/getBoundingClientRect/index.miniapp.js +34 -5
  19. package/dist/getRootContainer/index.d.ts +2 -0
  20. package/dist/{getRootElement → getRootContainer}/index.js +8 -8
  21. package/dist/getRootContainer/index.miniapp.d.ts +3 -0
  22. package/dist/{getRootElement → getRootContainer}/index.miniapp.js +4 -4
  23. package/dist/hooks/index.d.ts +2 -2
  24. package/dist/hooks/index.js +8 -0
  25. package/dist/hooks/useTouchEmulator.d.ts +7 -1
  26. package/dist/hooks/useTouchEmulator.js +36 -10
  27. package/dist/index.d.ts +4 -3
  28. package/dist/index.js +15 -3
  29. package/dist/isMini.d.ts +2 -1
  30. package/dist/isMini.js +3 -0
  31. package/dist/themeCreator/cssVarToValue.d.ts +16 -0
  32. package/dist/themeCreator/cssVarToValue.js +32 -4
  33. package/es/directionLocationUtil.d.ts +27 -12
  34. package/es/directionLocationUtil.js +91 -55
  35. package/es/domUtils/addClass.d.ts +1 -0
  36. package/es/domUtils/addClass.js +23 -0
  37. package/es/domUtils/index.d.ts +3 -0
  38. package/es/domUtils/index.js +9 -0
  39. package/es/domUtils/index.miniapp.d.ts +3 -0
  40. package/es/domUtils/index.miniapp.js +9 -0
  41. package/es/domUtils/rect.d.ts +12 -0
  42. package/es/domUtils/rect.js +22 -0
  43. package/es/domUtils/rect.miniapp.d.ts +2 -0
  44. package/es/domUtils/rect.miniapp.js +54 -0
  45. package/es/domUtils/removeClass.d.ts +1 -0
  46. package/es/domUtils/removeClass.js +24 -0
  47. package/es/getBoundingClientRect/index.d.ts +1 -1
  48. package/es/getBoundingClientRect/index.js +13 -0
  49. package/es/getBoundingClientRect/index.miniapp.d.ts +1 -2
  50. package/es/getBoundingClientRect/index.miniapp.js +34 -5
  51. package/es/getRootContainer/index.d.ts +2 -0
  52. package/es/getRootContainer/index.js +9 -0
  53. package/es/getRootContainer/index.miniapp.d.ts +3 -0
  54. package/es/{getRootElement → getRootContainer}/index.miniapp.js +4 -4
  55. package/es/hooks/index.d.ts +2 -2
  56. package/es/hooks/index.js +10 -1
  57. package/es/hooks/useTouchEmulator.d.ts +7 -1
  58. package/es/hooks/useTouchEmulator.js +29 -10
  59. package/es/index.d.ts +4 -3
  60. package/es/index.js +13 -2
  61. package/es/isMini.d.ts +2 -1
  62. package/es/isMini.js +2 -0
  63. package/es/themeCreator/cssVarToValue.d.ts +16 -0
  64. package/es/themeCreator/cssVarToValue.js +31 -3
  65. package/package.json +2 -2
  66. package/dist/getRootElement/index.d.ts +0 -2
  67. package/dist/getRootElement/index.miniapp.d.ts +0 -3
  68. package/es/getRootElement/index.d.ts +0 -2
  69. package/es/getRootElement/index.js +0 -9
  70. package/es/getRootElement/index.miniapp.d.ts +0 -3
@@ -21,5 +21,18 @@ __export(getBoundingClientRect_exports, {
21
21
  });
22
22
  module.exports = __toCommonJS(getBoundingClientRect_exports);
23
23
  function getBoundingClientRect(ele) {
24
+ if (!ele) {
25
+ return Promise.resolve({
26
+ width: 0,
27
+ height: 0,
28
+ top: 0,
29
+ right: 0,
30
+ bottom: 0,
31
+ left: 0,
32
+ x: 0,
33
+ y: 0,
34
+ toJSON: () => ({})
35
+ });
36
+ }
24
37
  return Promise.resolve(ele.getBoundingClientRect());
25
38
  }
@@ -1,2 +1 @@
1
- import type { TaroElement } from '@tarojs/runtime';
2
- export default function getBoundingClientRect(ele: TaroElement): Promise<DOMRect>;
1
+ export default function getBoundingClientRect(ele: any): Promise<DOMRect>;
@@ -25,17 +25,46 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
25
25
  mod
26
26
  ));
27
27
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+ var __async = (__this, __arguments, generator) => {
29
+ return new Promise((resolve, reject) => {
30
+ var fulfilled = (value) => {
31
+ try {
32
+ step(generator.next(value));
33
+ } catch (e) {
34
+ reject(e);
35
+ }
36
+ };
37
+ var rejected = (value) => {
38
+ try {
39
+ step(generator.throw(value));
40
+ } catch (e) {
41
+ reject(e);
42
+ }
43
+ };
44
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
45
+ step((generator = generator.apply(__this, __arguments)).next());
46
+ });
47
+ };
28
48
  var index_miniapp_exports = {};
29
49
  __export(index_miniapp_exports, {
30
50
  default: () => getBoundingClientRect
31
51
  });
32
52
  module.exports = __toCommonJS(index_miniapp_exports);
33
53
  var import_taro = __toESM(require("@tarojs/taro"));
54
+ var import_isMini = require("../isMini");
34
55
  function getBoundingClientRect(ele) {
35
- return new Promise((resolve) => {
36
- const query = import_taro.default.createSelectorQuery();
37
- query.select(`#${ele.uid}`).boundingClientRect().exec(([res]) => {
38
- resolve(res);
39
- });
56
+ return __async(this, null, function* () {
57
+ let result;
58
+ if (import_isMini.isWeapp || import_isMini.isTt) {
59
+ result = yield ele.getBoundingClientRect();
60
+ } else {
61
+ const query = import_taro.default.createSelectorQuery();
62
+ result = yield new Promise((resolve) => {
63
+ query.select(`#${ele.uid}`).boundingClientRect().exec(([res]) => {
64
+ resolve(res);
65
+ });
66
+ });
67
+ }
68
+ return result;
40
69
  });
41
70
  }
@@ -0,0 +1,2 @@
1
+ declare const getRootContainer: (rootCon?: HTMLElement | (() => HTMLElement) | Window, defaultCon?: any) => any;
2
+ export default getRootContainer;
@@ -15,14 +15,14 @@ var __copyProps = (to, from, except, desc) => {
15
15
  return to;
16
16
  };
17
17
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var getRootElement_exports = {};
19
- __export(getRootElement_exports, {
20
- default: () => getRootElement_default
18
+ var getRootContainer_exports = {};
19
+ __export(getRootContainer_exports, {
20
+ default: () => getRootContainer_default
21
21
  });
22
- module.exports = __toCommonJS(getRootElement_exports);
23
- const getRootElement = (rootEle) => {
24
- const rootElement = typeof rootEle === "function" ? rootEle() : rootEle;
22
+ module.exports = __toCommonJS(getRootContainer_exports);
23
+ const getRootContainer = (rootCon, defaultCon) => {
24
+ const rootElement = typeof rootCon === "function" ? rootCon() : rootCon;
25
25
  const defaultRootElement = document.body;
26
- return rootElement || defaultRootElement;
26
+ return rootElement || defaultCon || defaultRootElement;
27
27
  };
28
- var getRootElement_default = getRootElement;
28
+ var getRootContainer_default = getRootContainer;
@@ -0,0 +1,3 @@
1
+ import type { TaroElement } from '@tarojs/runtime';
2
+ declare const getRootContainer: (rootCon?: TaroElement | (() => TaroElement), defaultCon?: any) => any;
3
+ export default getRootContainer;
@@ -31,12 +31,12 @@ __export(index_miniapp_exports, {
31
31
  });
32
32
  module.exports = __toCommonJS(index_miniapp_exports);
33
33
  var import_taro = __toESM(require("@tarojs/taro"));
34
- const getRootElement = (rootEle) => {
34
+ const getRootContainer = (rootCon, defaultCon) => {
35
35
  const currentPages = import_taro.default.getCurrentPages() || [];
36
36
  const currentPage = currentPages[currentPages.length - 1];
37
37
  const pageElement = currentPage == null ? void 0 : currentPage.$taroPath;
38
38
  const defaultRootElement = document.getElementById(pageElement);
39
- const rootElement = typeof rootEle === "function" ? rootEle() : rootEle;
40
- return rootElement || defaultRootElement;
39
+ const rootElement = typeof rootCon === "function" ? rootCon() : rootCon;
40
+ return rootElement || defaultCon || defaultRootElement;
41
41
  };
42
- var index_miniapp_default = getRootElement;
42
+ var index_miniapp_default = getRootContainer;
@@ -1,11 +1,11 @@
1
1
  import useDidMountEffect from './useDidMountEffect';
2
2
  import useEventCallback from './useEventCallback';
3
3
  import useForkRef from './useForkRef';
4
- import useTouchEmulator from './useTouchEmulator';
4
+ import useTouchEmulator, { touchEmulator, emulateTouchStart, emulateTouchMove, emulateTouchEnd } from './useTouchEmulator';
5
5
  import useValue from './useValue';
6
6
  import useDomReady from './useDomReady';
7
7
  import useSize from './useSize';
8
8
  import useDomCss from './useDomCss';
9
9
  import useTouch from './useTouch';
10
10
  import useUniqueId from './useUniqueId';
11
- export { useValue, useForkRef, useEventCallback, useDidMountEffect, useTouchEmulator, useDomReady, useSize, useDomCss, useTouch, useUniqueId, };
11
+ export { useValue, useForkRef, useEventCallback, useDidMountEffect, useTouchEmulator, touchEmulator, emulateTouchStart, emulateTouchMove, emulateTouchEnd, useDomReady, useSize, useDomCss, useTouch, useUniqueId, };
@@ -27,6 +27,10 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
28
  var hooks_exports = {};
29
29
  __export(hooks_exports, {
30
+ emulateTouchEnd: () => import_useTouchEmulator.emulateTouchEnd,
31
+ emulateTouchMove: () => import_useTouchEmulator.emulateTouchMove,
32
+ emulateTouchStart: () => import_useTouchEmulator.emulateTouchStart,
33
+ touchEmulator: () => import_useTouchEmulator.touchEmulator,
30
34
  useDidMountEffect: () => import_useDidMountEffect.default,
31
35
  useDomCss: () => import_useDomCss.default,
32
36
  useDomReady: () => import_useDomReady.default,
@@ -51,6 +55,10 @@ var import_useTouch = __toESM(require("./useTouch"));
51
55
  var import_useUniqueId = __toESM(require("./useUniqueId"));
52
56
  // Annotate the CommonJS export names for ESM import in node:
53
57
  0 && (module.exports = {
58
+ emulateTouchEnd,
59
+ emulateTouchMove,
60
+ emulateTouchStart,
61
+ touchEmulator,
54
62
  useDidMountEffect,
55
63
  useDomCss,
56
64
  useDomReady,
@@ -1 +1,7 @@
1
- export default function useTouchEmulator(dom?: HTMLElement | Window): void;
1
+ declare const emulateTouchStart: (ev: any) => void;
2
+ declare const emulateTouchMove: (ev: any) => void;
3
+ declare const emulateTouchEnd: (ev: any) => void;
4
+ declare function useTouchEmulator(dom?: HTMLElement | Window): void;
5
+ declare const touchEmulator: (dom?: HTMLElement | Window) => () => void;
6
+ export default useTouchEmulator;
7
+ export { touchEmulator, emulateTouchStart, emulateTouchMove, emulateTouchEnd };
@@ -17,7 +17,11 @@ var __copyProps = (to, from, except, desc) => {
17
17
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
18
  var useTouchEmulator_exports = {};
19
19
  __export(useTouchEmulator_exports, {
20
- default: () => useTouchEmulator
20
+ default: () => useTouchEmulator_default,
21
+ emulateTouchEnd: () => emulateTouchEnd,
22
+ emulateTouchMove: () => emulateTouchMove,
23
+ emulateTouchStart: () => emulateTouchStart,
24
+ touchEmulator: () => touchEmulator
21
25
  });
22
26
  module.exports = __toCommonJS(useTouchEmulator_exports);
23
27
  var import_react = require("react");
@@ -88,22 +92,44 @@ function getActiveTouches(mouseEv) {
88
92
  }
89
93
  return createTouchList(mouseEv);
90
94
  }
95
+ const emulateTouchStart = onMouse("touchstart");
96
+ const emulateTouchMove = onMouse("touchmove");
97
+ const emulateTouchEnd = onMouse("touchend");
91
98
  function useTouchEmulator(dom = window) {
92
- const touchStart = onMouse("touchstart");
93
- const touchMove = onMouse("touchmove");
94
- const touchEnd = onMouse("touchend");
95
99
  (0, import_react.useEffect)(() => {
96
100
  if (dom) {
97
- dom.addEventListener("mousedown", touchStart, true);
98
- dom.addEventListener("mousemove", touchMove, true);
99
- dom.addEventListener("mouseup", touchEnd, true);
101
+ dom.addEventListener("mousedown", emulateTouchStart, true);
102
+ dom.addEventListener("mousemove", emulateTouchMove, true);
103
+ dom.addEventListener("mouseup", emulateTouchEnd, true);
100
104
  }
101
105
  return () => {
102
106
  if (dom) {
103
- dom.removeEventListener("mousedown", touchStart, true);
104
- dom.removeEventListener("mousemove", touchMove, true);
105
- dom.removeEventListener("mouseup", touchEnd, true);
107
+ dom.removeEventListener("mousedown", emulateTouchStart, true);
108
+ dom.removeEventListener("mousemove", emulateTouchMove, true);
109
+ dom.removeEventListener("mouseup", emulateTouchEnd, true);
106
110
  }
107
111
  };
108
112
  }, [dom]);
109
113
  }
114
+ const touchEmulator = (dom = window) => {
115
+ if (dom) {
116
+ dom.addEventListener("mousedown", emulateTouchStart, true);
117
+ dom.addEventListener("mousemove", emulateTouchMove, true);
118
+ dom.addEventListener("mouseup", emulateTouchEnd, true);
119
+ }
120
+ return function() {
121
+ if (dom) {
122
+ dom.removeEventListener("mousedown", emulateTouchStart, true);
123
+ dom.removeEventListener("mousemove", emulateTouchMove, true);
124
+ dom.removeEventListener("mouseup", emulateTouchEnd, true);
125
+ }
126
+ };
127
+ };
128
+ var useTouchEmulator_default = useTouchEmulator;
129
+ // Annotate the CommonJS export names for ESM import in node:
130
+ 0 && (module.exports = {
131
+ emulateTouchEnd,
132
+ emulateTouchMove,
133
+ emulateTouchStart,
134
+ touchEmulator
135
+ });
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { default as debounce } from './debounce';
2
- export { getStylesAndLocation, triggerEventTransform, parsePlacement, } from './directionLocationUtil';
2
+ export { getStylesAndLocation, getNewDirectionLocation, triggerEventTransform, parsePlacement, } from './directionLocationUtil';
3
3
  export { default as convertHexToRGBA } from './hex2rgba';
4
- export { useDidMountEffect, useEventCallback, useForkRef, useTouchEmulator, useValue, useDomReady, useSize, useDomCss, useTouch, useUniqueId, } from './hooks';
4
+ export { useDidMountEffect, useEventCallback, useForkRef, useTouchEmulator, touchEmulator, emulateTouchStart, emulateTouchMove, emulateTouchEnd, useValue, useDomReady, useSize, useDomCss, useTouch, useUniqueId, } from './hooks';
5
5
  export { default as isDev } from './isDev';
6
6
  export { isMini, isWeapp, isAlipay, isMiniapp } from './isMini';
7
7
  export { default as setRef } from './setRef';
@@ -9,8 +9,9 @@ export { default as throttle } from './throttle';
9
9
  export { default as toArray } from './toArray';
10
10
  export { default as blockTouch } from './touchBlocker';
11
11
  export { easing, duration, getTransitionProps, createTransitions, } from './transitions';
12
- export { default as getRootElement } from './getRootElement';
12
+ export { default as getRootContainer } from './getRootContainer';
13
13
  export { default as getBoundingClientRect } from './getBoundingClientRect';
14
+ export * from './domUtils';
14
15
  export * from './isType';
15
16
  export * from './render';
16
17
  export * from './themeCreator';
package/dist/index.js CHANGED
@@ -34,8 +34,12 @@ __export(src_exports, {
34
34
  debounce: () => import_debounce.default,
35
35
  duration: () => import_transitions.duration,
36
36
  easing: () => import_transitions.easing,
37
+ emulateTouchEnd: () => import_hooks.emulateTouchEnd,
38
+ emulateTouchMove: () => import_hooks.emulateTouchMove,
39
+ emulateTouchStart: () => import_hooks.emulateTouchStart,
37
40
  getBoundingClientRect: () => import_getBoundingClientRect.default,
38
- getRootElement: () => import_getRootElement.default,
41
+ getNewDirectionLocation: () => import_directionLocationUtil.getNewDirectionLocation,
42
+ getRootContainer: () => import_getRootContainer.default,
39
43
  getStylesAndLocation: () => import_directionLocationUtil.getStylesAndLocation,
40
44
  getTransitionProps: () => import_transitions.getTransitionProps,
41
45
  isAlipay: () => import_isMini.isAlipay,
@@ -47,6 +51,7 @@ __export(src_exports, {
47
51
  setRef: () => import_setRef.default,
48
52
  throttle: () => import_throttle.default,
49
53
  toArray: () => import_toArray.default,
54
+ touchEmulator: () => import_hooks.touchEmulator,
50
55
  triggerEventTransform: () => import_directionLocationUtil.triggerEventTransform,
51
56
  useDidMountEffect: () => import_hooks.useDidMountEffect,
52
57
  useDomCss: () => import_hooks.useDomCss,
@@ -71,8 +76,9 @@ var import_throttle = __toESM(require("./throttle"));
71
76
  var import_toArray = __toESM(require("./toArray"));
72
77
  var import_touchBlocker = __toESM(require("./touchBlocker"));
73
78
  var import_transitions = require("./transitions");
74
- var import_getRootElement = __toESM(require("./getRootElement"));
79
+ var import_getRootContainer = __toESM(require("./getRootContainer"));
75
80
  var import_getBoundingClientRect = __toESM(require("./getBoundingClientRect"));
81
+ __reExport(src_exports, require("./domUtils"), module.exports);
76
82
  __reExport(src_exports, require("./isType"), module.exports);
77
83
  __reExport(src_exports, require("./render"), module.exports);
78
84
  __reExport(src_exports, require("./themeCreator"), module.exports);
@@ -84,8 +90,12 @@ __reExport(src_exports, require("./themeCreator"), module.exports);
84
90
  debounce,
85
91
  duration,
86
92
  easing,
93
+ emulateTouchEnd,
94
+ emulateTouchMove,
95
+ emulateTouchStart,
87
96
  getBoundingClientRect,
88
- getRootElement,
97
+ getNewDirectionLocation,
98
+ getRootContainer,
89
99
  getStylesAndLocation,
90
100
  getTransitionProps,
91
101
  isAlipay,
@@ -97,6 +107,7 @@ __reExport(src_exports, require("./themeCreator"), module.exports);
97
107
  setRef,
98
108
  throttle,
99
109
  toArray,
110
+ touchEmulator,
100
111
  triggerEventTransform,
101
112
  useDidMountEffect,
102
113
  useDomCss,
@@ -108,6 +119,7 @@ __reExport(src_exports, require("./themeCreator"), module.exports);
108
119
  useTouchEmulator,
109
120
  useUniqueId,
110
121
  useValue,
122
+ ...require("./domUtils"),
111
123
  ...require("./isType"),
112
124
  ...require("./render"),
113
125
  ...require("./themeCreator")
package/dist/isMini.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  declare const isMini: boolean;
2
2
  declare const isWeapp: boolean;
3
3
  declare const isAlipay: boolean;
4
- export { isMini, isWeapp, isAlipay };
4
+ declare const isTt: boolean;
5
+ export { isMini, isWeapp, isAlipay, isTt };
5
6
  export declare const isMiniapp: () => boolean;
package/dist/isMini.js CHANGED
@@ -20,12 +20,14 @@ __export(isMini_exports, {
20
20
  isAlipay: () => isAlipay,
21
21
  isMini: () => isMini,
22
22
  isMiniapp: () => isMiniapp,
23
+ isTt: () => isTt,
23
24
  isWeapp: () => isWeapp
24
25
  });
25
26
  module.exports = __toCommonJS(isMini_exports);
26
27
  const isMini = typeof process.env.TARO_ENV === "string";
27
28
  const isWeapp = process.env.TARO_ENV === "weapp";
28
29
  const isAlipay = process.env.TARO_ENV === "alipay";
30
+ const isTt = process.env.TARO_ENV === "tt";
29
31
  const isMiniapp = () => {
30
32
  return isMini;
31
33
  };
@@ -34,5 +36,6 @@ const isMiniapp = () => {
34
36
  isAlipay,
35
37
  isMini,
36
38
  isMiniapp,
39
+ isTt,
37
40
  isWeapp
38
41
  });
@@ -1,4 +1,20 @@
1
1
  import { CssVarToValueOptions } from './index.types';
2
+ /**
3
+ * 设置全局默认主题变量
4
+ * 建议在小程序入口文件(app.ts)中调用,设置后所有组件都会使用该主题
5
+ * 支持主题继承:如果设置的主题中某个变量不存在,会自动从 defaultLight 继承
6
+ * @param themeVars 主题CSS变量对象
7
+ * @example
8
+ * import { setDefaultThemeVars } from '@bifrostui/utils';
9
+ * import { pioneerLight } from '@bifrostui/styles/registry';
10
+ * setDefaultThemeVars(pioneerLight.cssVars);
11
+ */
12
+ export declare const setDefaultThemeVars: (themeVars: Record<string, string> | undefined) => void;
13
+ /**
14
+ * 获取当前全局默认主题变量
15
+ * 返回合并后的主题变量(自定义主题 + defaultLight 基础主题)
16
+ */
17
+ export declare const getDefaultThemeVars: () => Record<string, string> | undefined;
2
18
  /**
3
19
  * css变量转值
4
20
  */
@@ -1,7 +1,21 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
4
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
+ };
5
19
  var __export = (target, all) => {
6
20
  for (var name in all)
7
21
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -17,15 +31,27 @@ var __copyProps = (to, from, except, desc) => {
17
31
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
32
  var cssVarToValue_exports = {};
19
33
  __export(cssVarToValue_exports, {
20
- cssVarToValue: () => cssVarToValue
34
+ cssVarToValue: () => cssVarToValue,
35
+ getDefaultThemeVars: () => getDefaultThemeVars,
36
+ setDefaultThemeVars: () => setDefaultThemeVars
21
37
  });
22
38
  module.exports = __toCommonJS(cssVarToValue_exports);
23
39
  var import_registry = require("@bifrostui/styles/registry");
40
+ let globalDefaultThemeVars;
41
+ const setDefaultThemeVars = (themeVars) => {
42
+ globalDefaultThemeVars = themeVars;
43
+ };
44
+ const getDefaultThemeVars = () => {
45
+ var _a, _b;
46
+ if (!globalDefaultThemeVars) {
47
+ return (_a = import_registry.defaultLight) == null ? void 0 : _a.cssVars;
48
+ }
49
+ return __spreadValues(__spreadValues({}, (_b = import_registry.defaultLight) == null ? void 0 : _b.cssVars), globalDefaultThemeVars);
50
+ };
24
51
  const cssVarToValue = (options) => {
25
- var _a;
26
52
  const {
27
53
  cssVar,
28
- themeVars = (_a = import_registry.defaultLight) == null ? void 0 : _a.cssVars,
54
+ themeVars = getDefaultThemeVars(),
29
55
  _visitedKeys = /* @__PURE__ */ new Set()
30
56
  } = options || {};
31
57
  if (!cssVar)
@@ -48,5 +74,7 @@ const cssVarToValue = (options) => {
48
74
  };
49
75
  // Annotate the CommonJS export names for ESM import in node:
50
76
  0 && (module.exports = {
51
- cssVarToValue
77
+ cssVarToValue,
78
+ getDefaultThemeVars,
79
+ setDefaultThemeVars
52
80
  });
@@ -22,26 +22,41 @@ export declare const getDirectionLocationStyle: ({ childrenOffset, arrowDirectio
22
22
  tipOffset: any;
23
23
  arrowLocation: any;
24
24
  offsetSpacing: any;
25
- }) => {
26
- styles: any;
25
+ }) => Promise<{
26
+ styles: {
27
+ top: number;
28
+ left: number;
29
+ transform: string;
30
+ visibility: string;
31
+ };
27
32
  childrenStyle: any;
28
- };
33
+ }>;
29
34
  /**
30
35
  * 获取气泡位置和箭头位置
31
36
  */
32
- export declare const getStylesAndLocation: ({ scrollRoot, childrenRef, arrowDirection, arrowLocation, offsetSpacing, selector, }: {
37
+ export declare const getStylesAndLocation: ({ scrollRoot, childrenRef, tipRef, arrowDirection, arrowLocation, offsetSpacing, }: {
33
38
  scrollRoot?: Element;
34
- childrenRef: any;
35
- arrowDirection: any;
36
- arrowLocation: any;
37
- offsetSpacing: any;
38
- selector: any;
39
- }) => {
40
- styles: any;
39
+ childrenRef?: React.RefObject<any>;
40
+ tipRef?: React.RefObject<any>;
41
+ arrowDirection: string;
42
+ arrowLocation: string;
43
+ offsetSpacing?: number;
44
+ }) => Promise<{
45
+ styles: {};
46
+ childrenStyle: {};
47
+ newArrowDirection: string;
48
+ newArrowLocation: string;
49
+ } | {
50
+ styles: {
51
+ top: number;
52
+ left: number;
53
+ transform: string;
54
+ visibility: string;
55
+ };
41
56
  childrenStyle: any;
42
57
  newArrowDirection: any;
43
58
  newArrowLocation: any;
44
- };
59
+ }>;
45
60
  export declare const triggerEventTransform: ({ trigger, click, show, hide }: {
46
61
  trigger: any;
47
62
  click: any;