
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
@arcmantle/image-viewer
Advanced tools
Image viewer web component based on web-worker canvas image manipulation.
A high-performance image viewer web component built with web workers and offscreen canvas for smooth image manipulation and display.
npm install @arcmantle/image-viewer
pnpm add @arcmantle/image-viewer
yarn add @arcmantle/image-viewer
<iv-image-viewer
image-src="/path/to/your/image.jpg"
reset-on-new-image
fit-on-new-image
></iv-image-viewer>
import { ImageViewer } from '@arcmantle/image-viewer';
// Using the component
const viewer = document.createElement('iv-image-viewer');
viewer.imageSrc = '/path/to/image.jpg';
viewer.resetOnNewImage = true;
document.body.appendChild(viewer);
// Programmatic control
viewer.adapter.api.zoom(1.5);
viewer.adapter.api.rotate(90);
viewer.adapter.api.fitToView();
viewer.adapter.api.reset();
import { ImageViewer } from '@arcmantle/image-viewer';
function App() {
return (
<ImageViewer
image-src="/spiral.jpg"
reset-on-new-image
fit-on-new-image
/>
);
}
Property | Type | Default | Description |
---|---|---|---|
imageSrc | string | '' | URL or path to the image to display |
resetOnNewImage | boolean | false | Whether to reset view transformations when a new image is loaded |
fitOnNewImage | boolean | false | Whether to automatically fit the image to view when loaded |
The component exposes an API object with the following methods:
// Access the API
const api = imageViewer.adapter.api;
// Reset view to default state
api.reset();
// Fit image to viewport
api.fitToView();
// Zoom by factor (1.5 = 150%, 0.5 = 50%)
api.zoom(1.5);
// Rotate by degrees (positive = clockwise)
api.rotate(90);
The component is focusable and can receive keyboard events when focused.
The image viewer uses a sophisticated architecture for optimal performance:
The component uses a WorkerView
class that provides:
The component can be styled with CSS:
iv-image-viewer {
width: 800px;
height: 600px;
border: 1px solid #ccc;
border-radius: 8px;
}
/* The component focuses cleanly */
iv-image-viewer:focus {
outline: 2px solid #0066cc;
}
// Create custom zoom controls
function createZoomControls(viewer) {
const zoomIn = document.createElement('button');
zoomIn.textContent = 'Zoom In';
zoomIn.onclick = () => viewer.adapter.api.zoom(1.2);
const zoomOut = document.createElement('button');
zoomOut.textContent = 'Zoom Out';
zoomOut.onclick = () => viewer.adapter.api.zoom(0.8);
const reset = document.createElement('button');
reset.textContent = 'Reset';
reset.onclick = () => viewer.adapter.api.reset();
return { zoomIn, zoomOut, reset };
}
async function loadImage(viewer, imageUrl) {
try {
// Set the image source
viewer.imageSrc = imageUrl;
// Optionally fit to view after loading
// The component will handle the loading automatically
setTimeout(() => {
viewer.adapter.api.fitToView();
}, 100);
} catch (error) {
console.error('Failed to load image:', error);
}
}
pnpm install
pnpm build
pnpm dev
pnpm build-demo
pnpm preview-demo
This project is licensed under the Apache 2.0 License - see the Apache License 2.0 for details.
This component is part of the @arcmantle ecosystem:
@arcmantle/adapter-element
- Base web component framework@arcmantle/library
- Core utilities and canvas helpers@arcmantle/lit-jsx
- JSX support for Lit-based components.
FAQs
Image viewer web component based on web-worker canvas image manipulation.
We found that @arcmantle/image-viewer demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.