保誠-保戶業務員媒合平台
HelenHuang
2022-06-09 9bdb95c9e34cef640534e5e5a1e2225a80442000
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
// Type definitions for LESS 3.x
// Project: http://lesscss.org/
// Definitions by: Tom Hasner <https://github.com/thasner>
//                 Pranay Prakash <https://github.com/pranaygp>
//                 Daniel Waxweiler <https://github.com/dwaxweiler>
//                 Richard Lea <https://github.com/chigix>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
 
declare namespace Less {
    // https://github.com/less/less.js/blob/master/lib/less/import-manager.js#L10
    interface RootFileInfo {
        /** whether to adjust URL's to be relative */
        rewriteUrls?: boolean;
        /** full resolved filename of current file */
        filename: string;
        relativeUrls: boolean;
        /** path to append to normal URLs for this node */
        rootpath: string;
        /** path to the current file, absolute */
        currentDirectory: string;
        /** absolute path to the entry file */
        entryPath: string;
        /** filename of the base file */
        rootFilename: string;
        /** whether the file should not be output and only output parts that are referenced */
        reference: boolean;
    }
 
    class PluginManager {
        constructor(less: LessStatic);
 
        addPreProcessor(preProcessor: PreProcessor, priority?: number): void;
 
        addFileManager(fileManager: FileManager): void;
    }
 
    interface Plugin {
        install: (less: LessStatic, pluginManager: PluginManager) => void;
        minVersion?: [number, number, number];
    }
 
    interface PreProcessor {
        process: (src: string, extra: PreProcessorExtraInfo) => string;
    }
 
    interface PreProcessorExtraInfo {
        context: {
            pluginManager: PluginManager;
        };
 
        fileInfo: RootFileInfo;
 
        imports: {
            [key: string]: any;
        };
    }
 
    interface FileLoadResult {
        /** Full resolved path to file. */
        filename: string;
 
        /** The contents of the file, as a string. */
        contents: string;
    }
 
    interface FileLoadError {
        /** Error object if an error occurs. */
        error: unknown;
    }
 
    class FileManager extends AbstractFileManager {
        /**
         * Returns whether this file manager supports this file for file retrieval
         * If true is returned, loadFile will then be called with the file.
         */
        supports(filename: string, currentDirectory: string, options: LoadFileOptions, environment: Environment): boolean;
 
        /**
         * Loads a file asynchronously. Expects a promise that either rejects with an error or fulfills with a FileLoadResult.
         */
        loadFile(filename: string, currentDirectory: string, options: LoadFileOptions, environment: Environment): Promise<FileLoadResult>;
 
        /**
         * Loads a file synchronously. Expects an immediate return with wither a FileLoadResult or FileLoadError.
         */
        loadFileSync(filename: string, currentDirectory: string, options: LoadFileOptions, environment: Environment): FileLoadResult | FileLoadError;
    }
 
    class AbstractFileManager {
        /**
         * Given the full path to a file, return the path component.
         */
        getPath(filename: string): string;
 
        /**
         * Append a .less extension if appropriate. Only called if less thinks one could be added.
         */
        tryAppendLessExtension(filename: string): string;
 
        /**
         * Whether the rootpath should be converted to be absolute.
         * The browser ovverides this to return true because urls must be absolute.
         */
        alwaysMakePathsAbsolute(): boolean;
 
        /**
         * Returns whether a path is absolute.
         */
        isPathAbsolute(path: string): boolean;
 
        /**
         * Joins together 2 paths.
         */
        join(basePath: string, laterPath: string): string;
 
        /**
         * Returns the difference between 2 paths
         * E.g. url = a/ baseUrl = a/b/ returns ../
         * url = a/b/ baseUrl = a/ returns b/
         */
        pathDiff(url: string, baseUrl: string): string;
 
        /**
         * Returns whether this file manager supports this file for syncronous file retrieval
         * If true is returned, loadFileSync will then be called with the file.
         */
        supportsSync(filename: string, currentDirectory: string, options: LoadFileOptions, environment: Environment): boolean;
    }
 
    interface LoadFileOptions {
        paths?: string[];
        prefixes?: string[];
        ext?: string;
        rawBuffer?: any;
        syncImport?: boolean;
    }
 
    interface Environment {
        /**
         * Converts a string to a base 64 string
         */
        encodeBase64(str: string): string;
 
        /**
         * Lookup the mime-type of a filename
         */
        mimeLookup(filename: string): string;
 
        /**
         * Look up the charset of a mime type
         */
        charsetLookup(mime: string): string;
 
        /**
         * Gets a source map generator
         */
        getSourceMapGenerator(): any;
    }
 
    interface SourceMapOption {
        sourceMapURL?: string;
        sourceMapBasepath?: string;
        sourceMapRootpath?: string;
        outputSourceFiles?: boolean;
        sourceMapFileInline?: boolean;
    }
 
    interface StaticOptions {
        async: boolean;
        fileAsync: boolean;
        modifyVars: { [variable: string]: string };
    }
 
    interface ImportManager {
        contents: { [fileName: string]: string };
    }
 
    /**
     * Reference to:
     * * https://github.com/less/less.js/blob/master/bin/lessc
     * * http://lesscss.org/usage/#less-options
     *
     * @interface Options
     */
    interface Options {
        sourceMap?: SourceMapOption;
        /** Filename of the main file to be passed to less.render() */
        filename?: string;
        /** The locations for less looking for files in @import rules */
        paths?: string[];
        /** True, if run the less parser and just reports errors without any output. */
        lint?: boolean;
        /** Pre-load global Less.js plugins */
        plugins?: Plugin[];
        /** @deprecated If true, compress using less built-in compression. */
        compress?: boolean;
        strictImports?: boolean;
        /** If true, allow imports from insecure https hosts. */
        insecure?: boolean;
        depends?: boolean;
        maxLineLen?: number;
        /** @deprecated If false, No color in compiling. */
        color?: boolean;
        /** @deprecated False by default. */
        ieCompat?: boolean;
        /** @deprecated If true, enable evaluation of JavaScript inline in `.less` files. */
        javascriptEnabled?: boolean;
        /** Whether output file information and line numbers in compiled CSS code. */
        dumpLineNumbers?: "comment" | string;
        /** Add a path to every generated import and url in output css files. */
        rootpath?: string;
        /** Math mode options for avoiding symbol conficts on math expressions. */
        math?: 'always' | 'strict' | 'parens-division' | 'parens' | 'strict-legacy' | number;
        /** If true, stops any warnings from being shown. */
        silent?: boolean;
        /** Without this option, Less attempts to guess at the output unit when it does maths. */
        strictUnits?: boolean;
        /** Defines a variable that can be referenced by the file. */
        globalVars?: {
          [key: string] : string,
        };
        /** Puts Var declaration at the end of base file. */
        modifyVars?: {
          [key: string] : string,
        };
        /** Read files synchronously in Node.js */
        syncImport?: boolean;
    }
 
    interface RenderError {
        column: number;
        extract: string[];
        filename: string;
        index: number;
        line: number;
        message: string;
        type: string;
    }
 
    interface RenderOutput {
        css: string;
        map: string;
        imports: string[];
    }
 
    interface RefreshOutput {
        endTime: Date;
        startTime: Date;
        sheets: number;
        totalMilliseconds: number;
    }
}
 
interface LessStatic {
    options: Less.StaticOptions;
 
    importManager?: Less.ImportManager;
    sheets: HTMLLinkElement[];
 
    modifyVars(vars: { [name: string]: string }): Promise<Less.RefreshOutput>;
 
    refreshStyles(): void;
 
    render(input: string, callback: (error: Less.RenderError, output: Less.RenderOutput | undefined) => void): void;
    render(input: string, options: Less.Options, callback: (error: Less.RenderError, output: Less.RenderOutput | undefined) => void): void;
 
    render(input: string): Promise<Less.RenderOutput>;
    render(input: string, options: Less.Options): Promise<Less.RenderOutput>;
 
    refresh(reload?: boolean, modifyVars?: { [variable: string]: string }, clearFileCache?: boolean): Promise<Less.RefreshOutput>;
 
    version: number[];
 
    watch(): void;
 
    FileManager: typeof Less.FileManager;
    PluginManager: typeof Less.PluginManager;
}
 
declare module "less" {
    export = less;
}
 
declare var less: LessStatic;