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

yaktor-ui-angular1

v0.1.2

Published

Generate AngularJS applications based on a JSON application grammar

Downloads

40

Readme

Generate AngularJS applications based on a JSON application grammar.

Usage

A yaktor-ui is automatically generated from cl files. The generated files include a public/api containing an application's state matrix and various view descriptions. From the api we generate a client side application using.

yaktor-ui create

JSON Specification

  • The application name is stored on the root level, and specified by the name key
  • States are store in a JSON object. The key represents the state name.
  • Each state must have a ui and elements key.
  • The ui key specifies the HTML fragment to generate
  • The elements key specifies child nodes
  • Each child node is a container of UI elements associated with another state
  • It must contain a ui key to generate another HTML fragment, and may contain an additional elements key

An application is described by a well-structure JSON specification, which is defined as a JSON Schema. This allows AngularJS applications to be generated with minimal programming. The JSON spec is still in flux, so feel free to suggest/make improvements.

Rules

The JSON must:

  • provide a name key at the top level with an application name. This will be inserted in the appropriate format (e.g. dashed, camel cased) throughout the project code.
  • provide a states key at the top level containing an object of application states. Each key of the state object must be a state name.

Each state object must:

  • provide a ui key describing an HTML container for all child nodes.
  • provide an elements key describing all possible state transitions from the current state.

Each state transition must:

  • provide a ui key describing an HTML container for all child nodes.
  • provide an elements key describing an HTML fragment related to a specific UI element.

Example

{
  "name": "Soda Purchaser",
  "states": {
    "state1": {
      "ui": {
        "tag": "div",
        "title": "State 1 Container"
      },
      "elements": {
        "state2": {
          "ui": {
            "tag": "div",
            "title": "Container for UI elements related to state2 transition."
          },
          "elements": {
            "descriptiveName": {
              "ui": {
                "tag": "input",
                "type": "text"
              }
            },
            "someOtherName": {
              "ui": {
                "tag": "checkbox",
              }
            }
            "action": {
              "ui": {
                "tag": "button",
                "event": "click"
              }
            }
          }
        }
      }
    },
    "state2": {},
    "state3": {},
  }
}

Convention

  • Use Socket API when generating Angular app from allInOne.js
  • Use REST API when generating Angular app from views.js
  • Create tabbed view for each state using multiple pages (e.g. /has-money shows both actions whereas /has-money/selection shows only selection)
  • Create UI model from views.js (POST, GET, FIND, etc)

Issues

  • In views schema, don't know how to handle array type. Enums with checkboxes are fine, but an open ended array is a bit more difficult to auto-generate aesthetically.
  • View names in view schema are mapped to state names and URLs in the Angular application. They should not contain slashes and extensions. I'm removing them now, but it's not general enough code to handle all cases of a view name.
  • When posting using views, the code assumes the endpoint is the same as the page name (e.g. in views.js /page.html is formatted to a state name of page and an endpoint of /page)

TODO:

  • Fix bug when generating from root directory
  • Expect view key to be a valid URL. Parse accordingly.
  • Alt text
  • ARIA support