shujie-ui 0.0.1

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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 sj-ui
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,49 @@
1
+ # sj-ui
2
+
3
+ A UniApp component library for Vue 3.
4
+
5
+ Compatible with Mini Programs (WeChat, Alipay, Baidu, ByteDance, etc.), H5, and App.
6
+
7
+ ## Features
8
+
9
+ - Vue 3 + TypeScript
10
+ - SCSS design system
11
+ - Full platform compatibility
12
+ - Tree-shakable
13
+ - Comprehensive documentation
14
+
15
+ ## Install
16
+
17
+ ```bash
18
+ npm install sj-ui
19
+ ```
20
+
21
+ ## Usage
22
+
23
+ ### Global import
24
+
25
+ ```ts
26
+ import { createSSRApp } from 'vue'
27
+ import SjUI from 'sj-ui'
28
+
29
+ const app = createSSRApp(App)
30
+ app.use(SjUI)
31
+ ```
32
+
33
+ ### On-demand import (easycom)
34
+
35
+ Configure in `pages.json`:
36
+
37
+ ```json
38
+ {
39
+ "easycom": {
40
+ "custom": {
41
+ "^sj-(.*)": "sj-ui/components/sj-$1/sj-$1.vue"
42
+ }
43
+ }
44
+ }
45
+ ```
46
+
47
+ ## License
48
+
49
+ MIT
@@ -0,0 +1,2 @@
1
+ .sj-button[data-v-d5bd5c39]{box-sizing:border-box;text-align:center;white-space:nowrap;appearance:none;cursor:pointer;border:none;outline:none;justify-content:center;align-items:center;margin:0;padding:0;font-weight:500;line-height:1;transition:all .3s cubic-bezier(.645,.045,.355,1);display:inline-flex}.sj-button--small[data-v-d5bd5c39]{height:56rpx;padding:0 24rpx;font-size:24rpx}.sj-button--medium[data-v-d5bd5c39]{height:72rpx;padding:0 32rpx;font-size:28rpx}.sj-button--large[data-v-d5bd5c39]{height:88rpx;padding:0 48rpx;font-size:32rpx}.sj-button--default[data-v-d5bd5c39]{color:#606266;border:1rpx solid #e4e7ed;background:#fff}.sj-button--primary[data-v-d5bd5c39]{color:#fff;background:#2979ff}.sj-button--success[data-v-d5bd5c39]{color:#fff;background:#19be6b}.sj-button--warning[data-v-d5bd5c39]{color:#fff;background:#f90}.sj-button--danger[data-v-d5bd5c39]{color:#fff;background:#fa3534}.sj-button--info[data-v-d5bd5c39]{color:#fff;background:#909399}.sj-button--square[data-v-d5bd5c39]{border-radius:8rpx}.sj-button--round[data-v-d5bd5c39]{border-radius:999rpx}.sj-button--circle[data-v-d5bd5c39]{border-radius:50%;padding:0}.sj-button--circle.sj-button--small[data-v-d5bd5c39]{width:56rpx}.sj-button--circle.sj-button--medium[data-v-d5bd5c39]{width:72rpx}.sj-button--circle.sj-button--large[data-v-d5bd5c39]{width:88rpx}.sj-button--plain[data-v-d5bd5c39]{background:0 0!important}.sj-button--plain.sj-button--primary[data-v-d5bd5c39]{color:#2979ff;border:1rpx solid #2979ff}.sj-button--plain.sj-button--success[data-v-d5bd5c39]{color:#19be6b;border:1rpx solid #19be6b}.sj-button--plain.sj-button--warning[data-v-d5bd5c39]{color:#f90;border:1rpx solid #f90}.sj-button--plain.sj-button--danger[data-v-d5bd5c39]{color:#fa3534;border:1rpx solid #fa3534}.sj-button--plain.sj-button--info[data-v-d5bd5c39]{color:#909399;border:1rpx solid #909399}.sj-button--hairline[data-v-d5bd5c39]{position:relative;border-width:0!important}.sj-button--hairline[data-v-d5bd5c39]:after{content:"";border-radius:inherit;border:1px solid inherit;pointer-events:none;transform-origin:0 0;position:absolute;inset:0;transform:scale(.5)}.sj-button--hairline.sj-button--default[data-v-d5bd5c39]:after{border-color:#e4e7ed}.sj-button--hairline.sj-button--primary[data-v-d5bd5c39]:after{border-color:#2979ff}.sj-button--hairline.sj-button--success[data-v-d5bd5c39]:after{border-color:#19be6b}.sj-button--hairline.sj-button--warning[data-v-d5bd5c39]:after{border-color:#f90}.sj-button--hairline.sj-button--danger[data-v-d5bd5c39]:after{border-color:#fa3534}.sj-button--hairline.sj-button--info[data-v-d5bd5c39]:after{border-color:#909399}.sj-button--disabled[data-v-d5bd5c39]{opacity:.5;cursor:not-allowed;pointer-events:none}.sj-button--loading[data-v-d5bd5c39]{cursor:default}.sj-button--block[data-v-d5bd5c39]{width:100%;display:flex}.sj-button--active[data-v-d5bd5c39]{opacity:.7}.sj-button__icon[data-v-d5bd5c39],.sj-button__loading[data-v-d5bd5c39]{margin-right:8rpx}.sj-button__loading-spinner[data-v-d5bd5c39]{width:32rpx;height:32rpx;border:4rpx solid currentColor;border-top-color:#0000;border-radius:50%;animation:.6s linear infinite sj-spin-d5bd5c39}.sj-button__text[data-v-d5bd5c39]{align-items:center;display:flex}@keyframes sj-spin-d5bd5c39{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.sj-cell[data-v-17f18255]{box-sizing:border-box;width:100%;padding:24rpx 32rpx;font-size:28rpx;background:#fff;align-items:center;line-height:1.5;display:flex;position:relative}.sj-cell[data-v-17f18255]:after{content:"";pointer-events:none;border-bottom:1rpx solid #e4e7ed;transform-origin:0 100%;position:absolute;bottom:0;left:0;right:0}.sj-cell--clickable[data-v-17f18255]{cursor:pointer}.sj-cell--clickable[data-v-17f18255]:active{background:#f2f3f5}.sj-cell--required[data-v-17f18255]:before{content:"*";left:16rpx;color:#fa3534;font-size:32rpx;position:absolute}.sj-cell--borderless[data-v-17f18255]:after{display:none}.sj-cell__left-icon[data-v-17f18255]{margin-right:16rpx;color:#909399}.sj-cell__title[data-v-17f18255]{flex:1;min-width:0}.sj-cell__title-text[data-v-17f18255]{color:#303133;font-size:28rpx}.sj-cell__label[data-v-17f18255]{margin-top:8rpx;color:#909399;font-size:24rpx;line-height:1.2;display:block}.sj-cell__value[data-v-17f18255]{text-align:right;flex:1;min-width:0;overflow:hidden}.sj-cell__value-text[data-v-17f18255]{color:#909399;font-size:28rpx;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.sj-cell__value--alone[data-v-17f18255]{color:#303133;text-align:left}.sj-cell__right-icon[data-v-17f18255]{margin-left:8rpx;color:#c0c4cc;font-size:28rpx}.sj-loading[data-v-6fb17634]{align-items:center;gap:16rpx;color:#909399;display:inline-flex}.sj-loading--vertical[data-v-6fb17634]{gap:8rpx;flex-direction:column}.sj-loading__spinner[data-v-6fb17634]{box-sizing:border-box;animation:.8s linear infinite sj-loading-rotate-6fb17634;position:relative}.sj-loading__circular[data-v-6fb17634]{width:100%;height:100%}.sj-loading__circular-ring[data-v-6fb17634]{border:4rpx solid currentColor;box-sizing:border-box;border-top-color:#0000;border-radius:50%;width:100%;height:100%}.sj-loading__spinner-dot[data-v-6fb17634]{opacity:0;background:currentColor;border-radius:50%;width:20%;height:20%;margin-left:-10%;position:absolute;top:0;left:50%}.sj-loading__spinner-dot[data-v-6fb17634]:first-child{opacity:0;transform:rotate(0)}.sj-loading__spinner-dot[data-v-6fb17634]:nth-child(2){opacity:.0833333;transform:rotate(30deg)}.sj-loading__spinner-dot[data-v-6fb17634]:nth-child(3){opacity:.166667;transform:rotate(60deg)}.sj-loading__spinner-dot[data-v-6fb17634]:nth-child(4){opacity:.25;transform:rotate(90deg)}.sj-loading__spinner-dot[data-v-6fb17634]:nth-child(5){opacity:.333333;transform:rotate(120deg)}.sj-loading__spinner-dot[data-v-6fb17634]:nth-child(6){opacity:.416667;transform:rotate(150deg)}.sj-loading__spinner-dot[data-v-6fb17634]:nth-child(7){opacity:.5;transform:rotate(180deg)}.sj-loading__spinner-dot[data-v-6fb17634]:nth-child(8){opacity:.583333;transform:rotate(210deg)}.sj-loading__spinner-dot[data-v-6fb17634]:nth-child(9){opacity:.666667;transform:rotate(240deg)}.sj-loading__spinner-dot[data-v-6fb17634]:nth-child(10){opacity:.75;transform:rotate(270deg)}.sj-loading__spinner-dot[data-v-6fb17634]:nth-child(11){opacity:.833333;transform:rotate(300deg)}.sj-loading__spinner-dot[data-v-6fb17634]:nth-child(12){opacity:.916667;transform:rotate(330deg)}.sj-loading__spinner--spinner[data-v-6fb17634]{animation:none}.sj-loading__text[data-v-6fb17634]{color:#909399;font-size:28rpx;line-height:1.5}@keyframes sj-loading-rotate-6fb17634{0%{transform:rotate(0)}to{transform:rotate(360deg)}}view,text,scroll-view,swiper,input,textarea,button,image{box-sizing:border-box}button{line-height:inherit;font-size:inherit;background:0 0;border:none;outline:none;margin:0;padding:0}button:after{display:none}input,textarea{box-sizing:border-box}
2
+ /*$vite$:1*/
@@ -0,0 +1,431 @@
1
+ import { Fragment as e, computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, createTextVNode as o, defineComponent as s, normalizeClass as c, normalizeStyle as l, openBlock as u, ref as d, renderList as f, renderSlot as p, toDisplayString as m, unref as h } from "vue";
2
+ //#region src/utils/format.ts
3
+ function g(e, t = "rpx") {
4
+ return e == null ? "" : typeof e == "string" ? /^\d+(\.\d+)?$/.test(e) ? `${e}${t}` : e : `${e}${t}`;
5
+ }
6
+ function _(e) {
7
+ return Number(e.replace(/rpx|px|rem|em|vw|vh/g, ""));
8
+ }
9
+ function v(e, t, n) {
10
+ return Math.min(Math.max(e, t), n);
11
+ }
12
+ function y(e, t = 2) {
13
+ return String(e).padStart(t, "0");
14
+ }
15
+ function b(e) {
16
+ if (typeof e != "object" || !e) return e;
17
+ if (e instanceof Date) return new Date(e.getTime());
18
+ if (Array.isArray(e)) return e.map((e) => b(e));
19
+ let t = {};
20
+ for (let n in e) Object.prototype.hasOwnProperty.call(e, n) && (t[n] = b(e[n]));
21
+ return t;
22
+ }
23
+ var x = 0;
24
+ function S(e = "sj") {
25
+ return `${e}-${++x}-${Math.random().toString(36).slice(2, 8)}`;
26
+ }
27
+ function C(e, t = 300) {
28
+ let n = null;
29
+ return function(...r) {
30
+ n && clearTimeout(n), n = setTimeout(() => {
31
+ e.apply(this, r), n = null;
32
+ }, t);
33
+ };
34
+ }
35
+ function w(e, t = 300) {
36
+ let n = 0;
37
+ return function(...r) {
38
+ let i = Date.now();
39
+ i - n >= t && (e.apply(this, r), n = i);
40
+ };
41
+ }
42
+ function T(e, t) {
43
+ return new Promise((n) => {
44
+ uni.createSelectorQuery().in(t).select(e).boundingClientRect((e) => {
45
+ n(e);
46
+ }).exec();
47
+ });
48
+ }
49
+ //#endregion
50
+ //#region src/components/sj-icon/sj-icon.vue?vue&type=script&setup=true&lang.ts
51
+ var E = /* @__PURE__ */ s({
52
+ __name: "sj-icon",
53
+ props: {
54
+ name: { default: "" },
55
+ color: { default: "" },
56
+ size: { default: "inherit" },
57
+ prefix: { default: "sj-icon" },
58
+ customClass: { default: "" },
59
+ customStyle: { default: "" }
60
+ },
61
+ emits: ["click"],
62
+ setup(e, { emit: n }) {
63
+ let r = e, a = n, o = t(() => g(r.size)), s = (e) => {
64
+ a("click", e);
65
+ };
66
+ return (t, n) => (u(), i("text", {
67
+ class: c([
68
+ e.prefix,
69
+ e.name ? `${e.prefix}-${e.name}` : "",
70
+ e.customClass
71
+ ]),
72
+ style: l([{
73
+ fontSize: o.value,
74
+ color: e.color || void 0
75
+ }, e.customStyle]),
76
+ onClick: s
77
+ }, null, 6));
78
+ }
79
+ }), D = (e, t) => {
80
+ let n = e.__vccOpts || e;
81
+ for (let [e, r] of t) n[e] = r;
82
+ return n;
83
+ }, O = /* @__PURE__ */ D(E, [["__scopeId", "data-v-7cac47d7"]]), k = [
84
+ "disabled",
85
+ "form-type",
86
+ "hover-class"
87
+ ], A = {
88
+ key: 0,
89
+ class: "sj-button__loading"
90
+ }, j = { class: "sj-button__text" }, M = /* @__PURE__ */ D(/* @__PURE__ */ s({
91
+ __name: "sj-button",
92
+ props: {
93
+ type: { default: "default" },
94
+ size: { default: "medium" },
95
+ shape: { default: "square" },
96
+ plain: {
97
+ type: Boolean,
98
+ default: !1
99
+ },
100
+ hairline: {
101
+ type: Boolean,
102
+ default: !1
103
+ },
104
+ disabled: {
105
+ type: Boolean,
106
+ default: !1
107
+ },
108
+ loading: {
109
+ type: Boolean,
110
+ default: !1
111
+ },
112
+ loadingText: { default: "" },
113
+ loadingSize: { default: "40rpx" },
114
+ icon: { default: "" },
115
+ iconPrefix: { default: "sj-icon" },
116
+ block: {
117
+ type: Boolean,
118
+ default: !1
119
+ },
120
+ nativeType: { default: "button" },
121
+ customClass: { default: "" },
122
+ customStyle: { default: "" }
123
+ },
124
+ emits: ["click"],
125
+ setup(t, { emit: s }) {
126
+ let d = t, f = s, h = (e) => {
127
+ d.disabled || d.loading || f("click", e);
128
+ };
129
+ return (s, d) => (u(), i("button", {
130
+ class: c([
131
+ "sj-button",
132
+ `sj-button--${t.type}`,
133
+ `sj-button--${t.size}`,
134
+ `sj-button--${t.shape}`,
135
+ {
136
+ "sj-button--plain": t.plain,
137
+ "sj-button--hairline": t.hairline,
138
+ "sj-button--disabled": t.disabled,
139
+ "sj-button--loading": t.loading,
140
+ "sj-button--block": t.block
141
+ },
142
+ t.customClass
143
+ ]),
144
+ style: l(t.customStyle),
145
+ disabled: t.disabled || t.loading,
146
+ "form-type": t.nativeType === "submit" || t.nativeType === "reset" ? t.nativeType : void 0,
147
+ "hover-class": t.disabled || t.loading ? "" : "sj-button--active",
148
+ "hover-start-time": "20",
149
+ "hover-stay-time": "70",
150
+ onClick: h
151
+ }, [
152
+ t.loading ? (u(), i("view", A, [...d[0] ||= [a("view", { class: "sj-button__loading-spinner" }, null, -1)]])) : r("", !0),
153
+ t.icon && !t.loading ? (u(), n(O, {
154
+ key: 1,
155
+ name: t.icon,
156
+ prefix: t.iconPrefix,
157
+ class: "sj-button__icon"
158
+ }, null, 8, ["name", "prefix"])) : r("", !0),
159
+ a("text", j, [t.loading && t.loadingText ? (u(), i(e, { key: 0 }, [o(m(t.loadingText), 1)], 64)) : p(s.$slots, "default", { key: 1 }, void 0, !0)])
160
+ ], 14, k));
161
+ }
162
+ }), [["__scopeId", "data-v-d5bd5c39"]]);
163
+ //#endregion
164
+ //#region src/components/sj-icon/index.ts
165
+ M.install = (e) => {
166
+ e.component("SjButton", M);
167
+ }, O.install = (e) => {
168
+ e.component("SjIcon", O);
169
+ };
170
+ //#endregion
171
+ //#region src/components/sj-cell/sj-cell.vue?vue&type=script&setup=true&lang.ts
172
+ var N = { class: "sj-cell__title-text" }, P = {
173
+ key: 0,
174
+ class: "sj-cell__label"
175
+ }, F = { class: "sj-cell__value-text" }, I = /* @__PURE__ */ D(/* @__PURE__ */ s({
176
+ __name: "sj-cell",
177
+ props: {
178
+ title: { default: "" },
179
+ value: { default: "" },
180
+ label: { default: "" },
181
+ isLink: {
182
+ type: Boolean,
183
+ default: !1
184
+ },
185
+ arrowDirection: { default: "right" },
186
+ required: {
187
+ type: Boolean,
188
+ default: !1
189
+ },
190
+ clickable: {
191
+ type: Boolean,
192
+ default: !1
193
+ },
194
+ icon: { default: "" },
195
+ iconSize: { default: "" },
196
+ titleWidth: { default: "" },
197
+ titleAlign: { default: "left" },
198
+ border: {
199
+ type: Boolean,
200
+ default: !0
201
+ },
202
+ customClass: { default: "" },
203
+ customStyle: { default: "" }
204
+ },
205
+ emits: ["click"],
206
+ setup(e, { emit: t }) {
207
+ let o = t, s = (e) => {
208
+ o("click", e);
209
+ };
210
+ return (t, o) => (u(), i("view", {
211
+ class: c([
212
+ "sj-cell",
213
+ {
214
+ "sj-cell--clickable": e.clickable || e.isLink,
215
+ "sj-cell--required": e.required,
216
+ "sj-cell--borderless": !e.border
217
+ },
218
+ e.customClass
219
+ ]),
220
+ style: l(e.customStyle),
221
+ onClick: s
222
+ }, [
223
+ e.icon ? (u(), n(O, {
224
+ key: 0,
225
+ name: e.icon,
226
+ size: e.iconSize || "40rpx",
227
+ class: "sj-cell__left-icon"
228
+ }, null, 8, ["name", "size"])) : p(t.$slots, "icon", { key: 1 }, void 0, !0),
229
+ e.title || t.$slots.title || t.$slots.label || e.label ? (u(), i("view", {
230
+ key: 2,
231
+ class: "sj-cell__title",
232
+ style: l({
233
+ textAlign: e.titleAlign,
234
+ flex: e.titleWidth ? `0 0 ${h(g)(e.titleWidth)}` : ""
235
+ })
236
+ }, [p(t.$slots, "title", {}, () => [a("text", N, m(e.title), 1)], !0), p(t.$slots, "label", {}, () => [e.label ? (u(), i("text", P, m(e.label), 1)) : r("", !0)], !0)], 4)) : r("", !0),
237
+ a("view", { class: c(["sj-cell__value", { "sj-cell__value--alone": !e.title && !t.$slots.title }]) }, [p(t.$slots, "default", {}, () => [a("text", F, m(e.value), 1)], !0)], 2),
238
+ e.isLink ? (u(), n(O, {
239
+ key: 3,
240
+ name: `arrow-${e.arrowDirection}`,
241
+ class: "sj-cell__right-icon"
242
+ }, null, 8, ["name"])) : p(t.$slots, "right-icon", { key: 4 }, void 0, !0)
243
+ ], 6));
244
+ }
245
+ }), [["__scopeId", "data-v-17f18255"]]);
246
+ //#endregion
247
+ //#region src/components/sj-cell/index.ts
248
+ I.install = (e) => {
249
+ e.component("SjCell", I);
250
+ };
251
+ //#endregion
252
+ //#region src/components/sj-loading/sj-loading.vue?vue&type=script&setup=true&lang.ts
253
+ var L = {
254
+ key: 0,
255
+ class: "sj-loading__circular"
256
+ }, R = /* @__PURE__ */ D(/* @__PURE__ */ s({
257
+ __name: "sj-loading",
258
+ props: {
259
+ type: { default: "circular" },
260
+ color: { default: "" },
261
+ size: { default: "64rpx" },
262
+ textSize: { default: "" },
263
+ text: { default: "" },
264
+ vertical: {
265
+ type: Boolean,
266
+ default: !1
267
+ },
268
+ customClass: { default: "" },
269
+ customStyle: { default: "" }
270
+ },
271
+ setup(n) {
272
+ let s = n, d = t(() => g(s.size));
273
+ return (t, s) => (u(), i("view", {
274
+ class: c([
275
+ "sj-loading",
276
+ { "sj-loading--vertical": n.vertical },
277
+ n.customClass
278
+ ]),
279
+ style: l(n.customStyle)
280
+ }, [a("view", {
281
+ class: c(["sj-loading__spinner", `sj-loading__spinner--${n.type}`]),
282
+ style: l({
283
+ width: d.value,
284
+ height: d.value,
285
+ color: n.color || void 0
286
+ })
287
+ }, [n.type === "circular" ? (u(), i("view", L, [...s[0] ||= [a("view", { class: "sj-loading__circular-ring" }, null, -1)]])) : (u(), i(e, { key: 1 }, f(12, (e) => a("view", {
288
+ class: "sj-loading__spinner-dot",
289
+ key: e
290
+ })), 64))], 6), n.text || t.$slots.default ? (u(), i("text", {
291
+ key: 0,
292
+ class: "sj-loading__text",
293
+ style: l({ fontSize: n.textSize ? h(g)(n.textSize) : void 0 })
294
+ }, [p(t.$slots, "default", {}, () => [o(m(n.text), 1)], !0)], 4)) : r("", !0)], 6));
295
+ }
296
+ }), [["__scopeId", "data-v-6fb17634"]]);
297
+ //#endregion
298
+ //#region src/components/sj-loading/index.ts
299
+ R.install = (e) => {
300
+ e.component("SjLoading", R);
301
+ };
302
+ //#endregion
303
+ //#region src/utils/platform.ts
304
+ function z() {
305
+ return typeof uni < "u" ? uni.getSystemInfoSync().uniPlatform || "unknown" : typeof window < "u" ? "h5" : "unknown";
306
+ }
307
+ function B() {
308
+ return z() === "h5";
309
+ }
310
+ function V() {
311
+ return z().startsWith("mp-");
312
+ }
313
+ function H() {
314
+ return z() === "mp-weixin";
315
+ }
316
+ function U() {
317
+ return z() === "mp-alipay";
318
+ }
319
+ function W() {
320
+ return z() === "app-plus";
321
+ }
322
+ function G() {
323
+ try {
324
+ return uni.getSystemInfoSync();
325
+ } catch {
326
+ return {
327
+ screenWidth: 375,
328
+ screenHeight: 667,
329
+ windowWidth: 375,
330
+ windowHeight: 667,
331
+ pixelRatio: 2,
332
+ platform: "unknown"
333
+ };
334
+ }
335
+ }
336
+ //#endregion
337
+ //#region src/utils/validate.ts
338
+ function K(e) {
339
+ return e == null ? !0 : typeof e == "string" ? e.trim() === "" : Array.isArray(e) ? e.length === 0 : typeof e == "object" ? Object.keys(e).length === 0 : !1;
340
+ }
341
+ function q(e) {
342
+ return typeof e == "number" && !isNaN(e);
343
+ }
344
+ function J(e) {
345
+ return /^1[3-9]\d{9}$/.test(e);
346
+ }
347
+ function Y(e) {
348
+ return /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(e);
349
+ }
350
+ function X(e) {
351
+ return /^https?:\/\/.+/.test(e);
352
+ }
353
+ function Z(e) {
354
+ return /^\d{15}|\d{18}|\d{17}[Xx]$/.test(e);
355
+ }
356
+ //#endregion
357
+ //#region src/hooks/useVisible.ts
358
+ function Q(e = !1) {
359
+ let t = d(e);
360
+ return {
361
+ visible: t,
362
+ show: () => {
363
+ t.value = !0;
364
+ },
365
+ hide: () => {
366
+ t.value = !1;
367
+ },
368
+ toggle: () => {
369
+ t.value = !t.value;
370
+ }
371
+ };
372
+ }
373
+ //#endregion
374
+ //#region src/hooks/useLoading.ts
375
+ function $(e = !1) {
376
+ let t = d(e), n = () => {
377
+ t.value = !0;
378
+ }, r = () => {
379
+ t.value = !1;
380
+ };
381
+ return {
382
+ loading: t,
383
+ startLoading: n,
384
+ stopLoading: r,
385
+ withLoading: async (e) => {
386
+ try {
387
+ return n(), await e();
388
+ } finally {
389
+ r();
390
+ }
391
+ }
392
+ };
393
+ }
394
+ //#endregion
395
+ //#region src/hooks/useScroll.ts
396
+ function ee(e = 50) {
397
+ let t = d({
398
+ scrollTop: 0,
399
+ scrollLeft: 0,
400
+ isScrollTop: !0,
401
+ isScrollBottom: !1,
402
+ direction: "none"
403
+ }), n = 0;
404
+ return {
405
+ scrollState: t,
406
+ onScroll: w((r) => {
407
+ let { scrollTop: i, scrollLeft: a } = r.detail, o = i > n ? "down" : i < n ? "up" : "none";
408
+ n = i, t.value = {
409
+ scrollTop: i,
410
+ scrollLeft: a,
411
+ isScrollTop: i <= e,
412
+ isScrollBottom: !1,
413
+ direction: o
414
+ };
415
+ }, 100)
416
+ };
417
+ }
418
+ //#endregion
419
+ //#region src/index.ts
420
+ var te = {
421
+ SjButton: M,
422
+ SjIcon: O,
423
+ SjCell: I,
424
+ SjLoading: R
425
+ }, ne = { install: (e) => {
426
+ Object.entries(te).forEach(([t, n]) => {
427
+ e.component(t, n);
428
+ });
429
+ } };
430
+ //#endregion
431
+ export { M as SjButton, I as SjCell, O as SjIcon, R as SjLoading, g as addUnit, v as clamp, C as debounce, b as deepClone, ne as default, z as getPlatform, T as getRect, G as getSystemInfo, U as isAlipay, W as isApp, Y as isEmail, K as isEmpty, B as isH5, Z as isIdCard, V as isMP, q as isNumber, J as isPhone, X as isUrl, H as isWeixin, y as padZero, _ as removeUnit, w as throttle, S as uniqueId, $ as useLoading, ee as useScroll, Q as useVisible };
@@ -0,0 +1 @@
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`vue`)):typeof define==`function`&&define.amd?define([`exports`,`vue`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.SjUI={},e.Vue))})(this,function(e,t){Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});function n(e,t=`rpx`){return e==null?``:typeof e==`string`?/^\d+(\.\d+)?$/.test(e)?`${e}${t}`:e:`${e}${t}`}function r(e){return Number(e.replace(/rpx|px|rem|em|vw|vh/g,``))}function i(e,t,n){return Math.min(Math.max(e,t),n)}function a(e,t=2){return String(e).padStart(t,`0`)}function o(e){if(typeof e!=`object`||!e)return e;if(e instanceof Date)return new Date(e.getTime());if(Array.isArray(e))return e.map(e=>o(e));let t={};for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=o(e[n]));return t}var s=0;function c(e=`sj`){return`${e}-${++s}-${Math.random().toString(36).slice(2,8)}`}function l(e,t=300){let n=null;return function(...r){n&&clearTimeout(n),n=setTimeout(()=>{e.apply(this,r),n=null},t)}}function u(e,t=300){let n=0;return function(...r){let i=Date.now();i-n>=t&&(e.apply(this,r),n=i)}}function d(e,t){return new Promise(n=>{uni.createSelectorQuery().in(t).select(e).boundingClientRect(e=>{n(e)}).exec()})}var f=(0,t.defineComponent)({__name:`sj-icon`,props:{name:{default:``},color:{default:``},size:{default:`inherit`},prefix:{default:`sj-icon`},customClass:{default:``},customStyle:{default:``}},emits:[`click`],setup(e,{emit:r}){let i=e,a=r,o=(0,t.computed)(()=>n(i.size)),s=e=>{a(`click`,e)};return(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`text`,{class:(0,t.normalizeClass)([e.prefix,e.name?`${e.prefix}-${e.name}`:``,e.customClass]),style:(0,t.normalizeStyle)([{fontSize:o.value,color:e.color||void 0},e.customStyle]),onClick:s},null,6))}}),p=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n},m=p(f,[[`__scopeId`,`data-v-7cac47d7`]]),h=[`disabled`,`form-type`,`hover-class`],g={key:0,class:`sj-button__loading`},_={class:`sj-button__text`},v=p((0,t.defineComponent)({__name:`sj-button`,props:{type:{default:`default`},size:{default:`medium`},shape:{default:`square`},plain:{type:Boolean,default:!1},hairline:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},loadingText:{default:``},loadingSize:{default:`40rpx`},icon:{default:``},iconPrefix:{default:`sj-icon`},block:{type:Boolean,default:!1},nativeType:{default:`button`},customClass:{default:``},customStyle:{default:``}},emits:[`click`],setup(e,{emit:n}){let r=e,i=n,a=e=>{r.disabled||r.loading||i(`click`,e)};return(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{class:(0,t.normalizeClass)([`sj-button`,`sj-button--${e.type}`,`sj-button--${e.size}`,`sj-button--${e.shape}`,{"sj-button--plain":e.plain,"sj-button--hairline":e.hairline,"sj-button--disabled":e.disabled,"sj-button--loading":e.loading,"sj-button--block":e.block},e.customClass]),style:(0,t.normalizeStyle)(e.customStyle),disabled:e.disabled||e.loading,"form-type":e.nativeType===`submit`||e.nativeType===`reset`?e.nativeType:void 0,"hover-class":e.disabled||e.loading?``:`sj-button--active`,"hover-start-time":`20`,"hover-stay-time":`70`,onClick:a},[e.loading?((0,t.openBlock)(),(0,t.createElementBlock)(`view`,g,[...r[0]||=[(0,t.createElementVNode)(`view`,{class:`sj-button__loading-spinner`},null,-1)]])):(0,t.createCommentVNode)(``,!0),e.icon&&!e.loading?((0,t.openBlock)(),(0,t.createBlock)(m,{key:1,name:e.icon,prefix:e.iconPrefix,class:`sj-button__icon`},null,8,[`name`,`prefix`])):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`text`,_,[e.loading&&e.loadingText?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:0},[(0,t.createTextVNode)((0,t.toDisplayString)(e.loadingText),1)],64)):(0,t.renderSlot)(n.$slots,`default`,{key:1},void 0,!0)])],14,h))}}),[[`__scopeId`,`data-v-d5bd5c39`]]);v.install=e=>{e.component(`SjButton`,v)},m.install=e=>{e.component(`SjIcon`,m)};var y={class:`sj-cell__title-text`},b={key:0,class:`sj-cell__label`},x={class:`sj-cell__value-text`},S=p((0,t.defineComponent)({__name:`sj-cell`,props:{title:{default:``},value:{default:``},label:{default:``},isLink:{type:Boolean,default:!1},arrowDirection:{default:`right`},required:{type:Boolean,default:!1},clickable:{type:Boolean,default:!1},icon:{default:``},iconSize:{default:``},titleWidth:{default:``},titleAlign:{default:`left`},border:{type:Boolean,default:!0},customClass:{default:``},customStyle:{default:``}},emits:[`click`],setup(e,{emit:r}){let i=r,a=e=>{i(`click`,e)};return(r,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`view`,{class:(0,t.normalizeClass)([`sj-cell`,{"sj-cell--clickable":e.clickable||e.isLink,"sj-cell--required":e.required,"sj-cell--borderless":!e.border},e.customClass]),style:(0,t.normalizeStyle)(e.customStyle),onClick:a},[e.icon?((0,t.openBlock)(),(0,t.createBlock)(m,{key:0,name:e.icon,size:e.iconSize||`40rpx`,class:`sj-cell__left-icon`},null,8,[`name`,`size`])):(0,t.renderSlot)(r.$slots,`icon`,{key:1},void 0,!0),e.title||r.$slots.title||r.$slots.label||e.label?((0,t.openBlock)(),(0,t.createElementBlock)(`view`,{key:2,class:`sj-cell__title`,style:(0,t.normalizeStyle)({textAlign:e.titleAlign,flex:e.titleWidth?`0 0 ${(0,t.unref)(n)(e.titleWidth)}`:``})},[(0,t.renderSlot)(r.$slots,`title`,{},()=>[(0,t.createElementVNode)(`text`,y,(0,t.toDisplayString)(e.title),1)],!0),(0,t.renderSlot)(r.$slots,`label`,{},()=>[e.label?((0,t.openBlock)(),(0,t.createElementBlock)(`text`,b,(0,t.toDisplayString)(e.label),1)):(0,t.createCommentVNode)(``,!0)],!0)],4)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`view`,{class:(0,t.normalizeClass)([`sj-cell__value`,{"sj-cell__value--alone":!e.title&&!r.$slots.title}])},[(0,t.renderSlot)(r.$slots,`default`,{},()=>[(0,t.createElementVNode)(`text`,x,(0,t.toDisplayString)(e.value),1)],!0)],2),e.isLink?((0,t.openBlock)(),(0,t.createBlock)(m,{key:3,name:`arrow-${e.arrowDirection}`,class:`sj-cell__right-icon`},null,8,[`name`])):(0,t.renderSlot)(r.$slots,`right-icon`,{key:4},void 0,!0)],6))}}),[[`__scopeId`,`data-v-17f18255`]]);S.install=e=>{e.component(`SjCell`,S)};var C={key:0,class:`sj-loading__circular`},w=p((0,t.defineComponent)({__name:`sj-loading`,props:{type:{default:`circular`},color:{default:``},size:{default:`64rpx`},textSize:{default:``},text:{default:``},vertical:{type:Boolean,default:!1},customClass:{default:``},customStyle:{default:``}},setup(e){let r=e,i=(0,t.computed)(()=>n(r.size));return(r,a)=>((0,t.openBlock)(),(0,t.createElementBlock)(`view`,{class:(0,t.normalizeClass)([`sj-loading`,{"sj-loading--vertical":e.vertical},e.customClass]),style:(0,t.normalizeStyle)(e.customStyle)},[(0,t.createElementVNode)(`view`,{class:(0,t.normalizeClass)([`sj-loading__spinner`,`sj-loading__spinner--${e.type}`]),style:(0,t.normalizeStyle)({width:i.value,height:i.value,color:e.color||void 0})},[e.type===`circular`?((0,t.openBlock)(),(0,t.createElementBlock)(`view`,C,[...a[0]||=[(0,t.createElementVNode)(`view`,{class:`sj-loading__circular-ring`},null,-1)]])):((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:1},(0,t.renderList)(12,e=>(0,t.createElementVNode)(`view`,{class:`sj-loading__spinner-dot`,key:e})),64))],6),e.text||r.$slots.default?((0,t.openBlock)(),(0,t.createElementBlock)(`text`,{key:0,class:`sj-loading__text`,style:(0,t.normalizeStyle)({fontSize:e.textSize?(0,t.unref)(n)(e.textSize):void 0})},[(0,t.renderSlot)(r.$slots,`default`,{},()=>[(0,t.createTextVNode)((0,t.toDisplayString)(e.text),1)],!0)],4)):(0,t.createCommentVNode)(``,!0)],6))}}),[[`__scopeId`,`data-v-6fb17634`]]);w.install=e=>{e.component(`SjLoading`,w)};function T(){return typeof uni<`u`?uni.getSystemInfoSync().uniPlatform||`unknown`:typeof window<`u`?`h5`:`unknown`}function E(){return T()===`h5`}function D(){return T().startsWith(`mp-`)}function O(){return T()===`mp-weixin`}function k(){return T()===`mp-alipay`}function A(){return T()===`app-plus`}function j(){try{return uni.getSystemInfoSync()}catch{return{screenWidth:375,screenHeight:667,windowWidth:375,windowHeight:667,pixelRatio:2,platform:`unknown`}}}function M(e){return e==null?!0:typeof e==`string`?e.trim()===``:Array.isArray(e)?e.length===0:typeof e==`object`?Object.keys(e).length===0:!1}function N(e){return typeof e==`number`&&!isNaN(e)}function P(e){return/^1[3-9]\d{9}$/.test(e)}function F(e){return/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(e)}function I(e){return/^https?:\/\/.+/.test(e)}function L(e){return/^\d{15}|\d{18}|\d{17}[Xx]$/.test(e)}function R(e=!1){let n=(0,t.ref)(e);return{visible:n,show:()=>{n.value=!0},hide:()=>{n.value=!1},toggle:()=>{n.value=!n.value}}}function z(e=!1){let n=(0,t.ref)(e),r=()=>{n.value=!0},i=()=>{n.value=!1};return{loading:n,startLoading:r,stopLoading:i,withLoading:async e=>{try{return r(),await e()}finally{i()}}}}function B(e=50){let n=(0,t.ref)({scrollTop:0,scrollLeft:0,isScrollTop:!0,isScrollBottom:!1,direction:`none`}),r=0;return{scrollState:n,onScroll:u(t=>{let{scrollTop:i,scrollLeft:a}=t.detail,o=i>r?`down`:i<r?`up`:`none`;r=i,n.value={scrollTop:i,scrollLeft:a,isScrollTop:i<=e,isScrollBottom:!1,direction:o}},100)}}var V={SjButton:v,SjIcon:m,SjCell:S,SjLoading:w};e.SjButton=v,e.SjCell=S,e.SjIcon=m,e.SjLoading=w,e.addUnit=n,e.clamp=i,e.debounce=l,e.deepClone=o,e.default={install:e=>{Object.entries(V).forEach(([t,n])=>{e.component(t,n)})}},e.getPlatform=T,e.getRect=d,e.getSystemInfo=j,e.isAlipay=k,e.isApp=A,e.isEmail=F,e.isEmpty=M,e.isH5=E,e.isIdCard=L,e.isMP=D,e.isNumber=N,e.isPhone=P,e.isUrl=I,e.isWeixin=O,e.padZero=a,e.removeUnit=r,e.throttle=u,e.uniqueId=c,e.useLoading=z,e.useScroll=B,e.useVisible=R});
package/package.json ADDED
@@ -0,0 +1,94 @@
1
+ {
2
+ "name": "shujie-ui",
3
+ "version": "0.0.1",
4
+ "private": false,
5
+ "description": "A UniApp component library for Vue 3, compatible with Mini Programs, H5, and App",
6
+ "keywords": [
7
+ "uniapp",
8
+ "vue3",
9
+ "component-library",
10
+ "ui",
11
+ "mini-program",
12
+ "shujie-ui"
13
+ ],
14
+ "author": "jiashujie",
15
+ "license": "MIT",
16
+ "main": "dist/shujie-ui.umd.js",
17
+ "module": "dist/shujie-ui.es.js",
18
+ "types": "dist/types/index.d.ts",
19
+ "files": [
20
+ "dist",
21
+ "README.md"
22
+ ],
23
+ "exports": {
24
+ ".": {
25
+ "import": "./dist/shujie-ui.es.js",
26
+ "require": "./dist/shujie-ui.umd.js",
27
+ "types": "./dist/types/index.d.ts"
28
+ },
29
+ "./styles/*": "./dist/styles/*"
30
+ },
31
+ "scripts": {
32
+ "dev": "vite",
33
+ "build": "vite build",
34
+ "build:types": "vue-tsc --declaration --emitDeclarationOnly --outDir dist/types",
35
+ "test": "vitest run",
36
+ "test:watch": "vitest",
37
+ "test:coverage": "vitest run --coverage",
38
+ "docs:dev": "vitepress dev docs",
39
+ "docs:build": "vitepress build docs",
40
+ "docs:preview": "vitepress preview docs",
41
+ "lint": "eslint . --ext .vue,.js,.ts,.jsx,.tsx",
42
+ "lint:fix": "eslint . --ext .vue,.js,.ts,.jsx,.tsx --fix",
43
+ "format": "prettier --write \"src/**/*.{js,ts,vue,scss,json}\"",
44
+ "prepare": "husky",
45
+ "prepublishOnly": "npm run build && npm run build:types",
46
+ "release": "npm run prepublishOnly && npm publish"
47
+ },
48
+ "devDependencies": {
49
+ "@commitlint/cli": "^20.5.0",
50
+ "@commitlint/config-conventional": "^20.5.0",
51
+ "@types/node": "^25.6.0",
52
+ "@typescript-eslint/eslint-plugin": "^8.58.1",
53
+ "@typescript-eslint/parser": "^8.58.1",
54
+ "@vitejs/plugin-vue": "^6.0.5",
55
+ "@vitest/coverage-v8": "^4.1.4",
56
+ "@vue/test-utils": "^2.4.6",
57
+ "eslint": "^10.2.0",
58
+ "eslint-config-prettier": "^10.1.8",
59
+ "eslint-plugin-prettier": "^5.5.5",
60
+ "eslint-plugin-vue": "^10.8.0",
61
+ "husky": "^9.1.7",
62
+ "jsdom": "^29.0.2",
63
+ "lint-staged": "^16.4.0",
64
+ "prettier": "^3.8.2",
65
+ "sass": "^1.99.0",
66
+ "typescript": "^6.0.2",
67
+ "vite": "^8.0.8",
68
+ "vitepress": "^1.6.4",
69
+ "vitest": "^4.1.4",
70
+ "vue": "^3.5.32",
71
+ "vue-tsc": "^3.2.6"
72
+ },
73
+ "peerDependencies": {
74
+ "vue": "^3.2.0"
75
+ },
76
+ "lint-staged": {
77
+ "*.{js,ts,vue}": [
78
+ "eslint --fix",
79
+ "prettier --write"
80
+ ],
81
+ "*.{scss,css,json,md}": [
82
+ "prettier --write"
83
+ ]
84
+ },
85
+ "repository": {
86
+ "type": "git",
87
+ "url": ""
88
+ },
89
+ "homepage": "",
90
+ "directories": {
91
+ "doc": "docs",
92
+ "example": "examples"
93
+ }
94
+ }