-
-
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.
[FEATURE modernized-built-in-components] Extract shared code
Refactor to extra shared code into internal component to pave way for implementing <LinkTo> with the new infrastructure. Part of #19270
- Loading branch information
1 parent
533c9af
commit d2b8b58
Showing
10 changed files
with
1,114 additions
and
997 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
88 changes: 0 additions & 88 deletions
88
packages/@ember/-internals/glimmer/lib/component-managers/internal.ts
This file was deleted.
Oops, something went wrong.
103 changes: 103 additions & 0 deletions
103
packages/@ember/-internals/glimmer/lib/components/-textarea.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,103 @@ | ||
/** | ||
@module @ember/component | ||
*/ | ||
import { CoreObject } from '@ember/-internals/runtime'; | ||
import { TextSupport } from '@ember/-internals/views'; | ||
import { EMBER_MODERNIZED_BUILT_IN_COMPONENTS } from '@ember/canary-features'; | ||
import { deprecate } from '@ember/debug'; | ||
import Component from '../component'; | ||
import layout from '../templates/empty'; | ||
|
||
/** | ||
The internal representation used for `Textarea` invocations. | ||
@class TextArea | ||
@extends Component | ||
@see {Ember.Templates.components.Textarea} | ||
@uses Ember.TextSupport | ||
@public | ||
*/ | ||
const TextArea = Component.extend(TextSupport, { | ||
classNames: ['ember-text-area'], | ||
|
||
layout, | ||
|
||
tagName: 'textarea', | ||
attributeBindings: [ | ||
'rows', | ||
'cols', | ||
'name', | ||
'selectionEnd', | ||
'selectionStart', | ||
'autocomplete', | ||
'wrap', | ||
'lang', | ||
'dir', | ||
'value', | ||
], | ||
rows: null, | ||
cols: null, | ||
}); | ||
|
||
TextArea.toString = () => '@ember/component/text-area'; | ||
|
||
if (EMBER_MODERNIZED_BUILT_IN_COMPONENTS) { | ||
Object.defineProperty(TextArea, '_wasReopened', { | ||
configurable: true, | ||
enumerable: false, | ||
writable: true, | ||
value: false, | ||
}); | ||
|
||
Object.defineProperty(TextArea, 'reopen', { | ||
configurable: true, | ||
enumerable: false, | ||
writable: true, | ||
value: function reopen(this: typeof TextArea, ...args: unknown[]): unknown { | ||
if (this === TextArea) { | ||
deprecate( | ||
'Reopening Ember.TextArea is deprecated. Consider implementing your own ' + | ||
'wrapper component or create a custom subclass.', | ||
false, | ||
{ | ||
id: 'ember.built-in-components.reopen', | ||
for: 'ember-source', | ||
since: {}, | ||
until: '4.0.0', | ||
} | ||
); | ||
|
||
TextArea._wasReopened = true; | ||
} | ||
|
||
return CoreObject.reopen.call(this, ...args); | ||
}, | ||
}); | ||
|
||
Object.defineProperty(TextArea, 'reopenClass', { | ||
configurable: true, | ||
enumerable: false, | ||
writable: true, | ||
value: function reopenClass(this: typeof TextArea, ...args: unknown[]): unknown { | ||
if (this === TextArea) { | ||
deprecate( | ||
'Reopening Ember.TextArea is deprecated. Consider implementing your own ' + | ||
'wrapper component or create a custom subclass.', | ||
false, | ||
{ | ||
id: 'ember.built-in-components.reopen', | ||
for: 'ember-source', | ||
since: {}, | ||
until: '4.0.0', | ||
} | ||
); | ||
|
||
TextArea._wasReopened = true; | ||
} | ||
|
||
return CoreObject.reopenClass.call(this, ...args); | ||
}, | ||
}); | ||
} | ||
|
||
export default TextArea; |
Oops, something went wrong.