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

@vf-dds/vf-dds-vanilla

v0.14.2

Published

NPM package for vanilla Javascript part of Vattenfall Digital Design System

Downloads

1,333

Readme

:warning: 0.14.1 will require updates for JavaScript implementation, read more at the DDS.

Vanilla part of Vattenfall DDS

This is the Vanilla JavaScript part of Vattenfall Digital Design System (DDS). Here you can look through logic, styling and other things layout-wise.

Contact and issue reporting

Contact us with general or specific questions at [email protected]. To handle our issue reporting, we are using an external tool. To report an issue, please use this form.

Installation

  • npm install

To build css/Tailwind for examples

  • npm run build-sass

To compile sandbox ids

  • npm run compile-sandbox

To build production for deployment

  • npm run compile-all

If you want an overview of your components, use npm run dev. This is built using vite, and code is stored in server.ts.

Standards

This project uses certain techniques, such as

  • BEM - https://en.bem.info/methodology/quick-start/
  • semver - https://semver.org/

Structure

The project is built with the following thoughts:

  • Components should always have their own css file, named after the component. E.g. css related to buttons, should be called buttons.css.
  • Components should always have their css stored in a scss-file named after it's parent. Example - css related to buttons should be in indicators.scss.
  • Components who need JavaScript, should have their own JavaScript file named after component. E.g. JavaScript related to people should be contained in people.js. If no JavaScript is supplied, none is needed.
  • Fonts are stored at src/fonts.
  • Global variables can be found in src/style/_variables.scss
  • All styling is finally summarized in src/style.scss, which exports to src/style.css.
  • In the examples folder (src/examples), you can find example of how the components are used, in code.
  • If you want to view an example of a component working, you can start our local development environment with npm run dev, and open the corresponding component in the UI.

Adding new components

In case you want to add new component to the library, follow the start underneath.

Javascript incorporation

If you want to add a new Javascript component, there are some things needed to get things working.

Adding and compiling CSS

Components in this library contains mostly css and some JavaScript. In case a new component is to be created, you should:

  • Add a scss-file in to the correct map, i.e. src/components/style/modules/{component_name}.scss, which contains the styling
  • Add in to a category-named file as a @forward, i.e src/components/style/modules/modules.scss.
  • Add it to the scss-script (/scripts/compile-all-scss.sh), to be able to compile new css-files.
  • Write example in src/examples, and check if it compiles with a new CodeSandbox id (using npm run compile-sandbox).

We write the styling for the site using SCSS but we compile it using sass. We have a script contained in /scripts named compile-all-scss.sh, which will create the category level, component level and global css-files needed. Run this from the root with ./scripts/compile-all-scss.sh.

Adding Tailwind components

Instead of adding your example to the examples folder, you should add it into src/tailwind-components. You should follow the same structure of category/component name. JavaScript are added the same as vanilla components. To build the related CSS, use npm run build-tailwind.

Initializing JavaScript

There are two main ways to initialize JavaScript, both are discussed here.

CodeSandbox

We use CodeSandbox to visualize our examples, and all these are generated programmatically. The code used for this is located in sandbox/sandbox.ts, and ids are later exposed to our end users through the file component-data.json. Other then generating the ids/sandboxes we do some special handling of JS and CSS, to cater for CodeSandbox.