优化动画逻辑

master
yutent 2023-11-20 11:43:11 +08:00
parent 0be2bf7971
commit 0043895a66
3 changed files with 4 additions and 3 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "wkit", "name": "wkit",
"version": "1.10.12", "version": "1.10.13",
"type": "module", "type": "module",
"description": "A library for building fast, lightweight web components.", "description": "A library for building fast, lightweight web components.",
"main": "dist/index.js", "main": "dist/index.js",

View File

@ -5,7 +5,7 @@
*/ */
export function animate(duration = 200, fromto = [], out = false) { export function animate(duration = 200, fromto = [], out = false) {
if (out === false) { if (out === false && this.style.display === 'none') {
this.style.display = '' this.style.display = ''
} }
let res = this.animate(fromto, { let res = this.animate(fromto, {

View File

@ -140,6 +140,7 @@ function getTemplateHtml(strings, type) {
} }
return [htmlResult, attrNames] return [htmlResult, attrNames]
} }
class Template { class Template {
constructor({ strings, ['__dom_type__']: type }, options) { constructor({ strings, ['__dom_type__']: type }, options) {
this.parts = [] this.parts = []
@ -480,7 +481,7 @@ class AttributePart {
this.$parent = parent this.$parent = parent
this.options = options this.options = options
if (strings.length > 2 || strings[0] !== '' || strings[1] !== '') { if (strings.length > 2 || strings[0] !== '' || strings[1] !== '') {
this._$committedValue = new Array(strings.length - 1).fill(new String()) this._$committedValue = new Array(strings.length - 1).fill('')
this.strings = strings this.strings = strings
} else { } else {
this._$committedValue = NOTHING this._$committedValue = NOTHING