Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@glomex/glomex-dialog
Advanced tools
A dialog web component that allows docking a video player or putting it in a lightbox
A dialog web component that allows docking a video player or putting it in a lightbox. It allows implementing a similar feature as https://amp.dev/documentation/examples/multimedia-animations/advanced_video_docking/ but without AMP.
See an example here: http://unpkg.com/@glomex/glomex-dialog/index.html
<script type="module">
import 'http://unpkg.com/@glomex/glomex-dialog';
</script>
<!--
mode: "" | "inline" | "dock" | "lightbox"
-->
<glomex-dialog mode="inline">
<!--
"dialog-overlay" is optional:
enables drag'n'drop feature when defined
-->
<div slot="dialog-overlay"></div>
<div slot="dialog-element">
<!-- Your HTML that should be docked / put into lightbox -->
</div>
</glomex-dialog>
import { html, render, useRef } from 'docup'
export default () => {
const select = useRef();
const dialog = useRef();
const onButtonClick = () => {
dialog.current.setAttribute('mode', select.current.value);
};
return html`
<p>
<select ref=${select}>
<option value="">hidden</option>
<option value="inline" selected>inline</option>
<option value="dock">dock</option>
<option value="lightbox">lightbox</option>
</select>
<button onClick=${onButtonClick} class="button">Switch Dialog Mode</button>
</p>
<glomex-dialog ref=${dialog} mode="inline">
<div slot="dialog-element">
<div style="position: relative;">
<div class="placeholder-16x9"></div>
<video
class="video-element"
controls
preload="none"
src="https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"
poster="https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/images/BigBuckBunny.jpg">
</video>
</div>
</div>
</glomex-dialog>`
}
Can render into an alternative dock target when this dock target is visible during dock transition. Otherwise it uses the default dock target.
import { html, render, useRef } from 'docup'
const sidebar = document.querySelector('.sidebar');
const alternativeDockTarget = document.createElement('div');
alternativeDockTarget.setAttribute('id', 'alternative-dock-target');
alternativeDockTarget.style.background = '#999';
alternativeDockTarget.width = '100%';
alternativeDockTarget.pointerEvents = 'none';
alternativeDockTarget.innerHTML = '<div class="placeholder-16x9"></div>';
sidebar.appendChild(alternativeDockTarget);
export default () => {
const select = useRef();
const dialog = useRef();
const onButtonClick = () => {
dialog.current.setAttribute('mode', select.current.value);
};
return html`
<p>
<select ref=${select}>
<option value="">hidden</option>
<option value="inline" selected>inline</option>
<option value="dock">dock</option>
<option value="lightbox">lightbox</option>
</select>
<button onClick=${onButtonClick} class="button">Switch Dialog Mode</button>
</p>
<glomex-dialog ref=${dialog} dock-target="#alternative-dock-target" mode="inline">
<div slot="dialog-element">
<div style="position: relative;">
<div class="placeholder-16x9"></div>
<video
class="video-element"
controls
preload="none"
src="https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"
poster="https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/images/BigBuckBunny.jpg">
</video>
</div>
</div>
</glomex-dialog>`
}
<glomex-dialog mode="inline" dock-target="#some-css-selector">
<!-- ... -->
</glomex-dialog>
import { html, render, useRef } from 'docup'
export default () => {
const select = useRef();
const dialog = useRef();
const onButtonClick = () => {
dialog.current.setAttribute('mode', select.current.value);
};
return html`
<p>
<select ref=${select}>
<option value="" selected>hidden</option>
<option value="inline">inline</option>
<option value="dock">dock</option>
<option value="lightbox">lightbox</option>
</select>
<button onClick=${onButtonClick} class="button">Switch Dialog Mode</button>
</p>
<glomex-dialog ref=${dialog}>
<div slot="dialog-element">
<div style="position: relative;">
<div class="placeholder-16x9"></div>
<video
class="video-element"
controls
preload="none"
src="https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"
poster="https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/images/BigBuckBunny.jpg">
</video>
</div>
</div>
</glomex-dialog>`
}
<!-- without a defined mode attribute -->
<glomex-dialog>
<!-- ... -->
</glomex-dialog>
This example auto docks the video element when the player gets scrolled out of view.
import { html, render, useRef, useEffect } from 'docup'
export default () => {
const select = useRef();
const dialog = useRef();
const onButtonClick = () => {
dialog.current.setAttribute('mode', select.current.value);
};
let onceVisible = false;
let currentIntersectionRatio;
useEffect(() => {
const observer = new IntersectionObserver((entries) => {
const glomexDialog = dialog.current;
currentIntersectionRatio = entries[0].intersectionRatio;
if (!onceVisible) {
onceVisible = entries[0].intersectionRatio === 1;
return;
}
const currentMode = glomexDialog.getAttribute('mode');
if (currentMode === 'lightbox' || !currentMode) {
return;
}
if (entries[0].intersectionRatio < 1 && glomexDialog.getAttribute('mode') !== 'dock') {
glomexDialog.setAttribute('mode', 'dock');
} else if (entries[0].intersectionRatio === 1) {
glomexDialog.setAttribute('mode', 'inline');
}
}, {
threshold: [0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1]
});
if (dialog.current) {
observer.observe(dialog.current);
dialog.current.addEventListener('toggledialog', (evt) => {
if (evt.detail.mode === 'inline' && currentIntersectionRatio !== 1) {
onceVisible = false;
}
});
}
}, [dialog]);
return html`
<p>
<select ref=${select}>
<option value="" selected>hidden</option>
<option value="inline">inline</option>
<option value="dock">dock</option>
<option value="lightbox">lightbox</option>
</select>
<button onClick=${onButtonClick} class="button">Switch Dialog Mode</button>
</p>
<glomex-dialog ref=${dialog} mode="inline" dock-target-inset="50px 10px auto auto">
<div slot="dialog-element">
<div style="position: relative;">
<div class="placeholder-16x9"></div>
<video
class="video-element"
controls
preload="none"
src="https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"
poster="https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/images/BigBuckBunny.jpg">
</video>
</div>
</div>
</glomex-dialog>`
}
<!-- The intersection-observer-code is custom in the above example -->
<glomex-dialog mode="inline" dock-target-inset="50px 10px auto auto">
<!-- ... -->
</glomex-dialog>
import { html, render, useRef } from 'docup'
export default () => {
const select = useRef();
const dialog = useRef();
const onButtonClick = () => {
dialog.current.setAttribute('mode', select.current.value);
};
return html`
<p>
<select ref=${select}>
<option value="">hidden</option>
<option value="inline" selected>inline</option>
<option value="dock">dock</option>
<option value="lightbox">lightbox</option>
</select>
<button onClick=${onButtonClick} class="button">Switch Dialog Mode</button>
</p>
<glomex-dialog ref=${dialog} mode="inline">
<div slot="dialog-overlay"></div>
<div slot="dialog-element">
<div style="position: relative;">
<div class="placeholder-16x9"></div>
<video
class="video-element"
controls
preload="none"
src="https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"
poster="https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/images/BigBuckBunny.jpg">
</video>
</div>
</div>
</glomex-dialog>`
}
<glomex-dialog mode="inline" dock-target-inset="50px 10px auto auto">
<!-- when this is defined it automatically makes the element draggable -->
<!-- allows to place custom elements in the dialog-overlay -->
<div slot="dialog-overlay"></div>
<!-- ... -->
</glomex-dialog>
Attribute | Values |
---|---|
aspect-ratio | 16:9 (default) |
dock-target | #anotherElement |
dock-target-inset | 0px 10px auto auto |
mode | inline , dock , lightbox |
Property | Modifiers | Type |
---|---|---|
aspectRatio | readonly | number |
dockTarget | readonly | Element | null |
placeholder | readonly | Element | null |
Method | Type |
---|---|
refreshDockTarget | (): void |
Event | Type |
---|---|
toggledialog | CustomEvent<{ mode: any; }> |
FAQs
A dialog web component that allows docking a video player or putting it in a lightbox
The npm package @glomex/glomex-dialog receives a total of 183 weekly downloads. As such, @glomex/glomex-dialog popularity was classified as not popular.
We found that @glomex/glomex-dialog demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.