@nanoporetech-digital/components 6.0.1 → 6.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -0
- package/dist/cjs/index-14451c95.js +6 -2
- package/dist/cjs/index-browser.cjs-d4554470.js +39 -0
- package/dist/cjs/index-browser.cjs-d4554470.js.map +1 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/nano-algolia.cjs.entry.js +6 -1
- package/dist/cjs/nano-algolia.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-animation.cjs.entry.js +1209 -0
- package/dist/cjs/nano-animation.cjs.entry.js.map +1 -0
- package/dist/cjs/nano-components.cjs.js +1 -1
- package/dist/cjs/nano-global-nav-user-profile_3.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-global-nav.cjs.entry.js +24 -25
- package/dist/cjs/nano-global-nav.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-global-search-results.cjs.entry.js +51 -27
- package/dist/cjs/nano-global-search-results.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-hero.cjs.entry.js +1 -1
- package/dist/cjs/nano-hero.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-intersection-observe.cjs.entry.js +131 -0
- package/dist/cjs/nano-intersection-observe.cjs.entry.js.map +1 -0
- package/dist/cjs/nano-resize-observe_2.cjs.entry.js +1 -1
- package/dist/cjs/nano-resize-observe_2.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-sticker.cjs.entry.js +2 -27
- package/dist/cjs/nano-sticker.cjs.entry.js.map +1 -1
- package/dist/cjs/{nano-table-400049cc.js → nano-table-06530d49.js} +5 -25
- package/dist/cjs/nano-table-06530d49.js.map +1 -0
- package/dist/cjs/nano-table.cjs.entry.js +2 -1
- package/dist/cjs/nano-table.cjs.entry.js.map +1 -1
- package/dist/cjs/scroll-parent-87393de2.js +31 -0
- package/dist/cjs/scroll-parent-87393de2.js.map +1 -0
- package/dist/cjs/search-insights-b2bb12bd.js +50 -0
- package/dist/cjs/search-insights-b2bb12bd.js.map +1 -0
- package/dist/cjs/{table.worker-a37f8365.js → table.worker-b4922b9b.js} +3 -2
- package/dist/cjs/table.worker-b4922b9b.js.map +1 -0
- package/dist/collection/collection-manifest.json +2 -1
- package/dist/collection/components/algolia/algolia-interface.js.map +1 -1
- package/dist/collection/components/algolia/algolia.js +8 -3
- package/dist/collection/components/algolia/algolia.js.map +1 -1
- package/dist/collection/components/animation/animation.js +547 -0
- package/dist/collection/components/animation/animation.js.map +1 -0
- package/dist/collection/components/animation/animations/attention_seekers/bounce.js +43 -0
- package/dist/collection/components/animation/animations/attention_seekers/flash.js +7 -0
- package/dist/collection/components/animation/animations/attention_seekers/headShake.js +8 -0
- package/dist/collection/components/animation/animations/attention_seekers/heartBeat.js +7 -0
- package/dist/collection/components/animation/animations/attention_seekers/jello.js +15 -0
- package/dist/collection/components/animation/animations/attention_seekers/pulse.js +5 -0
- package/dist/collection/components/animation/animations/attention_seekers/rubberBand.js +9 -0
- package/dist/collection/components/animation/animations/attention_seekers/shake.js +13 -0
- package/dist/collection/components/animation/animations/attention_seekers/shakeX.js +13 -0
- package/dist/collection/components/animation/animations/attention_seekers/shakeY.js +13 -0
- package/dist/collection/components/animation/animations/attention_seekers/swing.js +7 -0
- package/dist/collection/components/animation/animations/attention_seekers/tada.js +13 -0
- package/dist/collection/components/animation/animations/attention_seekers/wobble.js +18 -0
- package/dist/collection/components/animation/animations/back_entrances/backInDown.js +5 -0
- package/dist/collection/components/animation/animations/back_entrances/backInLeft.js +5 -0
- package/dist/collection/components/animation/animations/back_entrances/backInRight.js +5 -0
- package/dist/collection/components/animation/animations/back_entrances/backInUp.js +5 -0
- package/dist/collection/components/animation/animations/back_exits/backOutDown.js +5 -0
- package/dist/collection/components/animation/animations/back_exits/backOutLeft.js +5 -0
- package/dist/collection/components/animation/animations/back_exits/backOutRight.js +5 -0
- package/dist/collection/components/animation/animations/back_exits/backOutUp.js +5 -0
- package/dist/collection/components/animation/animations/bouncing_entrances/bounceIn.js +14 -0
- package/dist/collection/components/animation/animations/bouncing_entrances/bounceInDown.js +20 -0
- package/dist/collection/components/animation/animations/bouncing_entrances/bounceInLeft.js +16 -0
- package/dist/collection/components/animation/animations/bouncing_entrances/bounceInRight.js +16 -0
- package/dist/collection/components/animation/animations/bouncing_entrances/bounceInUp.js +16 -0
- package/dist/collection/components/animation/animations/bouncing_exits/bounceOut.js +6 -0
- package/dist/collection/components/animation/animations/bouncing_exits/bounceOutDown.js +14 -0
- package/dist/collection/components/animation/animations/bouncing_exits/bounceOutLeft.js +12 -0
- package/dist/collection/components/animation/animations/bouncing_exits/bounceOutRight.js +8 -0
- package/dist/collection/components/animation/animations/bouncing_exits/bounceOutUp.js +18 -0
- package/dist/collection/components/animation/animations/easings/easings.js +35 -0
- package/dist/collection/components/animation/animations/easings/easings.js.map +1 -0
- package/dist/collection/components/animation/animations/fading_entrances/fadeIn.js +4 -0
- package/dist/collection/components/animation/animations/fading_entrances/fadeInBottomLeft.js +4 -0
- package/dist/collection/components/animation/animations/fading_entrances/fadeInBottomRight.js +4 -0
- package/dist/collection/components/animation/animations/fading_entrances/fadeInDown.js +4 -0
- package/dist/collection/components/animation/animations/fading_entrances/fadeInDownBig.js +4 -0
- package/dist/collection/components/animation/animations/fading_entrances/fadeInLeft.js +4 -0
- package/dist/collection/components/animation/animations/fading_entrances/fadeInLeftBig.js +4 -0
- package/dist/collection/components/animation/animations/fading_entrances/fadeInRight.js +4 -0
- package/dist/collection/components/animation/animations/fading_entrances/fadeInRightBig.js +4 -0
- package/dist/collection/components/animation/animations/fading_entrances/fadeInTopLeft.js +4 -0
- package/dist/collection/components/animation/animations/fading_entrances/fadeInTopRight.js +4 -0
- package/dist/collection/components/animation/animations/fading_entrances/fadeInUp.js +4 -0
- package/dist/collection/components/animation/animations/fading_entrances/fadeInUpBig.js +4 -0
- package/dist/collection/components/animation/animations/fading_exits/fadeOut.js +4 -0
- package/dist/collection/components/animation/animations/fading_exits/fadeOutBottomLeft.js +4 -0
- package/dist/collection/components/animation/animations/fading_exits/fadeOutBottomRight.js +4 -0
- package/dist/collection/components/animation/animations/fading_exits/fadeOutDown.js +4 -0
- package/dist/collection/components/animation/animations/fading_exits/fadeOutDownBig.js +4 -0
- package/dist/collection/components/animation/animations/fading_exits/fadeOutLeft.js +4 -0
- package/dist/collection/components/animation/animations/fading_exits/fadeOutLeftBig.js +4 -0
- package/dist/collection/components/animation/animations/fading_exits/fadeOutRight.js +4 -0
- package/dist/collection/components/animation/animations/fading_exits/fadeOutRightBig.js +4 -0
- package/dist/collection/components/animation/animations/fading_exits/fadeOutTopLeft.js +4 -0
- package/dist/collection/components/animation/animations/fading_exits/fadeOutTopRight.js +4 -0
- package/dist/collection/components/animation/animations/fading_exits/fadeOutUp.js +4 -0
- package/dist/collection/components/animation/animations/fading_exits/fadeOutUpBig.js +4 -0
- package/dist/collection/components/animation/animations/flippers/flip.js +32 -0
- package/dist/collection/components/animation/animations/flippers/flipInX.js +20 -0
- package/dist/collection/components/animation/animations/flippers/flipInY.js +20 -0
- package/dist/collection/components/animation/animations/flippers/flipOutX.js +13 -0
- package/dist/collection/components/animation/animations/flippers/flipOutY.js +13 -0
- package/dist/collection/components/animation/animations/index.js +203 -0
- package/dist/collection/components/animation/animations/index.js.map +1 -0
- package/dist/collection/components/animation/animations/lightspeed/lightSpeedInLeft.js +10 -0
- package/dist/collection/components/animation/animations/lightspeed/lightSpeedInRight.js +10 -0
- package/dist/collection/components/animation/animations/lightspeed/lightSpeedOutLeft.js +8 -0
- package/dist/collection/components/animation/animations/lightspeed/lightSpeedOutRight.js +8 -0
- package/dist/collection/components/animation/animations/rotating_entrances/rotateIn.js +4 -0
- package/dist/collection/components/animation/animations/rotating_entrances/rotateInDownLeft.js +4 -0
- package/dist/collection/components/animation/animations/rotating_entrances/rotateInDownRight.js +4 -0
- package/dist/collection/components/animation/animations/rotating_entrances/rotateInUpLeft.js +4 -0
- package/dist/collection/components/animation/animations/rotating_entrances/rotateInUpRight.js +4 -0
- package/dist/collection/components/animation/animations/rotating_exits/rotateOut.js +4 -0
- package/dist/collection/components/animation/animations/rotating_exits/rotateOutDownLeft.js +4 -0
- package/dist/collection/components/animation/animations/rotating_exits/rotateOutDownRight.js +4 -0
- package/dist/collection/components/animation/animations/rotating_exits/rotateOutUpLeft.js +4 -0
- package/dist/collection/components/animation/animations/rotating_exits/rotateOutUpRight.js +4 -0
- package/dist/collection/components/animation/animations/sliding_entrances/slideInDown.js +4 -0
- package/dist/collection/components/animation/animations/sliding_entrances/slideInLeft.js +4 -0
- package/dist/collection/components/animation/animations/sliding_entrances/slideInRight.js +4 -0
- package/dist/collection/components/animation/animations/sliding_entrances/slideInUp.js +4 -0
- package/dist/collection/components/animation/animations/sliding_exits/slideOutDown.js +4 -0
- package/dist/collection/components/animation/animations/sliding_exits/slideOutLeft.js +4 -0
- package/dist/collection/components/animation/animations/sliding_exits/slideOutRight.js +4 -0
- package/dist/collection/components/animation/animations/sliding_exits/slideOutUp.js +4 -0
- package/dist/collection/components/animation/animations/specials/hinge.js +18 -0
- package/dist/collection/components/animation/animations/specials/jackInTheBox.js +11 -0
- package/dist/collection/components/animation/animations/specials/rollIn.js +8 -0
- package/dist/collection/components/animation/animations/specials/rollOut.js +8 -0
- package/dist/collection/components/animation/animations/zooming_entrances/zoomIn.js +4 -0
- package/dist/collection/components/animation/animations/zooming_entrances/zoomInDown.js +14 -0
- package/dist/collection/components/animation/animations/zooming_entrances/zoomInLeft.js +14 -0
- package/dist/collection/components/animation/animations/zooming_entrances/zoomInRight.js +14 -0
- package/dist/collection/components/animation/animations/zooming_entrances/zoomInUp.js +14 -0
- package/dist/collection/components/animation/animations/zooming_exits/zoomOut.js +5 -0
- package/dist/collection/components/animation/animations/zooming_exits/zoomOutDown.js +14 -0
- package/dist/collection/components/animation/animations/zooming_exits/zoomOutLeft.js +12 -0
- package/dist/collection/components/animation/animations/zooming_exits/zoomOutRight.js +12 -0
- package/dist/collection/components/animation/animations/zooming_exits/zoomOutUp.js +14 -0
- package/dist/collection/components/global-nav/global-nav-interface.js.map +1 -1
- package/dist/collection/components/global-nav/global-nav.js +25 -25
- package/dist/collection/components/global-nav/global-nav.js.map +1 -1
- package/dist/collection/components/global-search-results/global-search-results.js +51 -27
- package/dist/collection/components/global-search-results/global-search-results.js.map +1 -1
- package/dist/collection/components/hero/hero.css +0 -1
- package/dist/collection/components/intersection-observe/intersection-observe.js +256 -0
- package/dist/collection/components/intersection-observe/intersection-observe.js.map +1 -0
- package/dist/collection/components/resize-observe/resize-observe.js +1 -1
- package/dist/collection/components/resize-observe/resize-observe.js.map +1 -1
- package/dist/collection/components/select/select.js +5 -5
- package/dist/collection/components/select/select.js.map +1 -1
- package/dist/collection/components/sticker/sticker.js +2 -27
- package/dist/collection/components/sticker/sticker.js.map +1 -1
- package/dist/collection/components/table/table.js +2 -1
- package/dist/collection/components/table/table.js.map +1 -1
- package/dist/collection/components/table/table.utils.js +0 -21
- package/dist/collection/components/table/table.utils.js.map +1 -1
- package/dist/collection/utils/scroll-parent.js +26 -0
- package/dist/collection/utils/scroll-parent.js.map +1 -0
- package/dist/collection/utils/search-insights.js +46 -0
- package/dist/collection/utils/search-insights.js.map +1 -0
- package/dist/components/algolia.js +6 -1
- package/dist/components/algolia.js.map +1 -1
- package/dist/components/index-browser.cjs.js +37 -0
- package/dist/components/index-browser.cjs.js.map +1 -0
- package/dist/components/index.d.ts +2 -1
- package/dist/components/index.js +2 -1
- package/dist/components/index.js.map +1 -1
- package/dist/components/{nano-aspect-ratio.d.ts → nano-animation.d.ts} +4 -4
- package/dist/components/nano-animation.js +1239 -0
- package/dist/components/nano-animation.js.map +1 -0
- package/dist/components/nano-global-nav.js +24 -25
- package/dist/components/nano-global-nav.js.map +1 -1
- package/dist/components/nano-global-search-results.js +51 -27
- package/dist/components/nano-global-search-results.js.map +1 -1
- package/dist/components/nano-hero.js +1 -1
- package/dist/components/nano-hero.js.map +1 -1
- package/dist/components/nano-intersection-observe.d.ts +11 -0
- package/dist/components/nano-intersection-observe.js +149 -0
- package/dist/components/nano-intersection-observe.js.map +1 -0
- package/dist/components/resize-observe.js +1 -1
- package/dist/components/resize-observe.js.map +1 -1
- package/dist/components/scroll-parent.js +29 -0
- package/dist/components/scroll-parent.js.map +1 -0
- package/dist/components/search-insights.js +48 -0
- package/dist/components/search-insights.js.map +1 -0
- package/dist/components/select.js.map +1 -1
- package/dist/components/sticker.js +2 -27
- package/dist/components/sticker.js.map +1 -1
- package/dist/components/table.js +1 -21
- package/dist/components/table.js.map +1 -1
- package/dist/esm/index-9695db0a.js +6 -2
- package/dist/esm/index-browser.cjs-bf702094.js +37 -0
- package/dist/esm/index-browser.cjs-bf702094.js.map +1 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/nano-algolia.entry.js +6 -1
- package/dist/esm/nano-algolia.entry.js.map +1 -1
- package/dist/esm/nano-animation.entry.js +1205 -0
- package/dist/esm/nano-animation.entry.js.map +1 -0
- package/dist/esm/nano-components.js +1 -1
- package/dist/esm/nano-global-nav-user-profile_3.entry.js.map +1 -1
- package/dist/esm/nano-global-nav.entry.js +24 -25
- package/dist/esm/nano-global-nav.entry.js.map +1 -1
- package/dist/esm/nano-global-search-results.entry.js +51 -27
- package/dist/esm/nano-global-search-results.entry.js.map +1 -1
- package/dist/esm/nano-hero.entry.js +1 -1
- package/dist/esm/nano-hero.entry.js.map +1 -1
- package/dist/esm/nano-intersection-observe.entry.js +127 -0
- package/dist/esm/nano-intersection-observe.entry.js.map +1 -0
- package/dist/esm/nano-resize-observe_2.entry.js +1 -1
- package/dist/esm/nano-resize-observe_2.entry.js.map +1 -1
- package/dist/esm/nano-sticker.entry.js +2 -27
- package/dist/esm/nano-sticker.entry.js.map +1 -1
- package/dist/esm/{nano-table-a6641aef.js → nano-table-c85a2fd3.js} +3 -23
- package/dist/esm/nano-table-c85a2fd3.js.map +1 -0
- package/dist/esm/nano-table.entry.js +2 -1
- package/dist/esm/nano-table.entry.js.map +1 -1
- package/dist/esm/scroll-parent-bab1cbf7.js +29 -0
- package/dist/esm/scroll-parent-bab1cbf7.js.map +1 -0
- package/dist/esm/search-insights-f64a6b4c.js +48 -0
- package/dist/esm/search-insights-f64a6b4c.js.map +1 -0
- package/dist/esm/{table.worker-6b597e20.js → table.worker-761fba3e.js} +3 -2
- package/dist/esm/table.worker-761fba3e.js.map +1 -0
- package/dist/nano-components/index-browser.cjs-bf702094.js +5 -0
- package/dist/nano-components/index-browser.cjs-bf702094.js.map +1 -0
- package/dist/nano-components/nano-algolia.entry.js +1 -1
- package/dist/nano-components/nano-algolia.entry.js.map +1 -1
- package/dist/nano-components/nano-animation.entry.js +5 -0
- package/dist/nano-components/nano-animation.entry.js.map +1 -0
- package/dist/nano-components/nano-components.css +1 -1
- package/dist/nano-components/nano-components.esm.js +1 -1
- package/dist/nano-components/nano-components.esm.js.map +1 -1
- package/dist/nano-components/nano-global-nav-user-profile_3.entry.js.map +1 -1
- package/dist/nano-components/nano-global-nav.entry.js +1 -1
- package/dist/nano-components/nano-global-nav.entry.js.map +1 -1
- package/dist/nano-components/nano-global-search-results.entry.js +1 -1
- package/dist/nano-components/nano-global-search-results.entry.js.map +1 -1
- package/dist/nano-components/nano-hero.entry.js +1 -1
- package/dist/nano-components/nano-hero.entry.js.map +1 -1
- package/dist/nano-components/nano-intersection-observe.entry.js +5 -0
- package/dist/nano-components/nano-intersection-observe.entry.js.map +1 -0
- package/dist/nano-components/nano-resize-observe_2.entry.js +1 -1
- package/dist/nano-components/nano-resize-observe_2.entry.js.map +1 -1
- package/dist/nano-components/nano-sticker.entry.js +1 -1
- package/dist/nano-components/nano-sticker.entry.js.map +1 -1
- package/dist/nano-components/nano-table-c85a2fd3.js +5 -0
- package/dist/nano-components/nano-table-c85a2fd3.js.map +1 -0
- package/dist/nano-components/nano-table.entry.js +1 -1
- package/dist/nano-components/scroll-parent-bab1cbf7.js +5 -0
- package/dist/nano-components/scroll-parent-bab1cbf7.js.map +1 -0
- package/dist/nano-components/search-insights-f64a6b4c.js +5 -0
- package/dist/nano-components/search-insights-f64a6b4c.js.map +1 -0
- package/dist/nano-components/table.worker-761fba3e.js +5 -0
- package/dist/types/components/algolia/algolia-interface.d.ts +2 -1
- package/dist/types/components/algolia/algolia.d.ts +7 -1
- package/dist/types/components/animation/animation.d.ts +74 -0
- package/dist/types/components/animation/animations/easings/easings.d.ts +31 -0
- package/dist/types/components/animation/animations/index.d.ts +101 -0
- package/dist/types/components/global-nav/global-nav-interface.d.ts +1 -0
- package/dist/types/components/global-nav/global-nav.d.ts +2 -6
- package/dist/types/components/global-search-results/global-search-results.d.ts +13 -7
- package/dist/types/components/intersection-observe/intersection-observe.d.ts +45 -0
- package/dist/types/components/select/select.d.ts +2 -4
- package/dist/types/components/sticker/sticker.d.ts +0 -5
- package/dist/types/components/table/table.utils.d.ts +0 -6
- package/dist/types/components.d.ts +213 -43
- package/dist/types/interface.d.ts +7 -2
- package/dist/types/utils/scroll-parent.d.ts +6 -0
- package/dist/types/utils/search-insights.d.ts +22 -0
- package/docs-json.json +1031 -117
- package/docs-vscode.json +488 -8
- package/hydrate/index.js +1636 -249
- package/package.json +3 -2
- package/dist/cjs/nano-aspect-ratio.cjs.entry.js +0 -53
- package/dist/cjs/nano-aspect-ratio.cjs.entry.js.map +0 -1
- package/dist/cjs/nano-table-400049cc.js.map +0 -1
- package/dist/cjs/table.worker-a37f8365.js.map +0 -1
- package/dist/collection/components/aspect-ratio/aspect-ratio.css +0 -38
- package/dist/collection/components/aspect-ratio/aspect-ratio.js +0 -106
- package/dist/collection/components/aspect-ratio/aspect-ratio.js.map +0 -1
- package/dist/components/nano-aspect-ratio.js +0 -70
- package/dist/components/nano-aspect-ratio.js.map +0 -1
- package/dist/esm/nano-aspect-ratio.entry.js +0 -49
- package/dist/esm/nano-aspect-ratio.entry.js.map +0 -1
- package/dist/esm/nano-table-a6641aef.js.map +0 -1
- package/dist/esm/table.worker-6b597e20.js.map +0 -1
- package/dist/nano-components/nano-aspect-ratio.entry.js +0 -5
- package/dist/nano-components/nano-aspect-ratio.entry.js.map +0 -1
- package/dist/nano-components/nano-table-a6641aef.js +0 -5
- package/dist/nano-components/nano-table-a6641aef.js.map +0 -1
- package/dist/nano-components/table.worker-6b597e20.js +0 -5
- package/dist/types/components/aspect-ratio/aspect-ratio.d.ts +0 -19
- /package/dist/nano-components/{table.worker-6b597e20.js.map → table.worker-761fba3e.js.map} +0 -0
@@ -0,0 +1,547 @@
|
|
1
|
+
/*!
|
2
|
+
* Web Components for Nanopore digital Web Apps
|
3
|
+
*/
|
4
|
+
import { h, Host, } from '@stencil/core';
|
5
|
+
import { animations, easings } from './animations';
|
6
|
+
/**
|
7
|
+
* Animate elements declaratively with [~100 baked-in presets](https://animate.style/), or make your own with custom keyframes.
|
8
|
+
* Powered by the [Web Animations API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Animations_API).
|
9
|
+
*
|
10
|
+
* @slot - The element to animate. Avoid slotting in more than one element, as subsequent ones will be ignored. To animate multiple elements, either wrap them in a single container or use multiple *nano-animation* elements.
|
11
|
+
*/
|
12
|
+
export class NanoAnimation {
|
13
|
+
constructor() {
|
14
|
+
this.hasStarted = false;
|
15
|
+
this.handleAnimationFinish = () => {
|
16
|
+
this.play = false;
|
17
|
+
this.hasStarted = false;
|
18
|
+
this.nanoFinish.emit();
|
19
|
+
};
|
20
|
+
this.handleAnimationCancel = () => {
|
21
|
+
this.play = false;
|
22
|
+
this.hasStarted = false;
|
23
|
+
this.nanoCancel.emit();
|
24
|
+
};
|
25
|
+
this.handleSlotChange = () => {
|
26
|
+
this.destroyAnimation();
|
27
|
+
this.createAnimation();
|
28
|
+
};
|
29
|
+
this.name = 'none';
|
30
|
+
this.play = false;
|
31
|
+
this.delay = 0;
|
32
|
+
this.direction = 'normal';
|
33
|
+
this.duration = 1000;
|
34
|
+
this.easing = 'ease';
|
35
|
+
this.endDelay = 0;
|
36
|
+
this.fill = 'auto';
|
37
|
+
this.iterations = Infinity;
|
38
|
+
this.iterationStart = 0;
|
39
|
+
this.keyframes = undefined;
|
40
|
+
this.playbackRate = 1;
|
41
|
+
}
|
42
|
+
/** Gets and sets the current animation time. */
|
43
|
+
get currentTime() {
|
44
|
+
return this.animation?.currentTime ?? 0;
|
45
|
+
}
|
46
|
+
set currentTime(time) {
|
47
|
+
if (this.animation) {
|
48
|
+
this.animation.currentTime = time;
|
49
|
+
}
|
50
|
+
}
|
51
|
+
connectedCallback() {
|
52
|
+
this.createAnimation();
|
53
|
+
}
|
54
|
+
disconnectedCallback() {
|
55
|
+
this.destroyAnimation();
|
56
|
+
}
|
57
|
+
async createAnimation() {
|
58
|
+
if (!this.defaultSlot)
|
59
|
+
return;
|
60
|
+
const easing = easings[this.easing] ?? this.easing;
|
61
|
+
const keyframes = this.keyframes ??
|
62
|
+
animations[this.name];
|
63
|
+
const slot = this.defaultSlot;
|
64
|
+
const element = slot.assignedElements()[0];
|
65
|
+
if (!element || !keyframes) {
|
66
|
+
return false;
|
67
|
+
}
|
68
|
+
this.destroyAnimation();
|
69
|
+
this.animation = element.animate(keyframes, {
|
70
|
+
delay: this.delay,
|
71
|
+
direction: this.direction,
|
72
|
+
duration: this.duration,
|
73
|
+
easing,
|
74
|
+
endDelay: this.endDelay,
|
75
|
+
fill: this.fill,
|
76
|
+
iterationStart: this.iterationStart,
|
77
|
+
iterations: this.iterations,
|
78
|
+
});
|
79
|
+
this.animation.playbackRate = this.playbackRate;
|
80
|
+
this.animation.addEventListener('cancel', this.handleAnimationCancel);
|
81
|
+
this.animation.addEventListener('finish', this.handleAnimationFinish);
|
82
|
+
if (this.play) {
|
83
|
+
this.hasStarted = true;
|
84
|
+
this.nanoStart.emit();
|
85
|
+
}
|
86
|
+
else {
|
87
|
+
this.animation.pause();
|
88
|
+
}
|
89
|
+
return true;
|
90
|
+
}
|
91
|
+
destroyAnimation() {
|
92
|
+
if (this.animation) {
|
93
|
+
this.animation.cancel();
|
94
|
+
this.animation.removeEventListener('cancel', this.handleAnimationCancel);
|
95
|
+
this.animation.removeEventListener('finish', this.handleAnimationFinish);
|
96
|
+
this.hasStarted = false;
|
97
|
+
}
|
98
|
+
}
|
99
|
+
handleAnimationChange() {
|
100
|
+
this.createAnimation();
|
101
|
+
}
|
102
|
+
handlePlayChange() {
|
103
|
+
if (this.animation) {
|
104
|
+
if (this.play && !this.hasStarted) {
|
105
|
+
this.hasStarted = true;
|
106
|
+
this.nanoStart.emit();
|
107
|
+
}
|
108
|
+
if (this.play) {
|
109
|
+
this.animation.play();
|
110
|
+
}
|
111
|
+
else {
|
112
|
+
this.animation.pause();
|
113
|
+
}
|
114
|
+
return true;
|
115
|
+
}
|
116
|
+
return false;
|
117
|
+
}
|
118
|
+
handlePlaybackRateChange() {
|
119
|
+
if (this.animation) {
|
120
|
+
this.animation.playbackRate = this.playbackRate;
|
121
|
+
}
|
122
|
+
}
|
123
|
+
/** Clears all keyframe effects caused by this animation and aborts its playback. */
|
124
|
+
async cancel() {
|
125
|
+
this.animation?.cancel();
|
126
|
+
}
|
127
|
+
/** Sets the playback time to the end of the animation corresponding to the current playback direction. */
|
128
|
+
async finish() {
|
129
|
+
this.animation?.finish();
|
130
|
+
}
|
131
|
+
render() {
|
132
|
+
return (h(Host, null, h("slot", { ref: (slot) => (this.defaultSlot = slot), onSlotchange: this.handleSlotChange })));
|
133
|
+
}
|
134
|
+
static get is() { return "nano-animation"; }
|
135
|
+
static get encapsulation() { return "shadow"; }
|
136
|
+
static get styles() { return ":host {\n display: contents;\n }"; }
|
137
|
+
static get properties() {
|
138
|
+
return {
|
139
|
+
"name": {
|
140
|
+
"type": "string",
|
141
|
+
"mutable": false,
|
142
|
+
"complexType": {
|
143
|
+
"original": "AnimationName | 'none'",
|
144
|
+
"resolved": "\"flip\" | \"none\" | \"bounce\" | \"flash\" | \"headShake\" | \"heartBeat\" | \"jello\" | \"pulse\" | \"rubberBand\" | \"shake\" | \"shakeX\" | \"shakeY\" | \"swing\" | \"tada\" | \"wobble\" | \"backInDown\" | \"backInLeft\" | \"backInRight\" | \"backInUp\" | \"backOutDown\" | \"backOutLeft\" | \"backOutRight\" | \"backOutUp\" | \"bounceIn\" | \"bounceInDown\" | \"bounceInLeft\" | \"bounceInRight\" | \"bounceInUp\" | \"bounceOut\" | \"bounceOutDown\" | \"bounceOutLeft\" | \"bounceOutRight\" | \"bounceOutUp\" | \"fadeIn\" | \"fadeInBottomLeft\" | \"fadeInBottomRight\" | \"fadeInDown\" | \"fadeInDownBig\" | \"fadeInLeft\" | \"fadeInLeftBig\" | \"fadeInRight\" | \"fadeInRightBig\" | \"fadeInTopLeft\" | \"fadeInTopRight\" | \"fadeInUp\" | \"fadeInUpBig\" | \"fadeOut\" | \"fadeOutBottomLeft\" | \"fadeOutBottomRight\" | \"fadeOutDown\" | \"fadeOutDownBig\" | \"fadeOutLeft\" | \"fadeOutLeftBig\" | \"fadeOutRight\" | \"fadeOutRightBig\" | \"fadeOutTopLeft\" | \"fadeOutTopRight\" | \"fadeOutUp\" | \"fadeOutUpBig\" | \"flipInX\" | \"flipInY\" | \"flipOutX\" | \"flipOutY\" | \"lightSpeedInLeft\" | \"lightSpeedInRight\" | \"lightSpeedOutLeft\" | \"lightSpeedOutRight\" | \"rotateIn\" | \"rotateInDownLeft\" | \"rotateInDownRight\" | \"rotateInUpLeft\" | \"rotateInUpRight\" | \"rotateOut\" | \"rotateOutDownLeft\" | \"rotateOutDownRight\" | \"rotateOutUpLeft\" | \"rotateOutUpRight\" | \"slideInDown\" | \"slideInLeft\" | \"slideInRight\" | \"slideInUp\" | \"slideOutDown\" | \"slideOutLeft\" | \"slideOutRight\" | \"slideOutUp\" | \"hinge\" | \"jackInTheBox\" | \"rollIn\" | \"rollOut\" | \"zoomIn\" | \"zoomInDown\" | \"zoomInLeft\" | \"zoomInRight\" | \"zoomInUp\" | \"zoomOut\" | \"zoomOutDown\" | \"zoomOutLeft\" | \"zoomOutRight\" | \"zoomOutUp\"",
|
145
|
+
"references": {
|
146
|
+
"AnimationName": {
|
147
|
+
"location": "import",
|
148
|
+
"path": "../../interface"
|
149
|
+
}
|
150
|
+
}
|
151
|
+
},
|
152
|
+
"required": false,
|
153
|
+
"optional": false,
|
154
|
+
"docs": {
|
155
|
+
"tags": [],
|
156
|
+
"text": "The name of the built-in animation to use. For custom animations, use the `keyframes` prop."
|
157
|
+
},
|
158
|
+
"getter": false,
|
159
|
+
"setter": false,
|
160
|
+
"attribute": "name",
|
161
|
+
"reflect": false,
|
162
|
+
"defaultValue": "'none'"
|
163
|
+
},
|
164
|
+
"play": {
|
165
|
+
"type": "boolean",
|
166
|
+
"mutable": true,
|
167
|
+
"complexType": {
|
168
|
+
"original": "boolean",
|
169
|
+
"resolved": "boolean",
|
170
|
+
"references": {}
|
171
|
+
},
|
172
|
+
"required": false,
|
173
|
+
"optional": false,
|
174
|
+
"docs": {
|
175
|
+
"tags": [],
|
176
|
+
"text": "Plays the animation. When omitted, the animation will be paused. This attribute will be automatically removed when\nthe animation finishes or gets canceled."
|
177
|
+
},
|
178
|
+
"getter": false,
|
179
|
+
"setter": false,
|
180
|
+
"attribute": "play",
|
181
|
+
"reflect": true,
|
182
|
+
"defaultValue": "false"
|
183
|
+
},
|
184
|
+
"delay": {
|
185
|
+
"type": "number",
|
186
|
+
"mutable": false,
|
187
|
+
"complexType": {
|
188
|
+
"original": "number",
|
189
|
+
"resolved": "number",
|
190
|
+
"references": {}
|
191
|
+
},
|
192
|
+
"required": false,
|
193
|
+
"optional": false,
|
194
|
+
"docs": {
|
195
|
+
"tags": [],
|
196
|
+
"text": "The number of milliseconds to delay the start of the animation."
|
197
|
+
},
|
198
|
+
"getter": false,
|
199
|
+
"setter": false,
|
200
|
+
"attribute": "delay",
|
201
|
+
"reflect": false,
|
202
|
+
"defaultValue": "0"
|
203
|
+
},
|
204
|
+
"direction": {
|
205
|
+
"type": "string",
|
206
|
+
"mutable": false,
|
207
|
+
"complexType": {
|
208
|
+
"original": "PlaybackDirection",
|
209
|
+
"resolved": "\"alternate\" | \"alternate-reverse\" | \"normal\" | \"reverse\"",
|
210
|
+
"references": {
|
211
|
+
"PlaybackDirection": {
|
212
|
+
"location": "global"
|
213
|
+
}
|
214
|
+
}
|
215
|
+
},
|
216
|
+
"required": false,
|
217
|
+
"optional": false,
|
218
|
+
"docs": {
|
219
|
+
"tags": [],
|
220
|
+
"text": "Determines the direction of playback as well as the behavior when reaching the end of an iteration.\n[Learn more](https://developer.mozilla.org/en-US/docs/Web/CSS/animation-direction)"
|
221
|
+
},
|
222
|
+
"getter": false,
|
223
|
+
"setter": false,
|
224
|
+
"attribute": "direction",
|
225
|
+
"reflect": false,
|
226
|
+
"defaultValue": "'normal'"
|
227
|
+
},
|
228
|
+
"duration": {
|
229
|
+
"type": "number",
|
230
|
+
"mutable": false,
|
231
|
+
"complexType": {
|
232
|
+
"original": "number",
|
233
|
+
"resolved": "number",
|
234
|
+
"references": {}
|
235
|
+
},
|
236
|
+
"required": false,
|
237
|
+
"optional": false,
|
238
|
+
"docs": {
|
239
|
+
"tags": [],
|
240
|
+
"text": "The number of milliseconds each iteration of the animation takes to complete."
|
241
|
+
},
|
242
|
+
"getter": false,
|
243
|
+
"setter": false,
|
244
|
+
"attribute": "duration",
|
245
|
+
"reflect": false,
|
246
|
+
"defaultValue": "1000"
|
247
|
+
},
|
248
|
+
"easing": {
|
249
|
+
"type": "string",
|
250
|
+
"mutable": false,
|
251
|
+
"complexType": {
|
252
|
+
"original": "AnimationEasing",
|
253
|
+
"resolved": "\"linear\" | \"ease\" | \"easeIn\" | \"easeOut\" | \"easeInOut\" | \"easeInSine\" | \"easeOutSine\" | \"easeInOutSine\" | \"easeInQuad\" | \"easeOutQuad\" | \"easeInOutQuad\" | \"easeInCubic\" | \"easeOutCubic\" | \"easeInOutCubic\" | \"easeInQuart\" | \"easeOutQuart\" | \"easeInOutQuart\" | \"easeInQuint\" | \"easeOutQuint\" | \"easeInOutQuint\" | \"easeInExpo\" | \"easeOutExpo\" | \"easeInOutExpo\" | \"easeInCirc\" | \"easeOutCirc\" | \"easeInOutCirc\" | \"easeInBack\" | \"easeOutBack\" | \"easeInOutBack\"",
|
254
|
+
"references": {
|
255
|
+
"AnimationEasing": {
|
256
|
+
"location": "import",
|
257
|
+
"path": "../../interface"
|
258
|
+
}
|
259
|
+
}
|
260
|
+
},
|
261
|
+
"required": false,
|
262
|
+
"optional": false,
|
263
|
+
"docs": {
|
264
|
+
"tags": [],
|
265
|
+
"text": "The easing function to use for the animation. This can be a easing function or a custom easing function\nsuch as `cubic-bezier(0, 1, .76, 1.14)`."
|
266
|
+
},
|
267
|
+
"getter": false,
|
268
|
+
"setter": false,
|
269
|
+
"attribute": "easing",
|
270
|
+
"reflect": false,
|
271
|
+
"defaultValue": "'ease'"
|
272
|
+
},
|
273
|
+
"endDelay": {
|
274
|
+
"type": "number",
|
275
|
+
"mutable": false,
|
276
|
+
"complexType": {
|
277
|
+
"original": "number",
|
278
|
+
"resolved": "number",
|
279
|
+
"references": {}
|
280
|
+
},
|
281
|
+
"required": false,
|
282
|
+
"optional": false,
|
283
|
+
"docs": {
|
284
|
+
"tags": [],
|
285
|
+
"text": "The number of milliseconds to delay after the active period of an animation sequence."
|
286
|
+
},
|
287
|
+
"getter": false,
|
288
|
+
"setter": false,
|
289
|
+
"attribute": "end-delay",
|
290
|
+
"reflect": false,
|
291
|
+
"defaultValue": "0"
|
292
|
+
},
|
293
|
+
"fill": {
|
294
|
+
"type": "string",
|
295
|
+
"mutable": false,
|
296
|
+
"complexType": {
|
297
|
+
"original": "FillMode",
|
298
|
+
"resolved": "\"auto\" | \"backwards\" | \"both\" | \"forwards\" | \"none\"",
|
299
|
+
"references": {
|
300
|
+
"FillMode": {
|
301
|
+
"location": "global"
|
302
|
+
}
|
303
|
+
}
|
304
|
+
},
|
305
|
+
"required": false,
|
306
|
+
"optional": false,
|
307
|
+
"docs": {
|
308
|
+
"tags": [],
|
309
|
+
"text": "Sets how the animation applies styles to its target before and after its execution."
|
310
|
+
},
|
311
|
+
"getter": false,
|
312
|
+
"setter": false,
|
313
|
+
"attribute": "fill",
|
314
|
+
"reflect": false,
|
315
|
+
"defaultValue": "'auto'"
|
316
|
+
},
|
317
|
+
"iterations": {
|
318
|
+
"type": "number",
|
319
|
+
"mutable": false,
|
320
|
+
"complexType": {
|
321
|
+
"original": "number",
|
322
|
+
"resolved": "number",
|
323
|
+
"references": {}
|
324
|
+
},
|
325
|
+
"required": false,
|
326
|
+
"optional": false,
|
327
|
+
"docs": {
|
328
|
+
"tags": [],
|
329
|
+
"text": "The number of iterations to run before the animation completes. Defaults to `Infinity`, which loops."
|
330
|
+
},
|
331
|
+
"getter": false,
|
332
|
+
"setter": false,
|
333
|
+
"attribute": "iterations",
|
334
|
+
"reflect": false,
|
335
|
+
"defaultValue": "Infinity"
|
336
|
+
},
|
337
|
+
"iterationStart": {
|
338
|
+
"type": "number",
|
339
|
+
"mutable": false,
|
340
|
+
"complexType": {
|
341
|
+
"original": "number",
|
342
|
+
"resolved": "number",
|
343
|
+
"references": {}
|
344
|
+
},
|
345
|
+
"required": false,
|
346
|
+
"optional": false,
|
347
|
+
"docs": {
|
348
|
+
"tags": [],
|
349
|
+
"text": "The offset at which to start the animation, usually between 0 (start) and 1 (end)."
|
350
|
+
},
|
351
|
+
"getter": false,
|
352
|
+
"setter": false,
|
353
|
+
"attribute": "iteration-start",
|
354
|
+
"reflect": false,
|
355
|
+
"defaultValue": "0"
|
356
|
+
},
|
357
|
+
"keyframes": {
|
358
|
+
"type": "unknown",
|
359
|
+
"mutable": false,
|
360
|
+
"complexType": {
|
361
|
+
"original": "Keyframe[]",
|
362
|
+
"resolved": "Keyframe[]",
|
363
|
+
"references": {
|
364
|
+
"Keyframe": {
|
365
|
+
"location": "global"
|
366
|
+
}
|
367
|
+
}
|
368
|
+
},
|
369
|
+
"required": false,
|
370
|
+
"optional": true,
|
371
|
+
"docs": {
|
372
|
+
"tags": [],
|
373
|
+
"text": "The keyframes to use for the animation. If this is set, `name` will be ignored."
|
374
|
+
},
|
375
|
+
"getter": false,
|
376
|
+
"setter": false
|
377
|
+
},
|
378
|
+
"playbackRate": {
|
379
|
+
"type": "number",
|
380
|
+
"mutable": false,
|
381
|
+
"complexType": {
|
382
|
+
"original": "number",
|
383
|
+
"resolved": "number",
|
384
|
+
"references": {}
|
385
|
+
},
|
386
|
+
"required": false,
|
387
|
+
"optional": false,
|
388
|
+
"docs": {
|
389
|
+
"tags": [],
|
390
|
+
"text": "Sets the animation's playback rate. The default is `1`, which plays the animation at a normal speed. Setting this\nto `2`, for example, will double the animation's speed. A negative value can be used to reverse the animation. This\nvalue can be changed without causing the animation to restart."
|
391
|
+
},
|
392
|
+
"getter": false,
|
393
|
+
"setter": false,
|
394
|
+
"attribute": "playback-rate",
|
395
|
+
"reflect": false,
|
396
|
+
"defaultValue": "1"
|
397
|
+
},
|
398
|
+
"currentTime": {
|
399
|
+
"type": "number",
|
400
|
+
"mutable": false,
|
401
|
+
"complexType": {
|
402
|
+
"original": "CSSNumberish",
|
403
|
+
"resolved": "number",
|
404
|
+
"references": {
|
405
|
+
"CSSNumberish": {
|
406
|
+
"location": "global"
|
407
|
+
}
|
408
|
+
}
|
409
|
+
},
|
410
|
+
"required": false,
|
411
|
+
"optional": false,
|
412
|
+
"docs": {
|
413
|
+
"tags": [],
|
414
|
+
"text": "Gets and sets the current animation time."
|
415
|
+
},
|
416
|
+
"getter": true,
|
417
|
+
"setter": true,
|
418
|
+
"attribute": "current-time",
|
419
|
+
"reflect": false
|
420
|
+
}
|
421
|
+
};
|
422
|
+
}
|
423
|
+
static get events() {
|
424
|
+
return [{
|
425
|
+
"method": "nanoCancel",
|
426
|
+
"name": "nanoCancel",
|
427
|
+
"bubbles": true,
|
428
|
+
"cancelable": true,
|
429
|
+
"composed": true,
|
430
|
+
"docs": {
|
431
|
+
"tags": [],
|
432
|
+
"text": "Emitted when the animation is canceled."
|
433
|
+
},
|
434
|
+
"complexType": {
|
435
|
+
"original": "any",
|
436
|
+
"resolved": "any",
|
437
|
+
"references": {}
|
438
|
+
}
|
439
|
+
}, {
|
440
|
+
"method": "nanoFinish",
|
441
|
+
"name": "nanoFinish",
|
442
|
+
"bubbles": true,
|
443
|
+
"cancelable": true,
|
444
|
+
"composed": true,
|
445
|
+
"docs": {
|
446
|
+
"tags": [],
|
447
|
+
"text": "Emitted when the animation finishes."
|
448
|
+
},
|
449
|
+
"complexType": {
|
450
|
+
"original": "any",
|
451
|
+
"resolved": "any",
|
452
|
+
"references": {}
|
453
|
+
}
|
454
|
+
}, {
|
455
|
+
"method": "nanoStart",
|
456
|
+
"name": "nanoStart",
|
457
|
+
"bubbles": true,
|
458
|
+
"cancelable": true,
|
459
|
+
"composed": true,
|
460
|
+
"docs": {
|
461
|
+
"tags": [],
|
462
|
+
"text": "Emitted when the animation starts."
|
463
|
+
},
|
464
|
+
"complexType": {
|
465
|
+
"original": "any",
|
466
|
+
"resolved": "any",
|
467
|
+
"references": {}
|
468
|
+
}
|
469
|
+
}];
|
470
|
+
}
|
471
|
+
static get methods() {
|
472
|
+
return {
|
473
|
+
"cancel": {
|
474
|
+
"complexType": {
|
475
|
+
"signature": "() => Promise<void>",
|
476
|
+
"parameters": [],
|
477
|
+
"references": {
|
478
|
+
"Promise": {
|
479
|
+
"location": "global"
|
480
|
+
}
|
481
|
+
},
|
482
|
+
"return": "Promise<void>"
|
483
|
+
},
|
484
|
+
"docs": {
|
485
|
+
"text": "Clears all keyframe effects caused by this animation and aborts its playback.",
|
486
|
+
"tags": []
|
487
|
+
}
|
488
|
+
},
|
489
|
+
"finish": {
|
490
|
+
"complexType": {
|
491
|
+
"signature": "() => Promise<void>",
|
492
|
+
"parameters": [],
|
493
|
+
"references": {
|
494
|
+
"Promise": {
|
495
|
+
"location": "global"
|
496
|
+
}
|
497
|
+
},
|
498
|
+
"return": "Promise<void>"
|
499
|
+
},
|
500
|
+
"docs": {
|
501
|
+
"text": "Sets the playback time to the end of the animation corresponding to the current playback direction.",
|
502
|
+
"tags": []
|
503
|
+
}
|
504
|
+
}
|
505
|
+
};
|
506
|
+
}
|
507
|
+
static get watchers() {
|
508
|
+
return [{
|
509
|
+
"propName": "name",
|
510
|
+
"methodName": "handleAnimationChange"
|
511
|
+
}, {
|
512
|
+
"propName": "delay",
|
513
|
+
"methodName": "handleAnimationChange"
|
514
|
+
}, {
|
515
|
+
"propName": "direction",
|
516
|
+
"methodName": "handleAnimationChange"
|
517
|
+
}, {
|
518
|
+
"propName": "duration",
|
519
|
+
"methodName": "handleAnimationChange"
|
520
|
+
}, {
|
521
|
+
"propName": "easing",
|
522
|
+
"methodName": "handleAnimationChange"
|
523
|
+
}, {
|
524
|
+
"propName": "endDelay",
|
525
|
+
"methodName": "handleAnimationChange"
|
526
|
+
}, {
|
527
|
+
"propName": "fill",
|
528
|
+
"methodName": "handleAnimationChange"
|
529
|
+
}, {
|
530
|
+
"propName": "iterations",
|
531
|
+
"methodName": "handleAnimationChange"
|
532
|
+
}, {
|
533
|
+
"propName": "iterationStart",
|
534
|
+
"methodName": "handleAnimationChange"
|
535
|
+
}, {
|
536
|
+
"propName": "keyframes",
|
537
|
+
"methodName": "handleAnimationChange"
|
538
|
+
}, {
|
539
|
+
"propName": "play",
|
540
|
+
"methodName": "handlePlayChange"
|
541
|
+
}, {
|
542
|
+
"propName": "playbackRate",
|
543
|
+
"methodName": "handlePlaybackRateChange"
|
544
|
+
}];
|
545
|
+
}
|
546
|
+
}
|
547
|
+
//# sourceMappingURL=animation.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"animation.js","sourceRoot":"","sources":["../../../src/components/animation/animation.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,IAAI,EACJ,KAAK,EACL,CAAC,EAGD,KAAK,EACL,IAAI,EACJ,MAAM,GACP,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAGnD;;;;;GAKG;AAUH,MAAM,OAAO,aAAa;;IAEhB,eAAU,GAAG,KAAK,CAA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,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Component,\n Prop,\n Watch,\n h,\n ComponentInterface,\n EventEmitter,\n Event,\n Host,\n Method,\n} from '@stencil/core';\nimport { animations, easings } from './animations';\nimport type { AnimationEasing, AnimationName } from '../../interface';\n\n/**\n * Animate elements declaratively with [~100 baked-in presets](https://animate.style/), or make your own with custom keyframes.\n * Powered by the [Web Animations API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Animations_API).\n *\n * @slot - The element to animate. Avoid slotting in more than one element, as subsequent ones will be ignored. To animate multiple elements, either wrap them in a single container or use multiple *nano-animation* elements.\n */\n@Component({\n tag: 'nano-animation',\n styles: /* css */ `\n :host {\n display: contents;\n }\n `,\n shadow: true,\n})\nexport class NanoAnimation implements ComponentInterface {\n private animation?: Animation;\n private hasStarted = false;\n private defaultSlot?: HTMLSlotElement;\n\n /** The name of the built-in animation to use. For custom animations, use the `keyframes` prop. */\n @Prop() name: AnimationName | 'none' = 'none';\n\n /**\n * Plays the animation. When omitted, the animation will be paused. This attribute will be automatically removed when\n * the animation finishes or gets canceled.\n */\n @Prop({ reflect: true, mutable: true }) play = false;\n\n /** The number of milliseconds to delay the start of the animation. */\n @Prop() delay = 0;\n\n /**\n * Determines the direction of playback as well as the behavior when reaching the end of an iteration.\n * [Learn more](https://developer.mozilla.org/en-US/docs/Web/CSS/animation-direction)\n */\n @Prop() direction: PlaybackDirection = 'normal';\n\n /** The number of milliseconds each iteration of the animation takes to complete. */\n @Prop() duration = 1000;\n\n /**\n * The easing function to use for the animation. This can be a easing function or a custom easing function\n * such as `cubic-bezier(0, 1, .76, 1.14)`.\n */\n @Prop() easing: AnimationEasing = 'ease';\n\n /** The number of milliseconds to delay after the active period of an animation sequence. */\n @Prop() endDelay = 0;\n\n /** Sets how the animation applies styles to its target before and after its execution. */\n @Prop() fill: FillMode = 'auto';\n\n /** The number of iterations to run before the animation completes. Defaults to `Infinity`, which loops. */\n @Prop() iterations = Infinity;\n\n /** The offset at which to start the animation, usually between 0 (start) and 1 (end). */\n @Prop() iterationStart = 0;\n\n /** The keyframes to use for the animation. If this is set, `name` will be ignored. */\n @Prop() keyframes?: Keyframe[];\n\n /**\n * Sets the animation's playback rate. The default is `1`, which plays the animation at a normal speed. Setting this\n * to `2`, for example, will double the animation's speed. A negative value can be used to reverse the animation. This\n * value can be changed without causing the animation to restart.\n */\n @Prop() playbackRate = 1;\n\n /** Emitted when the animation is canceled. */\n @Event() nanoCancel: EventEmitter;\n\n /** Emitted when the animation finishes. */\n @Event() nanoFinish: EventEmitter;\n\n /** Emitted when the animation starts. */\n @Event() nanoStart: EventEmitter;\n\n /** Gets and sets the current animation time. */\n @Prop()\n get currentTime(): CSSNumberish {\n return this.animation?.currentTime ?? 0;\n }\n set currentTime(time: number) {\n if (this.animation) {\n this.animation.currentTime = time;\n }\n }\n\n connectedCallback() {\n this.createAnimation();\n }\n\n disconnectedCallback() {\n this.destroyAnimation();\n }\n\n private handleAnimationFinish = () => {\n this.play = false;\n this.hasStarted = false;\n this.nanoFinish.emit();\n };\n\n private handleAnimationCancel = () => {\n this.play = false;\n this.hasStarted = false;\n this.nanoCancel.emit();\n };\n\n private handleSlotChange = () => {\n this.destroyAnimation();\n this.createAnimation();\n };\n\n private async createAnimation() {\n if (!this.defaultSlot) return;\n\n const easing = easings[this.easing] ?? this.easing;\n const keyframes =\n this.keyframes ??\n (animations as unknown as Partial<Record<string, Keyframe[]>>)[this.name];\n const slot = this.defaultSlot;\n const element = slot.assignedElements()[0] as HTMLElement | undefined;\n\n if (!element || !keyframes) {\n return false;\n }\n\n this.destroyAnimation();\n this.animation = element.animate(keyframes, {\n delay: this.delay,\n direction: this.direction,\n duration: this.duration,\n easing,\n endDelay: this.endDelay,\n fill: this.fill,\n iterationStart: this.iterationStart,\n iterations: this.iterations,\n });\n this.animation.playbackRate = this.playbackRate;\n this.animation.addEventListener('cancel', this.handleAnimationCancel);\n this.animation.addEventListener('finish', this.handleAnimationFinish);\n\n if (this.play) {\n this.hasStarted = true;\n this.nanoStart.emit();\n } else {\n this.animation.pause();\n }\n\n return true;\n }\n\n private destroyAnimation() {\n if (this.animation) {\n this.animation.cancel();\n this.animation.removeEventListener('cancel', this.handleAnimationCancel);\n this.animation.removeEventListener('finish', this.handleAnimationFinish);\n this.hasStarted = false;\n }\n }\n\n @Watch('name')\n @Watch('delay')\n @Watch('direction')\n @Watch('duration')\n @Watch('easing')\n @Watch('endDelay')\n @Watch('fill')\n @Watch('iterations')\n @Watch('iterationStart')\n @Watch('keyframes')\n handleAnimationChange() {\n this.createAnimation();\n }\n\n @Watch('play')\n handlePlayChange() {\n if (this.animation) {\n if (this.play && !this.hasStarted) {\n this.hasStarted = true;\n this.nanoStart.emit();\n }\n\n if (this.play) {\n this.animation.play();\n } else {\n this.animation.pause();\n }\n\n return true;\n }\n return false;\n }\n\n @Watch('playbackRate')\n handlePlaybackRateChange() {\n if (this.animation) {\n this.animation.playbackRate = this.playbackRate;\n }\n }\n\n /** Clears all keyframe effects caused by this animation and aborts its playback. */\n @Method()\n async cancel() {\n this.animation?.cancel();\n }\n\n /** Sets the playback time to the end of the animation corresponding to the current playback direction. */\n @Method()\n async finish() {\n this.animation?.finish();\n }\n\n render() {\n return (\n <Host>\n <slot\n ref={(slot) => (this.defaultSlot = slot as HTMLSlotElement)}\n onSlotchange={this.handleSlotChange}\n ></slot>\n </Host>\n );\n }\n}\n"]}
|
@@ -0,0 +1,43 @@
|
|
1
|
+
export const bounce = [
|
2
|
+
{
|
3
|
+
offset: 0,
|
4
|
+
easing: 'cubic-bezier(0.215, 0.61, 0.355, 1)',
|
5
|
+
transform: 'translate3d(0, 0, 0)',
|
6
|
+
},
|
7
|
+
{
|
8
|
+
offset: 0.2,
|
9
|
+
easing: 'cubic-bezier(0.215, 0.61, 0.355, 1)',
|
10
|
+
transform: 'translate3d(0, 0, 0)',
|
11
|
+
},
|
12
|
+
{
|
13
|
+
offset: 0.4,
|
14
|
+
easing: 'cubic-bezier(0.755, 0.05, 0.855, 0.06)',
|
15
|
+
transform: 'translate3d(0, -30px, 0) scaleY(1.1)',
|
16
|
+
},
|
17
|
+
{
|
18
|
+
offset: 0.43,
|
19
|
+
easing: 'cubic-bezier(0.755, 0.05, 0.855, 0.06)',
|
20
|
+
transform: 'translate3d(0, -30px, 0) scaleY(1.1)',
|
21
|
+
},
|
22
|
+
{
|
23
|
+
offset: 0.53,
|
24
|
+
easing: 'cubic-bezier(0.215, 0.61, 0.355, 1)',
|
25
|
+
transform: 'translate3d(0, 0, 0)',
|
26
|
+
},
|
27
|
+
{
|
28
|
+
offset: 0.7,
|
29
|
+
easing: 'cubic-bezier(0.755, 0.05, 0.855, 0.06)',
|
30
|
+
transform: 'translate3d(0, -15px, 0) scaleY(1.05)',
|
31
|
+
},
|
32
|
+
{
|
33
|
+
offset: 0.8,
|
34
|
+
'transition-timing-function': 'cubic-bezier(0.215, 0.61, 0.355, 1)',
|
35
|
+
transform: 'translate3d(0, 0, 0) scaleY(0.95)',
|
36
|
+
},
|
37
|
+
{ offset: 0.9, transform: 'translate3d(0, -4px, 0) scaleY(1.02)' },
|
38
|
+
{
|
39
|
+
offset: 1,
|
40
|
+
easing: 'cubic-bezier(0.215, 0.61, 0.355, 1)',
|
41
|
+
transform: 'translate3d(0, 0, 0)',
|
42
|
+
},
|
43
|
+
];
|
@@ -0,0 +1,8 @@
|
|
1
|
+
export const headShake = [
|
2
|
+
{ offset: 0, transform: 'translateX(0)' },
|
3
|
+
{ offset: 0.065, transform: 'translateX(-6px) rotateY(-9deg)' },
|
4
|
+
{ offset: 0.185, transform: 'translateX(5px) rotateY(7deg)' },
|
5
|
+
{ offset: 0.315, transform: 'translateX(-3px) rotateY(-5deg)' },
|
6
|
+
{ offset: 0.435, transform: 'translateX(2px) rotateY(3deg)' },
|
7
|
+
{ offset: 0.5, transform: 'translateX(0)' },
|
8
|
+
];
|
@@ -0,0 +1,15 @@
|
|
1
|
+
export const jello = [
|
2
|
+
{ offset: 0, transform: 'translate3d(0, 0, 0)' },
|
3
|
+
{ offset: 0.111, transform: 'translate3d(0, 0, 0)' },
|
4
|
+
{ offset: 0.222, transform: 'skewX(-12.5deg) skewY(-12.5deg)' },
|
5
|
+
{ offset: 0.33299999999999996, transform: 'skewX(6.25deg) skewY(6.25deg)' },
|
6
|
+
{ offset: 0.444, transform: 'skewX(-3.125deg) skewY(-3.125deg)' },
|
7
|
+
{ offset: 0.555, transform: 'skewX(1.5625deg) skewY(1.5625deg)' },
|
8
|
+
{
|
9
|
+
offset: 0.6659999999999999,
|
10
|
+
transform: 'skewX(-0.78125deg) skewY(-0.78125deg)',
|
11
|
+
},
|
12
|
+
{ offset: 0.777, transform: 'skewX(0.390625deg) skewY(0.390625deg)' },
|
13
|
+
{ offset: 0.888, transform: 'skewX(-0.1953125deg) skewY(-0.1953125deg)' },
|
14
|
+
{ offset: 1, transform: 'translate3d(0, 0, 0)' },
|
15
|
+
];
|
@@ -0,0 +1,9 @@
|
|
1
|
+
export const rubberBand = [
|
2
|
+
{ offset: 0, transform: 'scale3d(1, 1, 1)' },
|
3
|
+
{ offset: 0.3, transform: 'scale3d(1.25, 0.75, 1)' },
|
4
|
+
{ offset: 0.4, transform: 'scale3d(0.75, 1.25, 1)' },
|
5
|
+
{ offset: 0.5, transform: 'scale3d(1.15, 0.85, 1)' },
|
6
|
+
{ offset: 0.65, transform: 'scale3d(0.95, 1.05, 1)' },
|
7
|
+
{ offset: 0.75, transform: 'scale3d(1.05, 0.95, 1)' },
|
8
|
+
{ offset: 1, transform: 'scale3d(1, 1, 1)' },
|
9
|
+
];
|