This commit is contained in:
harttle
2019-02-19 23:55:38 +08:00
parent cbebb00ef1
commit 29f53304bc
70 changed files with 3162 additions and 2565 deletions
+14
View File
@@ -0,0 +1,14 @@
import Scope from 'src/scope/scope';
declare type impl = (value: any, ...args: any[]) => any;
export default class Filter {
name: string;
impl: impl;
args: string[];
private static impls;
constructor(str: string, strictFilters?: boolean);
parseArgs(argList: string): string[];
render(value: any, scope: Scope): any;
static register(name: any, filter: any): void;
static clear(): void;
}
export {};
+8
View File
@@ -0,0 +1,8 @@
import Template from 'src/template/template';
import ITemplate from 'src/template/itemplate';
import Token from 'src/parser/token';
export default class extends Template implements ITemplate {
str: string;
constructor(token: Token);
render(): Promise<string>;
}
+6
View File
@@ -0,0 +1,6 @@
import Scope from 'src/scope/scope';
import Token from 'src/parser/token';
export default interface ITemplate {
token: Token;
render(scope: Scope): Promise<string>;
}
+10
View File
@@ -0,0 +1,10 @@
import Value from './value';
import Template from 'src/template/template';
import ITemplate from 'src/template/itemplate';
import Scope from 'src/scope/scope';
import OutputToken from 'src/parser/output-token';
export default class Output extends Template implements ITemplate {
value: Value;
constructor(token: OutputToken, strictFilters?: boolean);
render(scope: Scope): Promise<string>;
}
+10
View File
@@ -0,0 +1,10 @@
/**
* Key-Value Pairs Representing Tag Arguments
* Example:
* For the markup `{% include 'head.html' foo='bar' %}`,
* hash['foo'] === 'bar'
*/
export default class Hash {
[key: string]: any;
constructor(markup: any, scope: any);
}
+9
View File
@@ -0,0 +1,9 @@
import Scope from 'src/scope/scope';
import TagToken from 'src/parser/tag-token';
import Token from 'src/parser/token';
import Hash from 'src/template/tag/hash';
import ITagImpl from './itag-impl';
export default interface ITagImplOptions {
parse?: (this: ITagImpl, token: TagToken, remainingTokens: Array<Token>) => void;
render?: (this: ITagImpl, scope: Scope, hash: Hash) => any | Promise<any>;
}
+5
View File
@@ -0,0 +1,5 @@
import Liquid from 'src/liquid';
import ITagImplOptions from './itag-impl-options';
export default interface ITagImpl extends ITagImplOptions {
liquid: Liquid;
}
+19
View File
@@ -0,0 +1,19 @@
import Scope from 'src/scope/scope';
import ITagImplOptions from './itag-impl-options';
import Liquid from 'src/liquid';
import Template from 'src/template/template';
import ITemplate from 'src/template/itemplate';
import TagToken from 'src/parser/tag-token';
import Token from 'src/parser/token';
export default class Tag extends Template implements ITemplate {
name: string;
token: TagToken;
private impl;
static impls: {
[key: string]: ITagImplOptions;
};
constructor(token: TagToken, tokens: Token[], liquid: Liquid);
render(scope: Scope): Promise<string>;
static register(name: string, tag: ITagImplOptions): void;
static clear(): void;
}
+5
View File
@@ -0,0 +1,5 @@
import Token from 'src/parser/token';
export default class Template {
token: Token;
constructor(token: any);
}
+7
View File
@@ -0,0 +1,7 @@
import Scope from 'src/scope/scope';
export default class {
initial: any;
filters: Array<any>;
constructor(str: string, strictFilters?: boolean);
value(scope: Scope): any;
}