fslightbox 3.4.0-2 → 3.4.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/c/elements/setUpClassFacade.js +9 -0
- package/c/events/setUpEventsDispatcher.js +7 -0
- package/c/events/setUpGlobalEventsController.js +39 -0
- package/c/keyboard/KeyboardController.js +26 -0
- package/c/main-component/closing/LightboxCloseActioner.js +46 -0
- package/c/main-component/closing/setUpLightboxCloser.js +11 -0
- package/c/scrollbar/gsw.js +1 -0
- package/c/scrollbar/setUpScrollbarRecompensor.js +20 -0
- package/c/setUpCore.js +30 -0
- package/c/sfs.js +1 -0
- package/c/sizes/setUpWindowResizeActioner.js +38 -0
- package/c/slide/setUpSlideChangeFacade.js +23 -0
- package/c/slide/setUpSlideIndexChanger.js +89 -0
- package/c/so.js +1 -0
- package/c/sources/SourceLoadActioner.js +32 -0
- package/c/sources/SourceLoadHandler.js +41 -0
- package/c/sources/SourceSizer.js +36 -0
- package/c/sources/creating/CreatingSourcesBucket.js +29 -0
- package/c/sources/creating/CreatingSourcesLocalStorageManager.js +55 -0
- package/c/sources/creating/createSources.js +28 -0
- package/c/sources/pointering/down/setUpSourcesPointerDown.js +38 -0
- package/c/sources/pointering/move/SourcesPointerMove.js +16 -0
- package/c/sources/pointering/move/SourcesPointerMoveActioner.js +34 -0
- package/c/sources/pointering/up/SourcesPointerUp.js +13 -0
- package/c/sources/pointering/up/SourcesPointerUpActioner.js +38 -0
- package/c/sources/pointering/up/SourcesPointerUpActionerBucket.js +1 -0
- package/c/sources/setUpSourceDisplayFacade.js +26 -0
- package/c/sources/types/AutomaticTypeDetector.js +70 -0
- package/c/sources/types/DetectedTypeActioner.js +44 -0
- package/c/sources/types/getAutomaticTypeDetectorBucket.js +14 -0
- package/c/stage/setUpStageManager.js +57 -0
- package/c/stage/ssws.js +2 -0
- package/c/styles/createAndAppendStyles.js +9 -0
- package/c/styles/injectStylesIfNotInDom.js +8 -0
- package/c/styles/styles-injection/styles-injection.js +5 -0
- package/c/timeouts/getQueuedAction.js +15 -0
- package/cm/h/renderSvg.js +17 -0
- package/cm/nav/renderAndGetToolbarButton.js +11 -0
- package/cm/nav/renderCloseButton.js +10 -0
- package/cm/nav/renderFullscreenButton.js +43 -0
- package/cm/nav/renderNav.js +17 -0
- package/cm/nav/renderSlideNumber.js +29 -0
- package/cm/nav/renderToolbar.js +13 -0
- package/cm/renderSlideButton.js +11 -0
- package/cm/renderSlideButtonContainer.js +15 -0
- package/cm/renderSlideButtons.js +7 -0
- package/cm/renderSlideSwipingHoverer.js +6 -0
- package/cm/sources/proper-sources/renderCustom.js +15 -0
- package/cm/sources/proper-sources/renderImage.js +18 -0
- package/cm/sources/proper-sources/renderInvalid.js +18 -0
- package/cm/sources/proper-sources/renderVideo.js +31 -0
- package/cm/sources/proper-sources/renderYoutube.js +26 -0
- package/cm/sources/renderSourceWrappersContainer.js +18 -0
- package/cm/sources/saw.js +1 -0
- package/cm/sources/smw.js +1 -0
- package/cn/classes-names.js +27 -0
- package/cn/core-constants.js +6 -0
- package/cn/css-constants.js +1 -0
- package/cn/dom-constants.js +1 -0
- package/cn/elements.js +3 -0
- package/cn/local-storage-constants.js +2 -0
- package/h/elements/addToElementClassIfNotContains.js +6 -0
- package/h/elements/removeFromElementChildIfContains.js +5 -0
- package/h/elements/removeFromElementClassIfContains.js +6 -0
- package/h/objects/assignToObject.js +10 -0
- package/h/source/setUpSourceClassName.js +13 -0
- package/h/source/setUpSourceCustomAttributes.js +5 -0
- package/h/state/ifOnUpdateExistsHandleItForState.js +6 -0
- package/package.json +1 -1
- package/s.js +1 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { PREFIX, SOURCE_CLASS_NAME } from "../../../cn/classes-names";
|
|
2
|
+
import { setUpSourceClassName } from "../../../h/source/setUpSourceClassName";
|
|
3
|
+
import { setUpSourceCustomAttributes } from "../../../h/source/setUpSourceCustomAttributes";
|
|
4
|
+
|
|
5
|
+
export function renderYoutube(fsLightbox, i) {
|
|
6
|
+
const {
|
|
7
|
+
collections: { sourceLoadHandlers },
|
|
8
|
+
elements: { sources: sourcesElements, sourceAnimationWrappers },
|
|
9
|
+
props: { sources }
|
|
10
|
+
} = fsLightbox;
|
|
11
|
+
|
|
12
|
+
sourcesElements[i] = document.createElement("iframe");
|
|
13
|
+
setUpSourceClassName(fsLightbox, i, `${SOURCE_CLASS_NAME} ${PREFIX}youtube-iframe`);
|
|
14
|
+
var url = sources[i];
|
|
15
|
+
var p = url.split("?")[1];
|
|
16
|
+
sourcesElements[i].src = `https://www.youtube.com/embed/${getYoutubeVideoIdFromUrl()}?${p ? p : ""}`;
|
|
17
|
+
sourcesElements[i].allowFullscreen = true;
|
|
18
|
+
setUpSourceCustomAttributes(fsLightbox, i);
|
|
19
|
+
sourceAnimationWrappers[i].appendChild(sourcesElements[i]);
|
|
20
|
+
sourceLoadHandlers[i].handleYoutubeLoad();
|
|
21
|
+
|
|
22
|
+
function getYoutubeVideoIdFromUrl() {
|
|
23
|
+
const regExp = /^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/;
|
|
24
|
+
return url.match(regExp)[2];
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { smw } from "./smw";
|
|
2
|
+
import { ABSOLUTED_CLASS_NAME, FULL_DIMENSION_CLASS_NAME } from "../../cn/classes-names";
|
|
3
|
+
|
|
4
|
+
export function renderSourceWrappersContainer(fsLightbox) {
|
|
5
|
+
const { core: { sourcesPointerDown }, elements, props: { sources } } = fsLightbox;
|
|
6
|
+
|
|
7
|
+
const sourceWrappersContainer = document.createElement('div');
|
|
8
|
+
sourceWrappersContainer.className = `${ABSOLUTED_CLASS_NAME} ${FULL_DIMENSION_CLASS_NAME}`;
|
|
9
|
+
elements.container.appendChild(sourceWrappersContainer);
|
|
10
|
+
|
|
11
|
+
sourceWrappersContainer.addEventListener('pointerdown', sourcesPointerDown.listener);
|
|
12
|
+
|
|
13
|
+
elements.sourceWrappersContainer = sourceWrappersContainer;
|
|
14
|
+
|
|
15
|
+
for (let i = 0; i < sources.length; i++) {
|
|
16
|
+
smw(fsLightbox, i);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function saw({elements:{smw,sourceAnimationWrappers}},i){var w=document.createElement("div");var l=document.createElement("div");l.className="fslightboxl";for(var j=0;j<3;j++){var lc=document.createElement("div");l.appendChild(lc)}w.appendChild(l);smw[i].appendChild(w);sourceAnimationWrappers[i]=w}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ABSOLUTED_CLASS_NAME,FLEX_CENTERED_CLASS_NAME,FULL_DIMENSION_CLASS_NAME,TRANSFORM_TRANSITION_CLASS_NAME}from"../../cn/classes-names";import{saw}from"./saw";export function smw(o,i){var{core:{stageManager},elements:{smw,sourceWrappersContainer},props}=o,t=0,w=document.createElement("div");w.className=`${ABSOLUTED_CLASS_NAME} ${FULL_DIMENSION_CLASS_NAME} ${FLEX_CENTERED_CLASS_NAME}`;w.s=function(){w.style.display="flex"};w.h=function(){w.style.display="none"};w.a=function(){w.classList.add(TRANSFORM_TRANSITION_CLASS_NAME)};w.d=function(){w.classList.remove(TRANSFORM_TRANSITION_CLASS_NAME)};w.n=function(){w.style.removeProperty("transform")};w.v=function(v){t=v;return w;};w.ne=function(){s(-dt())};w.z=function(){s(0)};w.p=function(){s(dt())};function s(v){w.style.transform=`translateX(${v+t}px)`;t=0}function dt(){return(1+props.slideDistance)*innerWidth}if(!stageManager.i(i)){w.h()}smw[i]=w;sourceWrappersContainer.appendChild(w);saw(o,i)}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export const PREFIX = 'fslightbox-';
|
|
2
|
+
|
|
3
|
+
// single classes names
|
|
4
|
+
export const FSLIGHTBOX_STYLES = `${PREFIX}styles`;
|
|
5
|
+
export const CURSOR_GRABBING_CLASS_NAME = `${PREFIX}cursor-grabbing`;
|
|
6
|
+
export const FULL_DIMENSION_CLASS_NAME = `${PREFIX}full-dimension`;
|
|
7
|
+
export const FLEX_CENTERED_CLASS_NAME = `${PREFIX}flex-centered`;
|
|
8
|
+
export const OPEN_CLASS_NAME = `${PREFIX}open`;
|
|
9
|
+
export const TRANSFORM_TRANSITION_CLASS_NAME = `${PREFIX}transform-transition`;
|
|
10
|
+
export const ABSOLUTED_CLASS_NAME = `${PREFIX}absoluted`;
|
|
11
|
+
|
|
12
|
+
// slide buttons
|
|
13
|
+
export const SLIDE_BTN = `${PREFIX}slide-btn`;
|
|
14
|
+
export const SLIDE_BTN_CONTAINER = `${SLIDE_BTN}-container`;
|
|
15
|
+
|
|
16
|
+
// animations
|
|
17
|
+
export const FADE_IN_CLASS_NAME = `${PREFIX}fade-in`;
|
|
18
|
+
export const FADE_OUT_CLASS_NAME = `${PREFIX}fade-out`;
|
|
19
|
+
export const FADE_IN_STRONG_CLASS_NAME = FADE_IN_CLASS_NAME + '-strong';
|
|
20
|
+
export const FADE_OUT_STRONG_CLASS_NAME = FADE_OUT_CLASS_NAME + '-strong';
|
|
21
|
+
|
|
22
|
+
// opacity
|
|
23
|
+
const opacityBaseClassName = `${PREFIX}opacity-`;
|
|
24
|
+
export const OPACITY_1_CLASS_NAME = `${opacityBaseClassName}1`;
|
|
25
|
+
|
|
26
|
+
// sources
|
|
27
|
+
export const SOURCE_CLASS_NAME = `${PREFIX}source`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const ANIMATION_TIME = 300;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const FSLIGHTBOX_STYLES_ID = 'fslightbox-styles';
|
package/cn/elements.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This function assigns to object properties from second one
|
|
3
|
+
* @param { Object } object
|
|
4
|
+
* @param { Object } toAssign
|
|
5
|
+
*/
|
|
6
|
+
export function assignToObject(object, toAssign) {
|
|
7
|
+
for (let toAssignPropertyName in toAssign) {
|
|
8
|
+
object[toAssignPropertyName] = toAssign[toAssignPropertyName];
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Set up source class with custom class if set
|
|
3
|
+
*/
|
|
4
|
+
export function setUpSourceClassName(
|
|
5
|
+
{
|
|
6
|
+
elements: { sources },
|
|
7
|
+
props: { customClasses }
|
|
8
|
+
},
|
|
9
|
+
i, baseClassName
|
|
10
|
+
) {
|
|
11
|
+
const customClassName = customClasses[i] ? customClasses[i] : '';
|
|
12
|
+
sources[i].className = baseClassName + ' ' + customClassName;
|
|
13
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fslightbox",
|
|
3
|
-
"version": "3.4.0
|
|
3
|
+
"version": "3.4.0",
|
|
4
4
|
"description": "An easy to use vanilla JavaScript plug-in without production dependencies for displaying images, videos, or, through custom sources, anything you want in a clean overlying box.",
|
|
5
5
|
"author": "Bantha Apps Piotr Zdziarski",
|
|
6
6
|
"license": "MIT",
|
package/s.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const styles = ".fslightbox-absoluted{position:absolute;top:0;left:0}.fslightbox-fade-in{animation:fslightbox-fade-in .3s cubic-bezier(0,0,.7,1)}.fslightbox-fade-out{animation:fslightbox-fade-out .3s ease}.fslightbox-fade-in-strong{animation:fslightbox-fade-in-strong .3s cubic-bezier(0,0,.7,1)}.fslightbox-fade-out-strong{animation:fslightbox-fade-out-strong .3s ease}@keyframes fslightbox-fade-in{from{opacity:.65}to{opacity:1}}@keyframes fslightbox-fade-out{from{opacity:.35}to{opacity:0}}@keyframes fslightbox-fade-in-strong{from{opacity:.3}to{opacity:1}}@keyframes fslightbox-fade-out-strong{from{opacity:1}to{opacity:0}}.fslightbox-cursor-grabbing{cursor:grabbing}.fslightbox-full-dimension{width:100%;height:100%}.fslightbox-open{overflow:hidden;height:100%}.fslightbox-flex-centered{display:flex;justify-content:center;align-items:center}.fslightbox-opacity-0{opacity:0!important}.fslightbox-opacity-1{opacity:1!important}.fslightbox-scrollbarfix{padding-right:17px}.fslightbox-transform-transition{transition:transform .3s}.fslightbox-container{font-family:Arial,sans-serif;position:fixed;top:0;left:0;background:linear-gradient(rgba(30,30,30,.9),#000 1810%);touch-action:pinch-zoom;z-index:1000000000;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent}.fslightbox-container *{box-sizing:border-box}.fslightbox-svg-path{transition:fill .15s ease;fill:#ddd}.fslightbox-nav{height:45px;width:100%;position:absolute;top:0;left:0}.fslightbox-slide-number-container{display:flex;justify-content:center;align-items:center;position:relative;height:100%;font-size:15px;color:#d7d7d7;z-index:0;max-width:55px;text-align:left}.fslightbox-slide-number-container .fslightbox-flex-centered{height:100%}.fslightbox-slash{display:block;margin:0 5px;width:1px;height:12px;transform:rotate(15deg);background:#fff}.fslightbox-toolbar{position:absolute;z-index:3;right:0;top:0;height:100%;display:flex;background:rgba(35,35,35,.65)}.fslightbox-toolbar-button{height:100%;width:45px;cursor:pointer}.fslightbox-toolbar-button:hover .fslightbox-svg-path{fill:#fff}.fslightbox-slide-btn-container{display:flex;align-items:center;padding:12px 12px 12px 6px;position:absolute;top:50%;cursor:pointer;z-index:3;transform:translateY(-50%)}@media (min-width:476px){.fslightbox-slide-btn-container{padding:22px 22px 22px 6px}}@media (min-width:768px){.fslightbox-slide-btn-container{padding:30px 30px 30px 6px}}.fslightbox-slide-btn-container:hover .fslightbox-svg-path{fill:#f1f1f1}.fslightbox-slide-btn{padding:9px;font-size:26px;background:rgba(35,35,35,.65)}@media (min-width:768px){.fslightbox-slide-btn{padding:10px}}@media (min-width:1600px){.fslightbox-slide-btn{padding:11px}}.fslightbox-slide-btn-container-previous{left:0}@media (max-width:475.99px){.fslightbox-slide-btn-container-previous{padding-left:3px}}.fslightbox-slide-btn-container-next{right:0;padding-left:12px;padding-right:3px}@media (min-width:476px){.fslightbox-slide-btn-container-next{padding-left:22px}}@media (min-width:768px){.fslightbox-slide-btn-container-next{padding-left:30px}}@media (min-width:476px){.fslightbox-slide-btn-container-next{padding-right:6px}}.fslightbox-down-event-detector{position:absolute;z-index:1}.fslightbox-slide-swiping-hoverer{z-index:4}.fslightbox-invalid-file-wrapper{font-size:22px;color:#eaebeb;margin:auto}.fslightbox-video{object-fit:cover}.fslightbox-youtube-iframe{border:0}.fslightboxl{display:block;margin:auto;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:67px;height:67px}.fslightboxl div{box-sizing:border-box;display:block;position:absolute;width:54px;height:54px;margin:6px;border:5px solid;border-color:#999 transparent transparent transparent;border-radius:50%;animation:fslightboxl 1.2s cubic-bezier(.5,0,.5,1) infinite}.fslightboxl div:nth-child(1){animation-delay:-.45s}.fslightboxl div:nth-child(2){animation-delay:-.3s}.fslightboxl div:nth-child(3){animation-delay:-.15s}@keyframes fslightboxl{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}.fslightbox-source{position:relative;z-index:2;opacity:0}";
|