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

@dbp-toolkit/app-shell

v0.3.5

Published

A web component for building SPAs consisting of one topic with multiple activities. Handles login, language selection, activity switching, menus etc.

Downloads

65

Readme

App Shell Component

A web component for building SPAs consisting of one topic with multiple activities. Handles login, language selection, activity switching, menus etc.

You can install this component via npm:

npm i @dbp-toolkit/app-shell

Usage

<script type="module" src="node_modules/@dbp-toolkit/app-shell/dist/dbp-app-shell.js"></script>
<dbp-app-shell src="/example.topic.metadata.json"></dbp-app-shell>

Or directly via CDN:

<script type="module" src="https://unpkg.com/@dbp-toolkit/[email protected]/dist/dbp-app-shell.js"></script>
<dbp-app-shell src="/example.topic.metadata.json"></dbp-app-shell>

You need Keycloak and other parts to be in place to really make full use of the AppShell. Best take a look on examples like index.html for more explanation.

Attributes

  • provider-root (optional): You need to set the provider-root attribute for the app-shell to "terminate" all provider events
    • If you don't want to set the app-shell as provider-root then you need to set the attributes auth, requested-login-status and analytics-event as attribute for the app-shell or in a dbp-provider above it
    • example <dbp-app-shell provider-root></dbp-app-shell>
  • lang (optional, default: de): set to de or en for German or English
    • example <dbp-app-shell lang="de"></dbp-app-shell>
  • src: The path to a topic metadata file (json)
  • base-path (optional, default: /): An absolute base path for routing
  • entry-point-url: Entry point URL to access the API
  • keycloak-config: An object with the following keys: url, realm, clientId, silentCheckSsoRedirectUri, scope
  • matomo-url (optional): set to your Matomo server (required only for tracking)
    • example <dbp-app-shell matomo-url="https://my-matomo.tld"></dbp-app-shell>
  • matomo-site-id (optional): set to your site id (required only for tracking)
    • example <dbp-app-shell matomo-site-id="456789"></dbp-app-shell>
  • no-welcome-page (optional): skips the welcome page and welcome page isn't visible in menu
    • example <dbp-app-shell no-welcome-page></dbp-app-shell>

Emitted attributes

The component emits dbp-set-property events for these attributes:

  • lang to propagate a language change (possible values en, de)
  • requested-login-status (possible values logged-in, logged-out)

Emitted events

dbp-lang

The component emits a dbp-lang event when the language is changed (for example in the language picker). The details attribute of the event is the language (possible values en, de).

Slots

You use template tags to inject slots into the web component. These templates will be converted to div containers when the page is loaded and will not show up before that.

Unnamed slot

The unnamed slot will be removed when the application is loaded and can be filled with a loading-spinner.

Example: <app-shell><dbp-loading-spinner></dbp-loading-spinner></app-shell>

name

The content of this slot will be shown left in the header and can be used to set a name (e.g. the name of the institution).

Example: <app-shell><template slot="name">TU Graz<br />Graz University of Technology</template></app-shell>

title

The content of this slot will be shown as big h1 headline instead of the name in the topic manifest file.

Example: <app-shell><template slot="title">TU Graz Greenlight</template></app-shell>

logo

The content of this slot will be shown right in the header and can be used to override the logo image.

Example: <app-shell><template slot="logo"><img alt="logo" src="/path/to/logo.png" /></template></app-shell>

header

The content of this slot will override the whole content of the header. You will need to provide your own language selector and auth component.

Example: <app-shell><template slot="header">My custom header</template></app-shell>

footer-links

The content of this slot will override the whole content of the footer link section, for example to set custom links.

Example: <app-shell><template slot="footer-links"><a target="_blank" rel="noopener" class="int-link-external" href="https://my-webpage.com">Link text</a></template></app-shell>

footer

The content of this slot will override the whole content of the footer, for example to set custom links and also overwrite the dbp-build-info tag.

Example: <app-shell><template slot="footer"><a target="_blank" rel="noopener" class="int-link-external" href="https://my-webpage.com">Link text</a></template></app-shell>

Topic Metadata

{
  "name": {
    "de": "Beispiel",
    "en": "Example"
  },
  "short_name": {
    "de": "Beispiel",
    "en": "Example"
  },
  "description": {
    "de": "Ich bin eine Beschreibung der Applikation",
    "en": "I am a description of this application"
  },
  "routing_name": "example",
  "activities": [
    {"path": "example.metadata.json", "visible": true}
  ],
  "attributes": []
}

Activity Metadata

{
  "element": "dbp-activity-example",
  "module_src": "dbp-activity-example.js",
  "routing_name": "activity-example",
  "name": {
    "de": "Beispielaktivität",
    "en": "Example Activity"
  },
  "short_name": {
    "de": "Beispielaktivität",
    "en": "Example Activity"
  },
  "description": {
    "de": "Eine Beschreibung",
    "en": "A Description"
  }
}

Local development

# get the source
git clone [email protected]:digital-blueprint/toolkit.git
cd toolkit/packages/app-shell

# install dependencies
npm install

# constantly build dist/bundle.js and run a local web-server on port 8002 
npm run watch

# run tests
npm test

# build local packages in dist directory
npm run build

Jump to http://localhost:8002 and you should get a Single Sign On login page.