diff options
| author | Florian Dold <florian.dold@gmail.com> | 2016-01-10 20:07:42 +0100 |
|---|---|---|
| committer | Florian Dold <florian.dold@gmail.com> | 2016-01-10 20:07:42 +0100 |
| commit | 473503a246aa7a23539a349710c5549d1d87c147 (patch) | |
| tree | 2b1ee9b420df72a0d861759d1fbcd2226e489086 /extension/lib/decl/handlebars/handlebars-1.0.0.d.ts | |
| parent | dd19e0ecbe114ebd71122ff57ea56eabb6258b75 (diff) | |
The great modularization.
Use ES6 module syntax and SystemJS modules for everything.
Some testing stubs were added as well.
Diffstat (limited to 'extension/lib/decl/handlebars/handlebars-1.0.0.d.ts')
| -rw-r--r-- | extension/lib/decl/handlebars/handlebars-1.0.0.d.ts | 184 |
1 files changed, 184 insertions, 0 deletions
diff --git a/extension/lib/decl/handlebars/handlebars-1.0.0.d.ts b/extension/lib/decl/handlebars/handlebars-1.0.0.d.ts new file mode 100644 index 000000000..c118760c5 --- /dev/null +++ b/extension/lib/decl/handlebars/handlebars-1.0.0.d.ts @@ -0,0 +1,184 @@ +// Type definitions for Handlebars 1.0
+// Project: http://handlebarsjs.com/
+// Definitions by: Boris Yankov <https://github.com/borisyankov/>
+// Definitions: https://github.com/borisyankov/DefinitelyTyped
+
+
+// Use either HandlebarsStatic or HandlebarsRuntimeStatic
+declare var Handlebars: HandlebarsStatic;
+//declare var Handlebars: HandlebarsRuntimeStatic;
+
+/**
+* Implement this interface on your MVW/MVVM/MVC views such as Backbone.View
+**/
+interface HandlebarsTemplatable {
+ template: HandlebarsTemplateDelegate;
+}
+
+interface HandlebarsTemplateDelegate {
+ (context: any, options?: any): string;
+}
+
+interface HandlebarsCommon {
+ registerHelper(name: string, fn: Function, inverse?: boolean): void;
+ registerPartial(name: string, str: any): void;
+ K(): void;
+ createFrame(object: any): any;
+
+ Exception(message: string): void;
+ SafeString: typeof hbs.SafeString;
+ Utils: typeof hbs.Utils;
+
+ logger: Logger;
+ log(level: number, obj: any): void;
+}
+
+interface HandlebarsStatic extends HandlebarsCommon {
+ parse(input: string): hbs.AST.ProgramNode;
+ compile(input: any, options?: any): HandlebarsTemplateDelegate;
+}
+
+interface HandlebarsTemplates {
+ [index: string]: HandlebarsTemplateDelegate;
+}
+
+interface HandlebarsRuntimeStatic extends HandlebarsCommon {
+ // Handlebars.templates is the default template namespace in precompiler.
+ templates: HandlebarsTemplates;
+}
+
+declare module hbs {
+ class SafeString {
+ constructor(str: string);
+ static toString(): string;
+ }
+
+ module Utils {
+ function escapeExpression(str: string): string;
+ }
+}
+
+interface Logger {
+ DEBUG: number;
+ INFO: number;
+ WARN: number;
+ ERROR: number;
+ level: number;
+
+ methodMap: { [level: number]: string };
+
+ log(level: number, obj: string): void;
+}
+
+declare module hbs {
+ module AST {
+ interface IStripInfo {
+ left?: boolean;
+ right?: boolean;
+ inlineStandalone?: boolean;
+ }
+
+ class NodeBase {
+ firstColumn: number;
+ firstLine: number;
+ lastColumn: number;
+ lastLine: number;
+ type: string;
+ }
+
+ class ProgramNode extends NodeBase {
+ statements: NodeBase[];
+ }
+
+ class IdNode extends NodeBase {
+ original: string;
+ parts: string[];
+ string: string;
+ depth: number;
+ idName: string;
+ isSimple: boolean;
+ stringModeValue: string;
+ }
+
+ class HashNode extends NodeBase {
+ pairs: {0: string;
+ 1: NodeBase}[];
+ }
+
+ class SexprNode extends NodeBase {
+ hash: HashNode;
+ id: NodeBase;
+ params: NodeBase[];
+ isHelper: boolean;
+ eligibleHelper: boolean;
+ }
+
+ class MustacheNode extends NodeBase {
+ strip: IStripInfo;
+ escaped: boolean;
+ sexpr: SexprNode;
+
+ }
+
+ class BlockNode extends NodeBase {
+ mustache: MustacheNode;
+ program: ProgramNode;
+ inverse: ProgramNode;
+ strip: IStripInfo;
+ isInverse: boolean;
+ }
+
+ class PartialNameNode extends NodeBase {
+ name: string;
+ }
+
+ class PartialNode extends NodeBase {
+ partialName: PartialNameNode;
+ context: NodeBase;
+ hash: HashNode;
+ strip: IStripInfo;
+ }
+
+ class RawBlockNode extends NodeBase {
+ mustache: MustacheNode;
+ program: ProgramNode;
+ }
+
+ class ContentNode extends NodeBase {
+ original: string;
+ string: string;
+ }
+
+ class DataNode extends NodeBase {
+ id: IdNode;
+ stringModeValue: string;
+ idName: string;
+ }
+
+ class StringNode extends NodeBase {
+ original: string;
+ string: string;
+ stringModeValue: string;
+ }
+
+ class NumberNode extends NodeBase {
+ original: string;
+ number: string;
+ stringModeValue: number;
+ }
+
+ class BooleanNode extends NodeBase {
+ bool: string;
+ stringModeValue: boolean;
+ }
+
+ class CommentNode extends NodeBase {
+ comment: string;
+ strip: IStripInfo;
+ }
+ }
+}
+
+declare module "handlebars" {
+ export = Handlebars;
+}
|
