build: migrate the build tool from vue-cli to vite4 (#208)

This commit is contained in:
Fine0830
2022-12-17 14:07:03 +08:00
committed by GitHub
parent 1e0c253488
commit 44dcb1e7f6
214 changed files with 27014 additions and 54234 deletions

View File

@@ -15,11 +15,7 @@
* limitations under the License.
*/
import dayjs from "dayjs";
export default function dateFormatStep(
date: Date,
step: string,
monthDayDiff?: boolean
): string {
export default function dateFormatStep(date: Date, step: string, monthDayDiff?: boolean): string {
const year = date.getFullYear();
const monthTemp = date.getMonth() + 1;
let month = `${monthTemp}`;
@@ -101,5 +97,4 @@ export const dateFormatTime = (date: Date, step: string): string => {
return "";
};
export const dateFormat = (date: number, pattern = "YYYY-MM-DD HH:mm:ss") =>
dayjs(new Date(date)).format(pattern);
export const dateFormat = (date: number, pattern = "YYYY-MM-DD HH:mm:ss") => dayjs(new Date(date)).format(pattern);

View File

@@ -39,10 +39,7 @@ export function addResizeListener(element: any, fn: () => unknown): void {
export function removeResizeListener(element: any, fn: () => unknown): void {
if (!element || !element.__resizeListeners__) return;
element.__resizeListeners__.splice(
element.__resizeListeners__.indexOf(fn),
1
);
element.__resizeListeners__.splice(element.__resizeListeners__.indexOf(fn), 1);
if (!element.__resizeListeners__.length) {
element.__ro__.disconnect();
}

View File

@@ -53,12 +53,7 @@ export function isNumber(val: unknown): val is number {
}
export function isPromise<T = any>(val: unknown): val is Promise<T> {
return (
is(val, "Promise") &&
isObject(val) &&
isFunction(val.then) &&
isFunction(val.catch)
);
return is(val, "Promise") && isObject(val) && isFunction(val.then) && isFunction(val.catch);
}
export function isString(val: unknown): val is string {

View File

@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Duration } from "@/types/app";
import type { Duration } from "@/types/app";
import { TimeType } from "@/constants/data";
const timeFormat = (time: Date[]): Duration => {

View File

@@ -17,11 +17,7 @@
class Vec2 extends Float32Array {
constructor(v?: unknown, y?: unknown) {
super(2);
if (
v instanceof Vec2 ||
v instanceof Float32Array ||
(v instanceof Array && v.length == 2)
) {
if (v instanceof Vec2 || v instanceof Float32Array || (v instanceof Array && v.length == 2)) {
this[0] = v[0];
this[1] = v[1];
} else if (typeof v === "number" && typeof y === "number") {

View File

@@ -17,19 +17,11 @@
class Vec3 extends Float32Array {
constructor(v?: unknown, y?: unknown, z?: unknown) {
super(3);
if (
v instanceof Vec3 ||
v instanceof Float32Array ||
(v instanceof Array && v.length == 3)
) {
if (v instanceof Vec3 || v instanceof Float32Array || (v instanceof Array && v.length == 3)) {
this[0] = v[0];
this[1] = v[1];
this[2] = v[2];
} else if (
typeof v === "number" &&
typeof y === "number" &&
typeof z === "number"
) {
} else if (typeof v === "number" && typeof y === "number" && typeof z === "number") {
this[0] = v;
this[1] = y;
this[2] = z;
@@ -158,17 +150,9 @@ class Vec3 extends Float32Array {
}
static norm(x: unknown, y: unknown, z: unknown): Vec3 {
const rtn = new Vec3();
if (
x instanceof Vec3 ||
x instanceof Float32Array ||
(x instanceof Array && x.length == 3)
) {
if (x instanceof Vec3 || x instanceof Float32Array || (x instanceof Array && x.length == 3)) {
rtn.copy(x);
} else if (
typeof x === "number" &&
typeof y === "number" &&
typeof z === "number"
) {
} else if (typeof x === "number" && typeof y === "number" && typeof z === "number") {
rtn.xyz(x, y, z);
}
return rtn.norm();