y-design-ssr 0.2.1 → 0.2.3

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 +579 -1
  2. package/libs/button/index.mjs +111 -66
  3. package/libs/button/index.umd.js +203 -2
  4. package/libs/button/package.json +12 -0
  5. package/libs/cell/index.css +1077 -1
  6. package/libs/cell/index.mjs +167 -104
  7. package/libs/cell/index.umd.js +300 -2
  8. package/libs/cell/package.json +12 -0
  9. package/libs/checkbox/index.css +1053 -1
  10. package/libs/checkbox/index.mjs +242 -127
  11. package/libs/checkbox/index.umd.js +369 -2
  12. package/libs/checkbox/package.json +12 -0
  13. package/libs/checkboxGroup/index.css +422 -1
  14. package/libs/checkboxGroup/index.mjs +173 -87
  15. package/libs/checkboxGroup/index.umd.js +265 -2
  16. package/libs/checkboxGroup/package.json +12 -0
  17. package/libs/col/index.css +615 -1
  18. package/libs/col/index.mjs +246 -81
  19. package/libs/col/index.umd.js +305 -2
  20. package/libs/col/package.json +12 -0
  21. package/libs/countdown/index.css +417 -1
  22. package/libs/countdown/index.mjs +179 -71
  23. package/libs/countdown/index.umd.js +231 -2
  24. package/libs/countdown/package.json +12 -0
  25. package/libs/dialog/index.css +1405 -1
  26. package/libs/dialog/index.mjs +646 -476
  27. package/libs/dialog/index.umd.js +1128 -2
  28. package/libs/dialog/package.json +12 -0
  29. package/libs/empty/index.css +457 -1
  30. package/libs/empty/index.mjs +91 -44
  31. package/libs/empty/index.umd.js +139 -2
  32. package/libs/empty/package.json +12 -0
  33. package/libs/form/index.css +477 -1
  34. package/libs/form/index.mjs +226 -126
  35. package/libs/form/index.umd.js +319 -2
  36. package/libs/form/package.json +12 -0
  37. package/libs/formItem/index.css +477 -1
  38. package/libs/formItem/index.mjs +276 -126
  39. package/libs/formItem/index.umd.js +372 -2
  40. package/libs/formItem/package.json +12 -0
  41. package/libs/icon/index.css +982 -1
  42. package/libs/icon/index.mjs +107 -58
  43. package/libs/icon/index.umd.js +186 -2
  44. package/libs/icon/package.json +12 -0
  45. package/libs/index.css +2902 -1
  46. package/libs/index.mjs +3785 -2344
  47. package/libs/index.umd.js +5509 -2
  48. package/libs/input/index.css +483 -1
  49. package/libs/input/index.mjs +183 -92
  50. package/libs/input/index.umd.js +274 -2
  51. package/libs/input/package.json +12 -0
  52. package/libs/layout/index.css +684 -1
  53. package/libs/layout/index.mjs +230 -130
  54. package/libs/layout/index.umd.js +318 -2
  55. package/libs/layout/package.json +12 -0
  56. package/libs/list/index.css +440 -1
  57. package/libs/list/index.mjs +388 -207
  58. package/libs/list/index.umd.js +571 -2
  59. package/libs/list/package.json +12 -0
  60. package/libs/loading/index.css +548 -1
  61. package/libs/loading/index.mjs +196 -118
  62. package/libs/loading/index.umd.js +321 -2
  63. package/libs/loading/package.json +12 -0
  64. package/libs/mask/index.css +426 -1
  65. package/libs/mask/index.mjs +131 -70
  66. package/libs/mask/index.umd.js +201 -2
  67. package/libs/mask/package.json +12 -0
  68. package/libs/popup/index.css +465 -1
  69. package/libs/popup/index.mjs +210 -134
  70. package/libs/popup/index.umd.js +358 -2
  71. package/libs/popup/package.json +12 -0
  72. package/libs/progress/index.css +488 -1
  73. package/libs/progress/index.mjs +200 -128
  74. package/libs/progress/index.umd.js +322 -2
  75. package/libs/progress/package.json +12 -0
  76. package/libs/pullrefresh/index.css +441 -1
  77. package/libs/pullrefresh/index.mjs +241 -111
  78. package/libs/pullrefresh/index.umd.js +302 -2
  79. package/libs/pullrefresh/package.json +12 -0
  80. package/libs/row/index.css +485 -1
  81. package/libs/row/index.mjs +181 -89
  82. package/libs/row/index.umd.js +237 -2
  83. package/libs/row/package.json +12 -0
  84. package/libs/slider/index.css +558 -1
  85. package/libs/slider/index.mjs +356 -160
  86. package/libs/slider/index.umd.js +453 -2
  87. package/libs/slider/package.json +12 -0
  88. package/libs/stepper/index.css +489 -1
  89. package/libs/stepper/index.mjs +181 -101
  90. package/libs/stepper/index.umd.js +269 -2
  91. package/libs/stepper/package.json +12 -0
  92. package/libs/swipe/index.css +506 -1
  93. package/libs/swipe/index.mjs +542 -259
  94. package/libs/swipe/index.umd.js +703 -2
  95. package/libs/swipe/package.json +12 -0
  96. package/libs/swipeItem/index.css +424 -1
  97. package/libs/swipeItem/index.mjs +111 -52
  98. package/libs/swipeItem/index.umd.js +154 -2
  99. package/libs/swipeItem/package.json +12 -0
  100. package/libs/switch/index.css +472 -1
  101. package/libs/switch/index.mjs +121 -62
  102. package/libs/switch/index.umd.js +200 -2
  103. package/libs/switch/package.json +12 -0
  104. package/libs/tab/index.mjs +131 -68
  105. package/libs/tab/index.umd.js +190 -1
  106. package/libs/tab/package.json +12 -0
  107. package/libs/tabs/index.css +514 -1
  108. package/libs/tabs/index.mjs +751 -410
  109. package/libs/tabs/index.umd.js +1020 -2
  110. package/libs/tabs/package.json +12 -0
  111. package/libs/toast/index.css +1050 -1
  112. package/libs/toast/index.mjs +183 -114
  113. package/libs/toast/index.umd.js +306 -2
  114. package/libs/toast/package.json +12 -0
  115. package/libs/tooltip/index.css +514 -1
  116. package/libs/tooltip/index.mjs +293 -155
  117. package/libs/tooltip/index.umd.js +416 -2
  118. package/libs/tooltip/package.json +12 -0
  119. package/package.json +3 -3
@@ -1,11 +1,40 @@
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 = {
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 = {
9
38
  "pull-refresh": {
10
39
  pulling: "下拉刷新...",
11
40
  loosing: "释放刷新...",
@@ -17,18 +46,26 @@ const k = (e, t) => t ? typeof t == "string" ? ` ${e}--${t}` : Array.isArray(t)
17
46
  validateMessage: "请输入正确内容"
18
47
  }
19
48
  };
20
- h("zh-CN");
21
- _({
22
- "zh-CN": w
49
+ ref("zh-CN");
50
+ reactive({
51
+ "zh-CN": defaultLang
23
52
  });
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 = {
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 = {
28
65
  // 控制显示
29
66
  modelValue: {
30
67
  type: Boolean,
31
- default: !1
68
+ default: false
32
69
  },
33
70
  // 层级
34
71
  zIndex: {
@@ -53,87 +90,118 @@ const x = (e) => {
53
90
  // 触摸滚动开关
54
91
  lockScroll: {
55
92
  type: Boolean,
56
- default: !0
93
+ default: true
57
94
  },
58
95
  onAfterLeave: {
59
96
  type: Function,
60
97
  default: null
61
98
  }
62
- }, r = _([]);
63
- let v = 0;
64
- const $ = /* @__PURE__ */ C({
65
- name: R,
66
- props: U,
99
+ };
100
+ const stack = reactive([]);
101
+ let num = 0;
102
+ const Mask = /* @__PURE__ */ defineComponent({
103
+ name: name$1,
104
+ props: _props$1,
67
105
  emits: ["update:modelValue"],
68
- setup(e, {
69
- slots: t
106
+ setup(props, {
107
+ slots
70
108
  }) {
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);
109
+ const id = ref("");
110
+ onMounted(() => {
111
+ id.value = `mask${num}`;
112
+ num += 1;
113
+ stackIntercept(props.modelValue, true);
79
114
  });
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);
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
+ }
89
145
  return {
90
- _state: n
146
+ _state
91
147
  };
92
- }, d = (n) => {
148
+ };
149
+ const onTouchMove = (payload) => {
93
150
  const {
94
- lockScroll: o
95
- } = e;
96
- o && (n.preventDefault(), n.stopPropagation());
151
+ lockScroll
152
+ } = props;
153
+ if (lockScroll) {
154
+ payload.preventDefault();
155
+ payload.stopPropagation();
156
+ }
97
157
  };
98
158
  return () => {
99
159
  const {
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
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
111
172
  }, {
112
173
  default: () => {
113
- var p;
114
- return [M(i("div", {
115
- style: {
116
- animationDuration: `${o}ms`,
117
- zIndex: f,
118
- ...m
174
+ var _a;
175
+ return [withDirectives(createVNode("div", {
176
+ "style": {
177
+ animationDuration: `${duration}ms`,
178
+ zIndex,
179
+ ...customStyle
119
180
  },
120
- class: [T(), n],
121
- onTouchmove: d
122
- }, [(p = t.default) == null ? void 0 : p.call(t)]), [[V, s]])];
181
+ "class": [bem$1(), customClass],
182
+ "onTouchmove": onTouchMove
183
+ }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]), [[vShow, _state]])];
123
184
  }
124
185
  });
125
186
  };
126
187
  }
127
188
  });
128
- $.install = (e) => {
129
- const { name: t } = $;
130
- e.component(t, $);
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);
131
198
  };
132
- const [F, S, P] = x("popup"), E = {
199
+ const [name, bem, gBem] = createNamespace("popup");
200
+ const _props = {
133
201
  // 控制显示
134
202
  modelValue: {
135
203
  type: Boolean,
136
- default: !1
204
+ default: false
137
205
  },
138
206
  // 位置
139
207
  position: {
@@ -168,7 +236,7 @@ const [F, S, P] = x("popup"), E = {
168
236
  // 点击遮罩是否关闭
169
237
  isCloseOnClickMask: {
170
238
  type: Boolean,
171
- default: !0
239
+ default: true
172
240
  },
173
241
  onAfterLeave: {
174
242
  type: Function,
@@ -176,101 +244,109 @@ const [F, S, P] = x("popup"), E = {
176
244
  },
177
245
  lockScroll: {
178
246
  type: Boolean,
179
- default: !0
247
+ default: true
180
248
  },
181
249
  zIndex: {
182
250
  type: Number,
183
251
  default: 101
184
252
  }
185
- }, b = /* @__PURE__ */ C({
186
- name: F,
187
- props: E,
253
+ };
254
+ const Popup = /* @__PURE__ */ defineComponent({
255
+ name,
256
+ props: _props,
188
257
  emits: ["clickMask", "update:modelValue"],
189
- setup(e, {
190
- slots: t,
191
- emit: l
258
+ setup(props, {
259
+ slots,
260
+ emit
192
261
  }) {
193
- const a = g(() => {
262
+ const style2 = computed(() => {
194
263
  const {
195
- position: n,
196
- borderRadius: o,
197
- customStyle: f,
198
- duration: m
199
- } = e, u = D(o);
200
- let s = "0";
201
- switch (n) {
264
+ position,
265
+ borderRadius,
266
+ customStyle,
267
+ duration
268
+ } = props;
269
+ const tbR = parseUnit(borderRadius);
270
+ let br = `0`;
271
+ switch (position) {
202
272
  case "top":
203
- s = ` 0 0 ${u} ${u}`;
273
+ br = ` 0 0 ${tbR} ${tbR}`;
204
274
  break;
205
275
  case "bottom":
206
- s = `${u} ${u} 0 0`;
276
+ br = `${tbR} ${tbR} 0 0`;
207
277
  break;
208
278
  case "left":
209
- s = `0 ${u} ${u} 0`;
279
+ br = `0 ${tbR} ${tbR} 0`;
210
280
  break;
211
281
  case "right":
212
- s = `${u} 0 0 ${u}`;
282
+ br = `${tbR} 0 0 ${tbR}`;
213
283
  break;
214
284
  default:
215
- s = `${u}`;
285
+ br = `${tbR}`;
216
286
  }
217
287
  return {
218
- borderRadius: s,
219
- animationDuration: `${m}ms`,
220
- ...f
288
+ borderRadius: br,
289
+ animationDuration: `${duration}ms`,
290
+ ...customStyle
221
291
  };
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)
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)
227
302
  });
228
303
  return () => {
229
304
  const {
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
305
+ teleport,
306
+ position,
307
+ customClass,
308
+ duration,
309
+ onAfterLeave,
310
+ lockScroll,
311
+ zIndex
312
+ } = props;
313
+ return createVNode(Teleport, {
314
+ "to": teleport
240
315
  }, {
241
- default: () => [i("div", {
242
- class: S(),
243
- style: {
244
- zIndex: p
316
+ default: () => [createVNode("div", {
317
+ "class": bem(),
318
+ "style": {
319
+ zIndex
245
320
  }
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}`)
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}`)
255
330
  }, {
256
331
  default: () => {
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]])];
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]])];
264
339
  }
265
340
  })])]
266
341
  });
267
342
  };
268
343
  }
269
344
  });
270
- b.install = (e) => {
271
- const { name: t } = b;
272
- e.component(t, b);
345
+ const style = "";
346
+ Popup.install = (app) => {
347
+ const { name: name2 } = Popup;
348
+ app.component(name2, Popup);
273
349
  };
274
350
  export {
275
- b as default
351
+ Popup as default
276
352
  };