Comparing version 1.23.4 to 1.24.0
# Svelte changelog | ||
## 1.24.0 | ||
* Deconflict names with imports in SSR compiler ([#655](https://github.com/sveltejs/svelte/issues/655)) | ||
* Improved transition performance ([#670](https://github.com/sveltejs/svelte/pull/670)) | ||
* Run transitions on initial render ([#651](https://github.com/sveltejs/svelte/issues/651)) | ||
* Add dev mode warning if `hydrate` is true but `hydratable` was false ([#664](https://github.com/sveltejs/svelte/issues/664)) | ||
* Manipulate sourcemap to make missing loop values obvious ([#683](https://github.com/sveltejs/svelte/pull/683)) | ||
* Only add CSS scoping attributes where necessary ([#679](https://github.com/sveltejs/svelte/issues/679)) | ||
* Warn on unused CSS selectors ([#678](https://github.com/sveltejs/svelte/issues/678)) | ||
* Fix `<select>` binding in loop ([#685](https://github.com/sveltejs/svelte/issues/685)) | ||
* Prevent bindings from calling `oncreate` functions prematurely ([#694](https://github.com/sveltejs/svelte/pull/694)) | ||
* Simpler codegen ([#673](https://github.com/sveltejs/svelte/pull/673)) | ||
## 1.23.4 | ||
@@ -4,0 +17,0 @@ |
{ | ||
"name": "svelte", | ||
"version": "1.23.4", | ||
"version": "1.24.0", | ||
"description": "The magical disappearing UI framework", | ||
@@ -19,8 +19,4 @@ "main": "compiler/svelte.js", | ||
"lint": "eslint src test/*.js", | ||
"build": "npm run build:main && npm run build:shared && npm run build:ssr", | ||
"build:main": "node src/shared/_build.js && rollup -c rollup/rollup.config.main.js", | ||
"build:shared": "rollup -c rollup/rollup.config.shared.js", | ||
"build:ssr": "rollup -c rollup/rollup.config.ssr.js", | ||
"dev": "node src/shared/_build.js && rollup -c rollup/rollup.config.main.js -w", | ||
"dev:shared": "rollup -c rollup/rollup.config.shared.js -w", | ||
"build": "node src/shared/_build.js && rollup -c", | ||
"dev": "node src/shared/_build.js && rollup -c -w", | ||
"pretest": "npm run build", | ||
@@ -79,3 +75,3 @@ "prepublish": "npm run build && npm run lint", | ||
"reify": "^0.4.4", | ||
"rollup": "^0.39.0", | ||
"rollup": "^0.43.0", | ||
"rollup-plugin-buble": "^0.15.0", | ||
@@ -82,0 +78,0 @@ "rollup-plugin-commonjs": "^7.0.0", |
@@ -94,2 +94,5 @@ # Svelte | ||
## BrowserStack | ||
<img src="https://cdn.worldvectorlogo.com/logos/browserstack.svg" height="80" width="80" align="left"> | ||
<p>To keep Svelte's performance in check, we use BrowserStack to quickly run benchmarks for each PR that immediately give feedback to the contributor. You can see how we use BrowserStack in the <a href="https://github.com/sveltejs/svelte-bench">svelte-bench</a> project and check out BrowserStack's services on their <a href="https://www.browserstack.com/">website</a>.</p> | ||
@@ -96,0 +99,0 @@ ## License |
@@ -120,3 +120,3 @@ function noop() {} | ||
function generateKeyframes( | ||
function generateRule( | ||
a, | ||
@@ -127,8 +127,5 @@ b, | ||
ease, | ||
fn, | ||
node, | ||
style | ||
fn | ||
) { | ||
var id = '__svelte' + ~~(Math.random() * 1e9); // TODO make this more robust | ||
var keyframes = '@keyframes ' + id + '{\n'; | ||
var keyframes = '{\n'; | ||
@@ -140,15 +137,12 @@ for (var p = 0; p <= 1; p += 16.666 / duration) { | ||
keyframes += '100% {' + fn(b) + '}\n}'; | ||
style.textContent += keyframes; | ||
return keyframes + '100% {' + fn(b) + '}\n}'; | ||
} | ||
document.head.appendChild(style); | ||
// https://github.com/darkskyapp/string-hash/blob/master/index.js | ||
function hash(str) { | ||
var hash = 5381; | ||
var i = str.length; | ||
node.style.animation = (node.style.animation || '') | ||
.split(',') | ||
.filter(function(anim) { | ||
// when introing, discard old animations if there are any | ||
return anim && (delta < 0 || !/__svelte/.test(anim)); | ||
}) | ||
.concat(id + ' ' + duration + 'ms linear 1 forwards') | ||
.join(', '); | ||
while (i--) hash = ((hash << 5) - hash) ^ str.charCodeAt(i); | ||
return hash >>> 0; | ||
} | ||
@@ -163,4 +157,6 @@ | ||
// TODO share <style> tag between all transitions? | ||
if (obj.css) { | ||
var style = document.createElement('style'); | ||
if (obj.css && !transitionManager.stylesheet) { | ||
var style = createElement('style'); | ||
document.head.appendChild(style); | ||
transitionManager.stylesheet = style.sheet; | ||
} | ||
@@ -209,3 +205,4 @@ | ||
if (obj.delay) node.style.cssText = cssText; | ||
generateKeyframes( | ||
program.rule = generateRule( | ||
program.a, | ||
@@ -216,6 +213,15 @@ program.b, | ||
ease, | ||
obj.css, | ||
node, | ||
style | ||
obj.css | ||
); | ||
transitionManager.addRule(program.rule, program.name = '__svelte_' + hash(program.rule)); | ||
node.style.animation = (node.style.animation || '') | ||
.split(', ') | ||
.filter(function(anim) { | ||
// when introing, discard old animations if there are any | ||
return anim && (program.delta < 0 || !/__svelte/.test(anim)); | ||
}) | ||
.concat(program.name + ' ' + duration + 'ms linear 1 forwards') | ||
.join(', '); | ||
} | ||
@@ -235,7 +241,8 @@ | ||
done: function() { | ||
this.t = this.program.b; | ||
var program = this.program; | ||
this.t = program.b; | ||
if (obj.tick) obj.tick(this.t); | ||
if (obj.css) document.head.removeChild(style); | ||
this.program.callback(); | ||
this.program = null; | ||
if (obj.css) transitionManager.deleteRule(node, program.name); | ||
program.callback(); | ||
program = null; | ||
this.running = !!this.pending; | ||
@@ -245,3 +252,3 @@ }, | ||
if (obj.tick) obj.tick(1); | ||
if (obj.css) document.head.removeChild(style); | ||
if (obj.css) transitionManager.deleteRule(node, this.program.name); | ||
this.program = this.pending = null; | ||
@@ -257,2 +264,4 @@ this.running = false; | ||
bound: null, | ||
stylesheet: null, | ||
activeRules: {}, | ||
@@ -268,2 +277,9 @@ add: function(transition) { | ||
addRule: function(rule, name) { | ||
if (!this.activeRules[name]) { | ||
this.activeRules[name] = true; | ||
this.stylesheet.insertRule('@keyframes ' + name + ' ' + rule, this.stylesheet.cssRules.length); | ||
} | ||
}, | ||
next: function() { | ||
@@ -296,3 +312,16 @@ this.running = false; | ||
requestAnimationFrame(this.bound || (this.bound = this.next.bind(this))); | ||
} else if (this.stylesheet) { | ||
var i = this.stylesheet.cssRules.length; | ||
while (i--) this.stylesheet.deleteRule(i); | ||
this.activeRules = {}; | ||
} | ||
}, | ||
deleteRule: function(node, name) { | ||
node.style.animation = node.style.animation | ||
.split(', ') | ||
.filter(function(anim) { | ||
return anim.slice(0, name.length) !== name; | ||
}) | ||
.join(', '); | ||
} | ||
@@ -408,6 +437,6 @@ }; | ||
function _flush() { | ||
if (!this._renderHooks) return; | ||
if (!this._oncreate) return; | ||
while (this._renderHooks.length) { | ||
this._renderHooks.pop()(); | ||
while (this._oncreate.length) { | ||
this._oncreate.pop()(); | ||
} | ||
@@ -434,2 +463,2 @@ } | ||
export { differs, dispatchObservers, get, fire, observe, observeDev, on, onDev, set, _flush, proto, protoDev, appendNode, insertNode, detachNode, detachBetween, destroyEach, createElement, createSvgElement, createText, createComment, addListener, removeListener, setAttribute, setXlinkAttribute, getBindingGroupValue, toNumber, children, claimElement, claimText, linear, generateKeyframes, wrapTransition, transitionManager, noop, assign }; | ||
export { differs, dispatchObservers, get, fire, observe, observeDev, on, onDev, set, _flush, proto, protoDev, appendNode, insertNode, detachNode, detachBetween, destroyEach, createElement, createSvgElement, createText, createComment, addListener, removeListener, setAttribute, setXlinkAttribute, getBindingGroupValue, toNumber, children, claimElement, claimText, linear, generateRule, hash, wrapTransition, transitionManager, noop, assign }; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
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
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
1766099
15712
101