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

genesys-spark

v4.47.0

Published

This package is the default way to use Spark. It provides access to Spark's lazy-loading custom elements via a single shared CDN, as well as utilities for non-rendering UI tasks.

Downloads

1,206

Readme

genesys-spark

This package is the default way to use Spark. It provides access to Spark's lazy-loading custom elements via a single shared CDN, as well as utilities for non-rendering UI tasks.

Getting Started

Installation

Use your package manager of choice to install the package in your project.

npm install genesys-spark

Localization

To ensure components are localized correctly, use the lang attribute to set the language of your page. Components will respect the language of their closest ancestor with a recognized lang attribute.

Loading the components

When initializing your app/page, call registerSparkComponents, which will inject the script and style tags into your page that define the main Spark custom elements:

import { registerSparkComponents } from 'genesys-spark';

// It's not _required_ to await component loading, but it can help prevent a flash
// of unstyled content.
await registerSparkComponents();

Loading the chart components

When initializing your app/page, call registerSparkChartComponents, which will inject the script and style tags into your page that define the chart related Spark custom elements:

import { registerSparkChartComponents } from 'genesys-spark';

// It's not _required_ to await component loading, but it can help prevent a flash
// of unstyled content.
await registerSparkChartComponents();

Font Loading

While registerSparkComponents() and registerSparkChartComponents() will add the required web fonts to your page if they are not already present, it is recommended that you link stylesheets to load the Urbanist and Noto Sans fonts in your document prior to starting your app. This will improve loading performance and prevent a jarring font transition when the required fonts load.

Asset loading details

By adding a script tag to the document, we ensure that the components are always loaded from the same location. This keeps the bundle size of the consuming application smaller, and ensures that multiple apps on the same domain will share the browser's cache of the component definitions. Overall, this leads to a better end-user experience.

Additionally, Stencil builds the components so that their full implementations do not need to be loaded up-front. Instead, components are fetched as they are used in the page. Those lazy-loaded implementations also benefit from sharing the browser cache in the same way as the initial script.