@n8n/chat 0.5.2 → 0.6.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/.eslintignore +2 -0
- package/.eslintrc.cjs +51 -0
- package/.np-config.json +5 -0
- package/.storybook/main.ts +27 -0
- package/.storybook/preview.scss +4 -0
- package/.storybook/preview.ts +16 -0
- package/.vscode/extensions.json +3 -0
- package/README.md +4 -21
- package/env.d.ts +1 -0
- package/index.html +13 -0
- package/package.json +2 -69
- package/resources/workflow.json +293 -0
- package/scripts/pack.js +11 -0
- package/scripts/postbuild.js +16 -0
- package/{App.vue → src/App.vue} +2 -2
- package/src/__stories__/App.stories.ts +43 -0
- package/src/__tests__/index.spec.ts +223 -0
- package/src/__tests__/utils/create.ts +16 -0
- package/src/__tests__/utils/fetch.ts +18 -0
- package/src/__tests__/utils/selectors.ts +53 -0
- package/src/api/generic.ts +64 -0
- package/src/api/message.ts +31 -0
- package/src/components/Button.vue +41 -0
- package/{components → src/components}/Chat.vue +15 -19
- package/src/components/ChatWindow.vue +125 -0
- package/src/components/GetStarted.vue +24 -0
- package/{components → src/components}/GetStartedFooter.vue +4 -4
- package/{components → src/components}/Input.vue +40 -35
- package/src/components/Layout.vue +82 -0
- package/src/components/Message.vue +97 -0
- package/src/components/MessageTyping.vue +109 -0
- package/{components → src/components}/MessagesList.vue +8 -8
- package/{components → src/components}/PoweredBy.vue +7 -6
- package/src/composables/useChat.ts +7 -0
- package/src/composables/useI18n.ts +16 -0
- package/src/composables/useOptions.ts +11 -0
- package/src/constants/defaults.ts +25 -0
- package/{constants/localStorage.mjs → src/constants/localStorage.ts} +1 -1
- package/src/constants/symbols.ts +8 -0
- package/src/event-buses/chatEventBus.ts +3 -0
- package/src/index.ts +42 -0
- package/src/main.scss +40 -0
- package/src/plugins/chat.ts +101 -0
- package/src/types/chat.ts +12 -0
- package/src/types/messages.ts +6 -0
- package/src/types/options.ts +23 -0
- package/src/types/webhook.ts +17 -0
- package/src/utils/event-bus.ts +51 -0
- package/src/utils/mount.ts +16 -0
- package/tsconfig.json +27 -0
- package/vite.config.ts +51 -0
- package/vitest.config.ts +20 -0
- package/__stories__/App.stories.d.ts +0 -16
- package/__stories__/App.stories.js +0 -38
- package/__stories__/App.stories.mjs +0 -32
- package/__tests__/index.spec.d.ts +0 -1
- package/__tests__/index.spec.js +0 -146
- package/__tests__/index.spec.mjs +0 -172
- package/__tests__/setup.js +0 -3
- package/__tests__/setup.mjs +0 -1
- package/__tests__/utils/create.d.ts +0 -5
- package/__tests__/utils/create.js +0 -16
- package/__tests__/utils/create.mjs +0 -10
- package/__tests__/utils/fetch.d.ts +0 -3
- package/__tests__/utils/fetch.js +0 -20
- package/__tests__/utils/fetch.mjs +0 -9
- package/__tests__/utils/index.js +0 -38
- package/__tests__/utils/index.mjs +0 -3
- package/__tests__/utils/selectors.d.ts +0 -12
- package/__tests__/utils/selectors.js +0 -58
- package/__tests__/utils/selectors.mjs +0 -41
- package/api/generic.d.ts +0 -6
- package/api/generic.js +0 -68
- package/api/generic.mjs +0 -54
- package/api/index.js +0 -27
- package/api/index.mjs +0 -2
- package/api/message.d.ts +0 -3
- package/api/message.js +0 -33
- package/api/message.mjs +0 -30
- package/chat.bundle.es.js +0 -10760
- package/chat.bundle.umd.js +0 -18
- package/components/Button.vue +0 -34
- package/components/ChatWindow.vue +0 -104
- package/components/GetStarted.vue +0 -24
- package/components/Layout.vue +0 -66
- package/components/Message.vue +0 -94
- package/components/MessageTyping.vue +0 -101
- package/components/index.js +0 -76
- package/components/index.mjs +0 -10
- package/composables/index.js +0 -38
- package/composables/index.mjs +0 -3
- package/composables/useChat.d.ts +0 -1
- package/composables/useChat.js +0 -11
- package/composables/useChat.mjs +0 -5
- package/composables/useI18n.d.ts +0 -4
- package/composables/useI18n.js +0 -23
- package/composables/useI18n.mjs +0 -12
- package/composables/useOptions.d.ts +0 -3
- package/composables/useOptions.js +0 -14
- package/composables/useOptions.mjs +0 -8
- package/constants/defaults.d.ts +0 -3
- package/constants/defaults.js +0 -32
- package/constants/defaults.mjs +0 -26
- package/constants/index.js +0 -38
- package/constants/index.mjs +0 -3
- package/constants/localStorage.d.ts +0 -2
- package/constants/localStorage.js +0 -8
- package/constants/symbols.d.ts +0 -3
- package/constants/symbols.js +0 -8
- package/constants/symbols.mjs +0 -2
- package/css/index.css +0 -31
- package/event-buses/chatEventBus.d.ts +0 -1
- package/event-buses/chatEventBus.js +0 -8
- package/event-buses/chatEventBus.mjs +0 -2
- package/event-buses/index.js +0 -16
- package/event-buses/index.mjs +0 -1
- package/index.d.ts +0 -3
- package/index.js +0 -43
- package/index.mjs +0 -36
- package/main.css +0 -151
- package/plugins/chat.d.ts +0 -3
- package/plugins/chat.js +0 -85
- package/plugins/chat.mjs +0 -83
- package/plugins/index.js +0 -16
- package/plugins/index.mjs +0 -1
- package/style.css +0 -1
- package/types/App.vue.d.ts +0 -8
- package/types/__stories__/App.stories.d.ts +0 -17
- package/types/__tests__/index.spec.d.ts +0 -1
- package/types/__tests__/setup.d.ts +0 -0
- package/types/__tests__/utils/create.d.ts +0 -5
- package/types/__tests__/utils/fetch.d.ts +0 -4
- package/types/__tests__/utils/index.d.ts +0 -3
- package/types/__tests__/utils/selectors.d.ts +0 -12
- package/types/api/generic.d.ts +0 -6
- package/types/api/index.d.ts +0 -2
- package/types/api/message.d.ts +0 -3
- package/types/chat.d.ts +0 -11
- package/types/chat.js +0 -1
- package/types/chat.mjs +0 -0
- package/types/components/Button.vue.d.ts +0 -9
- package/types/components/Chat.vue.d.ts +0 -2
- package/types/components/ChatWindow.vue.d.ts +0 -2
- package/types/components/GetStarted.vue.d.ts +0 -2
- package/types/components/GetStartedFooter.vue.d.ts +0 -2
- package/types/components/Input.vue.d.ts +0 -2
- package/types/components/Layout.vue.d.ts +0 -11
- package/types/components/Message.vue.d.ts +0 -21
- package/types/components/MessageTyping.vue.d.ts +0 -15
- package/types/components/MessagesList.vue.d.ts +0 -14
- package/types/components/PoweredBy.vue.d.ts +0 -2
- package/types/components/index.d.ts +0 -10
- package/types/composables/index.d.ts +0 -3
- package/types/composables/useChat.d.ts +0 -2
- package/types/composables/useI18n.d.ts +0 -4
- package/types/composables/useOptions.d.ts +0 -4
- package/types/constants/defaults.d.ts +0 -3
- package/types/constants/index.d.ts +0 -3
- package/types/constants/localStorage.d.ts +0 -2
- package/types/constants/symbols.d.ts +0 -4
- package/types/event-buses/chatEventBus.d.ts +0 -1
- package/types/event-buses/index.d.ts +0 -1
- package/types/index.js +0 -49
- package/types/index.mjs +0 -4
- package/types/messages.d.ts +0 -6
- package/types/messages.js +0 -1
- package/types/messages.mjs +0 -0
- package/types/options.d.ts +0 -25
- package/types/options.js +0 -1
- package/types/options.mjs +0 -0
- package/types/plugins/chat.d.ts +0 -3
- package/types/plugins/index.d.ts +0 -1
- package/types/src/App.vue.d.ts +0 -8
- package/types/src/__stories__/App.stories.d.ts +0 -17
- package/types/src/__tests__/index.spec.d.ts +0 -1
- package/types/src/__tests__/setup.d.ts +0 -0
- package/types/src/__tests__/utils/create.d.ts +0 -5
- package/types/src/__tests__/utils/fetch.d.ts +0 -4
- package/types/src/__tests__/utils/index.d.ts +0 -3
- package/types/src/__tests__/utils/selectors.d.ts +0 -12
- package/types/src/api/generic.d.ts +0 -6
- package/types/src/api/index.d.ts +0 -2
- package/types/src/api/message.d.ts +0 -3
- package/types/src/components/Button.vue.d.ts +0 -9
- package/types/src/components/Chat.vue.d.ts +0 -2
- package/types/src/components/ChatWindow.vue.d.ts +0 -2
- package/types/src/components/GetStarted.vue.d.ts +0 -2
- package/types/src/components/GetStartedFooter.vue.d.ts +0 -2
- package/types/src/components/Input.vue.d.ts +0 -2
- package/types/src/components/Layout.vue.d.ts +0 -11
- package/types/src/components/Message.vue.d.ts +0 -21
- package/types/src/components/MessageTyping.vue.d.ts +0 -15
- package/types/src/components/MessagesList.vue.d.ts +0 -14
- package/types/src/components/PoweredBy.vue.d.ts +0 -2
- package/types/src/components/index.d.ts +0 -10
- package/types/src/composables/index.d.ts +0 -3
- package/types/src/composables/useChat.d.ts +0 -2
- package/types/src/composables/useI18n.d.ts +0 -4
- package/types/src/composables/useOptions.d.ts +0 -4
- package/types/src/constants/defaults.d.ts +0 -3
- package/types/src/constants/index.d.ts +0 -3
- package/types/src/constants/localStorage.d.ts +0 -2
- package/types/src/constants/symbols.d.ts +0 -4
- package/types/src/event-buses/chatEventBus.d.ts +0 -1
- package/types/src/event-buses/index.d.ts +0 -1
- package/types/src/index.d.ts +0 -2
- package/types/src/plugins/chat.d.ts +0 -3
- package/types/src/plugins/index.d.ts +0 -1
- package/types/src/types/chat.d.ts +0 -11
- package/types/src/types/index.d.ts +0 -4
- package/types/src/types/messages.d.ts +0 -6
- package/types/src/types/options.d.ts +0 -25
- package/types/src/types/webhook.d.ts +0 -15
- package/types/src/utils/event-bus.d.ts +0 -8
- package/types/src/utils/mount.d.ts +0 -1
- package/types/types/chat.d.ts +0 -11
- package/types/types/index.d.ts +0 -4
- package/types/types/messages.d.ts +0 -6
- package/types/types/options.d.ts +0 -25
- package/types/types/webhook.d.ts +0 -15
- package/types/utils/event-bus.d.ts +0 -8
- package/types/utils/index.d.ts +0 -2
- package/types/utils/mount.d.ts +0 -1
- package/types/webhook.d.ts +0 -15
- package/types/webhook.js +0 -1
- package/types/webhook.mjs +0 -0
- package/utils/event-bus.d.ts +0 -8
- package/utils/event-bus.js +0 -38
- package/utils/event-bus.mjs +0 -32
- package/utils/index.d.ts +0 -2
- package/utils/index.js +0 -27
- package/utils/index.mjs +0 -2
- package/utils/mount.d.ts +0 -1
- package/utils/mount.js +0 -19
- package/utils/mount.mjs +0 -13
- /package/{favicon.ico → public/favicon.ico} +0 -0
- /package/{__tests__/setup.d.ts → src/__tests__/setup.ts} +0 -0
- /package/{__tests__/utils/index.d.ts → src/__tests__/utils/index.ts} +0 -0
- /package/{api/index.d.ts → src/api/index.ts} +0 -0
- /package/{components/index.d.ts → src/components/index.ts} +0 -0
- /package/{composables/index.d.ts → src/composables/index.ts} +0 -0
- /package/{constants/index.d.ts → src/constants/index.ts} +0 -0
- /package/{event-buses/index.d.ts → src/event-buses/index.ts} +0 -0
- /package/{plugins/index.d.ts → src/plugins/index.ts} +0 -0
- /package/{shims.d.ts → src/shims.d.ts} +0 -0
- /package/{types/index.d.ts → src/types/index.ts} +0 -0
- /package/{types/src/utils/index.d.ts → src/utils/index.ts} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const chatEventBus: import('../utils').EventBus;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './chatEventBus';
|
package/types/src/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './chat';
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { ChatMessage } from '../types/messages';
|
|
2
|
-
import type { Ref } from 'vue';
|
|
3
|
-
export interface Chat {
|
|
4
|
-
initialMessages: Ref<ChatMessage[]>;
|
|
5
|
-
messages: Ref<ChatMessage[]>;
|
|
6
|
-
currentSessionId: Ref<string | null>;
|
|
7
|
-
waitingForResponse: Ref<boolean>;
|
|
8
|
-
loadPreviousSession: () => Promise<string | undefined>;
|
|
9
|
-
startNewSession: () => Promise<void>;
|
|
10
|
-
sendMessage: (text: string) => Promise<void>;
|
|
11
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export interface ChatOptions {
|
|
2
|
-
webhookUrl: string;
|
|
3
|
-
webhookConfig?: {
|
|
4
|
-
method?: 'GET' | 'POST';
|
|
5
|
-
headers?: Record<string, string>;
|
|
6
|
-
};
|
|
7
|
-
target?: string | Element;
|
|
8
|
-
mode?: 'window' | 'fullscreen';
|
|
9
|
-
showWelcomeScreen?: boolean;
|
|
10
|
-
loadPreviousSession?: boolean;
|
|
11
|
-
chatInputKey?: string;
|
|
12
|
-
chatSessionKey?: string;
|
|
13
|
-
defaultLanguage?: 'en';
|
|
14
|
-
initialMessages?: string[];
|
|
15
|
-
metadata?: Record<string, unknown>;
|
|
16
|
-
i18n: Record<string, {
|
|
17
|
-
title: string;
|
|
18
|
-
subtitle: string;
|
|
19
|
-
footer: string;
|
|
20
|
-
getStarted: string;
|
|
21
|
-
inputPlaceholder: string;
|
|
22
|
-
[message: string]: string;
|
|
23
|
-
}>;
|
|
24
|
-
theme?: {};
|
|
25
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export interface LoadPreviousSessionResponseItem {
|
|
2
|
-
id: string[];
|
|
3
|
-
kwargs: {
|
|
4
|
-
content: string;
|
|
5
|
-
additional_kwargs: Record<string, unknown>;
|
|
6
|
-
};
|
|
7
|
-
lc: number;
|
|
8
|
-
type: string;
|
|
9
|
-
}
|
|
10
|
-
export interface LoadPreviousSessionResponse {
|
|
11
|
-
data: LoadPreviousSessionResponseItem[];
|
|
12
|
-
}
|
|
13
|
-
export interface SendMessageResponse {
|
|
14
|
-
output: string;
|
|
15
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export type CallbackFn = Function;
|
|
2
|
-
export type UnregisterFn = () => void;
|
|
3
|
-
export interface EventBus {
|
|
4
|
-
on: (eventName: string, fn: CallbackFn) => UnregisterFn;
|
|
5
|
-
off: (eventName: string, fn: CallbackFn) => void;
|
|
6
|
-
emit: <T = Event>(eventName: string, event?: T) => void;
|
|
7
|
-
}
|
|
8
|
-
export declare function createEventBus(): EventBus;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function createDefaultMountingTarget(mountingTarget: string): void;
|
package/types/types/chat.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { ChatMessage } from '../types/messages';
|
|
2
|
-
import type { Ref } from 'vue';
|
|
3
|
-
export interface Chat {
|
|
4
|
-
initialMessages: Ref<ChatMessage[]>;
|
|
5
|
-
messages: Ref<ChatMessage[]>;
|
|
6
|
-
currentSessionId: Ref<string | null>;
|
|
7
|
-
waitingForResponse: Ref<boolean>;
|
|
8
|
-
loadPreviousSession: () => Promise<string | undefined>;
|
|
9
|
-
startNewSession: () => Promise<void>;
|
|
10
|
-
sendMessage: (text: string) => Promise<void>;
|
|
11
|
-
}
|
package/types/types/index.d.ts
DELETED
package/types/types/options.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export interface ChatOptions {
|
|
2
|
-
webhookUrl: string;
|
|
3
|
-
webhookConfig?: {
|
|
4
|
-
method?: 'GET' | 'POST';
|
|
5
|
-
headers?: Record<string, string>;
|
|
6
|
-
};
|
|
7
|
-
target?: string | Element;
|
|
8
|
-
mode?: 'window' | 'fullscreen';
|
|
9
|
-
showWelcomeScreen?: boolean;
|
|
10
|
-
loadPreviousSession?: boolean;
|
|
11
|
-
chatInputKey?: string;
|
|
12
|
-
chatSessionKey?: string;
|
|
13
|
-
defaultLanguage?: 'en';
|
|
14
|
-
initialMessages?: string[];
|
|
15
|
-
metadata?: Record<string, unknown>;
|
|
16
|
-
i18n: Record<string, {
|
|
17
|
-
title: string;
|
|
18
|
-
subtitle: string;
|
|
19
|
-
footer: string;
|
|
20
|
-
getStarted: string;
|
|
21
|
-
inputPlaceholder: string;
|
|
22
|
-
[message: string]: string;
|
|
23
|
-
}>;
|
|
24
|
-
theme?: {};
|
|
25
|
-
}
|
package/types/types/webhook.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export interface LoadPreviousSessionResponseItem {
|
|
2
|
-
id: string[];
|
|
3
|
-
kwargs: {
|
|
4
|
-
content: string;
|
|
5
|
-
additional_kwargs: Record<string, unknown>;
|
|
6
|
-
};
|
|
7
|
-
lc: number;
|
|
8
|
-
type: string;
|
|
9
|
-
}
|
|
10
|
-
export interface LoadPreviousSessionResponse {
|
|
11
|
-
data: LoadPreviousSessionResponseItem[];
|
|
12
|
-
}
|
|
13
|
-
export interface SendMessageResponse {
|
|
14
|
-
output: string;
|
|
15
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export type CallbackFn = Function;
|
|
2
|
-
export type UnregisterFn = () => void;
|
|
3
|
-
export interface EventBus {
|
|
4
|
-
on: (eventName: string, fn: CallbackFn) => UnregisterFn;
|
|
5
|
-
off: (eventName: string, fn: CallbackFn) => void;
|
|
6
|
-
emit: <T = Event>(eventName: string, event?: T) => void;
|
|
7
|
-
}
|
|
8
|
-
export declare function createEventBus(): EventBus;
|
package/types/utils/index.d.ts
DELETED
package/types/utils/mount.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function createDefaultMountingTarget(mountingTarget: string): void;
|
package/types/webhook.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export interface LoadPreviousSessionResponseItem {
|
|
2
|
-
id: string[];
|
|
3
|
-
kwargs: {
|
|
4
|
-
content: string;
|
|
5
|
-
additional_kwargs: Record<string, unknown>;
|
|
6
|
-
};
|
|
7
|
-
lc: number;
|
|
8
|
-
type: string;
|
|
9
|
-
}
|
|
10
|
-
export interface LoadPreviousSessionResponse {
|
|
11
|
-
data: LoadPreviousSessionResponseItem[];
|
|
12
|
-
}
|
|
13
|
-
export interface SendMessageResponse {
|
|
14
|
-
output: string;
|
|
15
|
-
}
|
package/types/webhook.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
package/types/webhook.mjs
DELETED
|
File without changes
|
package/utils/event-bus.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export type CallbackFn = Function;
|
|
2
|
-
export type UnregisterFn = () => void;
|
|
3
|
-
export interface EventBus {
|
|
4
|
-
on: (eventName: string, fn: CallbackFn) => UnregisterFn;
|
|
5
|
-
off: (eventName: string, fn: CallbackFn) => void;
|
|
6
|
-
emit: <T = Event>(eventName: string, event?: T) => void;
|
|
7
|
-
}
|
|
8
|
-
export declare function createEventBus(): EventBus;
|
package/utils/event-bus.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.createEventBus = createEventBus;
|
|
7
|
-
function createEventBus() {
|
|
8
|
-
const handlers = /* @__PURE__ */new Map();
|
|
9
|
-
function off(eventName, fn) {
|
|
10
|
-
const eventFns = handlers.get(eventName);
|
|
11
|
-
if (eventFns) {
|
|
12
|
-
eventFns.splice(eventFns.indexOf(fn) >>> 0, 1);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
function on(eventName, fn) {
|
|
16
|
-
let eventFns = handlers.get(eventName);
|
|
17
|
-
if (!eventFns) {
|
|
18
|
-
eventFns = [fn];
|
|
19
|
-
} else {
|
|
20
|
-
eventFns.push(fn);
|
|
21
|
-
}
|
|
22
|
-
handlers.set(eventName, eventFns);
|
|
23
|
-
return () => off(eventName, fn);
|
|
24
|
-
}
|
|
25
|
-
function emit(eventName, event) {
|
|
26
|
-
const eventFns = handlers.get(eventName);
|
|
27
|
-
if (eventFns) {
|
|
28
|
-
eventFns.slice().forEach(async handler => {
|
|
29
|
-
await handler(event);
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
return {
|
|
34
|
-
on,
|
|
35
|
-
off,
|
|
36
|
-
emit
|
|
37
|
-
};
|
|
38
|
-
}
|
package/utils/event-bus.mjs
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
export function createEventBus() {
|
|
2
|
-
const handlers = /* @__PURE__ */ new Map();
|
|
3
|
-
function off(eventName, fn) {
|
|
4
|
-
const eventFns = handlers.get(eventName);
|
|
5
|
-
if (eventFns) {
|
|
6
|
-
eventFns.splice(eventFns.indexOf(fn) >>> 0, 1);
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
function on(eventName, fn) {
|
|
10
|
-
let eventFns = handlers.get(eventName);
|
|
11
|
-
if (!eventFns) {
|
|
12
|
-
eventFns = [fn];
|
|
13
|
-
} else {
|
|
14
|
-
eventFns.push(fn);
|
|
15
|
-
}
|
|
16
|
-
handlers.set(eventName, eventFns);
|
|
17
|
-
return () => off(eventName, fn);
|
|
18
|
-
}
|
|
19
|
-
function emit(eventName, event) {
|
|
20
|
-
const eventFns = handlers.get(eventName);
|
|
21
|
-
if (eventFns) {
|
|
22
|
-
eventFns.slice().forEach(async (handler) => {
|
|
23
|
-
await handler(event);
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
return {
|
|
28
|
-
on,
|
|
29
|
-
off,
|
|
30
|
-
emit
|
|
31
|
-
};
|
|
32
|
-
}
|
package/utils/index.d.ts
DELETED
package/utils/index.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
var _eventBus = require("./event-bus");
|
|
7
|
-
Object.keys(_eventBus).forEach(function (key) {
|
|
8
|
-
if (key === "default" || key === "__esModule") return;
|
|
9
|
-
if (key in exports && exports[key] === _eventBus[key]) return;
|
|
10
|
-
Object.defineProperty(exports, key, {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function () {
|
|
13
|
-
return _eventBus[key];
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
var _mount = require("./mount");
|
|
18
|
-
Object.keys(_mount).forEach(function (key) {
|
|
19
|
-
if (key === "default" || key === "__esModule") return;
|
|
20
|
-
if (key in exports && exports[key] === _mount[key]) return;
|
|
21
|
-
Object.defineProperty(exports, key, {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
get: function () {
|
|
24
|
-
return _mount[key];
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
});
|
package/utils/index.mjs
DELETED
package/utils/mount.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function createDefaultMountingTarget(mountingTarget: string): void;
|
package/utils/mount.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.createDefaultMountingTarget = createDefaultMountingTarget;
|
|
7
|
-
function createDefaultMountingTarget(mountingTarget) {
|
|
8
|
-
const mountingTargetNode = document.querySelector(mountingTarget);
|
|
9
|
-
if (!mountingTargetNode) {
|
|
10
|
-
const generatedMountingTargetNode = document.createElement("div");
|
|
11
|
-
if (mountingTarget.startsWith("#")) {
|
|
12
|
-
generatedMountingTargetNode.id = mountingTarget.replace("#", "");
|
|
13
|
-
}
|
|
14
|
-
if (mountingTarget.startsWith(".")) {
|
|
15
|
-
generatedMountingTargetNode.classList.add(mountingTarget.replace(".", ""));
|
|
16
|
-
}
|
|
17
|
-
document.body.appendChild(generatedMountingTargetNode);
|
|
18
|
-
}
|
|
19
|
-
}
|
package/utils/mount.mjs
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export function createDefaultMountingTarget(mountingTarget) {
|
|
2
|
-
const mountingTargetNode = document.querySelector(mountingTarget);
|
|
3
|
-
if (!mountingTargetNode) {
|
|
4
|
-
const generatedMountingTargetNode = document.createElement("div");
|
|
5
|
-
if (mountingTarget.startsWith("#")) {
|
|
6
|
-
generatedMountingTargetNode.id = mountingTarget.replace("#", "");
|
|
7
|
-
}
|
|
8
|
-
if (mountingTarget.startsWith(".")) {
|
|
9
|
-
generatedMountingTargetNode.classList.add(mountingTarget.replace(".", ""));
|
|
10
|
-
}
|
|
11
|
-
document.body.appendChild(generatedMountingTargetNode);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|