refactor(ivy): move instructions (#29646)

- moves all publicly exported instructions to their own files
- refactors namespace instructions to set state in `state.ts`
- no longer exports * from `instructions.ts`.
- `instructions.ts` renamed to `shared.ts` (old `shared.ts` contents folded in to `instructions.ts`)
- updates `all.ts` to re-export from public instruction files.

PR Close #29646
This commit is contained in:
Ben Lesh
2019-04-01 15:36:43 -07:00
committed by Jason Aden
parent 03d914a6c2
commit 5a724b34bd
40 changed files with 3500 additions and 3236 deletions

View File

@ -365,3 +365,32 @@ export function getSelectedIndex() {
export function setSelectedIndex(index: number) {
_selectedIndex = index;
}
let _currentNamespace: string|null = null;
/**
* Sets the namespace used to create elements to `'http://www.w3.org/2000/svg'` in global state.
*/
export function namespaceSVG() {
_currentNamespace = 'http://www.w3.org/2000/svg';
}
/**
* Sets the namespace used to create elements to `'http://www.w3.org/1998/MathML/'` in global state.
*/
export function namespaceMathML() {
_currentNamespace = 'http://www.w3.org/1998/MathML/';
}
/**
* Sets the namespace used to create elements no `null`, which forces element creation to use
* `createElement` rather than `createElementNS`.
*/
export function namespaceHTML() {
_currentNamespace = null;
}
export function getNamespace(): string|null {
return _currentNamespace;
}