diff --git a/README.md b/README.md index d1e6b2b..ad66982 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ buttons. Focus will be given to the `dialog-confirm` button when the dialog is o ### Changes in 2.0 - `paper-dialog-behavior 2.0` styles only direct `h2` and `.buttons` children of the dialog because of how [`::slotted` works](https://developers.google.com/web/fundamentals/primers/shadowdom/?hl=en#stylinglightdom) (compound selector will select only top level nodes) -- `neon-animation 2.0` doesn't import the Web Animations polyfill, so you'll have to import it ([see Animations section](#Animations)) +- `` uses CSS animation keyframes instead of `neon-animation`, ([see Animations section](#Animations)) ### Styling @@ -40,17 +40,36 @@ this element. ### Animations Set the `entry-animation` and/or `exit-animation` attributes to add an animation when the dialog -is opened or closed. See the documentation in -[PolymerElements/neon-animation](https://github.com/PolymerElements/neon-animation) for more info. +is opened or closed. Included in the component are: +- fade-in-animation +- fade-out-animation +- scale-up-animation +- scale-down-animation -For example: +These animations are not based on the deprecated `neon-animation` component, and use CSS keyframe animations. +This change reduces code size, and uses the platform. You can implement custom entry/exit animations using +CSS keyframe animations; define the animation keyframes, a CSS class for the animation, and assign the class to the `entry/exit-animation`, e.g. ```html - - - - - + @keyframes appear-from-top { + 0% { + transform: translateY(-2000px); + opacity: 0; + } + 10% { + opacity: 0.2; + } + } + + .appear-from-top { + animation-name: appear-from-top; + animation-timing-function: cubic-bezier(0.0, 0.0, 0.2, 1); + animation-duration: 800ms; + } + + +

Header

Dialog body
@@ -62,4 +81,3 @@ For example: See the docs for `Polymer.PaperDialogBehavior` for accessibility features implemented by this element. - diff --git a/bower.json b/bower.json index bca919a..7edaf86 100644 --- a/bower.json +++ b/bower.json @@ -19,7 +19,6 @@ "homepage": "https://github.com/PolymerElements/paper-dialog", "ignore": [], "dependencies": { - "neon-animation": "PolymerElements/neon-animation#1 - 2", "paper-dialog-behavior": "PolymerElements/paper-dialog-behavior#1 - 2", "iron-overlay-behavior": "PolymerElements/iron-overlay-behavior#1 - 2", "polymer": "Polymer/polymer#1.9 - 2" @@ -33,14 +32,12 @@ "paper-dropdown-menu": "PolymerElements/paper-dropdown-menu#1 - 2", "paper-item": "PolymerElements/paper-item#1 - 2", "paper-listbox": "PolymerElements/paper-listbox#1 - 2", - "web-animations-js": "web-animations/web-animations-js#^2.2.0", "web-component-tester": "^6.0.0", "webcomponentsjs": "webcomponents/webcomponentsjs#^1.0.0" }, "variants": { "1.x": { "dependencies": { - "neon-animation": "PolymerElements/neon-animation#^1.0.0", "paper-dialog-behavior": "PolymerElements/paper-dialog-behavior#^1.0.0", "iron-overlay-behavior": "PolymerElements/iron-overlay-behavior#^1.7.0", "polymer": "Polymer/polymer#^1.9" @@ -54,7 +51,6 @@ "paper-dropdown-menu": "PolymerElements/paper-dropdown-menu#^1.0.0", "paper-item": "PolymerElements/paper-item#^1.0.0", "paper-listbox": "PolymerElements/paper-listbox#^1.0.0", - "web-animations-js": "web-animations/web-animations-js#^2.2.0", "web-component-tester": "^4.0.0", "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" }, diff --git a/demo/index.html b/demo/index.html index d332d91..624ee6c 100644 --- a/demo/index.html +++ b/demo/index.html @@ -23,8 +23,6 @@ - - @@ -33,17 +31,19 @@ - + + @@ -60,29 +60,47 @@

Dialog layouts

Dialog Title

-

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute - irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

+

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna + aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. + Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur + sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Scrolling

-

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute - irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

-

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute - irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

-

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute - irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

-

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute - irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

-

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute - irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

-

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute - irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

-

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute - irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

-

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute - irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

+

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore + magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo + consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. + Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

+

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore + magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo + consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. + Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

+

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore + magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo + consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. + Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

+

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore + magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo + consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. + Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

+

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore + magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo + consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. + Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

+

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore + magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo + consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. + Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

+

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore + magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo + consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. + Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

+

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore + magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo + consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. + Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Cancel @@ -92,8 +110,10 @@

Scrolling

Dialog Title

-

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute - irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

+

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna + aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. + Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur + sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

More Info... Decline @@ -102,7 +122,8 @@

Dialog Title

-

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

+

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna + aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

Tap me to close
@@ -133,8 +154,10 @@

Dialog Title

Dialog Title

-

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute - irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

+

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna + aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. + Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur + sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Open nested dialog
@@ -142,7 +165,8 @@

Dialog Title

Dialog Title

-

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

+

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna + aliqua.

@@ -172,19 +196,25 @@

Styling and positioning

Custom Colors

-

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure - dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

+

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna + aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. + Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur + sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Custom Size & Position

-

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure - dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

+

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna + aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. + Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur + sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

-

Position with positionTarget

+

Position with + positionTarget +

- + \ No newline at end of file diff --git a/paper-dialog.d.ts b/paper-dialog.d.ts index 0be1811..42126b4 100644 --- a/paper-dialog.d.ts +++ b/paper-dialog.d.ts @@ -9,7 +9,6 @@ */ /// -/// /// /// @@ -36,6 +35,11 @@ *
*
* + * ### Changes in 2.0 + * - `paper-dialog-behavior 2.0` styles only direct `h2` and `.buttons` children of the dialog because of how [`::slotted` works](https://developers.google.com/web/fundamentals/primers/shadowdom/?hl=en#stylinglightdom) + * (compound selector will select only top level nodes) + * - `` uses CSS animation keyframes instead of `neon-animation`, ([see Animations section](#Animations)) + * * ### Styling * * See the docs for `Polymer.PaperDialogBehavior` for the custom properties available for styling @@ -44,15 +48,35 @@ * ### Animations * * Set the `entry-animation` and/or `exit-animation` attributes to add an animation when the dialog - * is opened or closed. See the documentation in - * [PolymerElements/neon-animation](https://github.com/PolymerElements/neon-animation) for more info. + * is opened or closed. Included in the component are: + * - fade-in-animation + * - fade-out-animation + * - scale-up-animation + * - scale-down-animation + * + * These animations are not based on the deprecated `neon-animation` component, and use CSS keyframe animations. + * This change reduces code size, and uses the platform. You can implement custom entry/exit animations using + * CSS keyframe animations; define the animation keyframes, a CSS class for the animation, and assign the class to the `entry/exit-animation`, e.g. * - * For example: + * * - * *

Header

*
Dialog body
@@ -63,10 +87,50 @@ * See the docs for `Polymer.PaperDialogBehavior` for accessibility features implemented by this * element. */ -interface PaperDialogElement extends Polymer.Element, Polymer.PaperDialogBehavior, Polymer.NeonAnimationRunnerBehavior { - _renderOpened(): void; - _renderClosed(): void; - _onNeonAnimationFinish(): void; +interface PaperDialogElement extends Polymer.Element, Polymer.PaperDialogBehavior { + + /** + * Deprecated, use `entryAnimation` and `exitAnimation` instead. + * `paper-dialog` doesn't depend anymore on `neon-animation`, and this property is kept + * here to not break bindings. Setting it won't have effects on the animation. + */ + animationConfig: object|null|undefined; + + /** + * The class defining the entry animation. `` ships + * `fade-in-animation, fade-out-animation, scale-up-animation, scale-down-animation`, + * but you can use custom animations too. See the Animations section in the README.md. + */ + entryAnimation: string|null|undefined; + + /** + * The class defining the exit animation. `` ships + * `fade-in-animation, fade-out-animation, scale-up-animation, scale-down-animation`, + * but you can use custom animations too. See the Animations section in the README.md. + */ + exitAnimation: string|null|undefined; + ready(): void; + + /** + * `paper-dialog` doesn't depend anymore on `neon-animation`. + * This method was previously inherited from `Polymer.NeonAnimatableBehavior`, + * now is a no-op. + */ + cancelAnimation(): void; + + /** + * `paper-dialog` doesn't depend anymore on `neon-animation`. + * This method was previously inherited from `Polymer.NeonAnimatableBehavior`, + * now is a no-op. + */ + playAnimation(type?: string, cookie?: object): void; + + /** + * `paper-dialog` doesn't depend anymore on `neon-animation`. + * This method was previously inherited from `Polymer.NeonAnimatableBehavior`, + * now is a no-op. + */ + getAnimationConfig(type: any): any; } interface HTMLElementTagNameMap { diff --git a/paper-dialog.html b/paper-dialog.html index 8287467..7f41df3 100644 --- a/paper-dialog.html +++ b/paper-dialog.html @@ -9,7 +9,6 @@ --> - - - - - - paper-dialog tests - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + paper-dialog tests + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file