@kylexd/composable-kit 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/README.md +91 -0
- package/dist/composables/useApi.d.ts +78 -0
- package/dist/composables/useCache.d.ts +23 -0
- package/dist/composables/useCookies.d.ts +8 -0
- package/dist/composables/useCountdown.d.ts +31 -0
- package/dist/composables/useCreatedCancelApi.d.ts +41 -0
- package/dist/composables/useDownload.d.ts +5 -0
- package/dist/composables/useDownloadLink.d.ts +22 -0
- package/dist/composables/useForm.d.ts +13 -0
- package/dist/composables/useIsMobile.d.ts +7 -0
- package/dist/composables/useOpenLink.d.ts +8 -0
- package/dist/composables/useParseZod.d.ts +23 -0
- package/dist/composables/usePcHtmlToMobile.d.ts +40 -0
- package/dist/composables/usePopupQueue.d.ts +22 -0
- package/dist/composables/useQrCode.d.ts +6 -0
- package/dist/composables/useRsa.d.ts +6 -0
- package/dist/composables.d.ts +15 -0
- package/dist/composables.js +2 -0
- package/dist/dayjs-BXpdKo4H.js +65 -0
- package/dist/index.d.ts +34 -0
- package/dist/index.js +5 -0
- package/dist/sdk/useFirebase.d.ts +12 -0
- package/dist/sdk/useIntercom.d.ts +19 -0
- package/dist/sdk/useSalesmartly.d.ts +24 -0
- package/dist/sdk/useTurbolinkSdk.d.ts +30 -0
- package/dist/sdk.d.ts +4 -0
- package/dist/sdk.js +2 -0
- package/dist/tree-Ck3oXYA2.js +332 -0
- package/dist/types/shared.d.ts +11 -0
- package/dist/useRsa-aK-vaZUD.js +739 -0
- package/dist/useTurbolinkSdk-peRMONxI.js +250 -0
- package/dist/utils/copy.d.ts +5 -0
- package/dist/utils/dayjs.d.ts +15 -0
- package/dist/utils/debounce.d.ts +5 -0
- package/dist/utils/deepClone.d.ts +1 -0
- package/dist/utils/encryption.d.ts +11 -0
- package/dist/utils/formatParams.d.ts +4 -0
- package/dist/utils/isNotEmpty.d.ts +1 -0
- package/dist/utils/patterns.d.ts +1 -0
- package/dist/utils/piniaPersistedState.d.ts +15 -0
- package/dist/utils/renderSfc.d.ts +16 -0
- package/dist/utils/singleFlight.d.ts +6 -0
- package/dist/utils/thumbnail.d.ts +13 -0
- package/dist/utils/tree.d.ts +20 -0
- package/dist/utils/typeUtils.d.ts +3 -0
- package/dist/utils.d.ts +14 -0
- package/dist/utils.js +3 -0
- package/package.json +135 -0
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import { nextTick, ref } from "vue";
|
|
2
|
+
import { initializeApp } from "firebase/app";
|
|
3
|
+
import { getAnalytics, logEvent } from "firebase/analytics";
|
|
4
|
+
import Intercom, { hide, onShow, onUnreadCountChange, show, shutdown, update } from "@intercom/messenger-js-sdk";
|
|
5
|
+
import Turbolink from "turbolink-ai";
|
|
6
|
+
//#region src/sdk/useFirebase.ts
|
|
7
|
+
var firebaseAppMap = /* @__PURE__ */ new Map();
|
|
8
|
+
var firebaseAnalyticsMap = /* @__PURE__ */ new Map();
|
|
9
|
+
function useFirebase(options) {
|
|
10
|
+
const key = options.appName ?? "[DEFAULT]";
|
|
11
|
+
let app = firebaseAppMap.get(key) ?? null;
|
|
12
|
+
let analytics = firebaseAnalyticsMap.get(key) ?? null;
|
|
13
|
+
if (!app) {
|
|
14
|
+
app = initializeApp(options.config, options.appName);
|
|
15
|
+
firebaseAppMap.set(key, app);
|
|
16
|
+
}
|
|
17
|
+
if (!analytics) {
|
|
18
|
+
analytics = getAnalytics(app);
|
|
19
|
+
firebaseAnalyticsMap.set(key, analytics);
|
|
20
|
+
}
|
|
21
|
+
const customLogEvent = (eventName, params = {}) => {
|
|
22
|
+
const extras = typeof options.eventExtras === "function" ? options.eventExtras() : options.eventExtras;
|
|
23
|
+
logEvent(analytics, eventName, {
|
|
24
|
+
...params,
|
|
25
|
+
...extras
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
return {
|
|
29
|
+
app,
|
|
30
|
+
analytics,
|
|
31
|
+
customLogEvent
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/types/shared.ts
|
|
36
|
+
function resolveMaybeRef(value) {
|
|
37
|
+
if (value && typeof value === "object" && "value" in value) return value.value;
|
|
38
|
+
return value;
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/sdk/useIntercom.ts
|
|
42
|
+
function useIntercom(options) {
|
|
43
|
+
const intercomLoading = ref(false);
|
|
44
|
+
const intercomUnreadMessage = ref(0);
|
|
45
|
+
const updateUserInfo = () => {
|
|
46
|
+
const user = resolveMaybeRef(options.user);
|
|
47
|
+
if (!user?.userId) return;
|
|
48
|
+
const encryptedUserId = options.encryptUserId?.(String(user.userId)) ?? String(user.userId);
|
|
49
|
+
update(options.mapUser?.(user) ?? {
|
|
50
|
+
created_at: Date.now(),
|
|
51
|
+
name: user.userName,
|
|
52
|
+
user_id: encryptedUserId
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
onShow(() => {
|
|
56
|
+
intercomLoading.value = false;
|
|
57
|
+
});
|
|
58
|
+
onUnreadCountChange((unreadCount) => {
|
|
59
|
+
intercomUnreadMessage.value = unreadCount;
|
|
60
|
+
});
|
|
61
|
+
const initIntercom = () => {
|
|
62
|
+
Intercom({
|
|
63
|
+
app_id: options.appId,
|
|
64
|
+
hide_default_launcher: options.hideDefaultLauncher ?? true
|
|
65
|
+
});
|
|
66
|
+
updateUserInfo();
|
|
67
|
+
};
|
|
68
|
+
const deleteIntercom = () => {
|
|
69
|
+
shutdown();
|
|
70
|
+
options.clearCookies?.("intercom-");
|
|
71
|
+
nextTick(() => initIntercom());
|
|
72
|
+
};
|
|
73
|
+
return {
|
|
74
|
+
initIntercom,
|
|
75
|
+
updateUserInfo,
|
|
76
|
+
deleteIntercom,
|
|
77
|
+
shutdown,
|
|
78
|
+
showIntercom: show,
|
|
79
|
+
hideIntercom: hide,
|
|
80
|
+
intercomLoading,
|
|
81
|
+
intercomUnreadMessage
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
//#endregion
|
|
85
|
+
//#region src/sdk/useSalesmartly.ts
|
|
86
|
+
var salesmartlyStateMap = /* @__PURE__ */ new Map();
|
|
87
|
+
function useSalesmartly(options) {
|
|
88
|
+
const state = getSalesmartlyState(options.script);
|
|
89
|
+
const loadSalesmartly = async () => {
|
|
90
|
+
if (state.isLoaded) return true;
|
|
91
|
+
if (state.promise) return await state.promise;
|
|
92
|
+
state.promise = new Promise((resolve, reject) => {
|
|
93
|
+
const script = document.createElement("script");
|
|
94
|
+
script.src = options.script;
|
|
95
|
+
script.async = true;
|
|
96
|
+
document.body.appendChild(script);
|
|
97
|
+
script.onload = () => {
|
|
98
|
+
const ssq = window.ssq;
|
|
99
|
+
if (!ssq) {
|
|
100
|
+
reject(false);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
ssq.push("onReady", () => {
|
|
104
|
+
state.isLoaded = true;
|
|
105
|
+
state.ssq = ssq;
|
|
106
|
+
state.ssc = window.__ssc;
|
|
107
|
+
resolve(true);
|
|
108
|
+
});
|
|
109
|
+
};
|
|
110
|
+
script.onerror = () => {
|
|
111
|
+
state.isLoaded = false;
|
|
112
|
+
reject(false);
|
|
113
|
+
};
|
|
114
|
+
});
|
|
115
|
+
return await state.promise;
|
|
116
|
+
};
|
|
117
|
+
const updateUserInfo = () => {
|
|
118
|
+
const user = resolveMaybeRef(options.user);
|
|
119
|
+
if (!user?.userId) return;
|
|
120
|
+
const encryptedUserId = options.encryptUserId?.(String(user.userId)) ?? String(user.userId);
|
|
121
|
+
state.ssq?.push("setLoginInfo", options.mapUser?.(user) ?? {
|
|
122
|
+
user_id: encryptedUserId,
|
|
123
|
+
user_name: user.userName,
|
|
124
|
+
language: user.language,
|
|
125
|
+
email: encryptedUserId,
|
|
126
|
+
description: user.level === void 0 ? void 0 : `VIP等级: ${user.level}`,
|
|
127
|
+
update_label_type: "update"
|
|
128
|
+
});
|
|
129
|
+
};
|
|
130
|
+
const initSalesmartly = async () => {
|
|
131
|
+
await loadSalesmartly();
|
|
132
|
+
options.adjustDom?.();
|
|
133
|
+
updateUserInfo();
|
|
134
|
+
state.ssq?.push("onCloseChat", () => options.adjustDom?.());
|
|
135
|
+
};
|
|
136
|
+
return {
|
|
137
|
+
loadSalesmartly,
|
|
138
|
+
initSalesmartly,
|
|
139
|
+
updateUserInfo,
|
|
140
|
+
deleteSalesmartly: async () => {
|
|
141
|
+
await loadSalesmartly();
|
|
142
|
+
state.ssq?.push("clearUser");
|
|
143
|
+
},
|
|
144
|
+
showSalesmartly: async () => {
|
|
145
|
+
await loadSalesmartly();
|
|
146
|
+
state.ssq?.push("chatOpen");
|
|
147
|
+
},
|
|
148
|
+
hideSalesmartly: async () => {
|
|
149
|
+
await loadSalesmartly();
|
|
150
|
+
state.ssq?.push("chatClose");
|
|
151
|
+
},
|
|
152
|
+
hideCloseIcon: async () => {
|
|
153
|
+
await loadSalesmartly();
|
|
154
|
+
state.ssq?.push("hideCloseIcon");
|
|
155
|
+
},
|
|
156
|
+
onUnRead: async (callback) => {
|
|
157
|
+
await loadSalesmartly();
|
|
158
|
+
state.ssq?.push("onUnRead", callback);
|
|
159
|
+
},
|
|
160
|
+
onReceiveMessage: async (callback) => {
|
|
161
|
+
await loadSalesmartly();
|
|
162
|
+
state.ssq?.push("onReceiveMessage", callback);
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
function getSalesmartlyState(script) {
|
|
167
|
+
let state = salesmartlyStateMap.get(script);
|
|
168
|
+
if (!state) {
|
|
169
|
+
state = {
|
|
170
|
+
promise: null,
|
|
171
|
+
isLoaded: false,
|
|
172
|
+
ssq: null,
|
|
173
|
+
ssc: null
|
|
174
|
+
};
|
|
175
|
+
salesmartlyStateMap.set(script, state);
|
|
176
|
+
}
|
|
177
|
+
return state;
|
|
178
|
+
}
|
|
179
|
+
//#endregion
|
|
180
|
+
//#region src/sdk/useTurbolinkSdk.ts
|
|
181
|
+
var initPromiseMap = /* @__PURE__ */ new Map();
|
|
182
|
+
function useTurbolinkSdk(options) {
|
|
183
|
+
const getUid = (uid) => {
|
|
184
|
+
if (uid === void 0 || uid === null) return void 0;
|
|
185
|
+
return options.encryptUserId?.(String(uid)) ?? String(uid);
|
|
186
|
+
};
|
|
187
|
+
const getInitParams = () => {
|
|
188
|
+
const user = resolveMaybeRef(options.user);
|
|
189
|
+
return {
|
|
190
|
+
...resolveMaybeRef(options.config),
|
|
191
|
+
uid: getUid(user?.userId),
|
|
192
|
+
lang: resolveMaybeRef(options.lang) ?? user?.language
|
|
193
|
+
};
|
|
194
|
+
};
|
|
195
|
+
const initTurbolink = async () => {
|
|
196
|
+
const params = getInitParams();
|
|
197
|
+
const key = JSON.stringify(params);
|
|
198
|
+
let promise = initPromiseMap.get(key);
|
|
199
|
+
if (!promise) {
|
|
200
|
+
promise = Turbolink.init(params);
|
|
201
|
+
initPromiseMap.set(key, promise);
|
|
202
|
+
}
|
|
203
|
+
return await promise;
|
|
204
|
+
};
|
|
205
|
+
const setTurbolinkUserInfo = async () => {
|
|
206
|
+
const uid = getUid(resolveMaybeRef(options.user)?.userId);
|
|
207
|
+
if (uid) await Turbolink.setIdentity(uid);
|
|
208
|
+
};
|
|
209
|
+
const registerTurbolinkEvent = async ({ uid }) => {
|
|
210
|
+
await Turbolink.register({ uid: getUid(uid) });
|
|
211
|
+
};
|
|
212
|
+
const loginTurbolinkEvent = async ({ uid }) => {
|
|
213
|
+
await Turbolink.login({ uid: getUid(uid) });
|
|
214
|
+
};
|
|
215
|
+
const loadUrl = async (url, params) => {
|
|
216
|
+
await initTurbolink();
|
|
217
|
+
return await Turbolink.loadUrl({
|
|
218
|
+
...params,
|
|
219
|
+
url,
|
|
220
|
+
clickEventCallback: options.onLoadUrlEvent
|
|
221
|
+
});
|
|
222
|
+
};
|
|
223
|
+
const turbolinkCustomEvent = async (event) => {
|
|
224
|
+
if (!event.eventName) return;
|
|
225
|
+
await Turbolink.customEvent({
|
|
226
|
+
event: event.eventName,
|
|
227
|
+
backCamp: event.backCamp ?? false,
|
|
228
|
+
customData: event.customData ?? []
|
|
229
|
+
});
|
|
230
|
+
};
|
|
231
|
+
const catchTurbolinkEvent = async (event) => {
|
|
232
|
+
try {
|
|
233
|
+
await turbolinkCustomEvent(event);
|
|
234
|
+
} catch {
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
return {
|
|
239
|
+
initTurbolink,
|
|
240
|
+
setTurbolinkUserInfo,
|
|
241
|
+
registerTurbolinkEvent,
|
|
242
|
+
loginTurbolinkEvent,
|
|
243
|
+
logoutTurbolinkEvent: () => Turbolink.logout(),
|
|
244
|
+
loadUrl,
|
|
245
|
+
turbolinkCustomEvent,
|
|
246
|
+
catchTurbolinkEvent
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
//#endregion
|
|
250
|
+
export { useFirebase as a, resolveMaybeRef as i, useSalesmartly as n, useIntercom as r, useTurbolinkSdk as t };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import dayjs from 'dayjs';
|
|
2
|
+
import 'dayjs/plugin/duration';
|
|
3
|
+
import 'dayjs/plugin/minMax';
|
|
4
|
+
import 'dayjs/plugin/relativeTime';
|
|
5
|
+
import 'dayjs/plugin/timezone';
|
|
6
|
+
import 'dayjs/plugin/utc';
|
|
7
|
+
import type { Dayjs } from 'dayjs';
|
|
8
|
+
export declare const dayjsInstance: typeof dayjs;
|
|
9
|
+
export declare function formatTime(date: Date | Dayjs | number | string | undefined | null, format?: string): string;
|
|
10
|
+
export declare function formatTimeWithUtcOffset(date: Date | Dayjs | number | string, offset?: number, format?: string): string;
|
|
11
|
+
export declare function formatLocalStringAsUtcOffset(date: string, offset?: number): string;
|
|
12
|
+
export declare function getNowWithUtcOffset(offset?: number, format?: string): string;
|
|
13
|
+
export declare function formatTimeBeijingStringToUtc8String(date: string): string;
|
|
14
|
+
export declare function getNowBeijingTime(): string;
|
|
15
|
+
export declare function utcFormatToBeijingString(date: string, format?: string): string;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type DebouncedFunction<T extends (...args: unknown[]) => unknown> = {
|
|
2
|
+
(this: ThisParameterType<T>, ...args: Parameters<T>): void;
|
|
3
|
+
cancel: () => void;
|
|
4
|
+
};
|
|
5
|
+
export declare function debounce<T extends (...args: unknown[]) => unknown>(fn: T, wait: number, immediate?: boolean): DebouncedFunction<T>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function deepClone<T>(value: T): T;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface EncryptionKey {
|
|
2
|
+
id: string;
|
|
3
|
+
iv: string;
|
|
4
|
+
key: string;
|
|
5
|
+
}
|
|
6
|
+
export interface EncryptionOptions {
|
|
7
|
+
keys?: EncryptionKey[];
|
|
8
|
+
alphabet?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function encrypt(text: string, keyIndex?: number, options?: EncryptionOptions): string;
|
|
11
|
+
export declare function decrypt(encryptedText: string, options?: EncryptionOptions): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isNotEmpty(value: unknown): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const urlPattern: RegExp;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { StateTree } from 'pinia';
|
|
2
|
+
export interface PersistedStateRuntimeOptions {
|
|
3
|
+
mode: string;
|
|
4
|
+
appVersion: string;
|
|
5
|
+
isProd?: boolean;
|
|
6
|
+
keyPrefix?: string;
|
|
7
|
+
encodeInProd?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function createVersionedPiniaPersistedState(options: PersistedStateRuntimeOptions): {
|
|
10
|
+
plugin: (context: import("pinia").PiniaPluginContext) => void;
|
|
11
|
+
getPersistedState: (id: string) => any;
|
|
12
|
+
removeOldPersistedState: () => void;
|
|
13
|
+
};
|
|
14
|
+
export declare function encodePersistedState(data: StateTree): string;
|
|
15
|
+
export declare function decodePersistedState(data: string): StateTree;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type App, type Component } from 'vue';
|
|
2
|
+
export interface RenderSfcOptions {
|
|
3
|
+
to?: string | Element;
|
|
4
|
+
getProps?: () => Record<string, unknown>;
|
|
5
|
+
getSlot?: () => Record<string, unknown>;
|
|
6
|
+
install?: (app: App) => void;
|
|
7
|
+
containerId?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function renderSFC<T extends Component, R = unknown>(sfc: T, options?: RenderSfcOptions): {
|
|
10
|
+
vnode: () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
11
|
+
[key: string]: any;
|
|
12
|
+
}>;
|
|
13
|
+
container: HTMLDivElement;
|
|
14
|
+
vnodeRef: import("vue").Ref<R | undefined, R | undefined>;
|
|
15
|
+
unmount: () => void;
|
|
16
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export interface SingleFlightOptions<T extends (...args: any[]) => Promise<unknown>> {
|
|
2
|
+
params?: Parameters<T>;
|
|
3
|
+
keyGenerator?: (...args: Parameters<T>) => string;
|
|
4
|
+
}
|
|
5
|
+
export declare function singleFlight<T extends (...args: any[]) => Promise<unknown>>(fn: T, options?: SingleFlightOptions<T>): ReturnType<T>;
|
|
6
|
+
export declare function createSingleFlight<T extends (...args: any[]) => Promise<unknown>>(fn: T, options?: Omit<SingleFlightOptions<T>, 'params'>): T;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface ThumbnailOptions {
|
|
2
|
+
width?: number;
|
|
3
|
+
height?: number;
|
|
4
|
+
quality?: number;
|
|
5
|
+
format?: 'webp' | 'jpg' | 'png' | 'gif' | false;
|
|
6
|
+
}
|
|
7
|
+
export interface ThumbnailUrlOptions extends ThumbnailOptions {
|
|
8
|
+
ossOrigins?: string[];
|
|
9
|
+
isOssUrl?: (url: string) => boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare function getThumbnailUrl(url: string, options?: ThumbnailUrlOptions): string;
|
|
12
|
+
export declare function getOssThumbnailUrl(url: string, options: ThumbnailOptions): string;
|
|
13
|
+
export declare function getCdnThumbnailUrl(url: string, options: ThumbnailOptions): string;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type TreeNode<T, C extends string = 'children'> = {
|
|
2
|
+
[key in C]?: Array<TreeNode<T, C>>;
|
|
3
|
+
} & Omit<T, C>;
|
|
4
|
+
export interface ListToTreeOptions<T, IDType, C extends string = 'children'> {
|
|
5
|
+
childrenField?: C;
|
|
6
|
+
idField: keyof T;
|
|
7
|
+
parentIdField: keyof T;
|
|
8
|
+
rootParentId?: IDType;
|
|
9
|
+
}
|
|
10
|
+
export declare function listToTreeOptimized<T extends Record<string, unknown>, IDType = unknown, C extends string = 'children'>(sourceList: T[], options: ListToTreeOptions<T, IDType, C>): Array<TreeNode<T, C>>;
|
|
11
|
+
type FlattenNode<T extends Record<string, unknown>, PK extends string | undefined, CK extends string, IK extends keyof T> = PK extends string ? {
|
|
12
|
+
[K in PK]: T[IK];
|
|
13
|
+
} & Omit<T, CK> : Omit<T, CK>;
|
|
14
|
+
export interface TreeToListOptions<PK extends string | undefined, CK extends string, IK extends string> {
|
|
15
|
+
childrenKey?: CK;
|
|
16
|
+
idKey?: IK;
|
|
17
|
+
pidKey?: PK;
|
|
18
|
+
}
|
|
19
|
+
export declare function treeOptimizedToList<T extends Record<string, unknown>, PK extends string | undefined = undefined, CK extends string = 'children', IK extends keyof T & string = 'id'>(sourceTree: T[], options?: TreeToListOptions<PK, CK, IK>): Array<FlattenNode<T, PK, CK, IK>>;
|
|
20
|
+
export {};
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from './utils/copy';
|
|
2
|
+
export * from './utils/dayjs';
|
|
3
|
+
export * from './utils/debounce';
|
|
4
|
+
export * from './utils/deepClone';
|
|
5
|
+
export * from './utils/encryption';
|
|
6
|
+
export * from './utils/formatParams';
|
|
7
|
+
export * from './utils/isNotEmpty';
|
|
8
|
+
export * from './utils/patterns';
|
|
9
|
+
export * from './utils/piniaPersistedState';
|
|
10
|
+
export * from './utils/renderSfc';
|
|
11
|
+
export * from './utils/singleFlight';
|
|
12
|
+
export * from './utils/thumbnail';
|
|
13
|
+
export * from './utils/tree';
|
|
14
|
+
export * from './utils/typeUtils';
|
package/dist/utils.js
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { a as formatTimeWithUtcOffset, c as utcFormatToBeijingString, i as formatTimeBeijingStringToUtc8String, l as formatParams, n as formatLocalStringAsUtcOffset, o as getNowBeijingTime, r as formatTime, s as getNowWithUtcOffset, t as dayjsInstance, u as deepClone } from "./dayjs-BXpdKo4H.js";
|
|
2
|
+
import { _ as copyText, a as getThumbnailUrl, c as renderSFC, d as encodePersistedState, f as urlPattern, g as debounce, h as encrypt, i as getOssThumbnailUrl, l as createVersionedPiniaPersistedState, m as decrypt, n as treeOptimizedToList, o as createSingleFlight, p as isNotEmpty, r as getCdnThumbnailUrl, s as singleFlight, t as listToTreeOptimized, u as decodePersistedState } from "./tree-Ck3oXYA2.js";
|
|
3
|
+
export { copyText, createSingleFlight, createVersionedPiniaPersistedState, dayjsInstance, debounce, decodePersistedState, decrypt, deepClone, encodePersistedState, encrypt, formatLocalStringAsUtcOffset, formatParams, formatTime, formatTimeBeijingStringToUtc8String, formatTimeWithUtcOffset, getCdnThumbnailUrl, getNowBeijingTime, getNowWithUtcOffset, getOssThumbnailUrl, getThumbnailUrl, isNotEmpty, listToTreeOptimized, renderSFC, singleFlight, treeOptimizedToList, urlPattern, utcFormatToBeijingString };
|
package/package.json
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@kylexd/composable-kit",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Composable utilities for browser applications.",
|
|
5
|
+
"author": "kyle-z",
|
|
6
|
+
"license": "UNLICENSED",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"vue",
|
|
9
|
+
"composables",
|
|
10
|
+
"utilities",
|
|
11
|
+
"browser"
|
|
12
|
+
],
|
|
13
|
+
"type": "module",
|
|
14
|
+
"sideEffects": false,
|
|
15
|
+
"main": "./dist/index.js",
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"import": "./dist/index.js"
|
|
21
|
+
},
|
|
22
|
+
"./utils": {
|
|
23
|
+
"types": "./dist/utils.d.ts",
|
|
24
|
+
"import": "./dist/utils.js"
|
|
25
|
+
},
|
|
26
|
+
"./composables": {
|
|
27
|
+
"types": "./dist/composables.d.ts",
|
|
28
|
+
"import": "./dist/composables.js"
|
|
29
|
+
},
|
|
30
|
+
"./sdk": {
|
|
31
|
+
"types": "./dist/sdk.d.ts",
|
|
32
|
+
"import": "./dist/sdk.js"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"files": [
|
|
36
|
+
"dist",
|
|
37
|
+
"README.md",
|
|
38
|
+
"package.json"
|
|
39
|
+
],
|
|
40
|
+
"publishConfig": {
|
|
41
|
+
"access": "public",
|
|
42
|
+
"registry": "https://registry.npmjs.org/"
|
|
43
|
+
},
|
|
44
|
+
"scripts": {
|
|
45
|
+
"build": "vite build && tsc -p tsconfig.json --emitDeclarationOnly",
|
|
46
|
+
"type-check": "tsc -p tsconfig.json --noEmit",
|
|
47
|
+
"pack:check": "npm run build && npm --cache .npm-cache pack --dry-run"
|
|
48
|
+
},
|
|
49
|
+
"peerDependencies": {
|
|
50
|
+
"@intercom/messenger-js-sdk": "^0.0.14",
|
|
51
|
+
"copy-to-clipboard": "^3.3.3",
|
|
52
|
+
"crypto-js": "^4.2.0",
|
|
53
|
+
"dayjs": "^1.11.13",
|
|
54
|
+
"destr": "^2.0.3",
|
|
55
|
+
"firebase": "^11.7.1",
|
|
56
|
+
"ismobilejs": "^1.1.1",
|
|
57
|
+
"js-cookie": "^3.0.5",
|
|
58
|
+
"jsencrypt": "^3.3.2",
|
|
59
|
+
"pinia": "^3.0.1",
|
|
60
|
+
"pinia-plugin-persistedstate": "^4.2.0",
|
|
61
|
+
"qrcode": "^1.5.4",
|
|
62
|
+
"turbolink-ai": "^1.2.8",
|
|
63
|
+
"vue": "^3.5.13",
|
|
64
|
+
"zod": "^4.0.17"
|
|
65
|
+
},
|
|
66
|
+
"peerDependenciesMeta": {
|
|
67
|
+
"@intercom/messenger-js-sdk": {
|
|
68
|
+
"optional": true
|
|
69
|
+
},
|
|
70
|
+
"copy-to-clipboard": {
|
|
71
|
+
"optional": true
|
|
72
|
+
},
|
|
73
|
+
"crypto-js": {
|
|
74
|
+
"optional": true
|
|
75
|
+
},
|
|
76
|
+
"dayjs": {
|
|
77
|
+
"optional": true
|
|
78
|
+
},
|
|
79
|
+
"destr": {
|
|
80
|
+
"optional": true
|
|
81
|
+
},
|
|
82
|
+
"firebase": {
|
|
83
|
+
"optional": true
|
|
84
|
+
},
|
|
85
|
+
"ismobilejs": {
|
|
86
|
+
"optional": true
|
|
87
|
+
},
|
|
88
|
+
"js-cookie": {
|
|
89
|
+
"optional": true
|
|
90
|
+
},
|
|
91
|
+
"jsencrypt": {
|
|
92
|
+
"optional": true
|
|
93
|
+
},
|
|
94
|
+
"pinia": {
|
|
95
|
+
"optional": true
|
|
96
|
+
},
|
|
97
|
+
"pinia-plugin-persistedstate": {
|
|
98
|
+
"optional": true
|
|
99
|
+
},
|
|
100
|
+
"qrcode": {
|
|
101
|
+
"optional": true
|
|
102
|
+
},
|
|
103
|
+
"turbolink-ai": {
|
|
104
|
+
"optional": true
|
|
105
|
+
},
|
|
106
|
+
"vue": {
|
|
107
|
+
"optional": true
|
|
108
|
+
},
|
|
109
|
+
"zod": {
|
|
110
|
+
"optional": true
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
"devDependencies": {
|
|
114
|
+
"@intercom/messenger-js-sdk": "^0.0.14",
|
|
115
|
+
"@types/crypto-js": "^4.2.2",
|
|
116
|
+
"@types/js-cookie": "^3.0.6",
|
|
117
|
+
"@types/qrcode": "^1.5.5",
|
|
118
|
+
"copy-to-clipboard": "^3.3.3",
|
|
119
|
+
"crypto-js": "^4.2.0",
|
|
120
|
+
"dayjs": "^1.11.13",
|
|
121
|
+
"destr": "^2.0.3",
|
|
122
|
+
"firebase": "^11.7.1",
|
|
123
|
+
"ismobilejs": "^1.1.1",
|
|
124
|
+
"js-cookie": "^3.0.5",
|
|
125
|
+
"jsencrypt": "^3.3.2",
|
|
126
|
+
"pinia": "^3.0.1",
|
|
127
|
+
"pinia-plugin-persistedstate": "^4.2.0",
|
|
128
|
+
"qrcode": "^1.5.4",
|
|
129
|
+
"turbolink-ai": "^1.2.8",
|
|
130
|
+
"typescript": "~5.7.3",
|
|
131
|
+
"vite": "^8.0.14",
|
|
132
|
+
"vue": "^3.5.13",
|
|
133
|
+
"zod": "^4.0.17"
|
|
134
|
+
}
|
|
135
|
+
}
|