y-design-ssr 0.2.3 → 0.2.4

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 (119) hide show
  1. package/libs/button/index.css +1 -579
  2. package/libs/button/index.mjs +66 -111
  3. package/libs/button/index.umd.js +2 -203
  4. package/libs/button/package.json +1 -8
  5. package/libs/cell/index.css +1 -1077
  6. package/libs/cell/index.mjs +104 -167
  7. package/libs/cell/index.umd.js +2 -300
  8. package/libs/cell/package.json +1 -8
  9. package/libs/checkbox/index.css +1 -1053
  10. package/libs/checkbox/index.mjs +127 -242
  11. package/libs/checkbox/index.umd.js +2 -369
  12. package/libs/checkbox/package.json +1 -8
  13. package/libs/checkboxGroup/index.css +1 -422
  14. package/libs/checkboxGroup/index.mjs +87 -173
  15. package/libs/checkboxGroup/index.umd.js +2 -265
  16. package/libs/checkboxGroup/package.json +1 -8
  17. package/libs/col/index.css +1 -615
  18. package/libs/col/index.mjs +81 -246
  19. package/libs/col/index.umd.js +2 -305
  20. package/libs/col/package.json +1 -8
  21. package/libs/countdown/index.css +1 -417
  22. package/libs/countdown/index.mjs +71 -179
  23. package/libs/countdown/index.umd.js +2 -231
  24. package/libs/countdown/package.json +1 -8
  25. package/libs/dialog/index.css +1 -1405
  26. package/libs/dialog/index.mjs +476 -646
  27. package/libs/dialog/index.umd.js +2 -1128
  28. package/libs/dialog/package.json +1 -8
  29. package/libs/empty/index.css +1 -457
  30. package/libs/empty/index.mjs +44 -91
  31. package/libs/empty/index.umd.js +2 -139
  32. package/libs/empty/package.json +1 -8
  33. package/libs/form/index.css +1 -477
  34. package/libs/form/index.mjs +126 -226
  35. package/libs/form/index.umd.js +2 -319
  36. package/libs/form/package.json +1 -8
  37. package/libs/formItem/index.css +1 -477
  38. package/libs/formItem/index.mjs +126 -276
  39. package/libs/formItem/index.umd.js +2 -372
  40. package/libs/formItem/package.json +1 -8
  41. package/libs/icon/index.css +1 -982
  42. package/libs/icon/index.mjs +58 -107
  43. package/libs/icon/index.umd.js +2 -186
  44. package/libs/icon/package.json +1 -8
  45. package/libs/index.css +1 -2902
  46. package/libs/index.mjs +2348 -3789
  47. package/libs/index.umd.js +2 -5509
  48. package/libs/input/index.css +1 -483
  49. package/libs/input/index.mjs +92 -183
  50. package/libs/input/index.umd.js +2 -274
  51. package/libs/input/package.json +1 -8
  52. package/libs/layout/index.css +1 -684
  53. package/libs/layout/index.mjs +130 -230
  54. package/libs/layout/index.umd.js +2 -318
  55. package/libs/layout/package.json +1 -8
  56. package/libs/list/index.css +1 -440
  57. package/libs/list/index.mjs +207 -388
  58. package/libs/list/index.umd.js +2 -571
  59. package/libs/list/package.json +1 -8
  60. package/libs/loading/index.css +1 -548
  61. package/libs/loading/index.mjs +118 -196
  62. package/libs/loading/index.umd.js +2 -321
  63. package/libs/loading/package.json +1 -8
  64. package/libs/mask/index.css +1 -426
  65. package/libs/mask/index.mjs +70 -131
  66. package/libs/mask/index.umd.js +2 -201
  67. package/libs/mask/package.json +1 -8
  68. package/libs/popup/index.css +1 -465
  69. package/libs/popup/index.mjs +134 -210
  70. package/libs/popup/index.umd.js +2 -358
  71. package/libs/popup/package.json +1 -8
  72. package/libs/progress/index.css +1 -488
  73. package/libs/progress/index.mjs +128 -200
  74. package/libs/progress/index.umd.js +2 -322
  75. package/libs/progress/package.json +1 -8
  76. package/libs/pullrefresh/index.css +1 -441
  77. package/libs/pullrefresh/index.mjs +111 -241
  78. package/libs/pullrefresh/index.umd.js +2 -302
  79. package/libs/pullrefresh/package.json +1 -8
  80. package/libs/row/index.css +1 -485
  81. package/libs/row/index.mjs +89 -181
  82. package/libs/row/index.umd.js +2 -237
  83. package/libs/row/package.json +1 -8
  84. package/libs/slider/index.css +1 -558
  85. package/libs/slider/index.mjs +160 -356
  86. package/libs/slider/index.umd.js +2 -453
  87. package/libs/slider/package.json +1 -8
  88. package/libs/stepper/index.css +1 -489
  89. package/libs/stepper/index.mjs +101 -181
  90. package/libs/stepper/index.umd.js +2 -269
  91. package/libs/stepper/package.json +1 -8
  92. package/libs/swipe/index.css +1 -506
  93. package/libs/swipe/index.mjs +259 -542
  94. package/libs/swipe/index.umd.js +2 -703
  95. package/libs/swipe/package.json +1 -8
  96. package/libs/swipeItem/index.css +1 -424
  97. package/libs/swipeItem/index.mjs +52 -111
  98. package/libs/swipeItem/index.umd.js +2 -154
  99. package/libs/swipeItem/package.json +1 -8
  100. package/libs/switch/index.css +1 -472
  101. package/libs/switch/index.mjs +62 -121
  102. package/libs/switch/index.umd.js +2 -200
  103. package/libs/switch/package.json +1 -8
  104. package/libs/tab/index.mjs +68 -131
  105. package/libs/tab/index.umd.js +1 -190
  106. package/libs/tab/package.json +1 -8
  107. package/libs/tabs/index.css +1 -514
  108. package/libs/tabs/index.mjs +410 -751
  109. package/libs/tabs/index.umd.js +2 -1020
  110. package/libs/tabs/package.json +1 -8
  111. package/libs/toast/index.css +1 -1050
  112. package/libs/toast/index.mjs +114 -183
  113. package/libs/toast/index.umd.js +2 -306
  114. package/libs/toast/package.json +1 -8
  115. package/libs/tooltip/index.css +1 -514
  116. package/libs/tooltip/index.mjs +155 -293
  117. package/libs/tooltip/index.umd.js +2 -416
  118. package/libs/tooltip/package.json +1 -8
  119. package/package.json +5 -12
@@ -1,40 +1,11 @@
1
- import { ref, reactive, getCurrentInstance, provide, isVNode, inject, onUnmounted, computed, defineComponent, createVNode } from "vue";
2
- const getMods = (el, mods) => {
3
- if (!mods) {
4
- return "";
5
- }
6
- if (typeof mods === "string") {
7
- return ` ${el}--${mods}`;
8
- }
9
- if (Array.isArray(mods)) {
10
- return mods.reduce((acc, cur) => acc + getMods(el, cur), "");
11
- }
12
- return Object.keys(mods).reduce(
13
- (acc, cur) => acc + (mods[cur] ? getMods(el, cur) : ""),
14
- ""
15
- );
16
- };
17
- const createBEM = (block) => {
18
- return (el, mods) => {
19
- let _el = el;
20
- let _mods = mods;
21
- if (_el && typeof _el !== "string") {
22
- _mods = _el;
23
- _el = "";
24
- }
25
- _el = _el ? `${block}__${_el}` : block;
26
- return `${_el}${getMods(_el, _mods)}`;
27
- };
28
- };
29
- const createGlobalBem = () => {
30
- return (el, mods) => {
31
- if (!mods) {
32
- return `y-${el}`;
33
- }
34
- return `${getMods(`y-${el}`, mods)}`;
35
- };
36
- };
37
- const defaultLang = {
1
+ import { ref as h, reactive as m, getCurrentInstance as v, provide as _, isVNode as j, inject as A, onUnmounted as L, computed as l, defineComponent as y, createVNode as $ } from "vue";
2
+ const p = (e, t) => t ? typeof t == "string" ? ` ${e}--${t}` : Array.isArray(t) ? t.reduce((n, r) => n + p(e, r), "") : Object.keys(t).reduce(
3
+ (n, r) => n + (t[r] ? p(e, r) : ""),
4
+ ""
5
+ ) : "", P = (e) => (t, n) => {
6
+ let r = t, i = n;
7
+ return r && typeof r != "string" && (i = r, r = ""), r = r ? `${e}__${r}` : e, `${r}${p(r, i)}`;
8
+ }, T = () => (e, t) => t ? `${p(`y-${e}`, t)}` : `y-${e}`, B = {
38
9
  "pull-refresh": {
39
10
  pulling: "下拉刷新...",
40
11
  loosing: "释放刷新...",
@@ -46,190 +17,63 @@ const defaultLang = {
46
17
  validateMessage: "请输入正确内容"
47
18
  }
48
19
  };
49
- ref("zh-CN");
50
- reactive({
51
- "zh-CN": defaultLang
20
+ h("zh-CN");
21
+ m({
22
+ "zh-CN": B
52
23
  });
53
- const createNamespace = (name2) => {
54
- const prefixedName = `y-${name2}`;
55
- return [prefixedName, createBEM(prefixedName), createGlobalBem()];
24
+ const C = (e) => {
25
+ const t = `y-${e}`;
26
+ return [t, P(t), T()];
56
27
  };
57
- var Vertical = /* @__PURE__ */ ((Vertical2) => {
58
- Vertical2["Top"] = "top";
59
- Vertical2["Middle"] = "middle";
60
- Vertical2["Bottom"] = "bottom";
61
- return Vertical2;
62
- })(Vertical || {});
63
- const filterChildren = (children) => {
64
- const vnodes = [];
65
- const _filterChildren = (childrens) => {
66
- if (Array.isArray(childrens)) {
67
- childrens.forEach((child) => {
68
- var _a;
69
- if (isVNode(child)) {
70
- vnodes.push(child);
71
- if ((_a = child.component) == null ? void 0 : _a.subTree) {
72
- _filterChildren(child.component.subTree.children);
73
- }
74
- if (child.children) {
75
- _filterChildren(child.children);
76
- }
77
- }
78
- });
79
- }
80
- };
81
- _filterChildren(children);
82
- return vnodes;
83
- };
84
- const sortChildren = (childrens, instance) => {
85
- const vnodes = filterChildren(instance.subTree.children);
86
- childrens.sort((a, b) => vnodes.indexOf(a.vnode) - vnodes.indexOf(b.vnode));
87
- };
88
- const setRelation = (key) => {
89
- const instance = getCurrentInstance();
90
- const childrens = reactive([]);
91
- const initProvide = (value) => {
92
- const addChild = (child) => {
93
- if (child.proxy) {
94
- childrens.push(child);
95
- instance && sortChildren(childrens, instance);
96
- }
97
- };
98
- const removeChild = (child) => {
99
- const index = childrens.indexOf(child);
100
- childrens.splice(index, 1);
101
- };
102
- provide(key, {
103
- addChild,
104
- removeChild,
105
- childrens,
106
- ...value
28
+ var b = /* @__PURE__ */ ((e) => (e.Top = "top", e.Middle = "middle", e.Bottom = "bottom", e))(b || {});
29
+ const M = (e) => {
30
+ const t = [], n = (r) => {
31
+ Array.isArray(r) && r.forEach((i) => {
32
+ var c;
33
+ j(i) && (t.push(i), (c = i.component) != null && c.subTree && n(i.component.subTree.children), i.children && n(i.children));
107
34
  });
108
35
  };
36
+ return n(e), t;
37
+ }, I = (e, t) => {
38
+ const n = M(t.subTree.children);
39
+ e.sort((r, i) => n.indexOf(r.vnode) - n.indexOf(i.vnode));
40
+ }, z = (e) => {
41
+ const t = v(), n = m([]);
109
42
  return {
110
- childrens,
111
- initProvide
43
+ childrens: n,
44
+ initProvide: (i) => {
45
+ _(e, {
46
+ addChild: (s) => {
47
+ s.proxy && (n.push(s), t && I(n, t));
48
+ },
49
+ removeChild: (s) => {
50
+ const a = n.indexOf(s);
51
+ n.splice(a, 1);
52
+ },
53
+ childrens: n,
54
+ ...i
55
+ });
56
+ }
112
57
  };
113
- };
114
- const useRelation = (key) => {
115
- const parent = inject(key, null);
116
- const currentInstance = getCurrentInstance();
117
- if (parent && currentInstance) {
118
- const { childrens, addChild, removeChild } = parent;
119
- addChild(currentInstance);
120
- onUnmounted(() => removeChild(currentInstance));
121
- const index = computed(() => childrens.indexOf(currentInstance));
122
- return {
123
- index,
124
- parent
58
+ }, D = (e) => {
59
+ const t = A(e, null), n = v();
60
+ if (t && n) {
61
+ const { childrens: r, addChild: i, removeChild: c } = t;
62
+ return i(n), L(() => c(n)), {
63
+ index: l(() => r.indexOf(n)),
64
+ parent: t
125
65
  };
126
66
  }
127
67
  return {
128
68
  parent: null,
129
- index: ref(-1)
69
+ index: h(-1)
130
70
  };
131
71
  };
132
- var RowJustify = /* @__PURE__ */ ((RowJustify2) => {
133
- RowJustify2["Start"] = "start";
134
- RowJustify2["Center"] = "center";
135
- RowJustify2["End"] = "end";
136
- RowJustify2["SpaceBetween"] = "space-between";
137
- RowJustify2["SpaceAround"] = "space-around";
138
- return RowJustify2;
139
- })(RowJustify || {});
140
- const [name$1, bem$1] = createNamespace("row");
141
- const ROW_PROVIDE = name$1;
142
- /* @__PURE__ */ defineComponent({
143
- name: name$1,
144
- props: {
145
- type: {
146
- type: String,
147
- default: ""
148
- },
149
- // 列元素之间的间距(单位为 px)
150
- gutter: {
151
- type: [Number, String],
152
- default: 0
153
- },
154
- align: {
155
- type: String,
156
- default: Vertical.Top
157
- },
158
- justify: {
159
- type: String,
160
- default: RowJustify.Start
161
- }
162
- },
163
- setup(props, {
164
- slots
165
- }) {
166
- const {
167
- childrens,
168
- initProvide
169
- } = setRelation(ROW_PROVIDE);
170
- const groupList = computed(() => {
171
- const groups = [[]];
172
- let totalSpan = 0;
173
- childrens.forEach((child, index) => {
174
- var _a;
175
- totalSpan += Number((_a = child.proxy) == null ? void 0 : _a.span);
176
- if (totalSpan > 24) {
177
- groups.push([index]);
178
- totalSpan -= 24;
179
- } else {
180
- groups[groups.length - 1].push(index);
181
- }
182
- });
183
- return groups;
184
- });
185
- const spaceList = computed(() => {
186
- const gutter = Number(props.gutter);
187
- const spaces = [];
188
- if (!gutter)
189
- return spaces;
190
- groupList.value.forEach((group) => {
191
- const averagePadding = gutter * (group.length - 1) / group.length;
192
- group.forEach((item, index) => {
193
- if (index === 0) {
194
- spaces.push({
195
- right: averagePadding,
196
- left: 0
197
- });
198
- } else {
199
- const left = gutter - spaces[item - 1].right;
200
- const right = averagePadding - left;
201
- spaces.push({
202
- left,
203
- right
204
- });
205
- }
206
- });
207
- });
208
- return spaces;
209
- });
210
- initProvide({
211
- spaceList
212
- });
213
- return () => {
214
- var _a;
215
- const {
216
- type,
217
- align,
218
- justify
219
- } = props;
220
- return createVNode("div", {
221
- "class": bem$1({
222
- [type]: type,
223
- [`align-${align}`]: type && align,
224
- [`justify-${justify}`]: type && justify
225
- })
226
- }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
227
- };
228
- }
229
- });
230
- const [name, bem] = createNamespace("col");
231
- const Col = /* @__PURE__ */ defineComponent({
232
- name,
72
+ var x = /* @__PURE__ */ ((e) => (e.Start = "start", e.Center = "center", e.End = "end", e.SpaceBetween = "space-between", e.SpaceAround = "space-around", e))(x || {});
73
+ const [N, G] = C("row"), S = N;
74
+ b.Top, x.Start;
75
+ const [R, U] = C("col"), f = /* @__PURE__ */ y({
76
+ name: R,
233
77
  props: {
234
78
  // 列数
235
79
  span: {
@@ -242,58 +86,49 @@ const Col = /* @__PURE__ */ defineComponent({
242
86
  default: 0
243
87
  }
244
88
  },
245
- setup(props, {
246
- slots
89
+ setup(e, {
90
+ slots: t
247
91
  }) {
248
92
  const {
249
- parent,
250
- index
251
- } = useRelation(ROW_PROVIDE);
252
- const style2 = computed(() => {
253
- if (!parent) {
93
+ parent: n,
94
+ index: r
95
+ } = D(S), i = l(() => {
96
+ if (!n)
254
97
  return {};
255
- }
256
98
  const {
257
- spaceList
258
- } = parent;
259
- const spaces = spaceList.value;
260
- if (spaces.length === 0)
99
+ spaceList: c
100
+ } = n, o = c.value;
101
+ if (o.length === 0)
261
102
  return {};
262
103
  const {
263
- left,
264
- right
265
- } = spaces[index.value] || {};
104
+ left: s,
105
+ right: a
106
+ } = o[r.value] || {};
266
107
  return {
267
- paddingLeft: left ? `${left}px` : 0,
268
- paddingRight: right ? `${right}px` : 0
108
+ paddingLeft: s ? `${s}px` : 0,
109
+ paddingRight: a ? `${a}px` : 0
269
110
  };
270
111
  });
271
112
  return () => {
272
- var _a;
113
+ var s;
273
114
  const {
274
- span,
275
- offset
276
- } = props;
277
- return createVNode("div", {
278
- "style": style2.value,
279
- "class": bem({
280
- [span]: span,
281
- [`offset-${offset}`]: offset
115
+ span: c,
116
+ offset: o
117
+ } = e;
118
+ return $("div", {
119
+ style: i.value,
120
+ class: U({
121
+ [c]: c,
122
+ [`offset-${o}`]: o
282
123
  })
283
- }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
124
+ }, [(s = t.default) == null ? void 0 : s.call(t)]);
284
125
  };
285
126
  }
286
127
  });
287
- const reset = "";
288
- const libs = "";
289
- const font = "";
290
- const animation = "";
291
- const theme = "";
292
- const style = "";
293
- Col.install = (app) => {
294
- const { name: name2 } = Col;
295
- app.component(name2, Col);
128
+ f.install = (e) => {
129
+ const { name: t } = f;
130
+ e.component(t, f);
296
131
  };
297
132
  export {
298
- Col as default
133
+ f as default
299
134
  };