@varlet/ui 2.11.0-alpha.1683829480300 → 2.11.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.
@@ -2,7 +2,7 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
2
2
 
3
3
  import { isNumber, isObject, isString, kebabCase, toNumber, isWindow } from '@varlet/shared';
4
4
  import { getGlobalThis } from './shared.mjs';
5
- import { error } from '../utils/logger.mjs';
5
+ import { error } from './logger.mjs';
6
6
  // shorthand only
7
7
  export function getStyle(element) {
8
8
  return window.getComputedStyle(element);
package/es/utils/jest.mjs CHANGED
@@ -5,6 +5,7 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
5
5
  import { nextTick } from 'vue';
6
6
  import { config } from '@vue/test-utils';
7
7
  import { isPlainObject } from '@varlet/shared';
8
+ import { getStyle } from './elements.mjs';
8
9
  export var delay = time => new Promise(resolve => setTimeout(resolve, time));
9
10
  export function getTouch(el, x, y) {
10
11
  return {
@@ -83,37 +84,37 @@ export function mockOffset(_temp) {
83
84
  Object.defineProperties(HTMLElement.prototype, {
84
85
  offsetWidth: {
85
86
  get() {
86
- return offsetWidth != null ? offsetWidth : parseFloat(window.getComputedStyle(this).width) || 0;
87
+ return offsetWidth != null ? offsetWidth : parseFloat(getStyle(this).width) || 0;
87
88
  }
88
89
 
89
90
  },
90
91
  offsetHeight: {
91
92
  get() {
92
- return offsetHeight != null ? offsetHeight : parseFloat(window.getComputedStyle(this).height) || 0;
93
+ return offsetHeight != null ? offsetHeight : parseFloat(getStyle(this).height) || 0;
93
94
  }
94
95
 
95
96
  },
96
97
  clientWidth: {
97
98
  get() {
98
- return clientWidth != null ? clientWidth : parseFloat(window.getComputedStyle(this).width) || 0;
99
+ return clientWidth != null ? clientWidth : parseFloat(getStyle(this).width) || 0;
99
100
  }
100
101
 
101
102
  },
102
103
  clientHeight: {
103
104
  get() {
104
- return clientHeight != null ? clientHeight : parseFloat(window.getComputedStyle(this).height) || 0;
105
+ return clientHeight != null ? clientHeight : parseFloat(getStyle(this).height) || 0;
105
106
  }
106
107
 
107
108
  },
108
109
  offsetLeft: {
109
110
  get() {
110
- return offsetLeft != null ? offsetLeft : parseFloat(window.getComputedStyle(this).marginLeft) || 0;
111
+ return offsetLeft != null ? offsetLeft : parseFloat(getStyle(this).marginLeft) || 0;
111
112
  }
112
113
 
113
114
  },
114
115
  offsetTop: {
115
116
  get() {
116
- return offsetTop != null ? offsetTop : parseFloat(window.getComputedStyle(this).marginTop) || 0;
117
+ return offsetTop != null ? offsetTop : parseFloat(getStyle(this).marginTop) || 0;
117
118
  }
118
119
 
119
120
  },