SCDH / seed-frontend-components

Library of web components for building websites for digital editions.
MIT License
0 stars 0 forks source link

SEED Frontend Components

This is a collection of web components for building web frontends for digital editions. It's part of the SEED, which is an acronym and stands for SEED Electronic Editions. If you don't like recursion you can stick to SCDH Electronic Editions ;-).

Why web components?

List of Web Components

These are the most important building blocks:

Read the detailed documentation in the Wiki!

Usage Examples

See the example web pages section below.

There's also a list of real-world use cases below.

Getting started

Installation

Install from the open npm registry of the gitlab of University of Münster! The NPM package contains the components in the src folder, but neither the index page nor the examples.

Registry set up

Put this into your package's .npmrc:

# 805 is the group ID of SCDH toplevel group
@scdh:registry=https://zivgitlab.uni-muenster.de/api/v4/projects/805/packages/npm/

Downstream packages should always use the 805 as project ID.

Reason: This package has dependencies on other packages prefixed with @scdh in the SCDH toplevel group. By using the toplevel group ID, npm will be forwarded to the right projects by gitlab of University of Münster.

Alternatively, you can use the 7934 group and configure npm to use this one:

rm .npmrc
npm config set @scdh:registry=https://zivgitlab.uni-muenster.de/api/v4/groups/7934/-/packages/npm/
npm config set -- //zivgitlab.uni-muenster.de/api/v4/groups/7934/-/packages/npm/:_authToken=YOUR_API_READ_TOKEN 

TODO: Simplify!

Install

npm i @scdh/seed-frontend-components

Using the Compiled Library of Web Components

Instead adding this package to the dependencies of your project, you can simply load the compiled library of web components. The latest version is only at

https://scdh.zivgitlabpages.uni-muenster.de/tei-processing/seed-frontend-components/seed-frontend-components.js

or

https://scdh.zivgitlabpages.uni-muenster.de/tei-processing/seed-frontend-components/seed-frontend-components.cjs

Development

Run a development server, accessible through http://localhost:5173:

npm run dev

This will serve pages like index.html.

Run tests:

npm run test

Example Web Pages

Running the development server will bring up several pages with usage examples. They are contained in the examples folder.

API Docs

https://scdh.zivgitlabpages.uni-muenster.de/tei-processing/seed-frontend-components/docs/

Design Principles / Contributing

  1. Use RTK (Redux Toolkit) for state management.

  2. Write components the Lit way. Write view components!

  3. Prefer TS over JS.

  4. Do not configure the TS compiler to be tolerant when type checking.

Further Reading

Use Cases