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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@abrovink/abmedium-automerge

v0.9.1

Published

A graph medium

Downloads

1

Readme

abmedium-automerge

This package combines Abmedium with Automerge. Abmedium will handle alternative views of the content (with the help of layers). Automerge will handle the complexity around distributed editing. It will also handle serialization.

Document creation

Create a document.

let docA = document({ 0: seq(1, 2, 3), 1: sym("+"), 2: num(100), 3: num(200) });

Create an empty document.

let docB = document();

Merge documents as you do in Automerge.

docB = merge(docB, docA);

console.log("1.", docB);
// 1. {
//     '0': [ 'seq', [ 1, 2, 3 ] ],
//     '1': [ 'sym', '+' ],
//     '2': 100,
//     '3': 200
// }

Simultaneities

Let's update a document concurrently. (In a more realistic example this will of course happen in different processes.)

docA = change(docA, (doc) => {
  doc[2] = 110;
  doc[3] = 220;
});

docB = change(docB, (doc) => {
  doc[2] = 111;
});

docB = merge(docB, docA);

In the background Automerge kept track of the causality and registered a conflict: node 2 has been edited concurrently. Therefore a simultaneity has been created.

console.log("2.", docB);
// 2. {
//   '0': [ 'seq', [ 1, 2, 3 ] ],
//   '1': [ 'sym', '+' ],
//   '2': [ 'sim', [ 111, 110 ] ],
//   '3': 220
// }

Txt

The str type in Abmedium is not suitable for collaborative work on longer content. Fortunately Automerge offers a data type that is: Text.

Let's create a Text value.

let docC = document({ 0: txt("Hello!") });

It can be handled as other values in Abmedium. For example, valtype fully support it.

console.log(
  "3. ",
  treeOf(proj(docC), (value) => valtype(value, { txt: () => value.toString() }))
);
// 3. Hello!

For further information, read about Text in Automerge.

Examples

Inspect the examples directory for more examples. from-readme.js contains all the examples in this document.

Maturity Status

This package is not mature. It is not stable and will change a lot. It would be wonderful if you want to use it, but prepare for a bumpy ride. Maybe you want to contribute in that case?