y-design-ssr 0.2.6 → 0.2.7

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 (101) hide show
  1. package/README.md +1 -1
  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/cell/index.css +1 -1077
  6. package/libs/cell/index.mjs +105 -168
  7. package/libs/cell/index.umd.js +2 -301
  8. package/libs/checkbox/index.css +1 -1053
  9. package/libs/checkbox/index.mjs +128 -243
  10. package/libs/checkbox/index.umd.js +2 -370
  11. package/libs/checkboxGroup/index.css +1 -422
  12. package/libs/checkboxGroup/index.mjs +88 -174
  13. package/libs/checkboxGroup/index.umd.js +2 -266
  14. package/libs/col/index.css +1 -615
  15. package/libs/col/index.mjs +82 -247
  16. package/libs/col/index.umd.js +2 -306
  17. package/libs/countdown/index.css +1 -417
  18. package/libs/countdown/index.mjs +72 -180
  19. package/libs/countdown/index.umd.js +2 -232
  20. package/libs/dialog/index.css +1 -1405
  21. package/libs/dialog/index.mjs +477 -647
  22. package/libs/dialog/index.umd.js +2 -1129
  23. package/libs/empty/index.css +1 -457
  24. package/libs/empty/index.mjs +45 -92
  25. package/libs/empty/index.umd.js +2 -140
  26. package/libs/form/index.css +1 -477
  27. package/libs/form/index.mjs +127 -227
  28. package/libs/form/index.umd.js +2 -320
  29. package/libs/formItem/index.css +1 -477
  30. package/libs/formItem/index.mjs +127 -277
  31. package/libs/formItem/index.umd.js +2 -373
  32. package/libs/icon/index.css +1 -982
  33. package/libs/icon/index.mjs +59 -108
  34. package/libs/icon/index.umd.js +2 -187
  35. package/libs/index.css +1 -2902
  36. package/libs/index.mjs +2348 -3789
  37. package/libs/index.umd.js +2 -5509
  38. package/libs/input/index.css +1 -483
  39. package/libs/input/index.mjs +93 -184
  40. package/libs/input/index.umd.js +2 -275
  41. package/libs/layout/index.css +1 -684
  42. package/libs/layout/index.mjs +130 -230
  43. package/libs/layout/index.umd.js +2 -318
  44. package/libs/list/index.css +1 -440
  45. package/libs/list/index.mjs +208 -389
  46. package/libs/list/index.umd.js +2 -572
  47. package/libs/loading/index.css +1 -548
  48. package/libs/loading/index.mjs +119 -197
  49. package/libs/loading/index.umd.js +2 -322
  50. package/libs/locale/index.mjs +28 -0
  51. package/libs/locale/index.umd.js +1 -0
  52. package/libs/locale/package.json +6 -0
  53. package/libs/mask/index.css +1 -426
  54. package/libs/mask/index.mjs +71 -132
  55. package/libs/mask/index.umd.js +2 -202
  56. package/libs/popup/index.css +1 -465
  57. package/libs/popup/index.mjs +135 -211
  58. package/libs/popup/index.umd.js +2 -359
  59. package/libs/progress/index.css +1 -488
  60. package/libs/progress/index.mjs +129 -201
  61. package/libs/progress/index.umd.js +2 -323
  62. package/libs/pullrefresh/index.css +1 -441
  63. package/libs/pullrefresh/index.mjs +112 -242
  64. package/libs/pullrefresh/index.umd.js +2 -303
  65. package/libs/row/index.css +1 -485
  66. package/libs/row/index.mjs +90 -182
  67. package/libs/row/index.umd.js +2 -238
  68. package/libs/slider/index.css +1 -558
  69. package/libs/slider/index.mjs +161 -357
  70. package/libs/slider/index.umd.js +2 -454
  71. package/libs/stepper/index.css +1 -489
  72. package/libs/stepper/index.mjs +102 -182
  73. package/libs/stepper/index.umd.js +2 -270
  74. package/libs/style/index.css +1 -0
  75. package/libs/style/index.mjs +1 -0
  76. package/libs/style/index.umd.js +2 -0
  77. package/libs/style/package.json +6 -0
  78. package/libs/swipe/index.css +1 -506
  79. package/libs/swipe/index.mjs +260 -543
  80. package/libs/swipe/index.umd.js +2 -704
  81. package/libs/swipeItem/index.css +1 -424
  82. package/libs/swipeItem/index.mjs +53 -112
  83. package/libs/swipeItem/index.umd.js +2 -155
  84. package/libs/switch/index.css +1 -472
  85. package/libs/switch/index.mjs +63 -122
  86. package/libs/switch/index.umd.js +2 -201
  87. package/libs/tab/index.mjs +69 -132
  88. package/libs/tab/index.umd.js +1 -191
  89. package/libs/tabs/index.css +1 -514
  90. package/libs/tabs/index.mjs +411 -752
  91. package/libs/tabs/index.umd.js +2 -1021
  92. package/libs/toast/index.css +1 -1050
  93. package/libs/toast/index.mjs +115 -184
  94. package/libs/toast/index.umd.js +2 -307
  95. package/libs/tooltip/index.css +1 -514
  96. package/libs/tooltip/index.mjs +156 -294
  97. package/libs/tooltip/index.umd.js +2 -417
  98. package/libs/utils/index.mjs +76 -0
  99. package/libs/utils/index.umd.js +1 -0
  100. package/libs/utils/package.json +6 -0
  101. package/package.json +1 -4
@@ -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,183 +98,148 @@ 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,
316
- Progress as default
243
+ $ as Progress,
244
+ $ as default
317
245
  };