y-design-ssr 0.2.3 → 0.2.5

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 (120) hide show
  1. package/README.md +21 -16
  2. package/libs/button/index.css +1 -579
  3. package/libs/button/index.mjs +66 -111
  4. package/libs/button/index.umd.js +2 -203
  5. package/libs/button/package.json +1 -7
  6. package/libs/cell/index.css +1 -1077
  7. package/libs/cell/index.mjs +104 -167
  8. package/libs/cell/index.umd.js +2 -300
  9. package/libs/cell/package.json +1 -7
  10. package/libs/checkbox/index.css +1 -1053
  11. package/libs/checkbox/index.mjs +127 -242
  12. package/libs/checkbox/index.umd.js +2 -369
  13. package/libs/checkbox/package.json +1 -7
  14. package/libs/checkboxGroup/index.css +1 -422
  15. package/libs/checkboxGroup/index.mjs +87 -173
  16. package/libs/checkboxGroup/index.umd.js +2 -265
  17. package/libs/checkboxGroup/package.json +1 -7
  18. package/libs/col/index.css +1 -615
  19. package/libs/col/index.mjs +81 -246
  20. package/libs/col/index.umd.js +2 -305
  21. package/libs/col/package.json +1 -7
  22. package/libs/countdown/index.css +1 -417
  23. package/libs/countdown/index.mjs +71 -179
  24. package/libs/countdown/index.umd.js +2 -231
  25. package/libs/countdown/package.json +1 -7
  26. package/libs/dialog/index.css +1 -1405
  27. package/libs/dialog/index.mjs +476 -646
  28. package/libs/dialog/index.umd.js +2 -1128
  29. package/libs/dialog/package.json +1 -7
  30. package/libs/empty/index.css +1 -457
  31. package/libs/empty/index.mjs +44 -91
  32. package/libs/empty/index.umd.js +2 -139
  33. package/libs/empty/package.json +1 -7
  34. package/libs/form/index.css +1 -477
  35. package/libs/form/index.mjs +126 -226
  36. package/libs/form/index.umd.js +2 -319
  37. package/libs/form/package.json +1 -7
  38. package/libs/formItem/index.css +1 -477
  39. package/libs/formItem/index.mjs +126 -276
  40. package/libs/formItem/index.umd.js +2 -372
  41. package/libs/formItem/package.json +1 -7
  42. package/libs/icon/index.css +1 -982
  43. package/libs/icon/index.mjs +58 -107
  44. package/libs/icon/index.umd.js +2 -186
  45. package/libs/icon/package.json +1 -7
  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.mjs +92 -183
  51. package/libs/input/index.umd.js +2 -274
  52. package/libs/input/package.json +1 -7
  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/layout/package.json +1 -7
  57. package/libs/list/index.css +1 -440
  58. package/libs/list/index.mjs +207 -388
  59. package/libs/list/index.umd.js +2 -571
  60. package/libs/list/package.json +1 -7
  61. package/libs/loading/index.css +1 -548
  62. package/libs/loading/index.mjs +118 -196
  63. package/libs/loading/index.umd.js +2 -321
  64. package/libs/loading/package.json +1 -7
  65. package/libs/mask/index.css +1 -426
  66. package/libs/mask/index.mjs +70 -131
  67. package/libs/mask/index.umd.js +2 -201
  68. package/libs/mask/package.json +1 -7
  69. package/libs/popup/index.css +1 -465
  70. package/libs/popup/index.mjs +134 -210
  71. package/libs/popup/index.umd.js +2 -358
  72. package/libs/popup/package.json +1 -7
  73. package/libs/progress/index.css +1 -488
  74. package/libs/progress/index.mjs +128 -200
  75. package/libs/progress/index.umd.js +2 -322
  76. package/libs/progress/package.json +1 -7
  77. package/libs/pullrefresh/index.css +1 -441
  78. package/libs/pullrefresh/index.mjs +111 -241
  79. package/libs/pullrefresh/index.umd.js +2 -302
  80. package/libs/pullrefresh/package.json +1 -7
  81. package/libs/row/index.css +1 -485
  82. package/libs/row/index.mjs +89 -181
  83. package/libs/row/index.umd.js +2 -237
  84. package/libs/row/package.json +1 -7
  85. package/libs/slider/index.css +1 -558
  86. package/libs/slider/index.mjs +160 -356
  87. package/libs/slider/index.umd.js +2 -453
  88. package/libs/slider/package.json +1 -7
  89. package/libs/stepper/index.css +1 -489
  90. package/libs/stepper/index.mjs +101 -181
  91. package/libs/stepper/index.umd.js +2 -269
  92. package/libs/stepper/package.json +1 -7
  93. package/libs/swipe/index.css +1 -506
  94. package/libs/swipe/index.mjs +259 -542
  95. package/libs/swipe/index.umd.js +2 -703
  96. package/libs/swipe/package.json +1 -7
  97. package/libs/swipeItem/index.css +1 -424
  98. package/libs/swipeItem/index.mjs +52 -111
  99. package/libs/swipeItem/index.umd.js +2 -154
  100. package/libs/swipeItem/package.json +1 -7
  101. package/libs/switch/index.css +1 -472
  102. package/libs/switch/index.mjs +62 -121
  103. package/libs/switch/index.umd.js +2 -200
  104. package/libs/switch/package.json +1 -7
  105. package/libs/tab/index.mjs +68 -131
  106. package/libs/tab/index.umd.js +1 -190
  107. package/libs/tab/package.json +1 -7
  108. package/libs/tabs/index.css +1 -514
  109. package/libs/tabs/index.mjs +410 -751
  110. package/libs/tabs/index.umd.js +2 -1020
  111. package/libs/tabs/package.json +1 -7
  112. package/libs/toast/index.css +1 -1050
  113. package/libs/toast/index.mjs +114 -183
  114. package/libs/toast/index.umd.js +2 -306
  115. package/libs/toast/package.json +1 -7
  116. package/libs/tooltip/index.css +1 -514
  117. package/libs/tooltip/index.mjs +155 -293
  118. package/libs/tooltip/index.umd.js +2 -416
  119. package/libs/tooltip/package.json +1 -7
  120. package/package.json +7 -11
@@ -1,40 +1,11 @@
1
- import { ref, reactive, defineComponent, onMounted, onBeforeUpdate, onUnmounted, watch, nextTick, createVNode, Fragment } 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 b, defineComponent as B, onMounted as E, onBeforeUpdate as _, onUnmounted as D, watch as P, nextTick as k, createVNode as d, Fragment as R } from "vue";
2
+ const v = (e, t) => t ? typeof t == "string" ? ` ${e}--${t}` : Array.isArray(t) ? t.reduce((c, n) => c + v(e, n), "") : Object.keys(t).reduce(
3
+ (c, n) => c + (t[n] ? v(e, n) : ""),
4
+ ""
5
+ ) : "", L = (e) => (t, c) => {
6
+ let n = t, f = c;
7
+ return n && typeof n != "string" && (f = n, n = ""), n = n ? `${e}__${n}` : e, `${n}${v(n, f)}`;
8
+ }, T = () => (e, t) => t ? `${v(`y-${e}`, t)}` : `y-${e}`, U = {
38
9
  "pull-refresh": {
39
10
  pulling: "下拉刷新...",
40
11
  loosing: "释放刷新...",
@@ -46,23 +17,15 @@ const defaultLang = {
46
17
  validateMessage: "请输入正确内容"
47
18
  }
48
19
  };
49
- ref("zh-CN");
50
- reactive({
51
- "zh-CN": defaultLang
20
+ h("zh-CN");
21
+ b({
22
+ "zh-CN": U
52
23
  });
53
- const createNamespace = (name2) => {
54
- const prefixedName = `y-${name2}`;
55
- return [prefixedName, createBEM(prefixedName), createGlobalBem()];
56
- };
57
- const parseUnit = (val) => {
58
- if (isNaN(Number(val)) && typeof val === "string") {
59
- return val;
60
- }
61
- return `${val}px`;
62
- };
63
- const [name, bem] = createNamespace("progress");
64
- const Progress = /* @__PURE__ */ defineComponent({
65
- name,
24
+ const q = (e) => {
25
+ const t = `y-${e}`;
26
+ return [t, L(t), T()];
27
+ }, x = (e) => isNaN(Number(e)) && typeof e == "string" ? e : `${e}px`, [j, g] = q("progress"), $ = /* @__PURE__ */ B({
28
+ name: j,
66
29
  props: {
67
30
  // 进度
68
31
  percent: {
@@ -102,12 +65,12 @@ const Progress = /* @__PURE__ */ defineComponent({
102
65
  // 展示默认pivot
103
66
  defaultPivot: {
104
67
  type: Boolean,
105
- default: false
68
+ default: !1
106
69
  },
107
70
  // 里程碑模式
108
71
  modeMilestone: {
109
72
  type: Boolean,
110
- default: false
73
+ default: !1
111
74
  },
112
75
  // 里程碑节点
113
76
  mileages: {
@@ -117,7 +80,7 @@ const Progress = /* @__PURE__ */ defineComponent({
117
80
  // 动画
118
81
  animation: {
119
82
  type: Boolean,
120
- default: false
83
+ default: !1
121
84
  },
122
85
  // 动画时长
123
86
  duration: {
@@ -135,182 +98,147 @@ const Progress = /* @__PURE__ */ defineComponent({
135
98
  default: "%"
136
99
  }
137
100
  },
138
- setup(props, {
139
- slots
101
+ setup(e, {
102
+ slots: t
140
103
  }) {
141
- const progressRef = ref(null);
142
- const pivotContentRef = ref(null);
143
- const mileageRef = ref([]);
144
- const widthData = reactive({
104
+ const c = h(null), n = h(null), f = h([]), m = b({
145
105
  progressWidth: 0,
146
106
  pivotContentWidth: 0,
147
107
  mileageWidth: []
148
- });
149
- const growData = reactive({
108
+ }), i = b({
150
109
  number: 0,
151
110
  oldPercent: 0,
152
111
  timer: 0
153
112
  });
154
- onMounted(() => {
155
- resize();
156
- props.animation && grow();
157
- window.addEventListener("resize", resize);
158
- });
159
- onBeforeUpdate(() => {
160
- mileageRef.value = [];
161
- });
162
- onUnmounted(() => {
163
- growData.timer && cancelAnimationFrame(growData.timer);
164
- window.removeEventListener("resize", resize);
165
- });
166
- watch(() => props.percent, () => {
167
- grow();
168
- resizeWidth();
113
+ E(() => {
114
+ y(), e.animation && W(), window.addEventListener("resize", y);
115
+ }), _(() => {
116
+ f.value = [];
117
+ }), D(() => {
118
+ i.timer && cancelAnimationFrame(i.timer), window.removeEventListener("resize", y);
119
+ }), P(() => e.percent, () => {
120
+ W(), w();
169
121
  });
170
- const grow = () => {
122
+ const W = () => {
171
123
  const {
172
- duration,
173
- percent
174
- } = props;
175
- const step = Math.abs(percent - growData.oldPercent) / (duration / 16);
176
- if (step === 0)
124
+ duration: o,
125
+ percent: r
126
+ } = e, u = Math.abs(r - i.oldPercent) / (o / 16);
127
+ if (u === 0)
177
128
  return;
178
- let current = Number(growData.oldPercent);
179
- const update = () => {
180
- percent > growData.oldPercent ? current += step : current -= step;
181
- if (percent > growData.oldPercent && current > percent || percent < growData.oldPercent && current < percent) {
182
- current = percent;
183
- } else {
184
- growData.timer = requestAnimationFrame(update);
185
- }
186
- growData.oldPercent = current;
187
- growData.number = parseInt(current.toString());
129
+ let a = Number(i.oldPercent);
130
+ const l = () => {
131
+ r > i.oldPercent ? a += u : a -= u, r > i.oldPercent && a > r || r < i.oldPercent && a < r ? a = r : i.timer = requestAnimationFrame(l), i.oldPercent = a, i.number = parseInt(a.toString());
188
132
  };
189
- growData.timer && cancelAnimationFrame(growData.timer);
190
- growData.timer = requestAnimationFrame(update);
191
- };
192
- watch(() => props.mileages, () => resizeMileage);
193
- const resize = () => {
194
- resizeWidth();
195
- resizeMileage();
133
+ i.timer && cancelAnimationFrame(i.timer), i.timer = requestAnimationFrame(l);
196
134
  };
197
- const resizeWidth = () => {
198
- nextTick(() => {
199
- widthData.progressWidth = progressRef.value && progressRef.value.offsetWidth || 0;
200
- widthData.pivotContentWidth = pivotContentRef.value && pivotContentRef.value.offsetWidth || 0;
201
- }).catch((e) => {
202
- throw new Error(e);
135
+ P(() => e.mileages, () => C);
136
+ const y = () => {
137
+ w(), C();
138
+ }, w = () => {
139
+ k(() => {
140
+ m.progressWidth = c.value && c.value.offsetWidth || 0, m.pivotContentWidth = n.value && n.value.offsetWidth || 0;
141
+ }).catch((o) => {
142
+ throw new Error(o);
203
143
  });
204
- };
205
- const resizeMileage = () => {
206
- nextTick(() => {
207
- props.mileages.forEach((_, i) => {
208
- widthData.mileageWidth[i] = mileageRef.value[i] && mileageRef.value[i].offsetWidth || 0;
144
+ }, C = () => {
145
+ k(() => {
146
+ e.mileages.forEach((o, r) => {
147
+ m.mileageWidth[r] = f.value[r] && f.value[r].offsetWidth || 0;
209
148
  });
210
- }).catch((e) => {
211
- throw new Error(e);
149
+ }).catch((o) => {
150
+ throw new Error(o);
212
151
  });
213
- };
214
- const renderMileage = () => {
215
- var _a;
152
+ }, M = () => {
153
+ var l;
216
154
  const {
217
- mileages,
218
- percent,
219
- animation: animation2
220
- } = props;
221
- const doms = [];
222
- for (let i = 0; i < mileages.length; i++) {
223
- doms[i] = createVNode("div", {
224
- "ref": (el) => {
225
- if (el)
226
- mileageRef.value[i] = el;
155
+ mileages: o,
156
+ percent: r,
157
+ animation: u
158
+ } = e, a = [];
159
+ for (let s = 0; s < o.length; s++)
160
+ a[s] = d("div", {
161
+ ref: (p) => {
162
+ p && (f.value[s] = p);
227
163
  },
228
- "class": [bem("pivot-content", (animation2 ? growData.number : percent) >= mileages[i] ? "arrive" : "no-arrive")],
229
- "key": `mileage${i}`,
230
- "style": {
231
- left: `${(widthData.progressWidth - widthData.mileageWidth[i]) * mileages[i] / 100}px`
164
+ class: [g("pivot-content", (u ? i.number : r) >= o[s] ? "arrive" : "no-arrive")],
165
+ key: `mileage${s}`,
166
+ style: {
167
+ left: `${(m.progressWidth - m.mileageWidth[s]) * o[s] / 100}px`
232
168
  }
233
- }, [((_a = slots.mileage) == null ? void 0 : _a.call(slots)) || createVNode("div", {
234
- "class": bem("pivot")
235
- }, [`${mileages[i]}%`])]);
236
- }
237
- return doms;
238
- };
239
- const renderPivot = () => {
240
- var _a;
169
+ }, [((l = t.mileage) == null ? void 0 : l.call(t)) || d("div", {
170
+ class: g("pivot")
171
+ }, [`${o[s]}%`])]);
172
+ return a;
173
+ }, S = () => {
174
+ var s;
241
175
  const {
242
- defaultPivot,
243
- textColor,
244
- percent,
245
- animation: animation2,
246
- unit
247
- } = props;
248
- return createVNode(Fragment, null, [((_a = slots.pivot) == null ? void 0 : _a.call(slots)) || defaultPivot && createVNode("div", {
249
- "class": bem("pivot"),
250
- "style": {
251
- color: textColor
176
+ defaultPivot: o,
177
+ textColor: r,
178
+ percent: u,
179
+ animation: a,
180
+ unit: l
181
+ } = e;
182
+ return d(R, null, [((s = t.pivot) == null ? void 0 : s.call(t)) || o && d("div", {
183
+ class: g("pivot"),
184
+ style: {
185
+ color: r
252
186
  }
253
- }, [animation2 ? createVNode("div", {
254
- "class": bem("number")
255
- }, [createVNode("span", null, [growData.number, unit])]) : `${percent}${unit}`])]);
187
+ }, [a ? d("div", {
188
+ class: g("number")
189
+ }, [d("span", null, [i.number, l])]) : `${u}${l}`])]);
256
190
  };
257
191
  return () => {
258
192
  const {
259
- strokeWidth,
260
- trackColor,
261
- radius,
262
- percent,
263
- color,
264
- animation: animation2,
265
- duration,
266
- timing,
267
- defaultPivot,
268
- pivotColor,
269
- modeMilestone
270
- } = props;
271
- return createVNode("div", {
272
- "class": bem(),
273
- "ref": progressRef,
274
- "style": {
275
- height: parseUnit(strokeWidth),
276
- background: trackColor,
277
- borderRadius: parseUnit(radius)
193
+ strokeWidth: o,
194
+ trackColor: r,
195
+ radius: u,
196
+ percent: a,
197
+ color: l,
198
+ animation: s,
199
+ duration: p,
200
+ timing: N,
201
+ defaultPivot: z,
202
+ pivotColor: A,
203
+ modeMilestone: F
204
+ } = e;
205
+ return d("div", {
206
+ class: g(),
207
+ ref: c,
208
+ style: {
209
+ height: x(o),
210
+ background: r,
211
+ borderRadius: x(u)
278
212
  }
279
- }, [createVNode("span", {
280
- "class": bem("portion", {
281
- animation: animation2
213
+ }, [d("span", {
214
+ class: g("portion", {
215
+ animation: s
282
216
  }),
283
- "style": {
284
- width: `${widthData.progressWidth * percent / 100}px`,
285
- background: color,
286
- transitionDuration: `${duration}ms`,
287
- transitionTimingFunction: timing
217
+ style: {
218
+ width: `${m.progressWidth * a / 100}px`,
219
+ background: l,
220
+ transitionDuration: `${p}ms`,
221
+ transitionTimingFunction: N
288
222
  }
289
- }, [createVNode("div", {
290
- "ref": pivotContentRef,
291
- "class": bem("pivot-content", {
292
- animation: animation2
223
+ }, [d("div", {
224
+ ref: n,
225
+ class: g("pivot-content", {
226
+ animation: s
293
227
  }),
294
- "style": {
295
- left: `${(widthData.progressWidth - widthData.pivotContentWidth) * percent / 100}px`,
296
- background: defaultPivot ? pivotColor || color : "none",
297
- transitionDuration: `${duration}ms`,
298
- transitionTimingFunction: timing
228
+ style: {
229
+ left: `${(m.progressWidth - m.pivotContentWidth) * a / 100}px`,
230
+ background: z ? A || l : "none",
231
+ transitionDuration: `${p}ms`,
232
+ transitionTimingFunction: N
299
233
  }
300
- }, [renderPivot()])]), modeMilestone && renderMileage()]);
234
+ }, [S()])]), F && M()]);
301
235
  };
302
236
  }
303
237
  });
304
- const reset = "";
305
- const libs = "";
306
- const font = "";
307
- const animation = "";
308
- const theme = "";
309
- const style = "";
310
- Progress.install = (Vue) => {
311
- const { name: name2 } = Progress;
312
- Vue.component(name2, Progress);
238
+ $.install = (e) => {
239
+ const { name: t } = $;
240
+ e.component(t, $);
313
241
  };
314
242
  export {
315
- Progress as default
243
+ $ as default
316
244
  };