Popup close buttons can take a URL.

This commit is contained in:
2021-02-24 16:13:50 +01:00
parent 114c217ffa
commit ac779af339
68 changed files with 18127 additions and 43084 deletions
+39 -39
View File
@@ -9,9 +9,9 @@
static implementationError(klass) {
let interfaceKeys = Reflect.ownKeys(this.prototype);
let classKeys = Reflect.ownKeys(klass.prototype);
Reflect.ownKeys(klass.prototype);
for (let key of interfaceKeys) {
let interfaceDesc = this.prototype[key];
this.prototype[key];
let classDesc = klass.prototype[key];
if (typeof classDesc == 'undefined') return 'Missing ' + key
}
@@ -429,10 +429,10 @@
window.addEventListener(
'error',
event => {
if (typeof(event.error) == 'undefined') {
if (typeof event.error == 'undefined') {
// This sometimes happens in Edge. Since we have no error
// position, we cannot do much beside an info log.
console.info("Catched undefined error", event);
console.info('Catched undefined error', event);
return
}
this.appendError(event.error, event.filename);
@@ -870,7 +870,7 @@
return new Date(date.getTime() + 1)
}
static * iterYears(start, end) {
static *iterYears(start, end) {
let date = this.create(start.getFullYear(), 0, 1);
while (date <= end) {
yield date;
@@ -879,7 +879,7 @@
yield date;
}
static * iterMonths(year, limit = 12) {
static *iterMonths(year, limit = 12) {
let month = 0;
while (month < limit) {
let date = this.create(year.getFullYear(), month, 1);
@@ -888,7 +888,7 @@
}
}
static * iterMonthsOfYears(years) {
static *iterMonthsOfYears(years) {
for (let year of years) {
for (let month of this.iterMonths(year)) {
yield month;
@@ -896,7 +896,7 @@
}
}
static * iterDays(month) {
static *iterDays(month) {
let day = 1;
let limit = Dates.daysInMonth(month);
while (day <= limit) {
@@ -906,7 +906,7 @@
}
}
static * iterDaysOfMonths(months) {
static *iterDaysOfMonths(months) {
for (let month of months) {
for (let day of this.iterDays(month)) {
yield day;
@@ -1084,16 +1084,12 @@
static distanceToRect(p, r) {
let dx = 0;
let dy = 0;
if (p.x < r.x)
dx = p.x - r.x;
else if (p.x > r.x + r.width)
dx = p.x - (r.x + r.width);
if (p.y < r.y)
dy = p.y - r.y;
else if (p.y > r.y + r.height)
dy = p.y - (r.y + r.height);
if (p.x < r.x) dx = p.x - r.x;
else if (p.x > r.x + r.width) dx = p.x - (r.x + r.width);
if (p.y < r.y) dy = p.y - r.y;
else if (p.y > r.y + r.height) dy = p.y - (r.y + r.height);
return Math.sqrt(dx * dx + dy * dy)
/* let cx = Math.max(Math.min(p.x, r.x + r.width), r.x)
/* let cx = Math.max(Math.min(p.x, r.x + r.width), r.x)
let cy = Math.max(Math.min(p.y, r.y + r.height), r.y)
let result = Math.sqrt((p.x - cx) * (p.x - cx) + (p.y - cy) * (p.y - cy))
console.log("distanceToRect", p, r, result)
@@ -1137,8 +1133,7 @@
const i = sets.reduce((m, s, i) => (s.size < sets[m].size ? i : m), 0);
const [smallest] = sets.splice(i, 1);
const res = new Set();
for (let val of smallest)
if (sets.every(s => s.has(val))) res.add(val);
for (let val of smallest) if (sets.every(s => s.has(val))) res.add(val);
return res
}
@@ -1687,11 +1682,11 @@
next(nextValue) {
// push new value to the end, and remove oldest one
let removed = this.__push(nextValue);
// smooth value using all values from buffer
// smooth value using all values from buffer
let result = this.buffer.reduce((last, current) => {
return this.smoothing * current + (1 - this.smoothing) * last
}, removed);
// replace smoothed value
return this.smoothing * current + (1 - this.smoothing) * last
}, removed);
// replace smoothed value
this.buffer[this.buffer.length - 1] = result;
return result
}
@@ -3572,7 +3567,7 @@
// UO: since keepOnStage is called in nextVelocity we need to
// ensure a return value
if (!stagePolygon) return { x: 0, y: 0 }
let polygon = this.polygon;
this.polygon;
let bounced = this.bouncing();
if (bounced) {
let stage = this.containerBounds;
@@ -4658,7 +4653,7 @@
isClickable(node) {
if (node == null) return false
// console.log("isClickable", node, this.isClickPrevented(node))
// console.log("isClickable", node, this.isClickPrevented(node))
if (this.isClickPrevented(node)) {
return false
}
@@ -4705,8 +4700,8 @@
let clickRects = activeNodes.map(link => {
let rect = link.getBoundingClientRect();
// Since the getBoundingClientRect is untransformed we cannot rely on it's size
// We need a transformed bottom right to calculate local width and height
// Since the getBoundingClientRect is untransformed we cannot rely on it's size
// We need a transformed bottom right to calculate local width and height
let bottomRight = Points$1.fromPageToNode(element, {
x: rect.x + rect.width,
y: rect.y + rect.height
@@ -6249,7 +6244,7 @@
/** Configuration object. Return default styles as CSS values.
*/
defaultStyle() {
let padding = this.padding;
this.padding;
let style = {
maxWidth: this.maxWidth + 'px',
zIndex: this.zIndex,
@@ -6528,7 +6523,7 @@
* @memberof Popup
*/
static targetCenter(event) {
let target = event.target;
event.target;
let x = event.pageX;
let y = event.pageY;
let rect = Popup$1.targetRect(event);
@@ -6651,9 +6646,14 @@
if (this.autoClose) {
this.close();
}
setTimeout((event, key) => {
func(event, key);
}, 20, event, key);
setTimeout(
(event, key) => {
func(event, key);
},
20,
event,
key
);
}
/** Update the menu item denoted by key.
@@ -7569,7 +7569,7 @@
reorderArguments(params) {
// first parameter
//--------------------
const element = params[0];
params[0];
// other parameter
//--------------------
@@ -8239,7 +8239,7 @@
let svg = 'http://www.w3.org/2000/svg';
let xlink = 'http://www.w3.org/1999/xlink';
let svgGroup = element.parentNode;
element.parentNode;
let src = image.getAttributeNS(xlink, 'href');
@@ -8572,7 +8572,7 @@
*/
return html.replace(
/<\s*(a|video|img|image|circle)\s(.*?)(xlink:href|href|src)\s*=\s*["'](\..*?)["']\s*(.*?)>/g,
function () {
function() {
let path = that._getRelativePath(arguments[4]);
const tag = `<${arguments[1]} ${arguments[2]} ${arguments[3]}="${path}" ${arguments[5]}>`;
/* if (that.debug) */ console.log('Adjusted: ', tag);
@@ -8601,7 +8601,7 @@
return new Promise((resolve, reject) => {
let request = new XMLHttpRequest();
request.onreadystatechange = function () {
request.onreadystatechange = function() {
if (this.readyState == 4) {
if (this.status == 200 || Card._isLocal()) {
try {
@@ -9066,7 +9066,7 @@
let cx = target.getAttribute('cx');
let cy = target.getAttribute('cy');
let r = target.getAttribute('r');
let radius = r.endsWith('%') ? (parseFloat(r) / 100) * width : parseFloat(r);
r.endsWith('%') ? (parseFloat(r) / 100) * width : parseFloat(r);
let x = cx.endsWith('%') ? (parseFloat(cx) / 100) * width : cx;
let y = cy.endsWith('%') ? (parseFloat(cy) / 100) * height : cx;
@@ -9886,7 +9886,7 @@
});
},
onUpdateParams: ['{self}'],
onUpdate: function (self) {
onUpdate: function(self) {
let transform = self.target._gsTransform;
TweenLite.set(title, {