mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[IMP] update owl/playground
This commit is contained in:
@@ -1206,6 +1206,34 @@
|
|||||||
}
|
}
|
||||||
return doc;
|
return doc;
|
||||||
}
|
}
|
||||||
|
function getTimeout(delays, durations) {
|
||||||
|
/* istanbul ignore next */
|
||||||
|
while (delays.length < durations.length) {
|
||||||
|
delays = delays.concat(delays);
|
||||||
|
}
|
||||||
|
return Math.max.apply(null, durations.map((d, i) => {
|
||||||
|
return toMs(d) + toMs(delays[i]);
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
// Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
|
||||||
|
// in a locale-dependent way, using a comma instead of a dot.
|
||||||
|
// If comma is not replaced with a dot, the input will be rounded down (i.e. acting
|
||||||
|
// as a floor function) causing unexpected behaviors
|
||||||
|
function toMs(s) {
|
||||||
|
return Number(s.slice(0, -1).replace(",", ".")) * 1000;
|
||||||
|
}
|
||||||
|
function whenTransitionEnd(elm, cb) {
|
||||||
|
const styles = window.getComputedStyle(elm);
|
||||||
|
const delays = (styles.transitionDelay || "").split(", ");
|
||||||
|
const durations = (styles.transitionDuration || "").split(", ");
|
||||||
|
const timeout = getTimeout(delays, durations);
|
||||||
|
if (timeout > 0) {
|
||||||
|
elm.addEventListener("transitionend", cb, { once: true });
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
cb();
|
||||||
|
}
|
||||||
|
}
|
||||||
const UTILS = {
|
const UTILS = {
|
||||||
h: h,
|
h: h,
|
||||||
getFragment(str) {
|
getFragment(str) {
|
||||||
@@ -1234,23 +1262,24 @@
|
|||||||
elm.classList.remove(name + "-enter-active");
|
elm.classList.remove(name + "-enter-active");
|
||||||
elm.classList.remove(name + "-enter-to");
|
elm.classList.remove(name + "-enter-to");
|
||||||
};
|
};
|
||||||
elm.addEventListener("transitionend", finalize);
|
|
||||||
this.nextFrame(() => {
|
this.nextFrame(() => {
|
||||||
elm.classList.remove(name + "-enter");
|
elm.classList.remove(name + "-enter");
|
||||||
elm.classList.add(name + "-enter-to");
|
elm.classList.add(name + "-enter-to");
|
||||||
|
whenTransitionEnd(elm, finalize);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
transitionRemove(elm, name, rm) {
|
transitionRemove(elm, name, rm) {
|
||||||
elm.classList.add(name + "-leave");
|
elm.classList.add(name + "-leave");
|
||||||
elm.classList.add(name + "-leave-active");
|
elm.classList.add(name + "-leave-active");
|
||||||
elm.addEventListener("transitionend", () => {
|
const finalize = () => {
|
||||||
elm.classList.remove(name + "-leave-active");
|
elm.classList.remove(name + "-leave-active");
|
||||||
elm.classList.remove(name + "-enter-to");
|
elm.classList.remove(name + "-enter-to");
|
||||||
rm();
|
rm();
|
||||||
});
|
};
|
||||||
this.nextFrame(() => {
|
this.nextFrame(() => {
|
||||||
elm.classList.remove(name + "-leave");
|
elm.classList.remove(name + "-leave");
|
||||||
elm.classList.add(name + "-leave-to");
|
elm.classList.add(name + "-leave-to");
|
||||||
|
whenTransitionEnd(elm, finalize);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -1992,7 +2021,7 @@
|
|||||||
}
|
}
|
||||||
if (!shouldWarn &&
|
if (!shouldWarn &&
|
||||||
node.children.length === 1 &&
|
node.children.length === 1 &&
|
||||||
node.children[0].tagName !== 't' &&
|
node.children[0].tagName !== "t" &&
|
||||||
!node.children[0].hasAttribute("t-key")) {
|
!node.children[0].hasAttribute("t-key")) {
|
||||||
shouldWarn = true;
|
shouldWarn = true;
|
||||||
}
|
}
|
||||||
@@ -2490,8 +2519,8 @@
|
|||||||
exports.Store = Store;
|
exports.Store = Store;
|
||||||
|
|
||||||
exports._version = '0.9.0';
|
exports._version = '0.9.0';
|
||||||
exports._date = '2019-05-03T10:06:05.040Z';
|
exports._date = '2019-05-03T12:34:47.418Z';
|
||||||
exports._hash = '5b9abb6';
|
exports._hash = 'ab2a984';
|
||||||
exports._url = 'https://github.com/odoo/owl';
|
exports._url = 'https://github.com/odoo/owl';
|
||||||
|
|
||||||
}(this.owl = this.owl || {}));
|
}(this.owl = this.owl || {}));
|
||||||
|
|||||||
+5
-3
@@ -81,7 +81,7 @@ class TabbedEditor extends owl.Component {
|
|||||||
// remove this for xml/css (?)
|
// remove this for xml/css (?)
|
||||||
this.editor.session.setOption("useWorker", false);
|
this.editor.session.setOption("useWorker", false);
|
||||||
this.editor.setValue(this.props[this.state.currentTab], -1);
|
this.editor.setValue(this.props[this.state.currentTab], -1);
|
||||||
this.editor.setFontSize("13px");
|
this.editor.setFontSize("12px");
|
||||||
this.editor.setTheme("ace/theme/monokai");
|
this.editor.setTheme("ace/theme/monokai");
|
||||||
this.editor.session.setMode(MODES[this.state.currentTab]);
|
this.editor.session.setMode(MODES[this.state.currentTab]);
|
||||||
const tabSize = this.state.currentTab === "xml" ? 2 : 4;
|
const tabSize = this.state.currentTab === "xml" ? 2 : 4;
|
||||||
@@ -204,13 +204,15 @@ class App extends owl.Component {
|
|||||||
this.state.js
|
this.state.js
|
||||||
}`;
|
}`;
|
||||||
script.innerHTML = content;
|
script.innerHTML = content;
|
||||||
const errorHandler = e => this.displayError(e.message);
|
const errorHandler = e => this.displayError(e.message || e.reason.message);
|
||||||
iframe.contentWindow.addEventListener("error", errorHandler);
|
iframe.contentWindow.addEventListener("error", errorHandler);
|
||||||
|
iframe.contentWindow.addEventListener("unhandledrejection", errorHandler);
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
if (iframe.contentWindow) {
|
if (iframe.contentWindow) {
|
||||||
iframe.contentWindow.removeEventListener("error", errorHandler);
|
iframe.contentWindow.removeEventListener("error", errorHandler);
|
||||||
|
iframe.contentWindow.removeEventListener("unhandledrejection", errorHandler);
|
||||||
}
|
}
|
||||||
}, 100);
|
}, 200);
|
||||||
doc.body.appendChild(script);
|
doc.body.appendChild(script);
|
||||||
});
|
});
|
||||||
doc.head.appendChild(owlScript);
|
doc.head.appendChild(owlScript);
|
||||||
|
|||||||
Reference in New Issue
Block a user