y-design-ssr 0.2.6 → 0.2.8

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