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

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 (68) 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/render.d.ts +2 -2
  32. package/es/directionLocationUtil.d.ts +27 -12
  33. package/es/directionLocationUtil.js +91 -55
  34. package/es/domUtils/addClass.d.ts +1 -0
  35. package/es/domUtils/addClass.js +23 -0
  36. package/es/domUtils/index.d.ts +3 -0
  37. package/es/domUtils/index.js +9 -0
  38. package/es/domUtils/index.miniapp.d.ts +3 -0
  39. package/es/domUtils/index.miniapp.js +9 -0
  40. package/es/domUtils/rect.d.ts +12 -0
  41. package/es/domUtils/rect.js +22 -0
  42. package/es/domUtils/rect.miniapp.d.ts +2 -0
  43. package/es/domUtils/rect.miniapp.js +54 -0
  44. package/es/domUtils/removeClass.d.ts +1 -0
  45. package/es/domUtils/removeClass.js +24 -0
  46. package/es/getBoundingClientRect/index.d.ts +1 -1
  47. package/es/getBoundingClientRect/index.js +13 -0
  48. package/es/getBoundingClientRect/index.miniapp.d.ts +1 -2
  49. package/es/getBoundingClientRect/index.miniapp.js +34 -5
  50. package/es/getRootContainer/index.d.ts +2 -0
  51. package/es/getRootContainer/index.js +9 -0
  52. package/es/getRootContainer/index.miniapp.d.ts +3 -0
  53. package/es/{getRootElement → getRootContainer}/index.miniapp.js +4 -4
  54. package/es/hooks/index.d.ts +2 -2
  55. package/es/hooks/index.js +10 -1
  56. package/es/hooks/useTouchEmulator.d.ts +7 -1
  57. package/es/hooks/useTouchEmulator.js +29 -10
  58. package/es/index.d.ts +4 -3
  59. package/es/index.js +13 -2
  60. package/es/isMini.d.ts +2 -1
  61. package/es/isMini.js +2 -0
  62. package/es/render.d.ts +2 -2
  63. package/package.json +2 -2
  64. package/dist/getRootElement/index.d.ts +0 -2
  65. package/dist/getRootElement/index.miniapp.d.ts +0 -3
  66. package/es/getRootElement/index.d.ts +0 -2
  67. package/es/getRootElement/index.js +0 -9
  68. package/es/getRootElement/index.miniapp.d.ts +0 -3
package/es/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/es/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { default as default2 } from "./debounce";
2
2
  import {
3
3
  getStylesAndLocation,
4
+ getNewDirectionLocation,
4
5
  triggerEventTransform,
5
6
  parsePlacement
6
7
  } from "./directionLocationUtil";
@@ -10,6 +11,10 @@ import {
10
11
  useEventCallback,
11
12
  useForkRef,
12
13
  useTouchEmulator,
14
+ touchEmulator,
15
+ emulateTouchStart,
16
+ emulateTouchMove,
17
+ emulateTouchEnd,
13
18
  useValue,
14
19
  useDomReady,
15
20
  useSize,
@@ -29,8 +34,9 @@ import {
29
34
  getTransitionProps,
30
35
  createTransitions
31
36
  } from "./transitions";
32
- import { default as default9 } from "./getRootElement";
37
+ import { default as default9 } from "./getRootContainer";
33
38
  import { default as default10 } from "./getBoundingClientRect";
39
+ export * from "./domUtils";
34
40
  export * from "./isType";
35
41
  export * from "./render";
36
42
  export * from "./themeCreator";
@@ -41,8 +47,12 @@ export {
41
47
  default2 as debounce,
42
48
  duration,
43
49
  easing,
50
+ emulateTouchEnd,
51
+ emulateTouchMove,
52
+ emulateTouchStart,
44
53
  default10 as getBoundingClientRect,
45
- default9 as getRootElement,
54
+ getNewDirectionLocation,
55
+ default9 as getRootContainer,
46
56
  getStylesAndLocation,
47
57
  getTransitionProps,
48
58
  isAlipay,
@@ -54,6 +64,7 @@ export {
54
64
  default5 as setRef,
55
65
  default6 as throttle,
56
66
  default7 as toArray,
67
+ touchEmulator,
57
68
  triggerEventTransform,
58
69
  useDidMountEffect,
59
70
  useDomCss,
package/es/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/es/isMini.js CHANGED
@@ -1,6 +1,7 @@
1
1
  const isMini = typeof process.env.TARO_ENV === "string";
2
2
  const isWeapp = process.env.TARO_ENV === "weapp";
3
3
  const isAlipay = process.env.TARO_ENV === "alipay";
4
+ const isTt = process.env.TARO_ENV === "tt";
4
5
  const isMiniapp = () => {
5
6
  return isMini;
6
7
  };
@@ -8,5 +9,6 @@ export {
8
9
  isAlipay,
9
10
  isMini,
10
11
  isMiniapp,
12
+ isTt,
11
13
  isWeapp
12
14
  };
package/es/render.d.ts CHANGED
@@ -8,6 +8,6 @@ type ContainerType = (Element | DocumentFragment) & {
8
8
  export declare function testModernRender(node: ReactElement, container: ContainerType, isTest: boolean): void;
9
9
  export declare function render(node: ReactElement, container: ContainerType): void;
10
10
  /** @private Test usage. Not work in prod */
11
- export declare function testLegacyUnmount(container: ContainerType, isTest: boolean): boolean;
12
- export declare function unmount(container: ContainerType): boolean | Promise<void>;
11
+ export declare function testLegacyUnmount(container: ContainerType, isTest: boolean): any;
12
+ export declare function unmount(container: ContainerType): any;
13
13
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bifrostui/utils",
3
- "version": "2.0.0-alpha.0",
3
+ "version": "2.0.0-alpha.1",
4
4
  "description": "BUI React utilities for building components.",
5
5
  "main": "dist/index.js",
6
6
  "module": "es/index.js",
@@ -17,7 +17,7 @@
17
17
  },
18
18
  "dependencies": {
19
19
  "react-is": "^18.0.0",
20
- "@bifrostui/styles": "2.0.0-alpha.0"
20
+ "@bifrostui/styles": "2.0.0-alpha.1"
21
21
  },
22
22
  "peerDependencies": {
23
23
  "@tarojs/runtime": "^3.0.0",
@@ -1,2 +0,0 @@
1
- declare const getRootElement: (rootEle?: HTMLElement | (() => HTMLElement)) => HTMLElement;
2
- export default getRootElement;
@@ -1,3 +0,0 @@
1
- import type { TaroElement } from '@tarojs/runtime';
2
- declare const getRootElement: (rootEle?: TaroElement | (() => TaroElement)) => HTMLElement | TaroElement;
3
- export default getRootElement;
@@ -1,2 +0,0 @@
1
- declare const getRootElement: (rootEle?: HTMLElement | (() => HTMLElement)) => HTMLElement;
2
- export default getRootElement;
@@ -1,9 +0,0 @@
1
- const getRootElement = (rootEle) => {
2
- const rootElement = typeof rootEle === "function" ? rootEle() : rootEle;
3
- const defaultRootElement = document.body;
4
- return rootElement || defaultRootElement;
5
- };
6
- var getRootElement_default = getRootElement;
7
- export {
8
- getRootElement_default as default
9
- };
@@ -1,3 +0,0 @@
1
- import type { TaroElement } from '@tarojs/runtime';
2
- declare const getRootElement: (rootEle?: TaroElement | (() => TaroElement)) => HTMLElement | TaroElement;
3
- export default getRootElement;