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

@teipublisher/pb-components

v2.24.4

Published

Collection of webcomponents underlying TEI Publisher

Downloads

14,503

Readme

Web Components for TEI Publisher

This repository contains the web components used by TEI Publisher and apps generated by it.

Distributing the components in a separate package has several benefits:

  • generated apps can depend on a specific version of the components without getting into conflict with other apps
  • the components can be embedded into any environment, e.g. a CMS or blog software, as long as they can communicate with a TEI Publisher instance running somewhere else

While TEI Publisher 5 used Polymer as the framework for webcomponents, components now use the LitElement library, which adds only a thin layer on top of native web components.

Quick Start

Clone the repository, call npm install once and run npm start. This creates a simple webserver which you can access in a browser to see the documentation and demos.

All components talk to an endpoint, which will either be a TEI Publisher instance or an application generated from TEI Publisher. Docs and demos in this repo currently expect the endpoint to be available on http://localhost:8080/exist. TEI Publisher version 6 is required for all features to work correctly.

Loading Components from CDN

To include components into your own application, you can load them from a CDN:

<script src="https://cdn.jsdelivr.net/npm/@webcomponents/webcomponentsjs/webcomponents-loader.js"></script>
<script type="module" src="https://cdn.jsdelivr.net/npm/@teipublisher/pb-components/dist/pb-components-bundle.js"></script>

For most use case, including pb-components-bundle.js is enough. However, we ship additional bundles as described below:

| File | Description | | ------------------------------ | ------------------------------------------------------------------------------- | | dist/pb-components-bundle.js | (required) the base components, including text views and all core functionality | | dist/pb-leaflet-map.js | (optional) support for displaying maps | | dist/pb-odd-editor.js | implements the visual ODD editor | | dist/pb-component-docs.js | components to view the API documentation of this package | | dist/pb-tify.js | IIIF presentation API viewer |

Bundles build on each other, so you always need to at least include pb-components-bundle.js in your HTML page.

For some examples of how to embed components into plain HTML, see the sample collection on codepen.

Loading from npm

Install @teipublisher/pb-components into your project:

npm install --save @teipublisher/pb-components

Extending

If you wish to extend the library with your own components, there's a template project available, which you may fork.

Building

Run npm run build:production to generate the set of bundle files in dist, containing all components and their dependencies.

Development

For development, run npm start as described above. It will start a development server (on port 8000 by default), open a browser window and watch for file changes. Every component should have a demo to show its functionality.

You can configure TEI Publisher (or an app generated from it) to load components from the development server. This allows you to directly test changes you made to components within the full TEI Publisher environment.

In TEI Publisher, open modules/config.xqm and change variable $config:webcomponents to the value dev. Below, the variable $config:webcomponents-cdn should be set to http://localhost:8000:

declare variable $config:webcomponents := "dev";

declare variable $config:webcomponents-cdn := "http://localhost:8000";

After reloading TEI Publisher in the browser, components should be loaded from your local development server.

Building Documentation

To regenerate the API documentation, run npm run docs.