@helsenorge/lightbox 10.1.0 → 10.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1392 -801
- package/components/LightBox/index.js +39 -28
- package/components/LightBox/index.js.map +1 -1
- package/components/LightBox/styles.module.scss +1 -1
- package/package.json +1 -1
|
@@ -18,7 +18,7 @@ var roundNumber = function(num, decimal) {
|
|
|
18
18
|
return Number(num.toFixed(decimal));
|
|
19
19
|
};
|
|
20
20
|
var checkIsNumber = function(num, defaultValue) {
|
|
21
|
-
return defaultValue;
|
|
21
|
+
return false ? num : defaultValue;
|
|
22
22
|
};
|
|
23
23
|
var handleCallback = function(context, event, callback) {
|
|
24
24
|
if (callback && typeof callback === "function") {
|
|
@@ -462,7 +462,7 @@ function handlePanningStart(contextInstance, event) {
|
|
|
462
462
|
handlePanningSetup(contextInstance, event);
|
|
463
463
|
}
|
|
464
464
|
}
|
|
465
|
-
function handleAlignToBounds(contextInstance) {
|
|
465
|
+
function handleAlignToBounds(contextInstance, customAnimationTime) {
|
|
466
466
|
var scale = contextInstance.transformState.scale;
|
|
467
467
|
var _a = contextInstance.setup, minScale = _a.minScale, alignmentAnimation = _a.alignmentAnimation;
|
|
468
468
|
var disabled = alignmentAnimation.disabled, sizeX = alignmentAnimation.sizeX, sizeY = alignmentAnimation.sizeY, animationTime = alignmentAnimation.animationTime, animationType = alignmentAnimation.animationType;
|
|
@@ -471,7 +471,7 @@ function handleAlignToBounds(contextInstance) {
|
|
|
471
471
|
return;
|
|
472
472
|
var targetState = handlePanToBounds(contextInstance);
|
|
473
473
|
if (targetState) {
|
|
474
|
-
animate(contextInstance, targetState, animationTime, animationType);
|
|
474
|
+
animate(contextInstance, targetState, customAnimationTime !== null && customAnimationTime !== void 0 ? customAnimationTime : animationTime, animationType);
|
|
475
475
|
}
|
|
476
476
|
}
|
|
477
477
|
function handlePanning(contextInstance, clientX, clientY) {
|
|
@@ -551,8 +551,11 @@ function __spreadArray(to, from, pack) {
|
|
|
551
551
|
}
|
|
552
552
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
553
553
|
}
|
|
554
|
+
typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
|
|
555
|
+
var e = new Error(message);
|
|
556
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
557
|
+
};
|
|
554
558
|
var initialState = {
|
|
555
|
-
previousScale: 1,
|
|
556
559
|
scale: 1,
|
|
557
560
|
positionX: 0,
|
|
558
561
|
positionY: 0
|
|
@@ -1301,32 +1304,40 @@ var ZoomPanPinch = (
|
|
|
1301
1304
|
wrapper.addEventListener("touchmove", _this.onTouchPanning, passive);
|
|
1302
1305
|
wrapper.addEventListener("touchend", _this.onTouchPanningStop, passive);
|
|
1303
1306
|
};
|
|
1304
|
-
this.handleInitialize = function(contentComponent) {
|
|
1307
|
+
this.handleInitialize = function(wrapper, contentComponent) {
|
|
1308
|
+
var isCentered = false;
|
|
1305
1309
|
var centerOnInit = _this.setup.centerOnInit;
|
|
1310
|
+
var hasTarget = function(entries, target) {
|
|
1311
|
+
for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {
|
|
1312
|
+
var entry = entries_1[_i];
|
|
1313
|
+
if (entry.target === target) {
|
|
1314
|
+
return true;
|
|
1315
|
+
}
|
|
1316
|
+
}
|
|
1317
|
+
return false;
|
|
1318
|
+
};
|
|
1306
1319
|
_this.applyTransformation();
|
|
1307
1320
|
_this.onInitCallbacks.forEach(function(callback) {
|
|
1308
|
-
|
|
1321
|
+
callback(getContext(_this));
|
|
1309
1322
|
});
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
_this
|
|
1321
|
-
(
|
|
1323
|
+
_this.observer = new ResizeObserver(function(entries) {
|
|
1324
|
+
if (hasTarget(entries, wrapper) || hasTarget(entries, contentComponent)) {
|
|
1325
|
+
if (centerOnInit && !isCentered) {
|
|
1326
|
+
var currentWidth = contentComponent.offsetWidth;
|
|
1327
|
+
var currentHeight = contentComponent.offsetHeight;
|
|
1328
|
+
if (currentWidth > 0 || currentHeight > 0) {
|
|
1329
|
+
isCentered = true;
|
|
1330
|
+
_this.setCenter();
|
|
1331
|
+
}
|
|
1332
|
+
} else {
|
|
1333
|
+
handleCancelAnimation(_this);
|
|
1334
|
+
handleCalculateBounds(_this, _this.transformState.scale);
|
|
1335
|
+
handleAlignToBounds(_this, 0);
|
|
1322
1336
|
}
|
|
1323
|
-
}
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
}, 5e3);
|
|
1328
|
-
_this.observer.observe(contentComponent);
|
|
1329
|
-
}
|
|
1337
|
+
}
|
|
1338
|
+
});
|
|
1339
|
+
_this.observer.observe(wrapper);
|
|
1340
|
+
_this.observer.observe(contentComponent);
|
|
1330
1341
|
};
|
|
1331
1342
|
this.onWheelZoom = function(event) {
|
|
1332
1343
|
var disabled = _this.setup.disabled;
|
|
@@ -1450,7 +1461,7 @@ var ZoomPanPinch = (
|
|
|
1450
1461
|
var isAllowed = isPanningStartAllowed(_this, event);
|
|
1451
1462
|
if (!isAllowed)
|
|
1452
1463
|
return;
|
|
1453
|
-
var isDoubleTap = _this.lastTouch && +/* @__PURE__ */ new Date() - _this.lastTouch < 200;
|
|
1464
|
+
var isDoubleTap = _this.lastTouch && +/* @__PURE__ */ new Date() - _this.lastTouch < 200 && event.touches.length === 1;
|
|
1454
1465
|
if (!isDoubleTap) {
|
|
1455
1466
|
_this.lastTouch = +/* @__PURE__ */ new Date();
|
|
1456
1467
|
handleCancelAnimation(_this);
|
|
@@ -1580,7 +1591,7 @@ var ZoomPanPinch = (
|
|
|
1580
1591
|
_this.contentComponent = contentComponent;
|
|
1581
1592
|
handleCalculateBounds(_this, _this.transformState.scale);
|
|
1582
1593
|
_this.handleInitializeWrapperEvents(wrapperComponent);
|
|
1583
|
-
_this.handleInitialize(contentComponent);
|
|
1594
|
+
_this.handleInitialize(wrapperComponent, contentComponent);
|
|
1584
1595
|
_this.initializeWindowEvents();
|
|
1585
1596
|
_this.isInitialized = true;
|
|
1586
1597
|
var ctx = getContext(_this);
|
|
@@ -1649,7 +1660,7 @@ function styleInject(css, ref) {
|
|
|
1649
1660
|
style.appendChild(document.createTextNode(css));
|
|
1650
1661
|
}
|
|
1651
1662
|
}
|
|
1652
|
-
var css_248z = ".transform-component-module_wrapper__SPB86 {\n position: relative;\n width: -moz-fit-content;\n width: fit-content;\n height: -moz-fit-content;\n height: fit-content;\n overflow: hidden;\n -webkit-touch-callout: none; /* iOS Safari */\n -webkit-user-select: none; /* Safari */\n -khtml-user-select: none; /* Konqueror HTML */\n -moz-user-select: none; /* Firefox */\n -ms-user-select: none; /* Internet Explorer/Edge */\n user-select: none;\n margin: 0;\n padding: 0;\n}\n.transform-component-module_content__FBWxo {\n display: flex;\n flex-wrap: wrap;\n width: -moz-fit-content;\n width: fit-content;\n height: -moz-fit-content;\n height: fit-content;\n margin: 0;\n padding: 0;\n transform-origin: 0% 0%;\n}\n.transform-component-module_content__FBWxo img {\n pointer-events: none;\n}\n";
|
|
1663
|
+
var css_248z = ".transform-component-module_wrapper__SPB86 {\n position: relative;\n width: -moz-fit-content;\n width: fit-content;\n height: -moz-fit-content;\n height: fit-content;\n overflow: hidden;\n -webkit-touch-callout: none; /* iOS Safari */\n -webkit-user-select: none; /* Safari */\n -khtml-user-select: none; /* Konqueror HTML */\n -moz-user-select: none; /* Firefox */\n -ms-user-select: none; /* Internet Explorer/Edge */\n user-select: none;\n margin: 0;\n padding: 0;\n transform: translate3d(0, 0, 0);\n}\n.transform-component-module_content__FBWxo {\n display: flex;\n flex-wrap: wrap;\n width: -moz-fit-content;\n width: fit-content;\n height: -moz-fit-content;\n height: fit-content;\n margin: 0;\n padding: 0;\n transform-origin: 0% 0%;\n}\n.transform-component-module_content__FBWxo img {\n pointer-events: none;\n}\n";
|
|
1653
1664
|
var styles = { "wrapper": "transform-component-module_wrapper__SPB86", "content": "transform-component-module_content__FBWxo" };
|
|
1654
1665
|
styleInject(css_248z);
|
|
1655
1666
|
var TransformComponent = function(_a) {
|