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, onUnmounted, watch, createVNode, Transition, withDirectives, vShow, computed, Teleport } 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 _, defineComponent as C, onMounted as B, onUnmounted as A, watch as L, createVNode as i, Transition as N, withDirectives as M, vShow as V, computed as g, Teleport as z } from "vue";
2
+ const k = (e, t) => t ? typeof t == "string" ? ` ${e}--${t}` : Array.isArray(t) ? t.reduce((l, a) => l + k(e, a), "") : Object.keys(t).reduce(
3
+ (l, a) => l + (t[a] ? k(e, a) : ""),
4
+ ""
5
+ ) : "", I = (e) => (t, l) => {
6
+ let a = t, c = l;
7
+ return a && typeof a != "string" && (c = a, a = ""), a = a ? `${e}__${a}` : e, `${a}${k(a, c)}`;
8
+ }, O = () => (e, t) => t ? `${k(`y-${e}`, t)}` : `y-${e}`, w = {
38
9
  "pull-refresh": {
39
10
  pulling: "下拉刷新...",
40
11
  loosing: "释放刷新...",
@@ -46,26 +17,18 @@ const defaultLang = {
46
17
  validateMessage: "请输入正确内容"
47
18
  }
48
19
  };
49
- ref("zh-CN");
50
- reactive({
51
- "zh-CN": defaultLang
20
+ h("zh-CN");
21
+ _({
22
+ "zh-CN": w
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$1, bem$1, gBem$1] = createNamespace("mask");
64
- const _props$1 = {
24
+ const x = (e) => {
25
+ const t = `y-${e}`;
26
+ return [t, I(t), O()];
27
+ }, D = (e) => isNaN(Number(e)) && typeof e == "string" ? e : `${e}px`, [R, T, j] = x("mask"), U = {
65
28
  // 控制显示
66
29
  modelValue: {
67
30
  type: Boolean,
68
- default: false
31
+ default: !1
69
32
  },
70
33
  // 层级
71
34
  zIndex: {
@@ -90,118 +53,87 @@ const _props$1 = {
90
53
  // 触摸滚动开关
91
54
  lockScroll: {
92
55
  type: Boolean,
93
- default: true
56
+ default: !0
94
57
  },
95
58
  onAfterLeave: {
96
59
  type: Function,
97
60
  default: null
98
61
  }
99
- };
100
- const stack = reactive([]);
101
- let num = 0;
102
- const Mask = /* @__PURE__ */ defineComponent({
103
- name: name$1,
104
- props: _props$1,
62
+ }, r = _([]);
63
+ let v = 0;
64
+ const $ = /* @__PURE__ */ C({
65
+ name: R,
66
+ props: U,
105
67
  emits: ["update:modelValue"],
106
- setup(props, {
107
- slots
68
+ setup(e, {
69
+ slots: t
108
70
  }) {
109
- const id = ref("");
110
- onMounted(() => {
111
- id.value = `mask${num}`;
112
- num += 1;
113
- stackIntercept(props.modelValue, true);
71
+ const l = h("");
72
+ B(() => {
73
+ l.value = `mask${v}`, v += 1, a(e.modelValue, !0);
74
+ }), A(() => {
75
+ const n = r.findIndex((o) => o._id === l.value);
76
+ n >= 0 && r.splice(n, 1);
77
+ }), L(() => e.modelValue, (n) => {
78
+ a(n);
114
79
  });
115
- onUnmounted(() => {
116
- const index = stack.findIndex((v) => v._id === id.value);
117
- index >= 0 && stack.splice(index, 1);
118
- });
119
- watch(() => props.modelValue, (val) => {
120
- stackIntercept(val);
121
- });
122
- const stackIntercept = (val, isMounted) => {
123
- if (val) {
124
- stack.unshift({
125
- _id: id.value,
126
- _state: val
127
- });
128
- if (stack.length > 1) {
129
- stack[1]._state = false;
130
- }
131
- } else if (!isMounted) {
132
- stack.splice(0, 1);
133
- if (stack.length > 0) {
134
- stack[0]._state = true;
135
- }
136
- }
137
- };
138
- const find = () => {
139
- let _state = false;
140
- for (let i = 0; i < stack.length; i++) {
141
- if (stack[i]._id === id.value) {
142
- _state = stack[i]._state;
143
- }
144
- }
80
+ const a = (n, o) => {
81
+ n ? (r.unshift({
82
+ _id: l.value,
83
+ _state: n
84
+ }), r.length > 1 && (r[1]._state = !1)) : o || (r.splice(0, 1), r.length > 0 && (r[0]._state = !0));
85
+ }, c = () => {
86
+ let n = !1;
87
+ for (let o = 0; o < r.length; o++)
88
+ r[o]._id === l.value && (n = r[o]._state);
145
89
  return {
146
- _state
90
+ _state: n
147
91
  };
148
- };
149
- const onTouchMove = (payload) => {
92
+ }, d = (n) => {
150
93
  const {
151
- lockScroll
152
- } = props;
153
- if (lockScroll) {
154
- payload.preventDefault();
155
- payload.stopPropagation();
156
- }
94
+ lockScroll: o
95
+ } = e;
96
+ o && (n.preventDefault(), n.stopPropagation());
157
97
  };
158
98
  return () => {
159
99
  const {
160
- customClass,
161
- duration,
162
- zIndex,
163
- customStyle,
164
- onAfterLeave
165
- } = props;
166
- const {
167
- _state
168
- } = find();
169
- return createVNode(Transition, {
170
- "name": gBem$1("animation", "fade"),
171
- "onAfterLeave": onAfterLeave
100
+ customClass: n,
101
+ duration: o,
102
+ zIndex: f,
103
+ customStyle: m,
104
+ onAfterLeave: u
105
+ } = e, {
106
+ _state: s
107
+ } = c();
108
+ return i(N, {
109
+ name: j("animation", "fade"),
110
+ onAfterLeave: u
172
111
  }, {
173
112
  default: () => {
174
- var _a;
175
- return [withDirectives(createVNode("div", {
176
- "style": {
177
- animationDuration: `${duration}ms`,
178
- zIndex,
179
- ...customStyle
113
+ var p;
114
+ return [M(i("div", {
115
+ style: {
116
+ animationDuration: `${o}ms`,
117
+ zIndex: f,
118
+ ...m
180
119
  },
181
- "class": [bem$1(), customClass],
182
- "onTouchmove": onTouchMove
183
- }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]), [[vShow, _state]])];
120
+ class: [T(), n],
121
+ onTouchmove: d
122
+ }, [(p = t.default) == null ? void 0 : p.call(t)]), [[V, s]])];
184
123
  }
185
124
  });
186
125
  };
187
126
  }
188
127
  });
189
- const reset = "";
190
- const libs = "";
191
- const font = "";
192
- const animation = "";
193
- const theme = "";
194
- const style$1 = "";
195
- Mask.install = (app) => {
196
- const { name: name2 } = Mask;
197
- app.component(name2, Mask);
128
+ $.install = (e) => {
129
+ const { name: t } = $;
130
+ e.component(t, $);
198
131
  };
199
- const [name, bem, gBem] = createNamespace("popup");
200
- const _props = {
132
+ const [F, S, P] = x("popup"), E = {
201
133
  // 控制显示
202
134
  modelValue: {
203
135
  type: Boolean,
204
- default: false
136
+ default: !1
205
137
  },
206
138
  // 位置
207
139
  position: {
@@ -236,7 +168,7 @@ const _props = {
236
168
  // 点击遮罩是否关闭
237
169
  isCloseOnClickMask: {
238
170
  type: Boolean,
239
- default: true
171
+ default: !0
240
172
  },
241
173
  onAfterLeave: {
242
174
  type: Function,
@@ -244,110 +176,102 @@ const _props = {
244
176
  },
245
177
  lockScroll: {
246
178
  type: Boolean,
247
- default: true
179
+ default: !0
248
180
  },
249
181
  zIndex: {
250
182
  type: Number,
251
183
  default: 101
252
184
  }
253
- };
254
- const Popup = /* @__PURE__ */ defineComponent({
255
- name,
256
- props: _props,
185
+ }, b = /* @__PURE__ */ C({
186
+ name: F,
187
+ props: E,
257
188
  emits: ["clickMask", "update:modelValue"],
258
- setup(props, {
259
- slots,
260
- emit
189
+ setup(e, {
190
+ slots: t,
191
+ emit: l
261
192
  }) {
262
- const style2 = computed(() => {
193
+ const a = g(() => {
263
194
  const {
264
- position,
265
- borderRadius,
266
- customStyle,
267
- duration
268
- } = props;
269
- const tbR = parseUnit(borderRadius);
270
- let br = `0`;
271
- switch (position) {
195
+ position: n,
196
+ borderRadius: o,
197
+ customStyle: f,
198
+ duration: m
199
+ } = e, u = D(o);
200
+ let s = "0";
201
+ switch (n) {
272
202
  case "top":
273
- br = ` 0 0 ${tbR} ${tbR}`;
203
+ s = ` 0 0 ${u} ${u}`;
274
204
  break;
275
205
  case "bottom":
276
- br = `${tbR} ${tbR} 0 0`;
206
+ s = `${u} ${u} 0 0`;
277
207
  break;
278
208
  case "left":
279
- br = `0 ${tbR} ${tbR} 0`;
209
+ s = `0 ${u} ${u} 0`;
280
210
  break;
281
211
  case "right":
282
- br = `${tbR} 0 0 ${tbR}`;
212
+ s = `${u} 0 0 ${u}`;
283
213
  break;
284
214
  default:
285
- br = `${tbR}`;
215
+ s = `${u}`;
286
216
  }
287
217
  return {
288
- borderRadius: br,
289
- animationDuration: `${duration}ms`,
290
- ...customStyle
218
+ borderRadius: s,
219
+ animationDuration: `${m}ms`,
220
+ ...f
291
221
  };
292
- });
293
- const onClickMask = (event) => {
294
- emit("clickMask", event);
295
- if (props.isCloseOnClickMask) {
296
- visible.value = false;
297
- }
298
- };
299
- const visible = computed({
300
- get: () => props.modelValue,
301
- set: (value) => emit("update:modelValue", value)
222
+ }), c = (n) => {
223
+ l("clickMask", n), e.isCloseOnClickMask && (d.value = !1);
224
+ }, d = g({
225
+ get: () => e.modelValue,
226
+ set: (n) => l("update:modelValue", n)
302
227
  });
303
228
  return () => {
304
229
  const {
305
- teleport,
306
- position,
307
- customClass,
308
- duration,
309
- onAfterLeave,
310
- lockScroll,
311
- zIndex
312
- } = props;
313
- return createVNode(Teleport, {
314
- "to": teleport
230
+ teleport: n,
231
+ position: o,
232
+ customClass: f,
233
+ duration: m,
234
+ onAfterLeave: u,
235
+ lockScroll: s,
236
+ zIndex: p
237
+ } = e;
238
+ return i(z, {
239
+ to: n
315
240
  }, {
316
- default: () => [createVNode("div", {
317
- "class": bem(),
318
- "style": {
319
- zIndex
241
+ default: () => [i("div", {
242
+ class: S(),
243
+ style: {
244
+ zIndex: p
320
245
  }
321
- }, [createVNode(Mask, {
322
- "modelValue": visible.value,
323
- "onUpdate:modelValue": ($event) => visible.value = $event,
324
- "duration": duration,
325
- "lockScroll": lockScroll,
326
- "onClick": onClickMask,
327
- "onAfterLeave": onAfterLeave
328
- }, null), createVNode(Transition, {
329
- "name": gBem("animation", `slide-${position}`)
246
+ }, [i($, {
247
+ modelValue: d.value,
248
+ "onUpdate:modelValue": (y) => d.value = y,
249
+ duration: m,
250
+ lockScroll: s,
251
+ onClick: c,
252
+ onAfterLeave: u
253
+ }, null), i(N, {
254
+ name: P("animation", `slide-${o}`)
330
255
  }, {
331
256
  default: () => {
332
- var _a;
333
- return [withDirectives(createVNode("div", {
334
- "style": style2.value,
335
- "class": [bem("content", {
336
- [position]: position
337
- }), customClass]
338
- }, [((_a = slots.default) == null ? void 0 : _a.call(slots)) || null]), [[vShow, visible.value]])];
257
+ var y;
258
+ return [M(i("div", {
259
+ style: a.value,
260
+ class: [S("content", {
261
+ [o]: o
262
+ }), f]
263
+ }, [((y = t.default) == null ? void 0 : y.call(t)) || null]), [[V, d.value]])];
339
264
  }
340
265
  })])]
341
266
  });
342
267
  };
343
268
  }
344
269
  });
345
- const style = "";
346
- Popup.install = (app) => {
347
- const { name: name2 } = Popup;
348
- app.component(name2, Popup);
270
+ b.install = (e) => {
271
+ const { name: t } = b;
272
+ e.component(t, b);
349
273
  };
350
274
  export {
351
- Popup,
352
- Popup as default
275
+ b as Popup,
276
+ b as default
353
277
  };