Skip to content

Commit

Permalink
Merge pull request #26 from Neovici/update2x
Browse files Browse the repository at this point in the history
Update to 2.x - Refs #25
  • Loading branch information
Wurper committed Nov 16, 2018
2 parents 0f34f75 + dc977f8 commit 72a6ada
Show file tree
Hide file tree
Showing 11 changed files with 12,327 additions and 2,391 deletions.
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lts/*
8 changes: 3 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
language: node_js
node_js: "lts/*"
dist: trusty
sudo: required
env:
global:
- CC_TEST_REPORTER_ID=ee7700d6670416f453c04be8c8ea32b756b7309ce33bf965402136f5d4fb91bc
- SAUCE_USERNAME=nomego
- secure: BxvbM9LnQsXLoaohrIf+ip1kSVmqTgqOxwGU7HZnaw3hOjOZ5PGaD2l1G9X0j2c4QysB6KLcbmrJDWkIVtpiIR2NgC9DQbDpgCyafO+DXk6+sVOuGuV1h/5yt+rfx+VZOItkfCcmsi0MgUjCNCpk22lHIwDbRY3+vvRNNgF8eyyCMz47N+TBzpinTohU0xZOpWHPQbFQ6TfR6heoV/DrF/XPkDbDDLU4WV9AWrPZk9dHzLZLbl5DyXwWivyNqSCkPQCBhYckqZRuMU0XWNlp2tuxC+UMjBDh9HFWl4swZfcrBPOUE0zhjxKBF88QzJyfsLNd5pvkJNKYeQsLZ9z0I47INX867ZGi2iIAX4JW1I4FbAwZs8YnCMAKUzOdJgF8WkvjWRFZ+teO8Wp8s+ymb5NZYMaXlbVjg2wVYau3+1agLhhNXwVv7vYAfLclLfXHKrRCPeSBkX7iVUwlOn5OemWNJBJ9eGCqYi/mbU900wIdk00g9nyZeEjwtbWZkjrMprWqQkCPWxA5ZmkLWlm1pkduokUx0LlCV5MigOgJkQb//OacYwLjIdJCKX/V/KOipCCAlWBaVh3cFBQAx3EcPelD1nWT07xQtcz/BwrmvMGaNnQln3RvuOAV3oRfltR1EDIcRStoDNz00Evc5+Q1DL4fkHnMYWYFsfIQorlb+6o=
addons:
firefox: latest
apt:
Expand All @@ -17,7 +16,6 @@ cache:
directories:
- node_modules
- bower_components
- bower_components-1.x
- ".eslintcache"
- "$HOME/.cache/bower"
before_script:
Expand All @@ -26,7 +24,7 @@ before_script:
- ./cc-test-reporter before-build
- yarn run lint
script:
- xvfb-run yarn test
- yarn test
after_script:
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
notifications:
Expand Down
35 changes: 7 additions & 28 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,40 +21,19 @@
"tests"
],
"dependencies": {
"polymer": "Polymer/polymer#1.9 - 2",
"paper-dialog": "PolymerElements/paper-dialog#1 - 2",
"iron-form": "PolymerElements/iron-form#1 - 2",
"polymer": "Polymer/polymer#^2.6.1",
"paper-dialog": "PolymerElements/paper-dialog#^2.0.0",
"iron-form": "PolymerElements/iron-form#^2.0.0",
"cosmoz-templatize": "Neovici/cosmoz-templatize#^1.0.0"
},
"devDependencies": {
"paper-button": "PolymerElements/paper-button#1 - 2",
"iron-component-page": "PolymerElements/iron-component-page#1 - 3",
"iron-demo-helpers": "PolymerElements/iron-demo-helpers#1 - 2",
"iron-test-helpers": "PolymerElements/iron-test-helpers#1 - 2",
"paper-button": "PolymerElements/paper-button#^2.0.0",
"iron-component-page": "PolymerElements/iron-component-page#^3.0.0",
"iron-demo-helpers": "PolymerElements/iron-demo-helpers#^2.0.0",
"iron-test-helpers": "PolymerElements/iron-test-helpers#^2.0.0",
"web-component-tester": "^6.0.0",
"webcomponentsjs": "webcomponents/webcomponentsjs#^1.0.0"
},
"variants": {
"1.x": {
"dependencies": {
"polymer": "Polymer/polymer#^1.9",
"paper-dialog": "PolymerElements/paper-dialog#^1.1.0",
"iron-form": "PolymerElements/iron-form#1 - 2",
"cosmoz-templatize": "Neovici/cosmoz-templatize#^1.0.0"
},
"devDependencies": {
"paper-button": "PolymerElements/paper-button#^1.0.15",
"iron-component-page": "PolymerElements/iron-component-page#^2.0.0",
"iron-demo-helpers": "PolymerElements/iron-demo-helpers#^1.2.5",
"iron-test-helpers": "PolymerElements/iron-test-helpers#^1.0.0",
"web-component-tester": "^4.0.0",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
},
"resolutions": {
"webcomponentsjs": "^0.7"
}
}
},
"resolutions": {
"webcomponentsjs": "^1.0.0"
}
Expand Down
27 changes: 15 additions & 12 deletions cosmoz-dialog-behavior.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<link rel="import" href="../polymer/polymer.html">
<link rel="import" href="../polymer/polymer-element.html">
<link rel="import" href="../polymer/lib/utils/async.html">
<link rel="import" href="../paper-dialog/paper-dialog.html">
<link rel="import" href="../cosmoz-templatize/cosmoz-templatize.html">

Expand All @@ -11,7 +12,6 @@
'use strict';

window.Cosmoz = window.Cosmoz || {};
const _async = window.requestIdleCallback || window.requestAnimationFrame || Polymer.Base.async;

/**
* @polymerBehavior Cosmoz.DialogBehavior
Expand Down Expand Up @@ -74,25 +74,28 @@

_pendingProps: null,

_dialogCloseEventHandler: null,

created() {
this._dialogEventsHandler = this._handlePaperDialogEvents.bind(this);
this._dialogCloseEventHandler = this.close.bind(this);
this._pendingProps = {};
this._spawn = this._spawn.bind(this);
this._spawnSteps = [this._createDialog, this._createInstance];
},

attached() {
this._observer = Polymer.dom(this).observeNodes(this._onNodesChange);
this.listen(window, 'cosmoz-dialog-closeall', 'close');
this._observer = new Polymer.FlattenedNodesObserver(this, this._onNodesChange);
window.addEventListener('cosmoz-dialog-closeall', this._dialogCloseEventHandler);
},

detached() {
if (this._observer) {
Polymer.dom(this).unobserveNodes(this._observer);
this._observer.disconnect();
this._observer = null;
}
this._detachDialog();
this.unlisten(window, 'cosmoz-dialog-closeall', 'close');
window.removeEventListener('cosmoz-dialog-closeall', this._dialogCloseEventHandler);
this._templateInstance = null;
},

Expand All @@ -102,7 +105,7 @@
return;
}
step.call(this);
_async(this._spawn);
Polymer.Async.microTask.run(() => this._spawn);
},
/**
* Get the generated paper-dialog element
Expand All @@ -124,7 +127,7 @@

_attachDialog() {
if (!this._paperDialog.parentNode) {
Polymer.dom(document.body).appendChild(this._paperDialog);
document.body.appendChild(this._paperDialog);
}
},

Expand All @@ -139,7 +142,7 @@
if (!dialog.parentNode) {
return;
}
Polymer.dom(dialog.parentNode).removeChild(dialog);
dialog.parentNode.removeChild(dialog);
},


Expand Down Expand Up @@ -192,7 +195,7 @@
return;
}

_async(this._spawn);
Polymer.Async.microTask.run(() => this._spawn);
},

_createDialog() {
Expand Down Expand Up @@ -222,15 +225,15 @@
const instance = new this._instanceCtor(this._pendingProps);
this._templateInstance = instance;

Polymer.dom(this._paperDialog).appendChild(instance.root);
this._paperDialog.appendChild(instance.root);

if (instance._flushProperties) {
instance._flushProperties(true);
}
},

_handlePaperDialogEvents(event) {
this.fire(event.type);
this.dispatchEvent(new CustomEvent(event.type, { bubbles: true, composed: true }));
},

_forwardHostProp(prop, value) {
Expand Down
21 changes: 7 additions & 14 deletions cosmoz-dialog.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<link rel="import" href="../polymer/polymer.html">
<link rel="import" href="../polymer/polymer-element.html">
<link rel="import" href="cosmoz-dialog-behavior.html">

<!--
Expand All @@ -14,18 +14,11 @@
-->
<script>

(function () {
'use strict';

Polymer({

is: 'cosmoz-dialog',

behaviors: [
Cosmoz.DialogBehavior
]
});

})();
class CosmozDialog extends Polymer.mixinBehaviors(Cosmoz.DialogBehavior, Polymer.Element) {
static get is() {
return 'cosmoz-dialog';
}
}
customElements.define(CosmozDialog.is, CosmozDialog);

</script>
86 changes: 43 additions & 43 deletions cosmoz-form-dialog.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<link rel="import" href="../polymer/polymer.html">
<link rel="import" href="../polymer/polymer-element.html">
<link rel="import" href="../iron-form/iron-form.html">
<link rel="import" href="cosmoz-dialog-behavior.html">

Expand All @@ -7,58 +7,58 @@
@demo demo/form-dialog.html Dialog Demo
-->
<dom-module id="cosmoz-form-dialog">
<template>
<div hidden>
<slot></slot>
</div>
</template>
<script>
(function () {

Polymer({
class CosmozFormDialog extends Polymer.mixinBehaviors(Cosmoz.DialogBehavior, Polymer.Element) {
static get is() {
return 'cosmoz-form-dialog';
}

is: 'cosmoz-form-dialog',
constructor() {
super();
this._form = null;
this._spawnSteps.push(this._createForm);
}

behaviors: [
Cosmoz.DialogBehavior
],
static get template() {
return Polymer.html`
<template>
<div hidden>
<slot></slot>
</div>
</template>
`;
}

_form: null,
get form() {
return this._form;
}

created() {
this._spawnSteps.push(this._createForm);
},

get form() {
return this._form;
},

_detachDialog() {
if (this._form !== null && this._form.parentNode) {
Polymer.dom(this._form.parentNode).removeChild(this._form);
}
},

_attachDialog() {
if (!this._form.parentNode) {
Polymer.dom(document.body).appendChild(this._form);
}
},
_detachDialog() {
if (this._form !== null && this._form.parentNode) {
this._form.parentNode.removeChild(this._form);
}
}

_createForm() {
if (!this._paperDialog) {
return;
}
const ironForm = document.createElement('iron-form'),
form = document.createElement('form');
_attachDialog() {
if (!this._form.parentNode) {
document.body.appendChild(this._form);
}
}

Polymer.dom(ironForm).appendChild(form);
Polymer.dom(form).appendChild(this._paperDialog);
this._form = ironForm;
_createForm() {
if (!this._paperDialog) {
return;
}
});
const ironForm = document.createElement('iron-form'),
form = document.createElement('form');

})();
ironForm.appendChild(form);
form.appendChild(this._paperDialog);
this._form = ironForm;
}
}
customElements.define(CosmozFormDialog.is, CosmozFormDialog);

</script>
</dom-module>

0 comments on commit 72a6ada

Please sign in to comment.