summaryrefslogtreecommitdiff
path: root/packages/frontend/src/directives/index.ts
blob: a88778efaf3742be9b90265433d0b1217488f859 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*
 * SPDX-FileCopyrightText: syuilo and misskey-project
 * SPDX-License-Identifier: AGPL-3.0-only
 */

import type { App, Directive } from 'vue';

import { userPreviewDirective } from './user-preview.js';
import { getSizeDirective } from './get-size.js';
import { rippleDirective } from './ripple.js';
import { tooltipDirective } from './tooltip.js';
import { hotkeyDirective } from './hotkey.js';
import { appearDirective } from './appear.js';
import { animDirective } from './anim.js';
import { clickAnimeDirective } from './click-anime.js';
import { panelDirective } from './panel.js';
import { adaptiveBorderDirective } from './adaptive-border.js';
import { adaptiveBgDirective } from './adaptive-bg.js';

export default function(app: App) {
	for (const [key, value] of Object.entries(directives)) {
		app.directive(key, value);
	}
}

export const directives = {
	'userPreview': userPreviewDirective,
	'user-preview': userPreviewDirective,
	'get-size': getSizeDirective,
	'ripple': rippleDirective,
	'tooltip': tooltipDirective,
	'hotkey': hotkeyDirective,
	'appear': appearDirective,
	'anim': animDirective,
	'click-anime': clickAnimeDirective,
	'panel': panelDirective,
	'adaptive-border': adaptiveBorderDirective,
	'adaptive-bg': adaptiveBgDirective,
} as Record<string, Directive>;

declare module 'vue' {
	export interface GlobalDirectives {
		vUserPreview: typeof userPreviewDirective;
		vGetSize: typeof getSizeDirective;
		vRipple: typeof rippleDirective;
		vTooltip: typeof tooltipDirective;
		vHotkey: typeof hotkeyDirective;
		vAppear: typeof appearDirective;
		vAnim: typeof animDirective;
		vClickAnime: typeof clickAnimeDirective;
		vPanel: typeof panelDirective;
		vAdaptiveBorder: typeof adaptiveBorderDirective;
		vAdaptiveBg: typeof adaptiveBgDirective;
	}
}