├── .gitignore ├── CHANGELOG.md ├── src └── index.js ├── rollup.config.js ├── package.json ├── LICENSE ├── .eslintrc.json └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | index.js 4 | !src/index.js 5 | module.js -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # svelte-transitions-fade changelog 2 | 3 | ## 1.0.0 4 | 5 | * First release -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | export default function fade ( node, { delay = 0, duration = 400 } ) { 2 | const o = +getComputedStyle( node ).opacity; 3 | 4 | return { 5 | delay, 6 | duration, 7 | css: t => `opacity: ${t * o}` 8 | }; 9 | } -------------------------------------------------------------------------------- /rollup.config.js: -------------------------------------------------------------------------------- 1 | import buble from 'rollup-plugin-buble'; 2 | 3 | const pkg = require( './package.json' ); 4 | 5 | export default { 6 | entry: 'src/index.js', 7 | plugins: [ 8 | buble() 9 | ], 10 | targets: [ 11 | { dest: pkg.main, format: 'cjs' }, 12 | { dest: pkg.module, format: 'es' }, 13 | ] 14 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "svelte-transitions-fade", 3 | "version": "1.0.0", 4 | "description": "Fade transition plugin for Svelte", 5 | "main": "index.js", 6 | "module": "module.js", 7 | "scripts": { 8 | "test": "echo \"Error: no test specified\" && exit 1", 9 | "build": "rollup -c", 10 | "prepublish": "npm run lint && npm run build", 11 | "lint": "eslint src" 12 | }, 13 | "files": [ 14 | "index.js", 15 | "module.js" 16 | ], 17 | "repository": { 18 | "type": "git", 19 | "url": "git+https://github.com/sveltejs/svelte-transitions-fade.git" 20 | }, 21 | "keywords": [ 22 | "svelte", 23 | "transitions", 24 | "css", 25 | "animation" 26 | ], 27 | "author": "Rich Harris", 28 | "license": "MIT", 29 | "bugs": { 30 | "url": "https://github.com/sveltejs/svelte-transitions-fade/issues" 31 | }, 32 | "homepage": "https://github.com/sveltejs/svelte-transitions-fade#readme", 33 | "devDependencies": { 34 | "eslint": "^3.19.0", 35 | "eslint-plugin-import": "^2.2.0", 36 | "rollup": "^0.41.6", 37 | "rollup-plugin-buble": "^0.15.0" 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2017 [these people](https://github.com/sveltejs/svelte-transitions-fade/graphs/contributors) 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "root": true, 3 | "rules": { 4 | "indent": [ 2, "tab", { "SwitchCase": 1 } ], 5 | "semi": [ 2, "always" ], 6 | "keyword-spacing": [ 2, { "before": true, "after": true } ], 7 | "space-before-blocks": [ 2, "always" ], 8 | "space-before-function-paren": [ 2, "always" ], 9 | "no-mixed-spaces-and-tabs": [ 2, "smart-tabs" ], 10 | "no-cond-assign": 0, 11 | "no-unused-vars": 2, 12 | "object-shorthand": [ 2, "always" ], 13 | "no-const-assign": 2, 14 | "no-class-assign": 2, 15 | "no-this-before-super": 2, 16 | "no-var": 2, 17 | "no-unreachable": 2, 18 | "valid-typeof": 2, 19 | "quote-props": [ 2, "as-needed" ], 20 | "one-var": [ 2, "never" ], 21 | "prefer-arrow-callback": 2, 22 | "prefer-const": [ 2, { "destructuring": "all" } ], 23 | "arrow-spacing": 2, 24 | "no-inner-declarations": 0 25 | }, 26 | "env": { 27 | "es6": true, 28 | "browser": true, 29 | "node": true, 30 | "mocha": true 31 | }, 32 | "extends": [ 33 | "eslint:recommended", 34 | "plugin:import/errors", 35 | "plugin:import/warnings" 36 | ], 37 | "parserOptions": { 38 | "ecmaVersion": 6, 39 | "sourceType": "module" 40 | }, 41 | "settings": { 42 | "import/core-modules": [ "svelte" ] 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## DEPRECATED — As of Svelte v3, transitions are built into the main package 2 | 3 | # svelte-transitions-fade 4 | 5 | Fade transition plugin for [Svelte](https://svelte.technology). [Demo](https://svelte.technology/repl?version=2.5.0&gist=0bd4023626fe4256472e209dcdfac39f) 6 | 7 |  8 | 9 | ## Usage 10 | 11 | Recommended usage is via [svelte-transitions](https://github.com/sveltejs/svelte-transitions), but you can use this module directly if you prefer. Note that it assumes an ES module or CommonJS environment. 12 | 13 | Install with npm or yarn: 14 | 15 | ```bash 16 | npm install --save svelte-transitions-fade 17 | ``` 18 | 19 | Then add the plugin to your Svelte component's exported definition: 20 | 21 | ```html 22 | 25 | 26 | {#if visible} 27 | 28 |