@varlet/ui 2.4.3-alpha.1671108240429 → 2.4.3-alpha.1671110229484

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/es/space/Space.js CHANGED
@@ -2,11 +2,11 @@ import { createVNode as _createVNode } from "vue";
2
2
  import { defineComponent, Fragment, Comment } from 'vue';
3
3
  import { internalSizeValidator, props } from './props';
4
4
  import { toPxNum } from '../utils/elements';
5
- import { isArray } from '@varlet/shared';
6
-
7
-
5
+ import { inBrowser, isArray } from '@varlet/shared';
8
6
  import { call, createNamespace } from '../utils/components';
9
7
  import { spacePluginOptions } from './context';
8
+
9
+
10
10
  var {
11
11
  n,
12
12
  classes
@@ -19,13 +19,25 @@ export default defineComponent({
19
19
  var {
20
20
  slots
21
21
  } = _ref;
22
- var internalSizes = {};
23
- Object.keys(spacePluginOptions).forEach(key => {
24
- var size = spacePluginOptions[key];
25
- internalSizes[key] = isArray(size) ? size.map(toPxNum) : [toPxNum(size), toPxNum(size)];
26
- });
22
+ var internalSizes = {
23
+ mini: [0, 0],
24
+ small: [0, 0],
25
+ normal: [0, 0],
26
+ large: [0, 0]
27
+ };
28
+
29
+ var computeInternalSizes = () => {
30
+ Object.entries(spacePluginOptions).forEach(_ref2 => {
31
+ var [key, size] = _ref2;
32
+ internalSizes[key] = isArray(size) ? size.map(toPxNum) : [toPxNum(size), toPxNum(size)];
33
+ });
34
+ };
27
35
 
28
36
  var getSize = (size, isInternalSize) => {
37
+ if (!inBrowser()) {
38
+ return [0, 0];
39
+ }
40
+
29
41
  return isInternalSize ? internalSizes[size] : isArray(size) ? size.map(toPxNum) : [toPxNum(size), toPxNum(size)];
30
42
  };
31
43
 
@@ -33,6 +45,10 @@ export default defineComponent({
33
45
  return style === 'start' || style === 'end' ? "flex-" + style : style;
34
46
  };
35
47
 
48
+ if (inBrowser()) {
49
+ computeInternalSizes();
50
+ }
51
+
36
52
  return () => {
37
53
  var _call;
38
54