Skip to content

Commit

Permalink
chore(alphabetize unordered properties) (#68)
Browse files Browse the repository at this point in the history
  • Loading branch information
kybishop committed Dec 5, 2017
1 parent 74c545c commit ceb35f2
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 57 deletions.
16 changes: 8 additions & 8 deletions addon/components/-ember-popper-legacy.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ export default class EmberPopper extends EmberPopperBase {
this._initialParentNode = this.element.parentNode;

if (!GTE_EMBER_1_13) {
addObserver(this, 'renderInPlace', this, this._updatePopper);
addObserver(this, 'eventsEnabled', this, this._updatePopper);
addObserver(this, 'modifiers', this, this._updatePopper);
addObserver(this, 'registerAPI', this, this._updatePopper);
addObserver(this, 'onCreate', this, this._updatePopper);
addObserver(this, 'onUpdate', this, this._updatePopper);
addObserver(this, 'placement', this, this._updatePopper);
addObserver(this, 'popperContainer', this, this._updatePopper);
addObserver(this, 'popperTarget', this, this._updatePopper);
addObserver(this, 'registerAPI', this, this._updatePopper);
addObserver(this, 'renderInPlace', this, this._updatePopper);

super.didRender(...arguments);
}
Expand All @@ -34,15 +34,15 @@ export default class EmberPopper extends EmberPopperBase {
super.willDestroyElement(...arguments);

if (!GTE_EMBER_1_13) {
removeObserver(this, 'renderInPlace', this, this._updatePopper);
removeObserver(this, 'eventsEnabled', this, this._updatePopper);
removeObserver(this, 'modifiers', this, this._updatePopper);
removeObserver(this, 'registerAPI', this, this._updatePopper);
removeObserver(this, 'onCreate', this, this._updatePopper);
removeObserver(this, 'onUpdate', this, this._updatePopper);
removeObserver(this, 'placement', this, this._updatePopper);
removeObserver(this, 'popperContainer', this, this._updatePopper);
removeObserver(this, 'popperTarget', this, this._updatePopper);
removeObserver(this, 'registerAPI', this, this._updatePopper);
removeObserver(this, 'renderInPlace', this, this._updatePopper);
}

const element = this._getPopperElement();
Expand All @@ -56,8 +56,8 @@ export default class EmberPopper extends EmberPopperBase {

_updatePopper() {
const element = this._getPopperElement();
const renderInPlace = this.get('_renderInPlace');
const popperContainer = this.get('_popperContainer');
const renderInPlace = this.get('_renderInPlace');

// If renderInPlace is false, move the element to the popperContainer to avoid z-index issues.
// See renderInPlace for more details.
Expand All @@ -75,10 +75,10 @@ export default class EmberPopper extends EmberPopperBase {
@computed()
get _popperHash() {
return {
update: this.update.bind(this),
scheduleUpdate: this.scheduleUpdate.bind(this),
disableEventListeners: this.disableEventListeners.bind(this),
enableEventListeners: this.enableEventListeners.bind(this),
disableEventListeners: this.disableEventListeners.bind(this)
scheduleUpdate: this.scheduleUpdate.bind(this),
update: this.update.bind(this)
};
}
}
78 changes: 39 additions & 39 deletions addon/components/ember-popper-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,6 @@ export default class EmberPopperBase extends Component {
@type(optional('object'))
modifiers = null

/**
* An optional function to be called when a new target is located.
* The target is passed in as an argument to the function.
*/
@argument
@type(optional(Action))
registerAPI = null

/**
* onCreate callback merged (if present) into the Popper instance's options hash.
* https://popper.js.org/popper-documentation.html#Popper.Defaults.onCreate
Expand Down Expand Up @@ -83,6 +75,14 @@ export default class EmberPopperBase extends Component {
@type(optional(Selector))
popperTarget = null

/**
* An optional function to be called when a new target is located.
* The target is passed in as an argument to the function.
*/
@argument
@type(optional(Action))
registerAPI = null

/**
* If `true`, the popper element will not be moved to popperContainer. WARNING: This can cause
* z-index issues where your popper will be overlapped by DOM elements that aren't nested as
Expand All @@ -95,61 +95,61 @@ export default class EmberPopperBase extends Component {
// ================== PRIVATE PROPERTIES ==================

/**
* Set in didInsertElement() once the Popper is initialized.
* Passed to consumers via a named yield.
* Tracks current/previous state of `_renderInPlace`.
*/
_popper = null
_didRenderInPlace = false

/**
* Tracks current/previous value of `eventsEnabled` option
*/
_eventsEnabled = null

/**
* Parent of the element on didInsertElement, before it may have been moved
*/
_initialParentNode = null

/**
* Tracks current/previous state of `_renderInPlace`.
* Tracks current/previous value of `modifiers` option
*/
_didRenderInPlace = false
_modifiers = null

/**
* Tracks current/previous value of popper target
* Tracks current/previous value of `onCreate` callback
*/
_popperTarget = null
_onCreate = null

/**
* Tracks current/previous value of `eventsEnabled` option
* Tracks current/previous value of `onUpdate` callback
*/
_eventsEnabled = null
_onUpdate = null

/**
* Tracks current/previous value of `placement` option
*/
_placement = null

/**
* Tracks current/previous value of `modifiers` option
*/
_modifiers = null

/**
* ID for the requestAnimationFrame used for updates, used to cancel
* the RAF on component destruction
* Set in didInsertElement() once the Popper is initialized.
* Passed to consumers via a named yield.
*/
_updateRAF = null
_popper = null

/**
* Tracks current/previous value of `onCreate` callback
* Tracks current/previous value of popper target
*/
_onCreate = null
_popperTarget = null

/**
* Tracks current/previous value of `onUpdate` callback
* Public API of the popper sent to external components in `registerAPI`
*/
_onUpdate = null
_publicAPI = null

/**
* Public API of the popper sent to external components in `registerAPI`
* ID for the requestAnimationFrame used for updates, used to cancel
* the RAF on component destruction
*/
_publicAPI = null
_updateRAF = null

// ================== LIFECYCLE HOOKS ==================

Expand Down Expand Up @@ -202,13 +202,13 @@ export default class EmberPopperBase extends Component {
return;
}

const popperTarget = this._getPopperTarget();
const renderInPlace = this.get('_renderInPlace');
const eventsEnabled = this.get('eventsEnabled');
const modifiers = this.get('modifiers');
const placement = this.get('placement');
const onCreate = this.get('onCreate');
const onUpdate = this.get('onUpdate');
const placement = this.get('placement');
const popperTarget = this._getPopperTarget();
const renderInPlace = this.get('_renderInPlace');

// Compare against previous values to see if anything has changed
const didChange = renderInPlace !== this._didRenderInPlace
Expand All @@ -228,12 +228,12 @@ export default class EmberPopperBase extends Component {

// Store current values to check against on updates
this._didRenderInPlace = renderInPlace;
this._popperTarget = popperTarget;
this._eventsEnabled = eventsEnabled;
this._modifiers = modifiers;
this._placement = placement;
this._onCreate = onCreate;
this._onUpdate = onUpdate;
this._placement = placement;
this._popperTarget = popperTarget;

const options = {
eventsEnabled,
Expand Down Expand Up @@ -297,10 +297,10 @@ export default class EmberPopperBase extends Component {
// bootstrap the public API with fields that are guaranteed to be static,
// such as imperative actions
this._publicAPI = {
update: this.update.bind(this),
scheduleUpdate: this.scheduleUpdate.bind(this),
disableEventListeners: this.disableEventListeners.bind(this),
enableEventListeners: this.enableEventListeners.bind(this),
disableEventListeners: this.disableEventListeners.bind(this)
scheduleUpdate: this.scheduleUpdate.bind(this),
update: this.update.bind(this)
};
}

Expand Down
2 changes: 1 addition & 1 deletion addon/components/ember-popper.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { guidFor } from '@ember/object/internals';
import EmberPopperBase from './ember-popper-base';
import { guidFor } from '@ember/object/internals';

export default class EmberPopper extends EmberPopperBase {

Expand Down
6 changes: 3 additions & 3 deletions addon/templates/components/-ember-popper-legacy.hbs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{yield (hash
update=(action 'update')
scheduleUpdate=(action 'scheduleUpdate')
enableEventListeners=(action 'enableEventListeners')
disableEventListeners=(action 'disableEventListeners')
enableEventListeners=(action 'enableEventListeners')
scheduleUpdate=(action 'scheduleUpdate')
update=(action 'update')
)}}
12 changes: 6 additions & 6 deletions addon/templates/components/ember-popper.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
{{#if renderInPlace}}
<div id={{id}} class={{class}} role={{ariaRole}}>
{{yield (hash
update=(action 'update')
scheduleUpdate=(action 'scheduleUpdate')
enableEventListeners=(action 'enableEventListeners')
disableEventListeners=(action 'disableEventListeners')
enableEventListeners=(action 'enableEventListeners')
scheduleUpdate=(action 'scheduleUpdate')
update=(action 'update')
)}}
</div>
{{else}}
Expand All @@ -20,10 +20,10 @@
{{!-- Add a wrapper around the yielded block so we have something for the Popper to target --}}
<div id={{id}} class={{class}} role={{ariaRole}}>
{{yield (hash
update=(action 'update')
scheduleUpdate=(action 'scheduleUpdate')
enableEventListeners=(action 'enableEventListeners')
disableEventListeners=(action 'disableEventListeners')
enableEventListeners=(action 'enableEventListeners')
scheduleUpdate=(action 'scheduleUpdate')
update=(action 'update')
)}}
</div>
{{/-in-element}}
Expand Down

0 comments on commit ceb35f2

Please sign in to comment.