-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15759 from emberjs/typed-ember-glimmer
Typed ember glimmer
- Loading branch information
Showing
89 changed files
with
1,598 additions
and
865 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,3 +39,4 @@ publish_to_bower/ | |
bower_components/ | ||
npm-debug.log | ||
.ember-cli | ||
DEBUG/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export function assert(message: string, test?: boolean): void; | ||
|
||
export function warn(message: string, test: boolean, options?: any): void; | ||
|
||
export function deprecate(message: string, test: boolean, options?: any): void; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
export const environment: { | ||
hasDOM: boolean; | ||
isChrome: boolean; | ||
isFirefox: boolean; | ||
isPhantom: boolean; | ||
location: Location | null; | ||
history: History | null; | ||
userAgent: string; | ||
window: Window | null; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
declare module 'ember/features' { | ||
export const EMBER_MODULE_UNIFICATION: any; | ||
export const GLIMMER_CUSTOM_COMPONENT_MANAGER: any; | ||
export const EMBER_ENGINES_MOUNT_PARAMS: any; | ||
export const EMBER_GLIMMER_DETECT_BACKTRACKING_RERENDER: any; | ||
export const EMBER_GLIMMER_ALLOW_BACKTRACKING_RERENDER: any; | ||
export const MANDATORY_SETTER: any; | ||
} | ||
|
||
declare module 'ember-env-flags' { | ||
export const DEBUG: boolean; | ||
} |
This file was deleted.
Oops, something went wrong.
100 changes: 100 additions & 0 deletions
100
packages/ember-glimmer/lib/component-managers/abstract.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
import { ProgramSymbolTable } from '@glimmer/interfaces'; | ||
import { Tag, VersionedPathReference } from '@glimmer/reference'; | ||
import { | ||
Bounds, | ||
CompiledDynamicTemplate, | ||
ComponentDefinition, | ||
ComponentManager, | ||
DynamicScope, | ||
ElementOperations, | ||
Environment, | ||
PreparedArguments, | ||
} from '@glimmer/runtime'; | ||
import { IArguments } from '@glimmer/runtime/dist/types/lib/vm/arguments'; | ||
import { Destroyable, Option } from '@glimmer/util'; | ||
import { DEBUG } from 'ember-env-flags'; | ||
import DebugStack from '../utils/debug-stack'; | ||
|
||
// implements the ComponentManager interface as defined in glimmer: | ||
// tslint:disable-next-line:max-line-length | ||
// https://github.com/glimmerjs/glimmer-vm/blob/v0.24.0-beta.4/packages/%40glimmer/runtime/lib/component/interfaces.ts#L21 | ||
|
||
export default abstract class AbstractManager<T> implements ComponentManager<T> { | ||
public debugStack: typeof DebugStack; | ||
public _pushToDebugStack: (name: string, environment: any) => void; | ||
public _pushEngineToDebugStack: (name: string, environment: any) => void; | ||
|
||
constructor() { | ||
this.debugStack = undefined; | ||
} | ||
|
||
prepareArgs(_definition: ComponentDefinition<T>, _args: IArguments): Option<PreparedArguments> { | ||
return null; | ||
} | ||
|
||
// must be implemented by inheritors, inheritors should also | ||
// call `this._pushToDebugStack` to ensure the rerendering | ||
// assertion messages are properly maintained | ||
|
||
abstract create( | ||
env: Environment, | ||
definition: ComponentDefinition<T>, | ||
args: IArguments, | ||
dynamicScope: DynamicScope, | ||
caller: VersionedPathReference<void | {}>, | ||
hasDefaultBlock: boolean): T; | ||
abstract layoutFor( | ||
definition: ComponentDefinition<T>, | ||
component: T, | ||
env: Environment): CompiledDynamicTemplate<ProgramSymbolTable>; | ||
abstract getSelf(component: T): VersionedPathReference<void | {}>; | ||
|
||
didCreateElement(_component: T, _element: Element, _operations: ElementOperations): void { | ||
// noop | ||
} | ||
|
||
// inheritors should also call `this.debugStack.pop()` to | ||
// ensure the rerendering assertion messages are properly | ||
// maintained | ||
didRenderLayout(_component: T, _bounds: Bounds): void { | ||
// noop | ||
} | ||
|
||
didCreate(_bucket: T): void { | ||
// noop | ||
} | ||
|
||
getTag(_bucket: T): Option<Tag> { return null; } | ||
|
||
// inheritors should also call `this._pushToDebugStack` | ||
// to ensure the rerendering assertion messages are | ||
// properly maintained | ||
update(_bucket: T, _dynamicScope: DynamicScope): void { | ||
// noop | ||
} | ||
|
||
// inheritors should also call `this.debugStack.pop()` to | ||
// ensure the rerendering assertion messages are properly | ||
// maintained | ||
didUpdateLayout(_bucket: T, _bounds: Bounds): void { | ||
// noop | ||
} | ||
|
||
didUpdate(_bucket: T): void { | ||
// noop | ||
} | ||
|
||
abstract getDestructor(bucket: T): Option<Destroyable>; | ||
} | ||
|
||
if (DEBUG) { | ||
AbstractManager.prototype._pushToDebugStack = function(name: string, environment) { | ||
this.debugStack = environment.debugStack; | ||
this.debugStack.push(name); | ||
}; | ||
|
||
AbstractManager.prototype._pushEngineToDebugStack = function(name: string, environment) { | ||
this.debugStack = environment.debugStack; | ||
this.debugStack.pushEngine(name); | ||
}; | ||
} |
Oops, something went wrong.