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

@meteora-digital/silverstripe-cms

v5.1.1

Published

Styles and scripts to make the Silverstripe cms look awesome.

Downloads

59

Readme

Silverstripe CMS Theme

Install this package and import the SCSS / CSS and JavaScript files into your project to make Silverstripe look awesome.

Installation

npm i @meteora-digital/silverstripe-cms
yarn add @meteora-digital/silverstripe-cms

SCSS Usage

Create a new cms.scss file in your project, and import the styles

@import 'node_modules/@meteora-digital/silverstripe-cms/dist/styles/index.scss';

Next we need to set up some css variables for the theme.

If you're not using the darkmode component, you can simply add:

:root {
    --cms-background-colour: #f1f1f1;
    --cms-background-colour--dark: #e9e9e9;
    --cms-background-colour--light: #fefefe;
    --cms-background-colour--dynamic: #fefefe;
    --cms-border-colour: #bebebe;
    --cms-link-colour: #036cd7;
    --cms-text-colour: #0e0e0e;
    --cms-accent-colour: #81b88b;
}

If you are using the darkmode component, I recommend the following setup:

@mixin dark-mode {
    --cms-background-colour: #292c47;
    --cms-background-colour--dark: #23263d;
    --cms-background-colour--light: #323657;
    --cms-background-colour--dynamic: #323657;
    --cms-border-colour: #040406;
    --cms-link-colour: #60a3d5;
    --cms-text-colour: #c7c7c7;
    --cms-accent-colour: #81b88b;
}

@mixin light-mode {
    --cms-background-colour: #f1f1f1;
    --cms-background-colour--dark: #e9e9e9;
    --cms-background-colour--light: #fefefe;
    --cms-background-colour--dynamic: #fefefe;
    --cms-border-colour: #bebebe;
    --cms-link-colour: #036cd7;
    --cms-text-colour: #0e0e0e;
    --cms-accent-colour: #4d9159;
}

Note: The --cms-background-colour--dynamic variable is useful when you want to change an element's background colour based on the current darkmode state. For example, in darkmode you may want something to use --cms-background-colour--light and in lightmode you may want it to use --cms-background-colour--dark. This variable allows for extra control.

:root {
  @media (prefers-color-scheme: light) {
    @include light-mode;
  }

  @media (prefers-color-scheme: dark) {
    @include dark-mode;
  }
}

body {
  &[data-darkmode="on"] {
    @include dark-mode;
  }

  &[data-darkmode="off"] {
    @include light-mode;
  }
}

CMS Logo

Add your logo to the top of the CMS Sidebar.

@include cms-logo (
  $url: 'images/svg/logo.svg',
  $width: 54,
  $height: 22,
);

JavaScript Usage

I recommend setting up a seperate js file for each component. And then import those components to one cms.js file

document.addEventListener('DOMContentLoaded', () => {
  import('./cms/darkmode');
  import('./cms/page-observer');
});

Darkmode Usage

/* ---------------------------------------------
Import Darkmode
--------------------------------------------- */

import { DarkmodeController } from '@meteora-digital/silverstripe-cms';

/* ---------------------------------------------
Document Setup
--------------------------------------------- */

// Create a new darkmode controller
const Darkmode = new DarkmodeController();
// Find the south toolbar area
const toolbar = document.querySelector('.toolbar.toolbar--south.cms-panel-toggle');

// Add the darkmode button to the south toolbar
toolbar.appendChild(Darkmode.button);

FieldNames Usage

/* ---------------------------------------------
Import FieldNames
--------------------------------------------- */

import { FieldNamesController } from '@meteora-digital/silverstripe-cms';

/* ---------------------------------------------
Document Setup
--------------------------------------------- */

const FieldController = new FieldNamesController({
    include: ['.field'],
    exclude: [],
});

// Add $Variable names as titles on field inputs
FieldController.on('update', (label) => {
  const title = label.id.split('_');
  label.title = '$' + title[title.length - 1];
});

// If you're using the PageObserverController
window.addEventListener('page-updated', () => FieldController.update());

Page Observer Usage

The page observer is a mutation observer that can be used to check for changes to the page content, for example after an ajax request. This can help if you need to retarget DOM elements with custom JS.

/* ---------------------------------------------
Import Page Observer
--------------------------------------------- */

import { PageObserverController } from '@meteora-digital/silverstripe-cms';

/* ---------------------------------------------
Document Setup
--------------------------------------------- */

new PageObserverController();

/* ---------------------------------------------
Event Listeners
--------------------------------------------- */

window.addEventListener('page-updated', () => {
    // Do something after the page has been updated
});

License

MIT