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

nocms-publishing

v7.13.3

Published

Publisher interface for NoCMS

Downloads

21

Readme

NoCMS publishing

Publishing interface for NoCMS.

semantic-release Dependency Status devDependencies

Installation

npm i nocms-publishing

Features

  • AdminContent: Provide the menu on the right hand side. Most likely not used directly, but by nocms-server.
  • EditableArea: An editable area with the provided fields wrapped in an edit menu used by templates.
  • EditableComponentWrapper: A list of editable components used by templates.
  • EditImage: An image selector where you can pick responsive images, crop, zoom, add alt text, caption and attribution. Used by templates.
  • EditPdf: Pfd selector, used by templates.
  • EditSimpleImage: Select an image, used by templates

Usage

EditableArea

Example with Editable Area. editMode is a bool indicating editMode (the menu is open), but not necessarily activeEditMode (the group of input fields are in active edit state, e.g shown as input fields and with edit menu). EditableArea adds the activeEditMode bool, so it can be used by (in this example) ReactComponent.jsx.

import React from 'react';
import PropTypes from 'prop-types';
import { EditableArea } from 'nocms-publishing';
import ReactComponent from '../components/ReactComponent.jsx';

const EditableAreaDemo = (props, context) => {
  const { content } = props;
  const { editMode} = context;
  const information = <ReactComponent scope="content.information" data={content.information} />;

  return (
    {editMode ?
      <EditableArea scope="content.information" label="Praktisk informasjon">{information}</EditableArea>
      : information}
  )
};

EditableAreaDemo.propTypes = {
  content: PropTypes.object,
};

EditableAreaDemo.defaultProps = {
  content: {},
};

EditableAreaDemo.contextTypes = {
  editMode: PropTypes.bool,
  lang: PropTypes.string,
};

export default EditableAreaDemo;

EditImage

Example with EditImage. The example is very simplified. Most likely, you will need some logic to handle displaying different images according to viewport size or some strategy to avoid image "jumping".

The component itself is responsible for displaying the image when in not edit mode. See https://github.com/miles-no/nocms-cloudinary-utils for helpers. Run the example for more options for the image dialog.

import React, { Fragment } from 'react';
import { EditImage } from 'nocms-publishing';
import cloudinary from 'nocms-cloudinary-utils';

const aspectRatio = {
  large: {
    width: 5,
    height: 4,
  },
  small: {
    width: 2,
    height: 3,
  },
};
const ImageDemo = (props, context) => {
  const { activeEditMode, data, scope } = this.props;
  const { config, editMode } = this.context;
  const image = data.image || {};
  const transformation = {
    // for available options, see Clodinary docs
    quality: 'auto:eco',
    fetch_format: 'auto',
    use_root_path: true,
    crop: 'crop',
  };
  let src = cloudinary.getImageUrl(config.cloudinaryCloudName, transformation, image, aspectRatio.large);

  return (
    <Fragment>
      {editMode ?
        <EditImage
          scope={`${scope}.image`}
          data={image}
          activeEditMode={activeEditMode}
          targetDevices
          aspectRatio={aspectRatio}
          disableCaption
        />
      : null }
      {src}
    </Fragment>
  )
};

Run the example

The example can be useful for more examples and demo. As a standalone example, most site interaction will fail in lack of a real web server, page and message api.

git clone https://github.com/miles-no/nocms-publishing.git
cd nocms-publishing
npm i
npm run dev

In another terminal window for images

npm run dev:backend

Go to http://localhost:9000/

Commit message format and publishing

This repository is published using semantic-release, with the default AngularJS Commit Message Conventions.