lib/types.ts
last analyzed

Complexity

Total Complexity 0
Complexity/F 0

Size

Lines of Code 58
Function Count 0

Duplication

Duplicated Lines 0
Ratio 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 0
eloc 32
mnd 0
bc 0
fnc 0
dl 0
loc 58
ccs 57
cts 57
cp 1
bpm 0
cpm 0
noi 0
c 0
b 0
f 0
1 1
import type { Router } from 'vue-router';
2 1
import type { ComponentOptions } from 'vue';
3 1
4 1
export interface TitleOptions {
5 1
  /**
6 1
   * Prefix to be used in title generation
7 1
   */
8 1
  prefix?: string;
9 1
  /**
10 1
   * Suffix to be used in title generation
11 1
   */
12 1
  suffix?: string;
13 1
}
14 1
15 1
export type SetTitleFn = (val: string) => void;
16 1
export type TitleOptionFn<T = ComponentOptions> = (this: T, ctx: T) => string;
17 1
18 1
export type TitleOption = TitleOptionFn | string;
19 1
20 1
export interface SetTitleOptions extends TitleOptions {
21 1
  /**
22 1
   * Custom title definition
23 1
   */
24 1
  setTitleMethod?: SetTitleFn;
25 1
}
26 1
27 1
export interface PageTitleOptions extends SetTitleOptions {
28 1
  /**
29 1
   * Register mixin
30 1
   */
31 1
  mixin?: boolean;
32 1
  /**
33 1
   * Enable router integration
34 1
   */
35 1
  router?: Router;
36 1
}
37 1
38 1
declare module '@vue/runtime-core' {
39 1
  interface ComponentCustomProperties {
40 1
    /**
41 1
     * Current title
42 1
     */
43 1
    $title: string;
44 1
    /**
45 1
     * Update current title
46 1
     */
47 1
    $setPageTitle: SetTitleFn;
48 1
  }
49 1
50 1
  interface ComponentCustomOptions {
51 1
    /**
52 1
     * Title component option
53 1
     * `mixin` must be true
54 1
     */
55 1
    title?: TitleOption;
56 1
  }
57
}
58