JSPM

mashlib

1.7.22-8da67d95
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 376
  • Score
    100M100P100Q91058F
  • License MIT

Data mashup library

Package Exports

  • mashlib/dist/databrowser.html

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 (mashlib) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Solid-compatible data mashup library and Databrowser

NPM Package

The mashlib library (mashlib.js) is a solid-compatible code library of application-level functionality for the world of Solid. It compiles together all the following repository into what we know as mashlib.js:

  • solid-logic — core business logic of SolidOS
  • pane-registry - an index to hold all loaded solid panes, whether statically or dynamically loaded
  • solid-ui — User Interface widgets and utilities for Solid. Building blocks for solid-based apps
  • solid-panes — a set of core solid-compatible panes based on solid-ui.

A colorful dependency tree can be seen here.

Developing mashlib

As part of the SolidOS stack, mashlib can be developed locally by setting up the SolidOS code. Read more about that on the SolidOS Readme.

Goals

The goals of mashlib overlaps with the SolidOS Goals.

Typical uses

One major use of mashlib is as a "databrowser" for a personal data store.

Mashlib is used in SolidOS and contributes to:

And mashlib is also used standalone as the SolidOS Databrowser Webapp and can be tried out at: https://solid.github.io/mashlib/dist/browse.html.

But mashlib is also used as a library by adding mashlib.js (of minified version) directly in your applications. For example:

<script src="https://solidcommunity.net/mashlib.js"></script>.

Previous versions of this documentation

Check out SolidOS Pod for an earlier version of this documentation.

Documentation

Different implemnetation

SolidOS Databrowser Webapp

The static/browse.html page is compiled one to one into the dist (output) folder of mashlib and makes mashlib available stand-alone as the SolidOS Databrowser Webapp.

You can see and try out a SolidOS Databrowser Webapp deployment under this link: https://solid.github.io/mashlib/dist/browse.html

browse.htmlserves as a perfect example for: Solid WebID authentication and how to make use of mashlib function and variables.

SolidOS Databrowser Frontend

The src/databrowser.htmlpage is compiled into the SolidOS Databrowser Frontend which is displayed for each WebID on solidcommunity.net. This is the case because the solidcommunity.net Solid Server is configured with SolidOS as its frontend.

More information about the SolidOS Frontend and how to use it visit the User Guide.

SolidOS Data-Kitchen

SolidOS Data-Kitchen uses mashlib.jsas a direct import in its source code. Visit the code at SolidOS Data-Kitchen GitHub.

Mashlib global variables and funtions

If one wants to use mashlib as a direct import (as a package dependency or script import) one needs to know how they immediate available global variables and functions.

The availability of these global variables depends on how the sub-modules are imported and exported but also on where the variables are instanciated. For a basic theoretical read please read this resource.

What does global mean in mashlib? We mean the global object which depends on different environments. In mashlib, for now, we use the windowcontext which means these variables will not work in non-window contexts such as Node.js environments if directly used. (This does not mean you cannot use mashlib in Node.js environments -> just import it through npm). We will switch this at some point to the globalThis.

Next we list the most important window context/global variables and which sub-repos are they exported from:

  • solid-logic exports among others: solidLogicSingleton, authn, authSession, store, chat, profile;
  • pane-registry is exported entirely through the pane-registry variable;
  • solid-ui exports among others: authn, store, rdf, dom under the UI variable;
  • solid-panes exports getOutliner and the entire solid-ui through the UI variable, and solid-panes itself can be used through the panes variable.

For backward compatibility reasons, there are now different ways to make use of the same variables from mashlib. For example:

  • to make use of the UI (solid-ui) one can use UI or panes.UI;
  • authentication session, part of solid-logic, can be called as authSession or UI.authn.authSession or panes.UI.authn.authSession;
  • the store (from solid-logic) can be used as store or UI.store or panes.UI.store;
  • rdflib is entirely acessible as UI.rdf or panes.UI.rdf
  • the currentUser function is called as authn.currentUser() or UI.auth.currentUser() or panes.UI.authn.currentUser()
  • and to make use of the login pop up one needs to call UI.login.loginStatusBoxfunction.

You can see an example usage in the SolidOS Databrowser Webapp code.

The databrowser hack: upgrading your browser

This refers to a specific way in which the mashlib is deployed for users who at first only have a conventional web browser - a hypertext browser not a data browser. It is a hack -- in the original computing sense of a crafty, though not beautiful, little thing which gets the job done.

How does the data browser work?

  1. The user goes with a normal web browser to access some data object (like a to-do list).
  2. The server sees the browser doesn't understand the data natively.
  3. The server sends back a little placeholder HTML file, databrowser.html, instead of the data.
  4. The databrowser.html file loads the mashlib.js Javascript library, which can now understand the data.
  5. The mashlib.js then re-requests the original data, but accepting data formats.
  6. The server supplies the actual data of the to-do list or whatever it was.
  7. The mashlib.js code provides an editable visualization on the data.

The mashlib part of SolidOS Databrowser Frontend is read-write. Where the user is allowed to edit: it lets them edit the data and create new things. It is live in that often the databrowser signed up (using a websocket) for any changes which other users make, so users' screens are synchronized.

A major limitation of their data browser hack is that current web browsers are made to distrust any code loaded from one domain that uses data from another domain. This makes it hard, strangely complicated, and sometimes impossible to do some things.