@polymer/iron-behaviors
Advanced tools
Comparing version 3.0.0-pre.21 to 3.0.0-pre.22
/** | ||
@license | ||
Copyright (c) 2015 The Polymer Project Authors. All rights reserved. | ||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt | ||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt | ||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt | ||
Code distributed by Google as part of the polymer project is also | ||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt | ||
This code may only be used under the BSD style license found at | ||
http://polymer.github.io/LICENSE.txt The complete set of authors may be found at | ||
http://polymer.github.io/AUTHORS.txt The complete set of contributors may be | ||
found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as | ||
part of the polymer project is also subject to an additional IP rights grant | ||
found at http://polymer.github.io/PATENTS.txt | ||
*/ | ||
import '@polymer/polymer/polymer-legacy.js'; | ||
import { IronButtonState } from '../iron-button-state.js'; | ||
import { IronControlState } from '../iron-control-state.js'; | ||
import { Polymer } from '@polymer/polymer/lib/legacy/polymer-fn.js'; | ||
import { html } from '@polymer/polymer/lib/utils/html-tag.js'; | ||
import {Polymer} from '@polymer/polymer/lib/legacy/polymer-fn.js'; | ||
import {html} from '@polymer/polymer/lib/utils/html-tag.js'; | ||
import {IronButtonState} from '../iron-button-state.js'; | ||
import {IronControlState} from '../iron-control-state.js'; | ||
Polymer({ | ||
@@ -17,0 +20,0 @@ _template: html` |
/** | ||
@license | ||
Copyright (c) 2015 The Polymer Project Authors. All rights reserved. | ||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt | ||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt | ||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt | ||
Code distributed by Google as part of the polymer project is also | ||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt | ||
This code may only be used under the BSD style license found at | ||
http://polymer.github.io/LICENSE.txt The complete set of authors may be found at | ||
http://polymer.github.io/AUTHORS.txt The complete set of contributors may be | ||
found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as | ||
part of the polymer project is also subject to an additional IP rights grant | ||
found at http://polymer.github.io/PATENTS.txt | ||
*/ | ||
import '@polymer/polymer/polymer-legacy.js'; | ||
import { IronA11yKeysBehavior } from '@polymer/iron-a11y-keys-behavior/iron-a11y-keys-behavior.js'; | ||
import './iron-control-state.js'; | ||
import { dom } from '@polymer/polymer/lib/legacy/polymer.dom.js'; | ||
import {IronA11yKeysBehavior} from '@polymer/iron-a11y-keys-behavior/iron-a11y-keys-behavior.js'; | ||
import {dom} from '@polymer/polymer/lib/legacy/polymer.dom.js'; | ||
/** | ||
* @demo demo/index.html | ||
* @polymerBehavior Polymer.IronButtonState | ||
* @polymerBehavior IronButtonState | ||
*/ | ||
@@ -20,0 +21,0 @@ export const IronButtonStateImpl = { |
/** | ||
@license | ||
Copyright (c) 2015 The Polymer Project Authors. All rights reserved. | ||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt | ||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt | ||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt | ||
Code distributed by Google as part of the polymer project is also | ||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt | ||
This code may only be used under the BSD style license found at | ||
http://polymer.github.io/LICENSE.txt The complete set of authors may be found at | ||
http://polymer.github.io/AUTHORS.txt The complete set of contributors may be | ||
found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as | ||
part of the polymer project is also subject to an additional IP rights grant | ||
found at http://polymer.github.io/PATENTS.txt | ||
*/ | ||
import '@polymer/polymer/polymer-legacy.js'; | ||
import { PolymerElement } from '@polymer/polymer/polymer-element.js'; | ||
import { dom } from '@polymer/polymer/lib/legacy/polymer.dom.js'; | ||
import {dom} from '@polymer/polymer/lib/legacy/polymer.dom.js'; | ||
@@ -57,9 +57,2 @@ /** | ||
} | ||
}, | ||
__handleEventRetargeting: { | ||
type: Boolean, | ||
value: function() { | ||
return !this.shadowRoot && !PolymerElement; | ||
} | ||
} | ||
@@ -79,24 +72,5 @@ }, | ||
_focusBlurHandler: function(event) { | ||
// In Polymer 2.0, the library takes care of retargeting events. | ||
if (PolymerElement) { | ||
this._setFocused(event.type === 'focus'); | ||
return; | ||
} | ||
// NOTE(cdata): if we are in ShadowDOM land, `event.target` will | ||
// eventually become `this` due to retargeting; if we are not in | ||
// ShadowDOM land, `event.target` will eventually become `this` due | ||
// to the second conditional which fires a synthetic event (that is also | ||
// handled). In either case, we can disregard `event.path`. | ||
if (event.target === this) { | ||
this._setFocused(event.type === 'focus'); | ||
} else if (this.__handleEventRetargeting) { | ||
var target = /** @type {Node} */ (dom(event).localTarget); | ||
if (!this.isLightDescendant(target)) { | ||
this.fire( | ||
event.type, | ||
{sourceEvent: event}, | ||
{node: this, bubbles: event.bubbles, cancelable: event.cancelable}); | ||
} | ||
} | ||
// Polymer takes care of retargeting events. | ||
this._setFocused(event.type === 'focus'); | ||
return; | ||
}, | ||
@@ -103,0 +77,0 @@ |
@@ -10,29 +10,21 @@ { | ||
"devDependencies": { | ||
"@polymer/gen-typescript-declarations": "^1.2.2", | ||
"bower": "^1.8.0", | ||
"webmat": "^0.2.0", | ||
"@polymer/paper-styles": "^3.0.0-pre.21", | ||
"@polymer/paper-input": "^3.0.0-pre.21", | ||
"@polymer/iron-test-helpers": "^3.0.0-pre.21", | ||
"@polymer/iron-component-page": "^3.0.0-pre.21", | ||
"@polymer/paper-styles": "^3.0.0-pre.20", | ||
"@polymer/paper-input": "^3.0.0-pre.20", | ||
"@polymer/iron-test-helpers": "^3.0.0-pre.20", | ||
"wct-browser-legacy": "^1.0.1", | ||
"@webcomponents/webcomponentsjs": "^2.0.0" | ||
"@webcomponents/webcomponentsjs": "^2.0.0", | ||
"@polymer/gen-typescript-declarations": "^1.5.0" | ||
}, | ||
"scripts": { | ||
"update-types": "bower install && gen-typescript-declarations --deleteExisting --outDir .", | ||
"format": "webmat && npm run update-types" | ||
"format": "webmat", | ||
"generate-types": "gen-typescript-declarations --deleteExisting --outDir .", | ||
"prepack": "npm run generate-types" | ||
}, | ||
"version": "3.0.0-pre.21", | ||
"resolutions": { | ||
"inherits": "2.0.3", | ||
"samsam": "1.1.3", | ||
"supports-color": "3.1.2", | ||
"type-detect": "1.0.0", | ||
"@webcomponents/webcomponentsjs": "2.0.0-beta.2" | ||
}, | ||
"version": "3.0.0-pre.22", | ||
"author": "The Polymer Authors", | ||
"dependencies": { | ||
"@polymer/polymer": "^3.0.0", | ||
"@polymer/iron-a11y-keys-behavior": "^3.0.0-pre.21" | ||
"@polymer/iron-a11y-keys-behavior": "^3.0.0-pre.20" | ||
} | ||
} |
@@ -1,4 +0,2 @@ | ||
<!--- | ||
This README is automatically generated from the comments in these files: | ||
@@ -12,12 +10,78 @@ iron-button-state.html iron-control-state.html | ||
thing! https://github.com/PolymerLabs/tedium/issues | ||
--> | ||
[![Published on NPM](https://img.shields.io/npm/v/@polymer/iron-behaviors.svg)](https://www.npmjs.com/package/@polymer/iron-behaviors) | ||
[![Build status](https://travis-ci.org/PolymerElements/iron-behaviors.svg?branch=master)](https://travis-ci.org/PolymerElements/iron-behaviors) | ||
[![Published on webcomponents.org](https://img.shields.io/badge/webcomponents.org-published-blue.svg)](https://webcomponents.org/element/@polymer/iron-behaviors) | ||
_[Demo and API docs](https://elements.polymer-project.org/elements/iron-behaviors)_ | ||
## <iron-behaviors> | ||
`<iron-behaviors>` provides a set of behaviors for the iron elements. | ||
See: [Documentation](https://www.webcomponents.org/element/@polymer/iron-behaviors), | ||
[Demo](https://www.webcomponents.org/element/@polymer/iron-behaviors/demo/demo/index.html). | ||
<!-- No docs for Polymer.IronButtonState found. --> | ||
## Usage | ||
<!-- No docs for Polymer.IronControlState found. --> | ||
### Installation | ||
``` | ||
npm install --save @polymer/iron-behaviors | ||
``` | ||
### In a Polymer 3 element | ||
```js | ||
import {PolymerElement, html} from '@polymer/polymer'; | ||
import {mixinBehaviors} from '@polymer/polymer/lib/legacy/class.js'; | ||
import {IronButtonState} from '../iron-button-state.js'; | ||
import {IronControlState} from '../iron-control-state.js'; | ||
class SampleElement extends mixinBehaviors([IronButtonState, IronControlState], PolymerElement) { | ||
static get template() { | ||
return html` | ||
<style> | ||
:host { | ||
display: inline-block; | ||
} | ||
:host([disabled]) { | ||
opacity: 0.3; | ||
pointer-events: none; | ||
} | ||
:host([active]), | ||
:host([pressed]) { | ||
background-color: blue; | ||
} | ||
:host([focused]) { | ||
background-color: cornflowerblue; | ||
} | ||
</style> | ||
<slot></slot> | ||
`; | ||
} | ||
} | ||
customElements.define('sample-element', SampleElement); | ||
``` | ||
## Contributing | ||
If you want to send a PR to this element, here are | ||
the instructions for running the tests and demo locally: | ||
### Installation | ||
```sh | ||
git clone https://github.com/PolymerElements/iron-behaviors | ||
cd iron-behaviors | ||
npm install | ||
npm install -g polymer-cli | ||
``` | ||
### Running the demo locally | ||
```sh | ||
polymer serve --npm | ||
open http://127.0.0.1:<port>/demo/ | ||
``` | ||
### Running the tests | ||
```sh | ||
polymer test --npm | ||
``` |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7
474
87
23338
10
1