JSPM

peasy-dev-embed

1.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 27
  • Score
    100M100P100Q81148F
  • License MIT

Embed PeasyDev widgets on any website. Lightweight (<8KB gzipped), zero dependencies, Shadow DOM isolation, 3 themes.

Package Exports

  • peasy-dev-embed
  • peasy-dev-embed/dist/embed.esm.js
  • peasy-dev-embed/dist/embed.min.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (peasy-dev-embed) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

peasy-dev-embed

npm License: MIT Zero Dependencies Size

Embed PeasyDev widgets on any website or blog. Developer tools — JSON, YAML, regex, diff, and code formatting. Each widget is completely isolated via Shadow DOM, requires zero dependencies, and supports 3 built-in themes (light, dark, sepia). The self-executing script finds all data-peasy-dev elements on the page and renders interactive widgets automatically, including support for dynamically added elements in single-page applications via MutationObserver.

PeasyDev is part of the Peasy Tools ecosystem, providing 11 widget types for embedding file format information, tool cards, conversion guides, glossary terms, search boxes, and interactive tools directly into your pages.

Try the interactive widget builder at widget.peasydev.com -- build, preview, and copy embed code for any widget type.

peasy-dev-embed demo -- embed peasydev widgets with Shadow DOM isolation and theme support

Table of Contents

Quick Start

<!-- 1. Place a widget element where you want it -->
<div data-peasy-dev="tool"
  data-slug="json-formatter"
  data-theme="light">
</div>

<!-- 2. Load the embed script once, anywhere on the page -->
<script src="https://cdn.jsdelivr.net/npm/peasy-dev-embed@1/dist/embed.min.js"></script>

That's it. The script will find all data-peasy-dev elements, fetch data from the PeasyDev API, and render each widget with full Shadow DOM style isolation.

Widget Types

PeasyDev supports 11 widget types -- 11 common types available on all Peasy sites.

Type Description Usage
format File format info card with specs, MIME type, and use cases <div data-peasy-dev="format" data-slug="..."></div>
tool Tool card with description and direct launch link <div data-peasy-dev="tool" data-slug="..."></div>
convert Conversion card showing input/output format pair <div data-peasy-dev="convert" data-slug="..."></div>
compare Side-by-side comparison of two formats or tools <div data-peasy-dev="compare" data-slug="..."></div>
glossary Glossary term tooltip with definition on hover <div data-peasy-dev="glossary" data-slug="..."></div>
gallery Grid gallery of available tools for a category <div data-peasy-dev="gallery" data-slug="..."></div>
guide Guide/tutorial card with summary and read-more link <div data-peasy-dev="guide" data-slug="..."></div>
usecase Use-case card showing when and why to use a tool <div data-peasy-dev="usecase" data-slug="..."></div>
badge Inline badge showing format type or tool category <div data-peasy-dev="badge" data-slug="..."></div>
search Search box with autocomplete for tools and formats <div data-peasy-dev="search" data-slug="..."></div>
interactive Embedded interactive tool via iframe <div data-peasy-dev="interactive" data-slug="..."></div>

Widget Options

All options are set via data-* attributes on the widget element.

Attribute Values Default Description
data-peasy-dev format, tool, convert, compare, glossary, gallery, guide, usecase, badge, search, interactive required Widget type to render
data-slug any valid slug -- Format or tool slug (format, tool, glossary, guide, usecase widgets)
data-from format slug -- Source format for conversion widget
data-to format slug -- Target format for conversion widget
data-a slug -- First item for comparison widget
data-b slug -- Second item for comparison widget
data-category category slug -- Filter gallery by category
data-url full URL -- Tool URL for interactive (iframe) widget
data-height e.g. "500px" "400px" Iframe height for interactive widget
data-label any string slug Display label for badge widget
data-placeholder any string "Search tools..." Search input placeholder text
data-theme light, dark, sepia, auto light Visual theme for the widget
data-size compact, default, large default Widget size variant
data-lang en, ko, ja, es, etc. en Language for widget labels
data-track true, false false Send anonymous usage analytics

Themes

Three built-in themes are available, plus an auto mode that follows the user's OS preference.

<!-- Light theme (default) -- clean white background -->
<div data-peasy-dev="tool" data-slug="json-formatter" data-theme="light"></div>

<!-- Dark theme -- dark background, light text -->
<div data-peasy-dev="tool" data-slug="json-formatter" data-theme="dark"></div>

<!-- Sepia theme -- warm, paper-like appearance -->
<div data-peasy-dev="tool" data-slug="json-formatter" data-theme="sepia"></div>

<!-- Auto theme -- follows prefers-color-scheme -->
<div data-peasy-dev="tool" data-slug="json-formatter" data-theme="auto"></div>

Each theme sets CSS custom properties inside the Shadow DOM. The accent color (#0891B2) is consistent across all themes, providing brand recognition for PeasyDev.

CDN Options

<script src="https://cdn.jsdelivr.net/npm/peasy-dev-embed@1/dist/embed.min.js"></script>

npm (for bundlers like webpack, Vite, Rollup)

npm install peasy-dev-embed
// Just import -- the script self-executes and activates all widgets
import 'peasy-dev-embed';

ESM import (for modern module-based setups)

<script type="module">
  import 'https://cdn.jsdelivr.net/npm/peasy-dev-embed@1/dist/embed.esm.js';
</script>

Examples

Format Info Card

Display detailed information about a file format including MIME type, extensions, and use cases.

<!-- PeasyDev format info card with light theme -->
<div data-peasy-dev="format" data-slug="json-formatter" data-theme="light"></div>
<script src="https://cdn.jsdelivr.net/npm/peasy-dev-embed@1/dist/embed.min.js"></script>

Tool Card

Show a tool card with its description, category, and a direct link to launch the tool.

<!-- PeasyDev tool card -->
<div data-peasy-dev="tool" data-slug="json-formatter" data-theme="light"></div>
<script src="https://cdn.jsdelivr.net/npm/peasy-dev-embed@1/dist/embed.min.js"></script>

Add a search widget with autocomplete for finding tools and formats.

<!-- Search across PeasyDev tools and formats -->
<div data-peasy-dev="search"
  data-placeholder="Search PeasyDev tools..."
  data-theme="light">
</div>
<script src="https://cdn.jsdelivr.net/npm/peasy-dev-embed@1/dist/embed.min.js"></script>

Format Badge (Inline)

Display a compact inline badge showing a format type or tool category.

<p>This file is in <div data-peasy-dev="badge" data-slug="json-formatter"></div> format.</p>
<script src="https://cdn.jsdelivr.net/npm/peasy-dev-embed@1/dist/embed.min.js"></script>

Interactive Tool

Embed a full interactive tool via iframe. Use the data-slug attribute with the format category/tool-name.

<!-- Embed an interactive PeasyDev tool -->
<div data-peasy-dev="interactive"
  data-slug="dev/example-tool"
  data-height="500"
  data-theme="light">
</div>
<script src="https://cdn.jsdelivr.net/npm/peasy-dev-embed@1/dist/embed.min.js"></script>

Note: The data-slug value uses the format category-slug/tool-slug. Find available tools at peasydev.com/api/v1/tools/.

Glossary Tooltip

Show a glossary term with its definition, rendered as a tooltip-style card.

<div data-peasy-dev="glossary" data-slug="lossless" data-theme="light"></div>
<script src="https://cdn.jsdelivr.net/npm/peasy-dev-embed@1/dist/embed.min.js"></script>

Compact Widget (Sidebar)

Use the compact size for sidebar placements.

<div data-peasy-dev="format"
  data-slug="json-formatter"
  data-theme="light"
  data-size="compact">
</div>
<script src="https://cdn.jsdelivr.net/npm/peasy-dev-embed@1/dist/embed.min.js"></script>

Dark Theme

<div data-peasy-dev="format"
  data-slug="json-formatter"
  data-theme="dark"
  data-size="large">
</div>
<script src="https://cdn.jsdelivr.net/npm/peasy-dev-embed@1/dist/embed.min.js"></script>

Technical Details

  • Shadow DOM: Complete CSS isolation -- widget styles never leak into your page, and your page styles never affect the widget
  • Zero dependencies: No jQuery, React, Alpine, or any external library required
  • System fonts: Uses the system font stack -- no Google Fonts request, instant text rendering
  • Self-executing: Include the script tag and add data attributes -- no initialization code needed
  • MutationObserver: Automatically detects and renders widgets added dynamically (SPA-compatible)
  • Lazy loading: Widgets outside the viewport use IntersectionObserver for deferred initialization
  • CORS: PeasyDev API has CORS enabled for all origins
  • Bundle size: < 8KB gzipped (IIFE) -- minimal impact on page load
  • Accessibility: Semantic HTML, proper ARIA attributes, keyboard navigation support
  • Powered by: Each widget includes a subtle "PeasyDev" backlink in the footer

Learn More

Visit peasydev.com for the full PeasyDev experience.

Peasy Tools Family

Part of Peasy Tools -- simple, fast, free developer tools.

Site Domain npm Focus
PeasyPDF peasypdf.com npm PDF tools, conversion, compression, merging, and splitting
PeasyImage peasyimage.com npm Image conversion, compression, resizing, and format tools
PeasyVideo peasyvideo.com npm Video conversion, compression, trimming, and format tools
PeasyAudio peasyaudio.com npm Audio conversion, compression, trimming, and format tools
PeasyCSS peasycss.com npm CSS tools, minification, formatting, color conversion, and previews
PeasyText peasytext.com npm Text tools, word counting, encoding, hashing, and formatting
PeasyTools peasytools.com npm The Peasy Tools hub
PeasyFormats peasyformats.com npm File format encyclopedia
PeasyDev peasydev.com npm Developer tools
PeasyDesign peasydesign.com npm Design tools
PeasyQR peasyqr.com npm QR code generation, scanning, and customization tools
PeasySEO peasyseo.com npm SEO analysis tools
PeasySafe peasysafe.com npm Security tools
PeasySocial peasysocial.com npm Social media tools
PeasyMath peasymath.com npm Math tools
PeasyGen peasygen.com npm Generator tools

License

MIT -- see LICENSE.

Built by Peasy Tools.