y-design-ssr 0.2.6 → 0.2.8

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