Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update(argument): Updates @argument and types #61

Merged
merged 1 commit into from
Dec 1, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 16 additions & 14 deletions addon/components/ember-popper-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@ import { assert } from '@ember/debug';
import Component from '@ember/component';

import { action, computed } from 'ember-decorators/object';
import { argument } from '@ember-decorators/argument';
import { type, unionOf } from '@ember-decorators/argument/type';
import { tagName } from 'ember-decorators/component';

import { scheduler as raf } from 'ember-raf-scheduler';
import { argument } from '@ember-decorators/argument';
import { type, unionOf, optional } from '@ember-decorators/argument/type';
import { Action, Element } from '@ember-decorators/argument/types';

import { Element } from '../utils/globals';
import { scheduler as raf } from 'ember-raf-scheduler';

import layout from '../templates/components/ember-popper';

const Selector = unionOf('string', Element);

@tagName('')
export default class EmberPopperBase extends Component {
layout = layout
Expand All @@ -22,7 +24,7 @@ export default class EmberPopperBase extends Component {
/**
* Whether event listeners, resize and scroll, for repositioning the popper are initially enabled.
*/
@argument
@argument({ defaultIfUndefined: true })
@type('boolean')
eventsEnabled = true

Expand All @@ -31,37 +33,37 @@ export default class EmberPopperBase extends Component {
* https://popper.js.org/popper-documentation.html#Popper.DEFAULTS
*/
@argument
@type(unionOf(null, 'object'))
@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(unionOf(null, 'action'))
@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
*/
@argument
@type(unionOf(null, 'function'))
@type(optional(Function))
onCreate = null

/**
* onUpdate callback merged (if present) into the Popper instance's options hash.
* https://popper.js.org/popper-documentation.html#Popper.Defaults.onUpdate
*/
@argument
@type(unionOf(null, 'function'))
@type(optional(Function))
onUpdate = null

/**
* Placement of the popper. One of ['top', 'right', 'bottom', 'left'].
*/
@argument
@argument({ defaultIfUndefined: true })
@type('string')
placement = 'bottom'

Expand All @@ -70,23 +72,23 @@ export default class EmberPopperBase extends Component {
* See the block-comment in the template for more details. `.ember-application` is applied
* to the root element of the ember app by default, so we move it up to there.
*/
@argument
@type(unionOf('string', Element))
@argument({ defaultIfUndefined: true })
@type(Selector)
popperContainer = '.ember-application'

/**
* The element the popper will target. If left blank, will be set to the ember-popper's parent.
*/
@argument
@type(unionOf(null, 'string', Element))
@type(optional(Selector))
popperTarget = 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
* deeply in the DOM tree.
*/
@argument
@argument({ defaultIfUndefined: true })
@type('boolean')
renderInPlace = false

Expand Down
5 changes: 0 additions & 5 deletions addon/utils/globals.js

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"test": "ember try:each"
},
"dependencies": {
"@ember-decorators/argument": "~0.7.1",
"@ember-decorators/argument": "^0.8.2",
"babel-eslint": "^8.0.1",
"babel6-plugin-strip-class-callcheck": "^6.0.0",
"broccoli-funnel": "^2.0.0",
Expand Down
14 changes: 7 additions & 7 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
# yarn lockfile v1


"@ember-decorators/argument@~0.7.1":
version "0.7.1"
resolved "https://registry.yarnpkg.com/@ember-decorators/argument/-/argument-0.7.1.tgz#333f112159a242c332ca4d2495caff975d6d964a"
"@ember-decorators/argument@^0.8.2":
version "0.8.2"
resolved "https://registry.yarnpkg.com/@ember-decorators/argument/-/argument-0.8.2.tgz#f6dcd92c5c507356c3fc118e159e9ae64f4af79b"
dependencies:
babel-plugin-filter-imports "^1.1.0"
babel-plugin-filter-imports "^1.1.1"
broccoli-funnel "^2.0.1"
ember-cli-babel "^6.3.0"
ember-cli-version-checker "^2.0.0"
Expand Down Expand Up @@ -581,9 +581,9 @@ babel-plugin-eval@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/babel-plugin-eval/-/babel-plugin-eval-1.0.1.tgz#a2faed25ce6be69ade4bfec263f70169195950da"

babel-plugin-filter-imports@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/babel-plugin-filter-imports/-/babel-plugin-filter-imports-1.1.0.tgz#e5ea78f58f7fed4a22e59e136b52994c5fda7bad"
babel-plugin-filter-imports@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/babel-plugin-filter-imports/-/babel-plugin-filter-imports-1.1.1.tgz#0f418fb517a7c64b54461b947940081e51b3fd9d"
dependencies:
babel-types "^6.26.0"
lodash "^4.17.4"
Expand Down