-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathtypes.ts
More file actions
123 lines (103 loc) · 2.89 KB
/
Copy pathtypes.ts
File metadata and controls
123 lines (103 loc) · 2.89 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
// ---------------------------------------------------------------------------------------------------------------------
// module
// ---------------------------------------------------------------------------------------------------------------------
export interface ModuleOptions {
/**
* Image size hints
*
* @example 'attrs style url'
* @default 'style'
*/
imageSize?: string | string[] | false
/**
* List of content extensions; anything else as an asset
*
* @example 'md'
* @default 'md csv ya?ml json'
*/
contentExtensions?: string | string[],
/**
* Display debug messages
*
* @example true
* @default false
*/
debug?: boolean
}
// ---------------------------------------------------------------------------------------------------------------------
// assets
// ---------------------------------------------------------------------------------------------------------------------
export type ImageSize = Array<'style' | 'src' | 'url' | 'attrs'>
export type AssetConfig = {
srcAttr: string
content: string[],
width?: number
height?: number
}
export interface AssetMessage {
event: 'update' | 'remove' | 'refresh'
src?: string
width?: string
height?: string
}
// ---------------------------------------------------------------------------------------------------------------------
// content
// ---------------------------------------------------------------------------------------------------------------------
export interface ParsedContent {
/**
* The storage id of the file
* @example 'content:foo:bar:index.md'
*/
_id: string
/**
* The source group identifier
* @example 'content'
*/
_source: string
/**
* The directory of the file under _source
* @example 'foo'
*/
_dir: string
/**
* The route to the file (excluding _source)
* @example '/foo/bar'
*/
_path: string
/**
* The file path of the file (excluding _source)
* @example 'foo/bar/index.md'
*/
_file: string
/**
* The type of the file
* @example 'markdown'
*/
_type: string
/**
* The file extension (excluding the dot)
* @example 'md'
*/
_extension: string
/**
* The AST structure
* @example
*/
body: {
type: string,
children: Array<any>
}
/**
* Any other metadata key
* @see https://content.nuxtjs.org/guide/writing/markdown/#native-parameters
*/
[key: string | '_draft' | '_partial' | '_locale' | '_empty' | 'title' | 'description' | 'excerpt']: any
}
// ---------------------------------------------------------------------------------------------------------------------
// sockets
// ---------------------------------------------------------------------------------------------------------------------
export type Callback = (data: any) => void
export interface SocketInstance {
send: (data: any) => SocketInstance
addHandler: (handler: Callback) => SocketInstance
}