y-design-ssr 0.2.2 → 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 +5 -0
  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 +5 -0
  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 +5 -0
  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 +5 -0
  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 +5 -0
  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 +5 -0
  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 +5 -0
  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 +5 -0
  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 +5 -0
  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 +5 -0
  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 +5 -0
  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 +5 -0
  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 +5 -0
  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 +5 -0
  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 +5 -0
  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 +5 -0
  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 +5 -0
  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 +5 -0
  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 +5 -0
  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 +5 -0
  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 +5 -0
  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 +5 -0
  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 +5 -0
  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 +5 -0
  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 +5 -0
  104. package/libs/tab/index.mjs +68 -131
  105. package/libs/tab/index.umd.js +1 -190
  106. package/libs/tab/package.json +5 -0
  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 +5 -0
  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 +5 -0
  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 +5 -0
  119. package/package.json +5 -12
@@ -1,40 +1,11 @@
1
- import { ref, reactive, inject, getCurrentInstance, watch, onUnmounted, defineComponent, createVNode, computed, onBeforeUnmount } 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 z, reactive as E, inject as I, getCurrentInstance as N, watch as j, onUnmounted as B, defineComponent as V, createVNode as i, computed as f, onBeforeUnmount as w } from "vue";
2
+ const C = (e, n) => n ? typeof n == "string" ? ` ${e}--${n}` : Array.isArray(n) ? n.reduce((a, l) => a + C(e, l), "") : Object.keys(n).reduce(
3
+ (a, l) => a + (n[l] ? C(e, l) : ""),
4
+ ""
5
+ ) : "", M = (e) => (n, a) => {
6
+ let l = n, t = a;
7
+ return l && typeof l != "string" && (t = l, l = ""), l = l ? `${e}__${l}` : e, `${l}${C(l, t)}`;
8
+ }, q = () => (e, n) => n ? `${C(`y-${e}`, n)}` : `y-${e}`, F = {
38
9
  "pull-refresh": {
39
10
  pulling: "下拉刷新...",
40
11
  loosing: "释放刷新...",
@@ -46,58 +17,35 @@ const defaultLang = {
46
17
  validateMessage: "请输入正确内容"
47
18
  }
48
19
  };
49
- ref("zh-CN");
50
- reactive({
51
- "zh-CN": defaultLang
20
+ z("zh-CN");
21
+ E({
22
+ "zh-CN": F
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 FORM_ITEM_PROVIDE = "y-form-item";
64
- const useFormItem = () => {
65
- const parent = inject(FORM_ITEM_PROVIDE, null);
66
- const instance = getCurrentInstance();
67
- if (parent && (instance == null ? void 0 : instance.proxy)) {
68
- const { setField } = parent;
69
- const { resetValidation, change, validateWithTrigger } = parent;
70
- watch(
71
- () => instance.proxy.modelValue,
24
+ const $ = (e) => {
25
+ const n = `y-${e}`;
26
+ return [n, M(n), q()];
27
+ }, O = (e) => isNaN(Number(e)) && typeof e == "string" ? e : `${e}px`, P = "y-form-item", R = () => {
28
+ const e = I(P, null), n = N();
29
+ if (e && (n != null && n.proxy)) {
30
+ const { setField: a } = e, { resetValidation: l, change: t, validateWithTrigger: u } = e;
31
+ return j(
32
+ () => n.proxy.modelValue,
72
33
  () => {
73
- if (parent.instance && parent.instance.exposed) {
74
- resetValidation();
75
- change();
76
- validateWithTrigger("onChange");
77
- }
34
+ e.instance && e.instance.exposed && (l(), t(), u("onChange"));
78
35
  }
79
- );
80
- setField(instance);
81
- onUnmounted(() => setField(null));
82
- return {
83
- parent
36
+ ), a(n), B(() => a(null)), {
37
+ parent: e
84
38
  };
85
39
  }
86
40
  return {
87
41
  parent: null
88
42
  };
89
- };
90
- const [cname, bem$2] = createNamespace("icon");
91
- const isImage = (name2) => {
92
- const re = new RegExp(/\.(https|png|jpg|gif|jpeg|webp|apng)$/);
93
- return re.test(name2.toLowerCase());
94
- };
95
- const Icon = /* @__PURE__ */ defineComponent({
96
- name: cname,
43
+ }, [T, b] = $("icon"), U = (e) => new RegExp(/\.(https|png|jpg|gif|jpeg|webp|apng)$/).test(e.toLowerCase()), p = /* @__PURE__ */ V({
44
+ name: T,
97
45
  props: {
98
46
  dot: {
99
47
  type: Boolean,
100
- default: false
48
+ default: !1
101
49
  },
102
50
  name: {
103
51
  type: String,
@@ -140,95 +88,79 @@ const Icon = /* @__PURE__ */ defineComponent({
140
88
  }
141
89
  },
142
90
  emits: ["click"],
143
- setup(props, {
144
- slots,
145
- emit
91
+ setup(e, {
92
+ slots: n,
93
+ emit: a
146
94
  }) {
147
- const isImg = isImage(props.name);
148
- const getStyle = () => ({
149
- fontSize: parseUnit(props.size),
150
- color: props.color
151
- });
152
- const onClick = (event) => {
153
- emit("click", event);
95
+ const l = U(e.name), t = () => ({
96
+ fontSize: O(e.size),
97
+ color: e.color
98
+ }), u = (o) => {
99
+ a("click", o);
154
100
  };
155
101
  return () => {
156
102
  const {
157
- name: name2,
158
- classPrefix,
159
- badge,
160
- dot,
161
- subColor,
162
- subBg,
163
- tag: Tag
164
- } = props;
165
- return createVNode(Tag, {
166
- "class": `${classPrefix}${isImg ? "" : ` y-icon--${name2}`}`,
167
- "style": getStyle(),
168
- "onClick": onClick
103
+ name: o,
104
+ classPrefix: m,
105
+ badge: g,
106
+ dot: y,
107
+ subColor: v,
108
+ subBg: c,
109
+ tag: h
110
+ } = e;
111
+ return i(h, {
112
+ class: `${m}${l ? "" : ` y-icon--${o}`}`,
113
+ style: t(),
114
+ onClick: u
169
115
  }, {
170
116
  default: () => {
171
- var _a;
172
- return [isImg ? createVNode("em", {
173
- "class": bem$2("node")
174
- }, [createVNode("img", {
175
- "class": bem$2("image"),
176
- "src": name2,
177
- "alt": "icon"
178
- }, null)]) : null, dot ? createVNode("em", {
179
- "class": bem$2("dot"),
180
- "style": {
181
- backgroundColor: subBg
117
+ var d;
118
+ return [l ? i("em", {
119
+ class: b("node")
120
+ }, [i("img", {
121
+ class: b("image"),
122
+ src: o,
123
+ alt: "icon"
124
+ }, null)]) : null, y ? i("em", {
125
+ class: b("dot"),
126
+ style: {
127
+ backgroundColor: c
182
128
  }
183
- }, null) : null, badge ? createVNode("em", {
184
- "class": bem$2("badge"),
185
- "style": {
186
- color: subColor,
187
- backgroundColor: subBg
129
+ }, null) : null, g ? i("em", {
130
+ class: b("badge"),
131
+ style: {
132
+ color: v,
133
+ backgroundColor: c
188
134
  }
189
- }, [badge]) : null, ((_a = slots.default) == null ? void 0 : _a.call(slots)) || null];
135
+ }, [g]) : null, ((d = n.default) == null ? void 0 : d.call(n)) || null];
190
136
  }
191
137
  });
192
138
  };
193
139
  }
194
140
  });
195
- const reset = "";
196
- const libs = "";
197
- const font = "";
198
- const animation = "";
199
- const theme = "";
200
- const style$1 = "";
201
- Icon.install = (app) => {
202
- const { name: name2 } = Icon;
203
- app.component(name2, Icon);
141
+ p.install = (e) => {
142
+ const { name: n } = p;
143
+ e.component(n, p);
204
144
  };
205
- const useRelation = (key) => {
206
- const parent = inject(key, null);
207
- const currentInstance = getCurrentInstance();
208
- if (parent && currentInstance) {
209
- const { childrens, addChild, removeChild } = parent;
210
- addChild(currentInstance);
211
- onUnmounted(() => removeChild(currentInstance));
212
- const index = computed(() => childrens.indexOf(currentInstance));
213
- return {
214
- index,
215
- parent
145
+ const A = (e) => {
146
+ const n = I(e, null), a = N();
147
+ if (n && a) {
148
+ const { childrens: l, addChild: t, removeChild: u } = n;
149
+ return t(a), B(() => u(a)), {
150
+ index: f(() => l.indexOf(a)),
151
+ parent: n
216
152
  };
217
153
  }
218
154
  return {
219
155
  parent: null,
220
- index: ref(-1)
156
+ index: z(-1)
221
157
  };
222
- };
223
- const [name$1, bem$1] = createNamespace("checkbox-group");
224
- const CHECKBOX_KEY = name$1;
225
- const [name, bem] = createNamespace("checkbox");
226
- const Checkbox = /* @__PURE__ */ defineComponent({
227
- name,
158
+ }, [K, H] = $("checkbox-group"), L = K, [D, k] = $("checkbox"), x = /* @__PURE__ */ V({
159
+ name: D,
228
160
  props: {
229
161
  modelValue: {
230
162
  type: Boolean,
231
- default: false
163
+ default: !1
232
164
  },
233
165
  name: {
234
166
  type: String,
@@ -236,7 +168,7 @@ const Checkbox = /* @__PURE__ */ defineComponent({
236
168
  },
237
169
  disabled: {
238
170
  type: Boolean,
239
- default: false
171
+ default: !1
240
172
  },
241
173
  size: {
242
174
  type: [String, Number],
@@ -244,120 +176,73 @@ const Checkbox = /* @__PURE__ */ defineComponent({
244
176
  },
245
177
  square: {
246
178
  type: Boolean,
247
- default: true
179
+ default: !0
248
180
  },
249
181
  checkedColor: {
250
182
  type: String,
251
183
  default: ""
252
184
  }
253
185
  },
254
- setup(props, {
255
- slots,
256
- emit,
257
- expose
186
+ setup(e, {
187
+ slots: n,
188
+ emit: a,
189
+ expose: l
258
190
  }) {
259
191
  const {
260
- parent
261
- } = useRelation(CHECKBOX_KEY);
262
- const formParent = parent === null ? useFormItem().parent : null;
263
- if (parent) {
264
- parent.allItemNames.push(props.name);
265
- }
266
- const getComputedFromParent = (propsName, defaultValue = null) => {
267
- return computed(() => {
268
- if (parent && parent.props[propsName] !== null) {
269
- return parent.props[propsName];
270
- }
271
- if (Object.keys(props).includes(propsName)) {
272
- return props[propsName];
273
- }
274
- return defaultValue;
275
- });
192
+ parent: t
193
+ } = A(L), u = t === null ? R().parent : null;
194
+ t && t.allItemNames.push(e.name);
195
+ const o = (r, s = null) => f(() => t && t.props[r] !== null ? t.props[r] : Object.keys(e).includes(r) ? e[r] : s), m = o("disabled"), g = o("square"), y = o("checkedColor"), v = o("horizontal", !1), c = f(() => t ? t.props.modelValue.includes(e.name) : e.modelValue), h = (r) => {
196
+ var s;
197
+ m.value || typeof r < "u" && c.value === r || ((s = t == null ? void 0 : t.onItemChange) == null || s.call(t, e.name), a("update:modelValue", !e.modelValue), a("change", !e.modelValue));
276
198
  };
277
- const disabled = getComputedFromParent("disabled");
278
- const square = getComputedFromParent("square");
279
- const checkedColor = getComputedFromParent("checkedColor");
280
- const horizontal = getComputedFromParent("horizontal", false);
281
- const checked = computed(() => {
282
- if (parent) {
283
- return parent.props.modelValue.includes(props.name);
284
- }
285
- return props.modelValue;
199
+ l({
200
+ toggle: h
286
201
  });
287
- const toggle = (toChecked) => {
288
- var _a;
289
- if (disabled.value)
290
- return;
291
- if (typeof toChecked !== "undefined" && checked.value === toChecked)
292
- return;
293
- (_a = parent == null ? void 0 : parent.onItemChange) == null ? void 0 : _a.call(parent, props.name);
294
- emit("update:modelValue", !props.modelValue);
295
- emit("change", !props.modelValue);
296
- };
297
- expose({
298
- toggle
202
+ const d = f(() => ["mini", "small", "middle", "large"].includes(e.size.toString() || (u == null ? void 0 : u.getProp("size"))) ? null : O(e.size)), _ = f(() => {
203
+ const r = {};
204
+ return d.value && (r.width = d.value, r.height = d.value), c.value && y.value && (r.backgroundColor = y.value), r;
299
205
  });
300
- const iconSize = computed(() => {
301
- if (["mini", "small", "middle", "large"].includes(props.size.toString() || (formParent == null ? void 0 : formParent.getProp("size")))) {
302
- return null;
303
- }
304
- return parseUnit(props.size);
305
- });
306
- const iconStyle = computed(() => {
307
- const style2 = {};
308
- if (iconSize.value) {
309
- style2.width = iconSize.value;
310
- style2.height = iconSize.value;
311
- }
312
- if (checked.value && checkedColor.value) {
313
- style2.backgroundColor = checkedColor.value;
314
- }
315
- return style2;
316
- });
317
- onBeforeUnmount(() => {
318
- if (!parent)
206
+ return w(() => {
207
+ if (!t)
319
208
  return;
320
- const index = parent.allItemNames.indexOf(props.name);
321
- if (index >= 0) {
322
- parent.allItemNames.splice(index, 1);
323
- }
324
- });
325
- return () => {
326
- var _a, _b;
209
+ const r = t.allItemNames.indexOf(e.name);
210
+ r >= 0 && t.allItemNames.splice(r, 1);
211
+ }), () => {
212
+ var s, S;
327
213
  const {
328
- size
329
- } = props;
330
- return createVNode("div", {
331
- "class": bem({
332
- disabled: disabled.value,
333
- checked: checked.value,
334
- horizontal: horizontal.value,
335
- [size]: ["mini", "small", "middle", "large"].includes(size.toString())
214
+ size: r
215
+ } = e;
216
+ return i("div", {
217
+ class: k({
218
+ disabled: m.value,
219
+ checked: c.value,
220
+ horizontal: v.value,
221
+ [r]: ["mini", "small", "middle", "large"].includes(r.toString())
336
222
  }),
337
- "onClick": () => toggle(),
338
- "role": "checkbox",
339
- "aria-checked": checked.value
340
- }, [((_a = slots.icon) == null ? void 0 : _a.call(slots, {
341
- checked: checked.value
342
- })) || createVNode("div", {
343
- "class": bem("icon", {
344
- checked: checked.value,
345
- square: square.value
223
+ onClick: () => h(),
224
+ role: "checkbox",
225
+ "aria-checked": c.value
226
+ }, [((s = n.icon) == null ? void 0 : s.call(n, {
227
+ checked: c.value
228
+ })) || i("div", {
229
+ class: k("icon", {
230
+ checked: c.value,
231
+ square: g.value
346
232
  }),
347
- "style": iconStyle.value
348
- }, [checked.value ? createVNode(Icon, {
349
- "name": "done"
350
- }, null) : null]), createVNode("div", {
351
- "class": bem("label")
352
- }, [(_b = slots.default) == null ? void 0 : _b.call(slots)])]);
233
+ style: _.value
234
+ }, [c.value ? i(p, {
235
+ name: "done"
236
+ }, null) : null]), i("div", {
237
+ class: k("label")
238
+ }, [(S = n.default) == null ? void 0 : S.call(n)])]);
353
239
  };
354
240
  }
355
241
  });
356
- const style = "";
357
- Checkbox.install = (Vue) => {
358
- const { name: name2 } = Checkbox;
359
- Vue.component(name2, Checkbox);
242
+ x.install = (e) => {
243
+ const { name: n } = x;
244
+ e.component(n, x);
360
245
  };
361
246
  export {
362
- Checkbox as default
247
+ x as default
363
248
  };