Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: gothinkster/realworld-starter-kit
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: karimayachi/realworld-starter-kit
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Can’t automatically merge. Don’t worry, you can still create the pull request.
Loading
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.

/dist

# dependencies
/node_modules
/bower_components
9 changes: 9 additions & 0 deletions library/binding/bindingContext.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export declare class BindingContext {
template?: DocumentFragment;
vm: any;
originalVm: any;
propertyName: string;
parameter?: string;
preventCircularUpdate: boolean;
constructor();
}
32 changes: 32 additions & 0 deletions library/binding/bindingEngine.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { BindingHandler } from './bindingHandlers';
import { BindingContext } from './bindingContext';
interface BindingHandlers {
[key: string]: BindingHandler;
}
export declare class BindingEngine {
static handlers: BindingHandlers;
boundElements: WeakMap<HTMLElement, Map<string, BindingContext>>;
scopes: Map<string, any>;
constructor();
parseBinding: (name: string, value: string, node: HTMLElement, vm: any) => BindingProperties | null;
private resolveScopeAndCreateDependencyTree;
private recursiveResolveScope;
private rebind;
bindInitPhase: (bindingProperties: BindingProperties, rebind?: boolean) => void;
bindUpdatePhase: (bindingProperties: BindingProperties) => void;
getTransformFor: (element: HTMLElement, target: string) => Function | {
read: Function;
write: Function;
} | null;
private unwrap;
}
export interface BindingProperties {
handler: string;
parameter: string;
propertyName: string;
scope: any;
vm: any;
bindingValue: any;
element: HTMLElement;
}
export {};
45 changes: 45 additions & 0 deletions library/binding/bindingHandlers.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { BindingContext } from './bindingContext';
import { IArraySplice, IArrayChange } from 'mobx';
export declare abstract class BindingHandler {
abstract init?(element: HTMLElement, value: any, context: BindingContext, updateValue: (value: string) => void): void;
abstract update?(element: HTMLElement, value: string, context: BindingContext, change?: any): void;
}
export declare class TextHandler implements BindingHandler {
update(element: HTMLElement, value: string): void;
}
export declare class VisibleHandler implements BindingHandler {
initialValue?: string;
init: (element: HTMLElement) => void;
update: (element: HTMLElement, value: string) => void;
}
export declare class ValueHandler implements BindingHandler {
init(element: HTMLElement, _value: any, _contex: BindingContext, updateValue: (value: string) => void): void;
update(element: HTMLElement, value: string): void;
}
export declare class EventHandler implements BindingHandler {
init(element: HTMLElement, value: any, context: BindingContext): void;
}
export declare class AttributeHandler implements BindingHandler {
update(element: HTMLElement, value: string, context: BindingContext): void;
}
export declare class ScopeHandler implements BindingHandler {
init(_element: HTMLElement, value: any, context: BindingContext, _updateValue: (value: string) => void): void;
}
export declare class TransformHandler implements BindingHandler {
init(_element: HTMLElement, value: any, context: BindingContext, _updateValue: (value: string) => void): void;
}
export declare class IfHandler implements BindingHandler {
init(element: HTMLElement, _value: any, context: BindingContext, _updateValue: (value: string) => void): void;
update(element: HTMLElement, value: string, context: BindingContext, _change: IArraySplice<any>): void;
}
export declare class ContextHandler implements BindingHandler {
init(element: HTMLElement, _value: any, context: BindingContext, _updateValue: (value: string) => void): void;
update(element: HTMLElement, value: string, context: BindingContext, change: IArraySplice<any>): void;
}
export declare class HtmlHandler implements BindingHandler {
update(element: HTMLElement, value: string, context: BindingContext, change: IArraySplice<any>): void;
}
export declare class ForEachHandler implements BindingHandler {
init(element: HTMLElement, _value: any, context: BindingContext, _updateValue: (value: string) => void): void;
update(element: HTMLElement, value: any, context: BindingContext, change: IArraySplice<any> | IArrayChange): void;
}
7 changes: 7 additions & 0 deletions library/binding/propertyBinding.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { BindingHandler } from './bindingHandlers';
import { BindingContext } from './bindingContext';
import { IArraySplice } from 'mobx';
export declare class PropertyHandler implements BindingHandler {
init(element: HTMLElement, _value: any, context: BindingContext, updateValue: (value: any) => void): void;
update(element: HTMLElement, value: string, context: BindingContext, change: IArraySplice<any>): void;
}
10 changes: 10 additions & 0 deletions library/imagine.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
declare global {
interface Array<T> {
remove(o: T): Array<T>;
}
}
export { observable, computed, observe } from 'mobx';
export declare const bind: (element: HTMLElement | DocumentFragment | null, vm: any, debug?: boolean | undefined) => void;
export declare const contexts: WeakMap<HTMLElement, Map<string, import("./binding/bindingContext").BindingContext>>;
export declare const scopes: Map<string, any>;
export declare const bindingEngine: import("./binding/bindingEngine").BindingEngine;
Loading