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

@caldera-labs/state

v0.9.0

Published

Redux(-like) state management for [Caldera Forms](https://github.com/calderawp/caldera-forms).

Downloads

16

Readme

Redux(-like) state management for Caldera Forms.

Build Status Documentation Status Coverage Status Maintainability

🌋 👀Documentation

Installation

Add to a Project

Requires npm

npm i -D caldera-state

Usage

Import With webpack

    import {state} from '@caldera-labs/state';
    const STORE_SLUG = state.CALDERA_FORMS_STORE_SLUG;

Reference Implementations

This module is used was added to Caldera Forms, first for block UI and privacy settings screen. Pull request

Checkout For Development

Requires git and npm

  • Clone from Github
  • Install
    • cd caldera-state && npm install
  • See "Available Scripts" below for more information on development

What Is This?

This package provides Redux(-like) state management for Caldera Forms configurations and other things that need their state managed in a React app, such as Gutenberg.

Also, an example app and test coverage for all of that.

Why Is This?

  • https://github.com/CalderaWP/Caldera-Forms/issues/2564
  • Once source of single source of state
    • We need to state management in CF core, pro, and add-ons.
  • Isolated testing.
    • This package had 28 tests at initial commit.
    • Test basic functionality with mocks here.
    • Test that it actually works with CF REST API in CF.

Usage

Import Into A webpack Managed Project

import * as cfStateWebpack from '@caldera-labs/state'

This import exposes three keys: store,state, and util.

store - Pure functions for storing state

state - Interactions with Redux or wp.data

import * as cfFormsState from '@caldera-labs/state';
export const STORE = {
    reducer( state = DEFAULT_STATE, action ) {
        return cfFormsState.store.reducers.formsReducer(DEFAULT_STATE,action);
    },
    actions: cfFormsState.store.actions,
    selectors: cfFormsState.store.selectors,
};

util - Utility functions

Find the form with a specific ID in an array of forms.

cfFormsState.util.findFormById(Array,'cf123456');

Check if a given form config object has an ID

cfFormsState.util.formHasId(Object,'cf123456');

Current Status

  • ✔️ State management for forms.
  • ✔️ State management for settings.
  • ✖️ Migrate CF Pro state from Vuex to Redux.
  • ✔️ Integration with wp.data.
  • ✖️ Entries

Available Scripts

In the project directory, you can run:

npm start

Runs the app in the development mode. Open http://localhost:3000 to view it in the browser.

The page will reload if you make edits. You will also see any lint errors in the console.

This shows the example app that uses this to show and update a list of forms.

npm test

Launches the test runner in the interactive watch mode.

npm run build

Builds the app for production to the build folder. It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.

Release To npm

Must be logged in as project maintainer via npm cli

  • Patch release:

    • yarn release
  • Minor release:

    • yarn release:minor
  • Major release:

    • yarn release:major