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

guten-block-fields

v1.0.7

Published

Generate or manage block fields for <InspectorControls /> using a single JSON file.

Downloads

15

Readme

Guten Block Fields

WordPress Gutenberg development tool.

NPM version npm GitHub stars

When you creating blocks in Gutenberg, You may want more fields to manage the block's content. Gutenberg has a section called Inspector Controller which appears on the right side of the block when you click on particular block on editor. This package will help you to create those field in more easy way.

Install

$ npm install guten-block-fields

Usage

$ guten-block-fields make 

Documentaion

Click Here to see documentation.

Video Demo

Click Here To watch the video demo.

Create fields

To create or manage block's field you'll need to create a block-fields.json file in your plugin's root folder.

A block-fields.json file:

  • list the block's field and manage them anytime.
  • makes your field reproducible, and therefore much easier to share with another block.

"block-fields.json" options

name

Type: string

Name of your component.

output

Type: string

The path where you want to land of the generated files.

toggles

Type: object

List of the toggle

Example:

"toggles": {
        "bio": {
            "title": "Bio data",
            "isOpen": true,
        },
        "occuption": {
            "title":"Occuption",
            "isOpen":false
        }
    }

fields

Type: array

Pass the list of the field which needs to be required generated.

Options:
  • title Title or label of the field.
  • id id of the field.
  • type Type of the field.
  • value Default value of the field.
  • toggle Toggle id in which this field should be appear. See "toggle" option above.
  • baseControl Whether field should wrapper inside the or not.

Supported fields

text

Render

example:
{
    "title": "Your Name",
    "id": "your-name",
    "type": "text",
    "value": "john doe",
    "toggle": "bio",
    "baseControl": true
}

checkbox

Render

Additional option:

  • checked <true|false>
example:
{
    "title": "Accept t&c",
    "label": "Sample",
    "id": "sample",
    "toggle": "bio",
    "checked": true,
    "type": "checkbox"
},

button

Render <Button />

example:
{
    "title": "Save Changes",
    "type": "button",
    "id": "save-change",
    "toggle": "occuption",
    "default": false,
    "class": "save"
},

button-group

Render <ButtonGroup />

example:
{
    "title": "Button Group",
    "type": "button-group",
    "id": "button-group",
    "toggle": "occuption",
    "buttons": [
        {
            "isPrimary": true,
            "class": "red",
            "label": "Red",
            "id": "red"
        },
        {
            "isPrimary": false,
            "class": "blue",
            "label": "Blue",
            "id": "blue"
        }
    ]
},

select

Render <Select />

example
{
    "type": "select",
    "value": "india",
    "id": "country",
    "title": "Country",
    "options": [
        {
            "label": "India",
            "value": "india"
        },
        {
            "label": "USA",
            "value": "usa"
        }
    ]
},

radio

Render <RadioControl />

example:
{
    "type": "radio",
    "title": "Gender",
    "id": "gender",
    "value": "male",
    "options": [
        {
            "label": "Male",
            "value": "male"
        },
        {
            "label": "Female",
            "value": "female"
        }
    ]
},

range

Render <RangeControl />

Example
{
    "type": "range",
    "title": "Volume",
    "id": "volume",
    "min": 1,
    "max": 100,
    "value": 40
}

color

Render <ColorPalette />

Example
{
    "type": "color",
    "title": "Background Color",
    "id": "bg-color",
    "value": '#fff',
    "colors": [
        {
            "name": "red",
            "color": "#f00"
        },
        {
            "name": "blue",
            "color": "#00f"
        },
        {
            "name": "black",
            "color": "#000"
        }
    ]
}

tree

Render <TreeSelect />

Example
{
    "title": "Select Post",
    "type" : "tree",
    "optionlabel": "Select option",
    "selectedId": "p211",
    "tree":[
        {
            name: 'Post 1',
            id: 'p1',
            children: [
                { name: 'Descend 1 of post 1', id: 'p11' },
                { name: 'Descend 2 of post 1', id: 'p12' },
            ],
        },
        {
            name: 'post 2',
            id: 'p2',
            children: [
                {
                    name: 'Descend 1 of post 2',
                    id: 'p21',
                    children: [
                        {
                            name: 'Descend 1 of Descend 1 of post 2',
                            id: 'p211',
                        },
                    ],
                },
            ],
        },
    ]     
}

datetime

Render <DateTime />

Example
{
    "title": "Select Date and Time",
    "id": "date-posting",
    "type": "datetime",
    "is12hours": true,
    "locale": ""
}

Thanks! ;)