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

@campaign-buddy/form-generator

v2.1.5

Published

`@campaign-buddy/form-generator` is responsible for generating UI for json schemas created using `@campaign-buddy/json-schema-core`'s game system definition API with a high level of interface customizability.

Downloads

2

Readme

form-generator

@campaign-buddy/form-generator is responsible for generating UI for json schemas created using @campaign-buddy/json-schema-core's game system definition API with a high level of interface customizability.

Key Concepts

Widgets

Widgets are the form components that are responsible for mutating some field of the form data. They may mutate primitive data (e.g. strings, numbers, booleans) or they may mutate complex data (e.g. rich text, entity pickers, stats). Widgets are implemented outside of the form generator package and the form generator package does not provide default widgets. Widgets are given props that conform to WidgetProps (the linked interface has comments on all of the props describing what they are and when they're supplied if they're optional).

Note: entityApi may be undefined if the end-consumer of FormGenerator does not provide it. It is an optional prop to FormGenerator.

The widget for a particular field is determined by either the $uiWidget property in the fields schema or it is inferred from the field's type in the schema. Consumers of this package must define widgets for primitive fields (string, boolean, number, array).

Aggregates

Fields in a schema may define aggregates, which is a hybrid javascript/json-path-ex expression denoting that a particular field has a derived value. The value may be derived from a base input value (collected from the user via a Widget) or from other values in the form data or from a combination of the both. Widgets will receive both the base value and the aggregated value for a field. The base value is the user inputted value for the field and the aggregated value is the "display" value for a field.

Note: Other places in campaign buddy that deal with aggregated fields will treat the aggregated value as the "true" value.

Widgets should respect aggregated values when possible, although it may not always be. By convention, there are three ways for a widget to handle aggregated fields.

Aggregated value overrides base value

Most of the time, this is the preferred option. The widget should display the aggregated value as the true value. If the field is editable (e.g. the base value of the field is part of the aggregate) then, the base value should be editable in a popover when the aggregated value is clicked or focused.

Aggregated value combines with base value

In the case of array fields, the aggregated value can be merged with the base value to display the "true" value (e.g. in the case of the multi-entity picker). It should not be possible to "unselect" aggregated values in a list.

Ignore them aggregated value completely

The first way is to just ignore any aggregates. This option should be avoided when possible but sometimes it doesn't make sense for a particular field to be aggregated (such as the rich text field).

Warning: This approach may cause inconsistency in how data is displayed in other places in campaign buddy if the field does have an aggregate that is ignored by a widget. If a widget ignores aggregations, then the relevant type in @campaign-buddy/json-schema-core should be updated to disallow aggregates in the schema.