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

mlt-vdom

v2.0.1

Published

A strictly regulated, object-oriented Virtual DOM for the MLT Multimedia Framework.

Readme

🎬 MLT Virtual DOM (mlt-vdom)

A strictly-typed, Namespace-driven Virtual DOM for generating MLT Framework XML files.
Designed for 2026 automation workflows, it ensures structural integrity through proactive hierarchy validation, automatic reference syncing, and professional formatting.


🚀 Installation

Install via npm:

npm install mlt-vdom

📖 Core Concepts

1. Unified Constructor Convention

Every element in the library follows a consistent constructor signature:

new Mlt.ElementName(attributes, content)

  • attributes: An object { key: 'value' } representing XML attributes.
  • content: Can be a string, a number, a single MltNode, or an Array<MltNode>.

2. Node Behaviors

To prevent "Broken XML," the library separates nodes into two distinct functional classes:

  • ContainerNode (Type 0): Structural elements like Producer, Playlist, or Tractor. They use .add() to manage multiple children.
  • ReferenceNode (Type 1): Pointer elements like Entry or Track. They use .bind() to point to a source and automatically sync the producer attribute.

💻 Usage Example

import { Mlt } from 'mlt-vdom';

// 1. Create the root project
const mlt = new Mlt({ id: 'main_project' });

// 2. Define a Video Source (Producer)
const producer = new Mlt.Producer({ id: 'vid_01' }, [
    new Mlt.Property({ name: 'resource' }, 'clip.mp4'),
    new Mlt.Property({ name: 'mlt_service' }, 'avformat')
]);

// 3. Define the Timeline (Playlist)
const playlist = new Mlt.Playlist({ id: 'main_bin' });

// 4. Create an Entry (Links to the Producer)
const entry = new Mlt.Entry({ in: 0, out: 150 });
entry.bind(producer); // Correct semantic linking

// 5. Assemble the Tree
playlist.add(entry);
mlt.add(producer);
mlt.add(playlist);

// 6. Build the XML String
console.log(mlt.dump(true, 'optional/save/path/file.mlt'));

📝 Expected Output

Running the code above produces this perfectly formatted MLT XML:

<?xml version="1.0" encoding="utf-8"?>
<mlt LC_NUMERIC="C" version="7.37.0" xmlns="http://www.mltframework.org/bin/view/MLT/" id="main_project">
  <producer id="vid_01">
    <property name="resource">clip.mp4</property>
    <property name="mlt_service">avformat</property>
  </producer>
  <playlist id="main_bin">
    <entry in="0" out="150" producer="vid_01"/>
  </playlist>
</mlt>

🏗️ API Reference

Mlt.build(indent)

Generates the final XML string. Called only on the root Mlt instance.

  • false (default): Minified XML.
  • true: Pretty-printed XML (2 spaces).
  • number: Pretty-printed XML with N spaces.

Methods by Node Type

| Method | Applicable To | Description | | :--- | :--- | :--- | | .add(node) | Containers | Adds a child to the internal stack. Throws if hierarchy is invalid. | | .remove(node) | Containers | Removes a specific child node. | | .bind(node) | References | Binds a Producer/Playlist. Auto-sets the producer ID. | | .unbind() | References | Clears the binding and removes the producer attribute. | | .setAttribute(k, v) | All | Manually sets an XML attribute. | | .getAttribute(k) | All | Retrieves an attribute value. |


🛡️ Validation Logic

The library enforces the MLT schema at assignment time. If you try to add a node where it doesn't belong, it throws a Hierarchy Error immediately rather than generating invalid XML.

const playlist = new Mlt.Playlist();
const tractor = new Mlt.Tractor();

playlist.add(tractor); 
// ❌ Error: Hierarchy Error: <tractor> is not a valid child for <playlist>

⚖️ License

MIT