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

pipe-storyboard

v0.1.16

Published

Set of components to create storyboards from pipe queries

Downloads

10

Readme

Pipe Storyboard

Build Status

Set of components to create storyboards from pipe queries

Installation

npm install pipe-storyboard

Usage

pipe-storyboard = require \pipe-storyboard
Layout = create-factory pipe-storyboard.Layout
Story = create-factory pipe-storyboard.Story
Storyboard = create-factory pipe-storyboard.Storyboard

# used for creating custom componenets
LabelledComponent = create-factory pipe-storyboard.LabelledComponent

Storyboard do 

    # the pipe-server to get queries from
    url: \http://localhost:4081

    # a list of ui controls corresponding to the parameters of the child queries
    controls: 
        * name: \conversions
          label: \Conversions
          type: \number
          default-value: 0
          client-side: true
        ...

    # this tells the Storyboard component to load the ui-values from query-string
    state: @props.location.query

    # this function is invoked whenever a ui-value changes & updates the state
    on-change: (new-state) ~> 
        react-router.hash-history.replace-state null, (update-querystring window.location.href, new-state)

    # A layout component is used to position queries in a Storyboard
    Layout do 
        style: width: \100%

        # A Story component takes a query-id or branch-id and renders it
        # the values from the ui-controls (passed as controls prop above) will be mapped to parameters
        # and passed to each child query / layout
        Story branch-id: \pztAHkd
        Story branch-id: \pqucBWe

Usage (css / stylus)

@require 'node_modules/pipe-storyboard/src/index.css'

Components

  • Storyboard

Connects ui controls & queries by mapping ui values to parameters, and propagating these parameters to its children. Story, Layout or a Storyboard component itself can be passed as child. A Storyboard component also propagates the pipe api server url to its children, this can be overriden by setting the url prop on the child.

Control :: {
    
    # name of the control, used for fetching and updating value from state
    name :: String 

    # optional parameter, enum of standard html input types, used internally to render the ui-control
    # if undefined the render method must be implemented
    type :: String 
    label :: String

    # optional parameter works in conjunction with type, for example, if type is text and placeholder is 'hello'
    # a html input element with type text and placeholder 'hello' will be rendered in the form
    placeholder :: String

    # optional parameter works in conjunction with the type value 'select'
    options :: [String]
    multi :: Boolean
    tether :: Boolean

    # the default ui value
    default-value :: a

    # optional parameter, false by default. 
    # A value of true implies that only the transformation and presentaiton function will be executed (no ajax request will be made),
    # whereas a value of false implies that an ajax request will be made to the pipe api server to re-execute the query before running the transformation & presentation functions
    client-side: true

    # optional parameter, specifies how to extract the value of the ui-control from the `State`
    # the `State` object is passed as a prop to the `Storyboard` component, 
    # default-implementation = (state) ~> state[name]
    ui-value-from-state :: State -> UIValue

    # optional parameter, specifies how to update the state using the new value of the ui-control
    # the result of this function is folded (with the result from other controls) to obtain the full `State` object
    # default implementation = (new-ui-value) ~> "#{name}" : new-ui-value
    state-from-ui-value :: UIValue -> State' 

    # optional parameter, specifies how to convert the ui-value into a parameter for the query
    # default implementation = (ui-value) ~> "#{name}" : ui-value
    # the result of this function is folded (with the result from other controls) to obtain the full `Parameters` object
    # example usage: converting between local and gmt timezones
    parameters-from-ui-value :: UIValue -> Parameters', where Parameters' :: Map Name, Value

    # optional parameter, allows you to provide a custom implementation for rendering the ui-control, 
    # the default implementation uses a combination of type, placeholder & options props
    render? :: UIValue -> (UIValue -> ()) -> ReactElement
}

| Property | Type | Description | |------------------------------|--------------------------------|--------------------------------| | cache | Boolean | Number | pipe query cache parameter, propagated to children | | controls | [Control] | | | extras | object | combines and propagates to Children | | state | State | an object that stores the state of the ui controls, this can be the state of the hosting component or the query string (for example) | | on-change | State -> () | fired whenever the value of a ui-control changes, here you MUST update the state prop, above, to complete the data flow | | on-execute | Parameters -> Boolean -> () | fired whenever the user executes either by clicking on search or using (ctrl + enter / command + enter) hotkeys | | on-reset | () -> () | fired whenever the user resets the form, either by clicking or using (alt + r, option + r) hotkeys | | url | String | the url of the pipe api server, propagated to the children |

  • Story

Renders a pipe query

| Property | Type | Description | |------------------------------|--------------------------------|--------------------------------| | cache | Boolean | Number | pipe query cache parameter | | branch-id | String | the branch id of the pipe query, if specified the latest query for that branch will be rendered | | extras | object | extras are static parameters that are merged with the dynamic Parameters object, they help in reuse of queries | | query-id | String | the query id of the pipe query to be rendered | | url | String | the url of the pipe api server, usually propagated by the Storyboard component | | class-name | String | custom class name for styling the component externally | | style | object | custom css styles useful in combination with Layout and flexbox | | title | String | title for the query, defaults to the query-title property of the pipe document | | render-links | object -> ReactElement | a function that receives {query-id, branch-id, url, cache, parameters} and must return a ReactElement that renders the links on top-right corner of the query | | show-title | Boolean | defaults to true | | show-links | Boolean | defaults to true (setting it to false will hide the links to edit, share, .. query/result) |

  • Layout

| Property | Type | Description | |------------------------------|--------------------------------|--------------------------------| | cache | Boolean | Number | pipe query cache parameter, propagated to children | | class-name | String | custom class name for styling the component externally | | extras | object | combines and propagates to Children | | style | object | custom css styles | | url | String | the url of the pipe api server, usually propagated by the Storyboard component |