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

hydraulik

v0.1.0

Published

Hydraulik is an experimental react library for writing state handling components.

Downloads

15

Readme

Hydraulik

Build Status Dependencies Status DevDependencies Status

Hydraulik is an experimental react library for writing state handling components.

Usage

There is a separate documentation for the [cli] (https://github.com/doodzik/hydraulik-cli) and [types] (https://github.com/doodzik/hydraulik-types) available.

import React, { Component }          from 'react'
import { Schema, type, skip, Klass } from 'hydraulik'
import { Str }                       from 'hydraulik-types'

@type(Str, name = 'first_name')
class Users extend Schema {}

var klass = new Klass()
    klass.push(Users)
    klass.push(User)

var users = klass.sets.users,
    user  = klass.sets.user

users.create({ name: 'testName'})
users.create({ name: 'Second' })

// these components automatically listen for changed data
var UserList = users.Component(class {
  render(){
    let Lis = this.params.users.map(user => <li>user.first_name</li>)
    return <ul><Lis /></ul>
  }
}

var UserCreate = users.ComponentError(class {
  onClick() {
    users.create({ name: '' })
  }

  render(){
    return (
      <div>
        <span>
          { this.params.users_error.name }
        </span>
        <button onClick={this.onClick} />
      </div>
    )
  }
})

// ...
  render(){
    return (
      <UserList />
      <UserCreateState />
    )
  }
// ...

#Motivation

After writing several apis and single page apps I've got frustrated with repeating myself over and over again. I want to define how my data behaves declaritive. With as little mental overhead as possible.

#Installation

Requirements: [nvm] (https://github.com/creationix/nvm)

mkdir $projectName
cd $_
npm init
npm install hydraulik-cli --save-dev
(npm bin)/hydraulik init
npm install

# or in one line
mkdir $projectName && cd $_ && npm init && npm install hydraulik-cli --save-dev && (npm bin)/hydraulik init && npm install

#Test

Hydraulik uses jest for testing. You can run its test by $ npm test. If it dosn't work try running $ nvm use in the hydraulik dir and reinstall the dependencies.

#API ##Schema - Set

###@type(type: Type, [name = typeName], [preset = null])

Takes a Type that implement this [interface] (https://github.com/doodzik/hydraulik-types). The name of the type is the Types name downcased. You can overwrite the type behavior on an child class. preset == default value. Only if value null or undefiend.

###@skip([val: Int])

@skip() skips as many matches as provided in props.skip. defaults to 0 if params.skip isn't defined @skip(int) skips as many as are defined for int

if skip is 0 nothing is skiped

###@limit([val: Int])

@limit() limits as many matches as provided in props.limit. defaults to 0 if params.limit isn't defined @limit(int) limits as many as are defined for int

if limit is 0 nothing is limited if limit is 1 it returns the element without the surrounding array

####filter(filterFn: function(val))

filters the set. FilterFn has to return a boolean. Val is an element of the set. You can access args from outside via val.params. Params from the component

##ObserverSet/ObserverSubset

instances of the ObserverSet/ObserverSubset are stored in the Klass instance variable sets.

###create(argObj: Object)

###update(argObj: Object, query: Object)

###destroy(query: Object)

###Component(ComposedComponent: Component)

###ComponentError(ComposedComponent: Component)

#Contributing

##[Code of Conduct] (https://github.com/doodzik/hydraulik/blob/master/CODE_OF_CONDUCT.md)

##Issues & Feature Requests

If you encounter a bug, inconsistencies or if anything isn't clear or clear enough open an issue. If you want a feature. Open an issue and we will discuss it. I'm happy to introduce you to hydraulik's code base. Feel free to reopen issues and claim unassigned issues for yourself to solve. The issue doesn't have to be code relatet. If you think that there can be something done with this projects organization open an issue.

##Guide

The source code lives in the src folder.

###hydraulik.jsx exports all classes that can be accessible through import * from 'hydraulik'

###klass.jsx The [Class] (http://en.wikipedia.org/wiki/Class_(set_theory)) contains all sets. Builds sets if #sets is called the first time. Build with the klassBuilder.

###klassBuilder.jsx It makes that the BaseSet and SubSet share the same storage. Converts sets into observed sets

###observerSet.jsx inherits from observerSubset and registers new action to the dispatcher

###observerSubset.jsx The adapter for the different set types. The user interacts with its methods.

###schema.jsx The DSL for Hydraulik.

###schema-decorators.jsx decorators for the schema.

###*-set.jsx TODO - move to own module sets provide crud operations and validation for an data table

###setEvents.jsx The events an observer set listens to.

##Roadmap

  1. add a server/websocket set
  2. add relations and co-dependent constrains.
  3. remove the need to register a schema manually.

#[License] (http://www.gnu.org/licenses/gpl-3.0.en.html)