Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_activeItemContentChanged(newValue, oldValue) {
if (newValue) {
var html = newValue;
// only append if not empty
if (html !== null) {
wipeSlot(this, "*");
html = encapScript(newValue);
// insert the content as quickly as possible, then work on the dynamic imports
microTask.run(() => {
setTimeout(() => {
let frag = document.createRange().createContextualFragment(html);
this.appendChild(frag);
const evt = new CustomEvent(
"json-outline-schema-active-body-changed",
{
bubbles: true,
composed: true,
cancelable: false,
detail: { html }
}
);
}, 5);
});
// if there are, dynamically import them
if (varExists(this.manifest, "metadata.node.dynamicElementLoader")) {
_retryUpload(e) {
e.model.set("item.error", false);
e.model.set("item.progress", 0);
// The async helps give visual feedback of a retry occurring, even though it's less efficient.
var self = this;
microTask.run(() => {
self.uploadFile(e.model.__data__.item);
});
}
_itemContentChanged(newValue, oldValue) {
if (newValue) {
var html = newValue;
// only append if not empty
if (html !== null) {
html = encapScript(newValue);
wipeSlot(this, "*");
// insert the content as quickly as possible, then work on the dynamic imports
microTask.run(() => {
setTimeout(() => {
let frag = document.createRange().createContextualFragment(html);
this.appendChild(frag);
}, 5);
});
// if there are, dynamically import them
if (varExists(this.manifest, "metadata.node.dynamicElementLoader")) {
let tagsFound = findTagsInHTML(html);
const basePath = this.pathFromUrl(
decodeURIComponent(import.meta.url)
);
for (var i in tagsFound) {
const tagName = tagsFound[i];
if (
this.manifest.metadata.node.dynamicElementLoader[tagName] &&
!window.customElements.get(tagName)
_columnPathChanged(instance, column) {
if (!instance) {
return;
}
// sometimes instance isn't ready to be notified yet and throws an error.
microTask.run(() => {
// TODO: hack to avoid: https://github.com/Polymer/polymer/issues/3307
this._parentProps = this._parentProps || {};
instance.notifyPath(column.path, column.value);
});
}
}
// create a paper tooltip and append to body
this._tooltip = document.createElement('paper-tooltip');
document.body.appendChild(this._tooltip);
// clone content in and append to paper-tooltip body
this.$.content.assignedNodes().forEach((node) => {
this._tooltip.appendChild(node.cloneNode(true));
});
// set manual mode to avoid setting extra listeners in paper-tooltip
this._tooltip.manualMode = true;
// configure tooltip properties and show
this._tooltip._target = this._target;
this._tooltip.animationDelay = this.animationDelay;
this._tooltip.offset = this.offset;
this._tooltip.position = this.position;
this._tooltip.fitToVisibleBounds = true;
microTask.run(() => {
this._tooltip.show();
});
}
}
let fromOpacity = oldTarget ? 1 : 0;
let toOpacity = newTarget ? 1 : 0;
flush();
let thisRect = this.getBoundingClientRect();
let thisStyle = window.getComputedStyle(this);
let fromRect = from.getBoundingClientRect();
let toRect = to.getBoundingClientRect();
if (toRect.top === 0 && toRect.right === 0 &&
toRect.bottom === 0 && toRect.left === 0 &&
toRect.width === 0 && toRect.height === 0) {
this.style.transitionProperty = 'none';
this.style.opacity = toOpacity;
this._transitionsInFlight = [];
microTask.run(this._moveComplete.bind(this))
return;
} else {
this.style.transitionProperty = '';
}
let top = parseFloat(thisStyle.top || '0') + (fromRect.top - thisRect.top);
let right = parseFloat(thisStyle.right || '0') - (fromRect.right - thisRect.right);
let bottom = parseFloat(thisStyle.bottom || '0') - (fromRect.bottom - thisRect.bottom);
let left = parseFloat(thisStyle.left || '0') + (fromRect.left - thisRect.left);
this.style.transitionDuration = '0s';
this.style.transitionDelay = '0s';
let startValues = [
this.style.top = top + 'px',
this.style.right = right + 'px',
this.style.bottom = bottom + 'px',
_morphClose() {
var fab = this._fab;
var content = this._content;
var contentRect = fab.getBoundingClientRect();
var morpher = this.$.morpher;
var ms = morpher.style;
morpher.style.display = "block";
microTask.run(() => {
var fabRect = fab.getBoundingClientRect();
ms.top = fabRect.top + "px";
ms.left = fabRect.left + "px";
ms.width = fabRect.width + "px";
ms.height = fabRect.height + "px";
ms.borderRadius = "50%";
microTask.run(() => {
morpher.style.display = "none";
fab.style.visibility = "visible";
});
});
}
}