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

@geocity/agenda-embed

v1.5.0

Published

Web component to browse, filter and search events; including a detail view.

Downloads

397

Readme

Agenda Embed

Web component to browse, filter and search events; including a detail view.

Installation

A. By downloading

You can download the latest version on Gitlab to serve it from your own server.

B. Using a third-party CDN

You can directly hotlink the JavaScript file mentioned below through a CDN like Unpkg or JSDelivr:

<script type="module" src="https://unpkg.com/@geocity/agenda-embed"></script>

<script
  type="module"
  src="https://cdn.jsdelivr.net/npm/@geocity/agenda-embed"
></script>

C. Using a package manager

The widget is available as a package that you can install using your favorite Node package manager; example using npm:

npm install @geocity/agenda-embed

To define the custom agenda-embed element, you must import the package somewhere in your code:

import '@geocity/agenda-embed';

Usage

Embed the web component directly in an HTML page:

<!-- Customize the style -->
<style>
  agenda-embed {
    --agd-color-primary: #008c6f;
    --agd-color-accent: #005d95;
    --agd-headings-font-family: 'Playfair Display', serif;
    --agd-headings-font-weight: 500;
    /* ... */
  }
</style>

<!-- Render the component -->
<agenda-embed></agenda-embed>

<!-- Initialize the component -->
<script type="module" src="/path/to/agenda-embed.js"></script>

Filter events displayed by domain

You can globally restrict the widget to events of a given domain by using the domain attribute on the component:

<agenda-embed domain="sport"></agenda-embed>

A domain must be specified for the filters dropdown to be displayed.

To display events from all domains, don’t specify this attribute.

Customize the API target

Specify the api-base-url attribute to use a different API target:

<agenda-embed api-base-url="https://www.yourdomain.ch/api"></agenda-embed>

This parameter is optional, https://geocity.ch/rest is the default.

The end-points called by the widget are:

  • GET /agenda for the list of events
  • GET /agenda/:id for the event details

Scroll position and sticky headers

When navigating between the list view and the detail view, the scroll position will be adjusted. For example:

  • When going from the list to the detail, it will move the scroll position to the top of the agenda-embed element.
  • When going back to the list, it will restore the scroll position where it was before.

If the website you are embedding the widget in has a sticky element (like a header) at the top of the page, it might cover the top of the widget content. The scroll-offsets attribute gives the widget insights about this element to improve the scroll position:

<agenda-embed scroll-offsets="[[0, 80], [992, 150]]"></agenda-embed>

The value must be a valid JSON where the key is the viewport min-width and the value the offset to be applied. The example above can be described as:

  • Starting from a viewport width of 0 pixels, offset the scroll position by 80 pixels.
  • Starting from a viewport width of 992 pixels, offset the scroll position by 150 pixels.

You can add as many breakpoints as you need.

Upcoming events widget

Display the 5 next events in a small widget with just the date and title:

<!-- Customize the style -->
<style>
  agenda-upcoming-embed {
    --agd-color-primary: #008c6f;
    /* ... */
  }
</style>

<!-- Render the component -->
<agenda-upcoming-embed></agenda-upcoming-embed>

<!-- Initialize the component -->
<script type="module" src="/path/to/agenda-upcoming-embed.js"></script>

The options domain and api-base-url works as well on this component.

Link to the event details

To enable links to the events page, the URL of the page hosting the agenda-embed widget must be provided in the agenda-url option.

<agenda-upcoming-embed agenda-url="/medias/agenda"></agenda-upcoming-embed>