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 #19155 from emberjs/refactor-input-component
Refactor internal `<Input>` component implementation
- Loading branch information
Showing
9 changed files
with
190 additions
and
170 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
134 changes: 0 additions & 134 deletions
134
packages/@ember/-internals/glimmer/lib/component-managers/input.ts
This file was deleted.
Oops, something went wrong.
127 changes: 116 additions & 11 deletions
127
packages/@ember/-internals/glimmer/lib/component-managers/internal.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
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
40 changes: 40 additions & 0 deletions
40
packages/@ember/-internals/glimmer/lib/components/internal.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,40 @@ | ||
import { Owner, setOwner } from '@ember/-internals/owner'; | ||
import { guidFor } from '@ember/-internals/utils'; | ||
import { assert } from '@ember/debug'; | ||
import { Reference, valueForRef } from '@glimmer/reference'; | ||
|
||
export default class InternalComponent { | ||
// Factory interface | ||
static create(): never { | ||
throw assert('Use constructor instead of create'); | ||
} | ||
|
||
static get class(): typeof InternalComponent { | ||
return this; | ||
} | ||
|
||
static get fullName(): string { | ||
return this.name; | ||
} | ||
|
||
static get normalizedName(): string { | ||
return this.name; | ||
} | ||
|
||
constructor( | ||
protected owner: Owner, | ||
public args: Record<string, Reference | undefined>, | ||
public caller: unknown | ||
) { | ||
setOwner(this, owner); | ||
} | ||
|
||
protected arg(key: string): unknown { | ||
let ref = this.args[key]; | ||
return ref ? valueForRef(ref) : undefined; | ||
} | ||
|
||
toString(): string { | ||
return `<${this.constructor.toString()}:${guidFor(this)}>`; | ||
} | ||
} |
Oops, something went wrong.