y-design-ssr 0.2.3 → 0.2.4

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 +1 -579
  2. package/libs/button/index.mjs +66 -111
  3. package/libs/button/index.umd.js +2 -203
  4. package/libs/button/package.json +1 -8
  5. package/libs/cell/index.css +1 -1077
  6. package/libs/cell/index.mjs +104 -167
  7. package/libs/cell/index.umd.js +2 -300
  8. package/libs/cell/package.json +1 -8
  9. package/libs/checkbox/index.css +1 -1053
  10. package/libs/checkbox/index.mjs +127 -242
  11. package/libs/checkbox/index.umd.js +2 -369
  12. package/libs/checkbox/package.json +1 -8
  13. package/libs/checkboxGroup/index.css +1 -422
  14. package/libs/checkboxGroup/index.mjs +87 -173
  15. package/libs/checkboxGroup/index.umd.js +2 -265
  16. package/libs/checkboxGroup/package.json +1 -8
  17. package/libs/col/index.css +1 -615
  18. package/libs/col/index.mjs +81 -246
  19. package/libs/col/index.umd.js +2 -305
  20. package/libs/col/package.json +1 -8
  21. package/libs/countdown/index.css +1 -417
  22. package/libs/countdown/index.mjs +71 -179
  23. package/libs/countdown/index.umd.js +2 -231
  24. package/libs/countdown/package.json +1 -8
  25. package/libs/dialog/index.css +1 -1405
  26. package/libs/dialog/index.mjs +476 -646
  27. package/libs/dialog/index.umd.js +2 -1128
  28. package/libs/dialog/package.json +1 -8
  29. package/libs/empty/index.css +1 -457
  30. package/libs/empty/index.mjs +44 -91
  31. package/libs/empty/index.umd.js +2 -139
  32. package/libs/empty/package.json +1 -8
  33. package/libs/form/index.css +1 -477
  34. package/libs/form/index.mjs +126 -226
  35. package/libs/form/index.umd.js +2 -319
  36. package/libs/form/package.json +1 -8
  37. package/libs/formItem/index.css +1 -477
  38. package/libs/formItem/index.mjs +126 -276
  39. package/libs/formItem/index.umd.js +2 -372
  40. package/libs/formItem/package.json +1 -8
  41. package/libs/icon/index.css +1 -982
  42. package/libs/icon/index.mjs +58 -107
  43. package/libs/icon/index.umd.js +2 -186
  44. package/libs/icon/package.json +1 -8
  45. package/libs/index.css +1 -2902
  46. package/libs/index.mjs +2348 -3789
  47. package/libs/index.umd.js +2 -5509
  48. package/libs/input/index.css +1 -483
  49. package/libs/input/index.mjs +92 -183
  50. package/libs/input/index.umd.js +2 -274
  51. package/libs/input/package.json +1 -8
  52. package/libs/layout/index.css +1 -684
  53. package/libs/layout/index.mjs +130 -230
  54. package/libs/layout/index.umd.js +2 -318
  55. package/libs/layout/package.json +1 -8
  56. package/libs/list/index.css +1 -440
  57. package/libs/list/index.mjs +207 -388
  58. package/libs/list/index.umd.js +2 -571
  59. package/libs/list/package.json +1 -8
  60. package/libs/loading/index.css +1 -548
  61. package/libs/loading/index.mjs +118 -196
  62. package/libs/loading/index.umd.js +2 -321
  63. package/libs/loading/package.json +1 -8
  64. package/libs/mask/index.css +1 -426
  65. package/libs/mask/index.mjs +70 -131
  66. package/libs/mask/index.umd.js +2 -201
  67. package/libs/mask/package.json +1 -8
  68. package/libs/popup/index.css +1 -465
  69. package/libs/popup/index.mjs +134 -210
  70. package/libs/popup/index.umd.js +2 -358
  71. package/libs/popup/package.json +1 -8
  72. package/libs/progress/index.css +1 -488
  73. package/libs/progress/index.mjs +128 -200
  74. package/libs/progress/index.umd.js +2 -322
  75. package/libs/progress/package.json +1 -8
  76. package/libs/pullrefresh/index.css +1 -441
  77. package/libs/pullrefresh/index.mjs +111 -241
  78. package/libs/pullrefresh/index.umd.js +2 -302
  79. package/libs/pullrefresh/package.json +1 -8
  80. package/libs/row/index.css +1 -485
  81. package/libs/row/index.mjs +89 -181
  82. package/libs/row/index.umd.js +2 -237
  83. package/libs/row/package.json +1 -8
  84. package/libs/slider/index.css +1 -558
  85. package/libs/slider/index.mjs +160 -356
  86. package/libs/slider/index.umd.js +2 -453
  87. package/libs/slider/package.json +1 -8
  88. package/libs/stepper/index.css +1 -489
  89. package/libs/stepper/index.mjs +101 -181
  90. package/libs/stepper/index.umd.js +2 -269
  91. package/libs/stepper/package.json +1 -8
  92. package/libs/swipe/index.css +1 -506
  93. package/libs/swipe/index.mjs +259 -542
  94. package/libs/swipe/index.umd.js +2 -703
  95. package/libs/swipe/package.json +1 -8
  96. package/libs/swipeItem/index.css +1 -424
  97. package/libs/swipeItem/index.mjs +52 -111
  98. package/libs/swipeItem/index.umd.js +2 -154
  99. package/libs/swipeItem/package.json +1 -8
  100. package/libs/switch/index.css +1 -472
  101. package/libs/switch/index.mjs +62 -121
  102. package/libs/switch/index.umd.js +2 -200
  103. package/libs/switch/package.json +1 -8
  104. package/libs/tab/index.mjs +68 -131
  105. package/libs/tab/index.umd.js +1 -190
  106. package/libs/tab/package.json +1 -8
  107. package/libs/tabs/index.css +1 -514
  108. package/libs/tabs/index.mjs +410 -751
  109. package/libs/tabs/index.umd.js +2 -1020
  110. package/libs/tabs/package.json +1 -8
  111. package/libs/toast/index.css +1 -1050
  112. package/libs/toast/index.mjs +114 -183
  113. package/libs/toast/index.umd.js +2 -306
  114. package/libs/toast/package.json +1 -8
  115. package/libs/tooltip/index.css +1 -514
  116. package/libs/tooltip/index.mjs +155 -293
  117. package/libs/tooltip/index.umd.js +2 -416
  118. package/libs/tooltip/package.json +1 -8
  119. package/package.json +5 -12
@@ -1,40 +1,11 @@
1
- import { ref, reactive, defineComponent, onMounted, createVNode, Transition, withDirectives, vShow, createApp, h } 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 B, reactive as S, defineComponent as N, onMounted as z, createVNode as a, Transition as A, withDirectives as T, vShow as _, createApp as h, h as $ } from "vue";
2
+ const f = (e, t) => t ? typeof t == "string" ? ` ${e}--${t}` : Array.isArray(t) ? t.reduce((r, n) => r + f(e, n), "") : Object.keys(t).reduce(
3
+ (r, n) => r + (t[n] ? f(e, n) : ""),
4
+ ""
5
+ ) : "", D = (e) => (t, r) => {
6
+ let n = t, o = r;
7
+ return n && typeof n != "string" && (o = n, n = ""), n = n ? `${e}__${n}` : e, `${n}${f(n, o)}`;
8
+ }, E = () => (e, t) => t ? `${f(`y-${e}`, t)}` : `y-${e}`, M = {
38
9
  "pull-refresh": {
39
10
  pulling: "下拉刷新...",
40
11
  loosing: "释放刷新...",
@@ -46,22 +17,14 @@ const defaultLang = {
46
17
  validateMessage: "请输入正确内容"
47
18
  }
48
19
  };
49
- ref("zh-CN");
50
- reactive({
51
- "zh-CN": defaultLang
20
+ B("zh-CN");
21
+ S({
22
+ "zh-CN": M
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$1, gBem] = createNamespace("toast");
64
- const _props = {
24
+ const v = (e) => {
25
+ const t = `y-${e}`;
26
+ return [t, D(t), E()];
27
+ }, I = (e) => isNaN(Number(e)) && typeof e == "string" ? e : `${e}px`, [L, d, j] = v("toast"), q = {
65
28
  // 主文案
66
29
  title: {
67
30
  type: String,
@@ -85,78 +48,67 @@ const _props = {
85
48
  // 关闭时回调
86
49
  onClose: {
87
50
  type: Function,
88
- required: true
51
+ required: !0
89
52
  },
90
53
  // 动画时长
91
54
  animationDuration: {
92
55
  type: [Number, String],
93
56
  default: 300
94
57
  }
95
- };
96
- const Toast = /* @__PURE__ */ defineComponent({
97
- name,
98
- props: _props,
99
- setup(props, {
100
- slots
58
+ }, C = /* @__PURE__ */ N({
59
+ name: L,
60
+ props: q,
61
+ setup(e, {
62
+ slots: t
101
63
  }) {
102
- const state = reactive({
103
- visible: false
64
+ const r = S({
65
+ visible: !1
104
66
  // 控制v-show
105
- });
106
- const show = () => {
107
- const timer = setTimeout(() => {
108
- state.visible = false;
109
- clearTimeout(timer);
110
- }, Number(props.duration));
67
+ }), n = () => {
68
+ const o = setTimeout(() => {
69
+ r.visible = !1, clearTimeout(o);
70
+ }, Number(e.duration));
111
71
  };
112
- onMounted(() => {
113
- state.visible = true;
114
- show();
115
- });
116
- return () => {
72
+ return z(() => {
73
+ r.visible = !0, n();
74
+ }), () => {
117
75
  const {
118
- title,
119
- message,
120
- position,
121
- animationDuration,
122
- onClose
123
- } = props;
124
- return createVNode(Transition, {
125
- "name": gBem("animation", "fade"),
126
- "onAfterLeave": onClose
76
+ title: o,
77
+ message: l,
78
+ position: i,
79
+ animationDuration: s,
80
+ onClose: c
81
+ } = e;
82
+ return a(A, {
83
+ name: j("animation", "fade"),
84
+ onAfterLeave: c
127
85
  }, {
128
86
  default: () => {
129
- var _a;
130
- return [withDirectives(createVNode("div", {
131
- "class": bem$1({
132
- [position]: true
87
+ var u;
88
+ return [T(a("div", {
89
+ class: d({
90
+ [i]: !0
133
91
  }),
134
- "style": {
135
- animationDuration: typeof animationDuration === "number" ? `${animationDuration}ms` : animationDuration
92
+ style: {
93
+ animationDuration: typeof s == "number" ? `${s}ms` : s
136
94
  }
137
- }, [createVNode("div", {
138
- "class": bem$1("content")
139
- }, [((_a = slots.icon) == null ? void 0 : _a.call(slots)) || null, createVNode("div", {
140
- "class": bem$1("text")
141
- }, [title]), message && createVNode("div", {
142
- "class": bem$1("message")
143
- }, [message])])]), [[vShow, state.visible]])];
95
+ }, [a("div", {
96
+ class: d("content")
97
+ }, [((u = t.icon) == null ? void 0 : u.call(t)) || null, a("div", {
98
+ class: d("text")
99
+ }, [o]), l && a("div", {
100
+ class: d("message")
101
+ }, [l])])]), [[_, r.visible]])];
144
102
  }
145
103
  });
146
104
  };
147
105
  }
148
- });
149
- const [cname, bem] = createNamespace("icon");
150
- const isImage = (name2) => {
151
- const re = new RegExp(/\.(https|png|jpg|gif|jpeg|webp|apng)$/);
152
- return re.test(name2.toLowerCase());
153
- };
154
- const Icon = /* @__PURE__ */ defineComponent({
155
- name: cname,
106
+ }), [F, p] = v("icon"), G = (e) => new RegExp(/\.(https|png|jpg|gif|jpeg|webp|apng)$/).test(e.toLowerCase()), m = /* @__PURE__ */ N({
107
+ name: F,
156
108
  props: {
157
109
  dot: {
158
110
  type: Boolean,
159
- default: false
111
+ default: !1
160
112
  },
161
113
  name: {
162
114
  type: String,
@@ -199,102 +151,81 @@ const Icon = /* @__PURE__ */ defineComponent({
199
151
  }
200
152
  },
201
153
  emits: ["click"],
202
- setup(props, {
203
- slots,
204
- emit
154
+ setup(e, {
155
+ slots: t,
156
+ emit: r
205
157
  }) {
206
- const isImg = isImage(props.name);
207
- const getStyle = () => ({
208
- fontSize: parseUnit(props.size),
209
- color: props.color
210
- });
211
- const onClick = (event) => {
212
- emit("click", event);
158
+ const n = G(e.name), o = () => ({
159
+ fontSize: I(e.size),
160
+ color: e.color
161
+ }), l = (i) => {
162
+ r("click", i);
213
163
  };
214
164
  return () => {
215
165
  const {
216
- name: name2,
217
- classPrefix,
218
- badge,
219
- dot,
220
- subColor,
221
- subBg,
222
- tag: Tag
223
- } = props;
224
- return createVNode(Tag, {
225
- "class": `${classPrefix}${isImg ? "" : ` y-icon--${name2}`}`,
226
- "style": getStyle(),
227
- "onClick": onClick
166
+ name: i,
167
+ classPrefix: s,
168
+ badge: c,
169
+ dot: u,
170
+ subColor: x,
171
+ subBg: y,
172
+ tag: k
173
+ } = e;
174
+ return a(k, {
175
+ class: `${s}${n ? "" : ` y-icon--${i}`}`,
176
+ style: o(),
177
+ onClick: l
228
178
  }, {
229
179
  default: () => {
230
- var _a;
231
- return [isImg ? createVNode("em", {
232
- "class": bem("node")
233
- }, [createVNode("img", {
234
- "class": bem("image"),
235
- "src": name2,
236
- "alt": "icon"
237
- }, null)]) : null, dot ? createVNode("em", {
238
- "class": bem("dot"),
239
- "style": {
240
- backgroundColor: subBg
180
+ var b;
181
+ return [n ? a("em", {
182
+ class: p("node")
183
+ }, [a("img", {
184
+ class: p("image"),
185
+ src: i,
186
+ alt: "icon"
187
+ }, null)]) : null, u ? a("em", {
188
+ class: p("dot"),
189
+ style: {
190
+ backgroundColor: y
241
191
  }
242
- }, null) : null, badge ? createVNode("em", {
243
- "class": bem("badge"),
244
- "style": {
245
- color: subColor,
246
- backgroundColor: subBg
192
+ }, null) : null, c ? a("em", {
193
+ class: p("badge"),
194
+ style: {
195
+ color: x,
196
+ backgroundColor: y
247
197
  }
248
- }, [badge]) : null, ((_a = slots.default) == null ? void 0 : _a.call(slots)) || null];
198
+ }, [c]) : null, ((b = t.default) == null ? void 0 : b.call(t)) || null];
249
199
  }
250
200
  });
251
201
  };
252
202
  }
253
203
  });
254
- const reset = "";
255
- const libs = "";
256
- const font = "";
257
- const animation = "";
258
- const theme = "";
259
- const style$1 = "";
260
- Icon.install = (app) => {
261
- const { name: name2 } = Icon;
262
- app.component(name2, Icon);
204
+ m.install = (e) => {
205
+ const { name: t } = m;
206
+ e.component(t, m);
263
207
  };
264
- let toastApp = createApp({});
265
- let num = 0;
266
- const treasures = [];
267
- const toastCreate = (customProps, iconProps) => {
268
- const id = `toast${num += 1}`;
269
- const wrapper = {
270
- render: () => {
271
- return h(
272
- Toast,
273
- { ...customProps, onClose: () => close(id, customProps.onClose) },
274
- { icon: () => h(Icon, { ...iconProps }) }
275
- );
276
- }
277
- };
278
- toastApp = createApp(wrapper);
279
- const element = document.createElement("div");
280
- treasures.push({ id, app: toastApp, el: element });
281
- toastApp.mount(element);
282
- document.body.appendChild(element);
283
- };
284
- const close = (id, userOnClose) => {
285
- treasures.forEach((obj) => {
286
- if (id === obj.id) {
287
- obj.app.unmount();
288
- document.body.removeChild(obj.el);
289
- userOnClose == null ? void 0 : userOnClose();
290
- }
208
+ let g = h({}), P = 0;
209
+ const w = [], R = (e, t) => {
210
+ const r = `toast${P += 1}`;
211
+ g = h({
212
+ render: () => $(
213
+ C,
214
+ { ...e, onClose: () => U(r, e.onClose) },
215
+ { icon: () => $(m, { ...t }) }
216
+ )
217
+ });
218
+ const o = document.createElement("div");
219
+ w.push({ id: r, app: g, el: o }), g.mount(o), document.body.appendChild(o);
220
+ }, U = (e, t) => {
221
+ w.forEach((r) => {
222
+ e === r.id && (r.app.unmount(), document.body.removeChild(r.el), t == null || t());
291
223
  });
292
224
  };
293
- const style = "";
294
- Toast.install = (app) => {
295
- app.provide("toast", toastCreate);
225
+ C.install = (e) => {
226
+ e.provide("toast", R);
296
227
  };
297
228
  export {
298
- Toast as default,
299
- toastCreate
229
+ C as default,
230
+ R as toastCreate
300
231
  };