@morghulis/core 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 +33 -0
- package/dist/favicon.ico +0 -0
- package/dist/index.css +1 -0
- package/dist/morghulis-core.es.js +6044 -0
- package/dist/morghulis-core.es.js.map +1 -0
- package/dist/morghulis-core.umd.js +35 -0
- package/dist/morghulis-core.umd.js.map +1 -0
- package/dist/types/core.d.ts +2 -0
- package/dist/types/index.d.ts +9 -0
- package/dist/types/types.d.ts +17 -0
- package/dist/types/use-channel/Channel.d.ts +17 -0
- package/dist/types/use-channel/ChannelHub.d.ts +9 -0
- package/dist/types/use-channel/index.d.ts +5 -0
- package/dist/types/use-channel/types.d.ts +28 -0
- package/dist/types/use-request/index.d.ts +15 -0
- package/dist/types/use-socket/index.d.ts +5 -0
- package/package.json +44 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { App } from "vue";
|
|
2
|
+
import 'nprogress/nprogress.css';
|
|
3
|
+
import { useRequest } from "./use-request";
|
|
4
|
+
import { IOptions } from "./types";
|
|
5
|
+
import { createChannel, useChannel } from "./use-channel";
|
|
6
|
+
declare const createMorghulisCore: (options?: IOptions) => {
|
|
7
|
+
install(app: App): void;
|
|
8
|
+
};
|
|
9
|
+
export { createMorghulisCore, useRequest, createChannel, useChannel, };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Ref } from "vue";
|
|
2
|
+
import ChannelHub from "./use-channel/ChannelHub";
|
|
3
|
+
export type IOptions = {
|
|
4
|
+
baseURL?: string;
|
|
5
|
+
minioURL?: string;
|
|
6
|
+
$$message?: (msg: string, type: string) => void;
|
|
7
|
+
};
|
|
8
|
+
export type Options = {
|
|
9
|
+
baseURL: string;
|
|
10
|
+
minioURL: string;
|
|
11
|
+
$$message: (type: string, msg: string) => void;
|
|
12
|
+
};
|
|
13
|
+
export type Core = {
|
|
14
|
+
status: Ref<string>;
|
|
15
|
+
open: () => void;
|
|
16
|
+
hub: ChannelHub;
|
|
17
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Reactive } from "vue";
|
|
2
|
+
import { ChannelConfig, ChannelStatus } from "./types";
|
|
3
|
+
import { AxiosInstance } from "axios";
|
|
4
|
+
export default class Channel {
|
|
5
|
+
private config;
|
|
6
|
+
status: Reactive<ChannelStatus>;
|
|
7
|
+
handlerKey: string;
|
|
8
|
+
channelKey: string;
|
|
9
|
+
url: string;
|
|
10
|
+
request: AxiosInstance;
|
|
11
|
+
constructor(config: ChannelConfig);
|
|
12
|
+
execute(data?: any): void;
|
|
13
|
+
ready(): void;
|
|
14
|
+
start(): void;
|
|
15
|
+
proceed(data: any): void;
|
|
16
|
+
stop(): void;
|
|
17
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ChannelConfig, ChannelContainer } from "./types";
|
|
2
|
+
import Channel from "./Channel";
|
|
3
|
+
export default class ChannelHub {
|
|
4
|
+
container: ChannelContainer;
|
|
5
|
+
constructor();
|
|
6
|
+
loadChannel(handlerKey: string, channelKey: string): Promise<Channel>;
|
|
7
|
+
destroy(handlerKey: string, channelKey: string): void;
|
|
8
|
+
register(config: ChannelConfig): Channel;
|
|
9
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import Channel from "./Channel";
|
|
2
|
+
export type IChannelConfig = {
|
|
3
|
+
handlerKey: string;
|
|
4
|
+
channelKey?: string;
|
|
5
|
+
url?: string;
|
|
6
|
+
auth?: boolean;
|
|
7
|
+
onStart?(): void;
|
|
8
|
+
onStop?(): void;
|
|
9
|
+
onProceed?(payload: any): void;
|
|
10
|
+
};
|
|
11
|
+
export type ChannelConfig = {
|
|
12
|
+
handlerKey: string;
|
|
13
|
+
channelKey: string;
|
|
14
|
+
url: string;
|
|
15
|
+
auth?: boolean;
|
|
16
|
+
onStart(): void;
|
|
17
|
+
onStop(): void;
|
|
18
|
+
onProceed?(payload: any): void;
|
|
19
|
+
};
|
|
20
|
+
export type ChannelContainer = {
|
|
21
|
+
[handlerKey: string]: {
|
|
22
|
+
[channelKey: string]: Channel;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export type ChannelStatus = {
|
|
26
|
+
loading: boolean;
|
|
27
|
+
payload: any;
|
|
28
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AxiosInstance } from 'axios';
|
|
2
|
+
import 'nprogress/nprogress.css';
|
|
3
|
+
export declare function useRequest(): {
|
|
4
|
+
getHttpRequest: (auth?: boolean) => AxiosInstance;
|
|
5
|
+
download: (path: string) => void;
|
|
6
|
+
all: (mapping: {
|
|
7
|
+
[key: string]: Promise<any>;
|
|
8
|
+
}) => Promise<{
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
}>;
|
|
11
|
+
read: (path: string) => Promise<{
|
|
12
|
+
blob: Blob;
|
|
13
|
+
fileName: string;
|
|
14
|
+
}>;
|
|
15
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@morghulis/core",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"main": "./dist/morghulis-core.umd.js",
|
|
12
|
+
"module": "./dist/morghulis-core.es.js",
|
|
13
|
+
"types": "./dist/types/index.d.ts",
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"types": "./dist/types/index.d.ts",
|
|
17
|
+
"import": "./dist/morghulis-core.es.js",
|
|
18
|
+
"require": "./dist/morghulis-core.umd.js"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"scripts": {
|
|
22
|
+
"dev": "vite",
|
|
23
|
+
"build": "vite build && vue-tsc --emitDeclarationOnly",
|
|
24
|
+
"preview": "vite preview"
|
|
25
|
+
},
|
|
26
|
+
"peerDependencies": {
|
|
27
|
+
"vue": "^3.5.13"
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@morghulis/utils": "^0.0.8",
|
|
31
|
+
"@vueuse/core": "^13.1.0",
|
|
32
|
+
"axios": "^1.8.1",
|
|
33
|
+
"nprogress": "^0.2.0"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@types/nprogress": "^0.2.3",
|
|
37
|
+
"@types/node": "^22.14.0",
|
|
38
|
+
"@vitejs/plugin-vue": "^5.2.3",
|
|
39
|
+
"typescript": "~5.8.0",
|
|
40
|
+
"vite": "^6.2.4",
|
|
41
|
+
"vite-plugin-vue-devtools": "^7.7.2",
|
|
42
|
+
"vue-tsc": "^2.2.8"
|
|
43
|
+
}
|
|
44
|
+
}
|