@varlet/ui 2.4.2 → 2.4.3-alpha.1671109780742
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 +20 -8
- package/es/space/context.js +9 -0
- package/es/space/index.js +3 -1
- package/es/varlet.esm.js +3322 -3310
- package/highlight/web-types.json +1 -1
- package/lib/space/Space.js +20 -7
- package/lib/space/context.js +17 -0
- package/lib/space/index.js +4 -1
- package/package.json +5 -5
- package/types/space.d.ts +12 -1
- package/umd/varlet.js +6 -6
package/es/space/Space.js
CHANGED
|
@@ -2,20 +2,15 @@ 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';
|
|
5
|
+
import { inBrowser, isArray } from '@varlet/shared';
|
|
6
|
+
import { call, createNamespace } from '../utils/components';
|
|
7
|
+
import { spacePluginOptions } from './context';
|
|
6
8
|
|
|
7
9
|
|
|
8
|
-
import { call, createNamespace } from '../utils/components';
|
|
9
10
|
var {
|
|
10
11
|
n,
|
|
11
12
|
classes
|
|
12
13
|
} = createNamespace('space');
|
|
13
|
-
var internalSizes = {
|
|
14
|
-
mini: [4, 4],
|
|
15
|
-
small: [6, 6],
|
|
16
|
-
normal: [8, 12],
|
|
17
|
-
large: [12, 20]
|
|
18
|
-
};
|
|
19
14
|
export default defineComponent({
|
|
20
15
|
name: 'VarSpace',
|
|
21
16
|
props,
|
|
@@ -24,6 +19,19 @@ export default defineComponent({
|
|
|
24
19
|
var {
|
|
25
20
|
slots
|
|
26
21
|
} = _ref;
|
|
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) => {
|
|
29
37
|
return isInternalSize ? internalSizes[size] : isArray(size) ? size.map(toPxNum) : [toPxNum(size), toPxNum(size)];
|
|
@@ -33,6 +41,10 @@ export default defineComponent({
|
|
|
33
41
|
return style === 'start' || style === 'end' ? "flex-" + style : style;
|
|
34
42
|
};
|
|
35
43
|
|
|
44
|
+
if (inBrowser()) {
|
|
45
|
+
computeInternalSizes();
|
|
46
|
+
}
|
|
47
|
+
|
|
36
48
|
return () => {
|
|
37
49
|
var _call;
|
|
38
50
|
|
package/es/space/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import Space from './Space';
|
|
2
|
+
import { mergeSpacePluginOptions } from './context';
|
|
2
3
|
|
|
3
|
-
Space.install = function (app) {
|
|
4
|
+
Space.install = function (app, spacePluginOptions) {
|
|
5
|
+
mergeSpacePluginOptions(spacePluginOptions);
|
|
4
6
|
app.component(Space.name, Space);
|
|
5
7
|
};
|
|
6
8
|
|