npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

flux-signage-editor

v1.2.0

Published

Editor de imagens e vídeos da plataforma Flux Signage — Fabric.js powered, React compatible

Readme

flux-signage-editor

Editor visual de imagens e vídeos para sinalização digital, powered by Fabric.js v6. Disponível como módulo ES puro ou componente React.

Instalação

npm install flux-signage-editor

Para uso com React, instale também as peer dependencies:

npm install react react-dom

Uso — Vanilla JS

import { createEditor } from 'flux-signage-editor';

const editor = createEditor({
  container: '#my-editor',   // seletor CSS ou HTMLElement
  width: 1920,               // largura do artboard (default: 1920)
  height: 1080,              // altura do artboard (default: 1080)
  onReady() {
    console.log('Editor pronto');
  },
  onChange() {
    console.log('Canvas modificado');
  },
});

Uso — React

import { useRef } from 'react';
import { SignageEditor, type SignageEditorRef } from 'flux-signage-editor/react';

function App() {
  const editorRef = useRef<SignageEditorRef>(null);

  const handleExport = () => {
    editorRef.current?.exportPNG((blob) => {
      const url = URL.createObjectURL(blob);
      window.open(url);
    });
  };

  return (
    <>
      <SignageEditor
        ref={editorRef}
        width={1920}
        height={1080}
        onReady={() => console.log('Pronto')}
        onChange={() => console.log('Modificado')}
        style={{ width: '100%', height: '80vh' }}
      />
      <button onClick={handleExport}>Exportar PNG</button>
    </>
  );
}

API

createEditor(config): EditorInstance

Cria e monta o editor dentro do container especificado.

EditorConfig

| Propriedade | Tipo | Default | Descrição | |---|---|---|---| | container | HTMLElement \| string | — | Elemento ou seletor CSS (obrigatório) | | width | number | 1920 | Largura do artboard em pixels | | height | number | 1080 | Altura do artboard em pixels | | onReady | () => void | — | Callback após inicialização | | onChange | () => void | — | Callback a cada mudança no canvas |

EditorInstance

Canvas

editor.setSize(1080, 1920);          // redimensiona o artboard
editor.getSize();                     // → { width, height }
editor.fitToScreen();                 // ajusta zoom ao viewport
editor.setZoom(1.5);                  // define nível de zoom
editor.getZoom();                     // → number

Ferramentas

editor.addRectangle(100, 100);        // retângulo na posição (x, y)
editor.addCircle(200, 200);           // círculo
editor.addHeading();                  // texto título
editor.addSubheading();               // texto subtítulo
editor.addBodyText();                 // texto corpo

await editor.addImageFromURL('https://example.com/img.png');
await editor.addVideoFromURL('https://example.com/video.mp4');

editor.createByType('rectangle');     // factory genérica por nome de tipo

Todos os métodos de ferramenta aceitam (x?, y?) opcionais para posicionamento.

Histórico

editor.undo();
editor.redo();

Páginas

editor.getPages();              // → Page[]
editor.getCurrentPageIndex();   // → number
editor.addPage();
editor.goToPage(2);

Cada Page contém:

interface Page {
  json: string;        // estado serializado do canvas
  name: string;        // nome da página
  thumbnail: string;   // data URL da miniatura
}

Exportação

Todos os métodos de exportação são callback-based:

// PNG (Blob)
editor.exportPNG((blob) => {
  const url = URL.createObjectURL(blob);
  // download, upload, etc.
}, { multiplier: 2 });

// JPG (Blob)
editor.exportJPG((blob) => { ... }, { quality: 0.85 });

// SVG (string)
editor.exportSVG((svgString) => { ... });

// PDF (Blob)
editor.exportPDF((blob) => { ... });

// MP4 (Blob) — exporta animações da timeline
editor.exportMP4((blob) => { ... }, { fps: 60 });

// JSON (string) — estado serializado do canvas
editor.exportJSON((json) => {
  localStorage.setItem('backup', json);
});

// Importar JSON
await editor.importJSON(jsonString);

ExportOptions

| Propriedade | Tipo | Default | Descrição | |---|---|---|---| | quality | number | 0.92 | Qualidade JPG (0–1) | | multiplier | number | 1 | Escala para exports raster (2 = 2x resolução) | | fps | number | 30 | Frames por segundo para MP4 |

Eventos

editor.on('object:modified', (e) => { ... });
editor.on('object:added', (e) => { ... });
editor.off('object:modified', handler);

Acesso direto ao canvas

const canvas = editor.getCanvas(); // instância Fabric.js Canvas

Destruição

editor.destroy(); // remove listeners e libera recursos

TypeScript

Todos os tipos são exportados:

import type {
  EditorConfig,
  EditorInstance,
  ExportFormat,
  ExportOptions,
  Page,
} from 'flux-signage-editor';

Licença

MIT