@lanrenbang/basecoat-ultra 0.1.7 → 0.2.0
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 → LICENSE.md} +2 -2
- package/README.md +77 -147
- package/dist/css/basecoat.cdn.css +134 -1726
- package/dist/css/basecoat.cdn.min.css +1 -1
- package/dist/css/basecoat.css +34 -24
- package/dist/css/datepicker.css +277 -1080
- package/dist/css/datepicker.min.css +2 -1
- package/dist/css/resizable.css +39 -60
- package/dist/css/resizable.min.css +1 -1
- package/dist/js/all.js +1 -0
- package/dist/js/all.min.js +1 -0
- package/dist/js/basecoat.js +6 -4
- package/dist/js/basecoat.min.js +12 -12
- package/dist/js/carousel.js +8 -0
- package/dist/js/carousel.min.js +24 -17
- package/dist/js/catppuccin-theme-switcher.js +41 -6
- package/dist/js/catppuccin-theme-switcher.min.js +62 -47
- package/dist/js/datepicker.js +211 -46
- package/dist/js/datepicker.min.js +566 -423
- package/dist/js/input-otp.js +69 -79
- package/dist/js/input-otp.min.js +30 -35
- package/dist/js/pagination.js +107 -0
- package/dist/js/pagination.min.js +43 -0
- package/dist/js/resizable.js +35 -46
- package/dist/js/resizable.min.js +180 -182
- package/dist/js/sheet.js +28 -26
- package/dist/js/sheet.min.js +34 -34
- package/dist/js/toast.js +17 -35
- package/dist/js/toast.min.js +35 -56
- package/dist/js/toggle.js +5 -0
- package/dist/js/toggle.min.js +15 -10
- package/package.json +28 -14
- package/CHANGELOG-cn.md +0 -54
- package/CHANGELOG.md +0 -54
- package/README-cn.md +0 -202
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
(() => {
|
|
2
|
-
const l = ["latte", "frappe", "macchiato", "mocha"],
|
|
2
|
+
const l = ["latte", "frappe", "macchiato", "mocha"], v = ["frappe", "macchiato", "mocha"], u = [
|
|
3
3
|
"rosewater",
|
|
4
4
|
"flamingo",
|
|
5
5
|
"pink",
|
|
@@ -15,67 +15,82 @@
|
|
|
15
15
|
"blue",
|
|
16
16
|
"lavender"
|
|
17
17
|
];
|
|
18
|
-
function
|
|
19
|
-
if (!l.includes(
|
|
20
|
-
const a = { background: `var(--ctp-${
|
|
21
|
-
return
|
|
22
|
-
a[
|
|
18
|
+
function w(e) {
|
|
19
|
+
if (!l.includes(e)) return {};
|
|
20
|
+
const a = { background: `var(--ctp-${e}-base)` };
|
|
21
|
+
return u.forEach((c) => {
|
|
22
|
+
a[c] = `var(--ctp-${e}-${c})`;
|
|
23
23
|
}), a;
|
|
24
24
|
}
|
|
25
|
-
function
|
|
26
|
-
const
|
|
27
|
-
l.forEach((
|
|
25
|
+
function f(e, a, c) {
|
|
26
|
+
const n = document.documentElement;
|
|
27
|
+
l.forEach((o) => n.classList.remove(`theme-${o}`)), u.forEach((o) => n.classList.remove(`accent-${o}`)), n.classList.add(`theme-${e}`), n.classList.add(`accent-${a}`), v.includes(e) ? n.classList.add("dark") : n.classList.remove("dark");
|
|
28
28
|
try {
|
|
29
|
-
localStorage.setItem("catppuccin-theme",
|
|
29
|
+
localStorage.setItem("catppuccin-theme", e), localStorage.setItem("catppuccin-accent", a), localStorage.removeItem("basecoat-mode");
|
|
30
30
|
} catch {
|
|
31
31
|
}
|
|
32
|
+
c && c.dispatchEvent(new CustomEvent("change", {
|
|
33
|
+
bubbles: !0,
|
|
34
|
+
detail: { theme: e, accent: a }
|
|
35
|
+
}));
|
|
32
36
|
}
|
|
33
|
-
function
|
|
37
|
+
function E() {
|
|
34
38
|
try {
|
|
35
|
-
const
|
|
36
|
-
if (
|
|
37
|
-
|
|
38
|
-
else if (
|
|
39
|
-
|
|
39
|
+
const e = localStorage.getItem("catppuccin-theme"), a = localStorage.getItem("catppuccin-accent"), c = localStorage.getItem("basecoat-mode");
|
|
40
|
+
if (e && a)
|
|
41
|
+
f(e, a);
|
|
42
|
+
else if (c)
|
|
43
|
+
c === "dark" ? document.documentElement.classList.add("dark") : document.documentElement.classList.remove("dark");
|
|
40
44
|
else {
|
|
41
|
-
const
|
|
42
|
-
document.documentElement.classList.toggle("dark",
|
|
45
|
+
const n = window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
46
|
+
document.documentElement.classList.toggle("dark", n);
|
|
43
47
|
}
|
|
44
|
-
} catch (
|
|
45
|
-
console.error("Basecoat: Theme initialization failed",
|
|
48
|
+
} catch (e) {
|
|
49
|
+
console.error("Basecoat: Theme initialization failed", e);
|
|
46
50
|
}
|
|
47
51
|
}
|
|
48
|
-
|
|
49
|
-
const
|
|
50
|
-
const a =
|
|
51
|
-
let
|
|
52
|
-
(!
|
|
53
|
-
const
|
|
54
|
-
|
|
52
|
+
typeof document < "u" && E();
|
|
53
|
+
const k = (e) => {
|
|
54
|
+
const a = e.querySelector(".theme-flavors"), c = e.querySelector(".theme-accents"), n = e.querySelector(".theme-reset");
|
|
55
|
+
let o = localStorage.getItem("catppuccin-theme");
|
|
56
|
+
(!o || !l.includes(o)) && (o = document.documentElement.classList.contains("dark") ? "mocha" : "latte"), a && (a.innerHTML = "", a.className = "button-group w-full", l.forEach((s) => {
|
|
57
|
+
const t = document.createElement("button");
|
|
58
|
+
t.type = "button", t.className = "btn btn-sm capitalize flex-1", t.textContent = s, t.dataset.flavor = s, a.appendChild(t);
|
|
55
59
|
}));
|
|
56
|
-
const
|
|
60
|
+
const p = () => {
|
|
57
61
|
if (!a) return;
|
|
58
|
-
a.querySelectorAll("[data-flavor]").forEach((
|
|
59
|
-
|
|
62
|
+
a.querySelectorAll("[data-flavor]").forEach((t) => {
|
|
63
|
+
t.dataset.flavor === o ? (t.classList.remove("btn-outline", "btn-ghost"), t.classList.add("btn-primary")) : (t.classList.remove("btn-primary"), t.classList.add("btn-ghost"));
|
|
60
64
|
});
|
|
61
|
-
},
|
|
62
|
-
if (!
|
|
63
|
-
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
},
|
|
65
|
+
}, h = () => {
|
|
66
|
+
if (!c) return;
|
|
67
|
+
c.innerHTML = "";
|
|
68
|
+
const s = w(o), t = localStorage.getItem("catppuccin-theme"), d = localStorage.getItem("catppuccin-accent");
|
|
69
|
+
c.className = "theme-accents grid grid-cols-7 gap-3 place-items-center p-4 rounded-xl border border-border/50 mt-4 transition-colors duration-300", c.style.backgroundColor = s.background, u.forEach((m) => {
|
|
70
|
+
const i = document.createElement("button");
|
|
71
|
+
i.type = "button";
|
|
72
|
+
const g = d === m && t === o;
|
|
73
|
+
if (i.className = `size-6 rounded-full border border-border/20 shadow-sm transition-transform hover:scale-110 focus:outline-none focus:ring-2 focus:ring-ring relative flex items-center justify-center ${g ? "ring-2 ring-white ring-offset-2 scale-110" : ""}`, i.title = m, i.style.backgroundColor = s[m], i.dataset.tooltip = m, i.dataset.side = "top", g) {
|
|
74
|
+
const r = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
75
|
+
r.setAttribute("class", "text-white drop-shadow-sm"), r.style.width = "12px", r.style.height = "12px", r.setAttribute("viewBox", "0 0 24 24"), r.setAttribute("fill", "none"), r.setAttribute("stroke", "currentColor"), r.setAttribute("stroke-width", "3"), r.setAttribute("stroke-linecap", "round"), r.setAttribute("stroke-linejoin", "round");
|
|
76
|
+
const b = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
77
|
+
b.setAttribute("d", "M20 6 9 17l-5-5"), r.appendChild(b), i.appendChild(r);
|
|
78
|
+
}
|
|
79
|
+
i.onclick = (r) => {
|
|
80
|
+
r.stopPropagation(), f(o, m, e), p(), h();
|
|
81
|
+
}, c.appendChild(i);
|
|
70
82
|
});
|
|
71
83
|
};
|
|
72
|
-
a && a.addEventListener("click", (
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
}),
|
|
76
|
-
const
|
|
77
|
-
l.forEach((
|
|
78
|
-
|
|
84
|
+
a && a.addEventListener("click", (s) => {
|
|
85
|
+
const t = s.target.closest("[data-flavor]");
|
|
86
|
+
t && (o = t.dataset.flavor, p(), h());
|
|
87
|
+
}), n && n.addEventListener("click", () => {
|
|
88
|
+
const s = document.documentElement, t = s.classList.contains("dark");
|
|
89
|
+
l.forEach((d) => s.classList.remove(`theme-${d}`)), u.forEach((d) => s.classList.remove(`accent-${d}`)), localStorage.removeItem("catppuccin-theme"), localStorage.removeItem("catppuccin-accent"), localStorage.setItem("basecoat-mode", t ? "dark" : "light"), t ? s.classList.add("dark") : s.classList.remove("dark"), o = t ? "mocha" : "latte", p(), h(), e.dispatchEvent(new CustomEvent("change", {
|
|
90
|
+
bubbles: !0,
|
|
91
|
+
detail: { theme: null, accent: null, mode: t ? "dark" : "light" }
|
|
92
|
+
}));
|
|
93
|
+
}), p(), h(), e.dataset.catppuccinThemeSwitcherInitialized = !0, e.dispatchEvent(new CustomEvent("basecoat:initialized"));
|
|
79
94
|
};
|
|
80
|
-
window.basecoat && window.basecoat.register("catppuccin-theme-switcher", ".catppuccin-theme-switcher",
|
|
95
|
+
window.basecoat && window.basecoat.register("catppuccin-theme-switcher", ".catppuccin-theme-switcher:not([data-catppuccin-theme-switcher-initialized])", k);
|
|
81
96
|
})();
|
package/dist/js/datepicker.js
CHANGED
|
@@ -2313,55 +2313,220 @@ Date.prototype.fp_incr = function(days) {
|
|
|
2313
2313
|
if (typeof window !== "undefined") {
|
|
2314
2314
|
window.flatpickr = flatpickr;
|
|
2315
2315
|
}
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2316
|
+
var zh$1 = { exports: {} };
|
|
2317
|
+
var zh = zh$1.exports;
|
|
2318
|
+
var hasRequiredZh;
|
|
2319
|
+
function requireZh() {
|
|
2320
|
+
if (hasRequiredZh) return zh$1.exports;
|
|
2321
|
+
hasRequiredZh = 1;
|
|
2322
|
+
(function(module, exports$1) {
|
|
2323
|
+
(function(global, factory) {
|
|
2324
|
+
factory(exports$1);
|
|
2325
|
+
})(zh, (function(exports$12) {
|
|
2326
|
+
var fp = typeof window !== "undefined" && window.flatpickr !== void 0 ? window.flatpickr : {
|
|
2327
|
+
l10ns: {}
|
|
2328
|
+
};
|
|
2329
|
+
var Mandarin = {
|
|
2330
|
+
weekdays: {
|
|
2331
|
+
shorthand: ["周日", "周一", "周二", "周三", "周四", "周五", "周六"],
|
|
2332
|
+
longhand: [
|
|
2333
|
+
"星期日",
|
|
2334
|
+
"星期一",
|
|
2335
|
+
"星期二",
|
|
2336
|
+
"星期三",
|
|
2337
|
+
"星期四",
|
|
2338
|
+
"星期五",
|
|
2339
|
+
"星期六"
|
|
2340
|
+
]
|
|
2341
|
+
},
|
|
2342
|
+
months: {
|
|
2343
|
+
shorthand: [
|
|
2344
|
+
"一月",
|
|
2345
|
+
"二月",
|
|
2346
|
+
"三月",
|
|
2347
|
+
"四月",
|
|
2348
|
+
"五月",
|
|
2349
|
+
"六月",
|
|
2350
|
+
"七月",
|
|
2351
|
+
"八月",
|
|
2352
|
+
"九月",
|
|
2353
|
+
"十月",
|
|
2354
|
+
"十一月",
|
|
2355
|
+
"十二月"
|
|
2356
|
+
],
|
|
2357
|
+
longhand: [
|
|
2358
|
+
"一月",
|
|
2359
|
+
"二月",
|
|
2360
|
+
"三月",
|
|
2361
|
+
"四月",
|
|
2362
|
+
"五月",
|
|
2363
|
+
"六月",
|
|
2364
|
+
"七月",
|
|
2365
|
+
"八月",
|
|
2366
|
+
"九月",
|
|
2367
|
+
"十月",
|
|
2368
|
+
"十一月",
|
|
2369
|
+
"十二月"
|
|
2370
|
+
]
|
|
2371
|
+
},
|
|
2372
|
+
rangeSeparator: " 至 ",
|
|
2373
|
+
weekAbbreviation: "周",
|
|
2374
|
+
scrollTitle: "滚动切换",
|
|
2375
|
+
toggleTitle: "点击切换 12/24 小时时制"
|
|
2376
|
+
};
|
|
2377
|
+
fp.l10ns.zh = Mandarin;
|
|
2378
|
+
var zh2 = fp.l10ns;
|
|
2379
|
+
exports$12.Mandarin = Mandarin;
|
|
2380
|
+
exports$12.default = zh2;
|
|
2381
|
+
Object.defineProperty(exports$12, "__esModule", { value: true });
|
|
2382
|
+
}));
|
|
2383
|
+
})(zh$1, zh$1.exports);
|
|
2384
|
+
return zh$1.exports;
|
|
2385
|
+
}
|
|
2386
|
+
var zhExports = requireZh();
|
|
2387
|
+
var zhTw$1 = { exports: {} };
|
|
2388
|
+
var zhTw = zhTw$1.exports;
|
|
2389
|
+
var hasRequiredZhTw;
|
|
2390
|
+
function requireZhTw() {
|
|
2391
|
+
if (hasRequiredZhTw) return zhTw$1.exports;
|
|
2392
|
+
hasRequiredZhTw = 1;
|
|
2393
|
+
(function(module, exports$1) {
|
|
2394
|
+
(function(global, factory) {
|
|
2395
|
+
factory(exports$1);
|
|
2396
|
+
})(zhTw, (function(exports$12) {
|
|
2397
|
+
var fp = typeof window !== "undefined" && window.flatpickr !== void 0 ? window.flatpickr : {
|
|
2398
|
+
l10ns: {}
|
|
2399
|
+
};
|
|
2400
|
+
var MandarinTraditional = {
|
|
2401
|
+
weekdays: {
|
|
2402
|
+
shorthand: ["週日", "週一", "週二", "週三", "週四", "週五", "週六"],
|
|
2403
|
+
longhand: [
|
|
2404
|
+
"星期日",
|
|
2405
|
+
"星期一",
|
|
2406
|
+
"星期二",
|
|
2407
|
+
"星期三",
|
|
2408
|
+
"星期四",
|
|
2409
|
+
"星期五",
|
|
2410
|
+
"星期六"
|
|
2411
|
+
]
|
|
2412
|
+
},
|
|
2413
|
+
months: {
|
|
2414
|
+
shorthand: [
|
|
2415
|
+
"一月",
|
|
2416
|
+
"二月",
|
|
2417
|
+
"三月",
|
|
2418
|
+
"四月",
|
|
2419
|
+
"五月",
|
|
2420
|
+
"六月",
|
|
2421
|
+
"七月",
|
|
2422
|
+
"八月",
|
|
2423
|
+
"九月",
|
|
2424
|
+
"十月",
|
|
2425
|
+
"十一月",
|
|
2426
|
+
"十二月"
|
|
2427
|
+
],
|
|
2428
|
+
longhand: [
|
|
2429
|
+
"一月",
|
|
2430
|
+
"二月",
|
|
2431
|
+
"三月",
|
|
2432
|
+
"四月",
|
|
2433
|
+
"五月",
|
|
2434
|
+
"六月",
|
|
2435
|
+
"七月",
|
|
2436
|
+
"八月",
|
|
2437
|
+
"九月",
|
|
2438
|
+
"十月",
|
|
2439
|
+
"十一月",
|
|
2440
|
+
"十二月"
|
|
2441
|
+
]
|
|
2442
|
+
},
|
|
2443
|
+
rangeSeparator: " 至 ",
|
|
2444
|
+
weekAbbreviation: "週",
|
|
2445
|
+
scrollTitle: "滾動切換",
|
|
2446
|
+
toggleTitle: "點擊切換 12/24 小時時制"
|
|
2447
|
+
};
|
|
2448
|
+
fp.l10ns.zh_tw = MandarinTraditional;
|
|
2449
|
+
var zhTw2 = fp.l10ns;
|
|
2450
|
+
exports$12.MandarinTraditional = MandarinTraditional;
|
|
2451
|
+
exports$12.default = zhTw2;
|
|
2452
|
+
Object.defineProperty(exports$12, "__esModule", { value: true });
|
|
2453
|
+
}));
|
|
2454
|
+
})(zhTw$1, zhTw$1.exports);
|
|
2455
|
+
return zhTw$1.exports;
|
|
2456
|
+
}
|
|
2457
|
+
var zhTwExports = requireZhTw();
|
|
2458
|
+
const EnglishFull = {
|
|
2459
|
+
weekdays: {
|
|
2460
|
+
shorthand: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
|
|
2461
|
+
longhand: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
|
|
2462
|
+
},
|
|
2463
|
+
months: {
|
|
2464
|
+
shorthand: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
|
|
2465
|
+
longhand: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]
|
|
2466
|
+
}
|
|
2343
2467
|
};
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2468
|
+
const EnglishShort = {
|
|
2469
|
+
weekdays: {
|
|
2470
|
+
shorthand: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
|
|
2471
|
+
longhand: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
|
|
2472
|
+
},
|
|
2473
|
+
months: {
|
|
2474
|
+
shorthand: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
|
|
2475
|
+
longhand: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
|
|
2476
|
+
}
|
|
2477
|
+
};
|
|
2478
|
+
const locales = {
|
|
2479
|
+
"zh": zhExports.Mandarin,
|
|
2480
|
+
"zh-tw": zhTwExports.MandarinTraditional,
|
|
2481
|
+
"en-full": EnglishFull,
|
|
2482
|
+
"en-short": EnglishShort
|
|
2483
|
+
};
|
|
2484
|
+
const initDatepicker = (input) => {
|
|
2485
|
+
if (input._flatpickr) return;
|
|
2486
|
+
if (input.dataset.datepickerInitialized) return;
|
|
2487
|
+
const mode = input.dataset.mode || "single";
|
|
2488
|
+
const enableTime = input.dataset.enableTime === "true";
|
|
2489
|
+
const noCalendar = input.dataset.noCalendar === "true";
|
|
2490
|
+
const isInline = input.dataset.inline === "true";
|
|
2491
|
+
const dateFormat = input.dataset.dateFormat || (enableTime && noCalendar ? "H:i" : "Y-m-d");
|
|
2492
|
+
const locale = input.dataset.locale || "en-short";
|
|
2493
|
+
const localeConfig = locales[locale] || EnglishShort;
|
|
2494
|
+
flatpickr(input, {
|
|
2495
|
+
mode,
|
|
2496
|
+
enableTime,
|
|
2497
|
+
noCalendar,
|
|
2498
|
+
inline: isInline,
|
|
2499
|
+
dateFormat,
|
|
2500
|
+
allowInput: true,
|
|
2501
|
+
shorthandCurrentMonth: locale === "en-short",
|
|
2502
|
+
static: !isInline,
|
|
2503
|
+
locale: localeConfig,
|
|
2504
|
+
onOpen: () => {
|
|
2505
|
+
document.dispatchEvent(new CustomEvent("basecoat:popover", { detail: { source: input } }));
|
|
2506
|
+
},
|
|
2507
|
+
onChange: (selectedDates, dateStr) => {
|
|
2508
|
+
input.dispatchEvent(new CustomEvent("change", {
|
|
2509
|
+
bubbles: true,
|
|
2510
|
+
detail: { value: dateStr, dates: selectedDates }
|
|
2511
|
+
}));
|
|
2512
|
+
}
|
|
2363
2513
|
});
|
|
2514
|
+
input.dataset.datepickerInitialized = "true";
|
|
2515
|
+
input.dispatchEvent(new CustomEvent("basecoat:initialized"));
|
|
2516
|
+
};
|
|
2517
|
+
if (window.basecoat) {
|
|
2518
|
+
window.basecoat.register("datepicker", ".datepicker:not([data-datepicker-initialized])", initDatepicker);
|
|
2519
|
+
if (document.readyState === "complete" || document.readyState === "interactive") {
|
|
2520
|
+
window.basecoat.init("datepicker");
|
|
2521
|
+
}
|
|
2364
2522
|
}
|
|
2523
|
+
document.addEventListener("basecoat:popover", (event) => {
|
|
2524
|
+
document.querySelectorAll(".datepicker").forEach((el) => {
|
|
2525
|
+
if (el._flatpickr && el._flatpickr.isOpen && event.detail?.source !== el) {
|
|
2526
|
+
el._flatpickr.close();
|
|
2527
|
+
}
|
|
2528
|
+
});
|
|
2529
|
+
});
|
|
2365
2530
|
export {
|
|
2366
2531
|
initDatepicker
|
|
2367
2532
|
};
|