GithubHelp home page GithubHelp logo

microcomps's Introduction

MicroComps

🧱 A bundle of micro components.

How it works

Step 1 : Import

Import MicroComps.js into your project

Step 2 : Instanciate

Create a MicroComps instance. The constructor takes an object of options. You must provide a "container" which is element that will host the MicroComps instance DOM elements.

let mc = new MicroComps({
	container: document.querySelector('.microcomps')
});

Step 3 : Add controls

Your MicroComps instance got a "add" method. This "add" method signature is the following :

add(objectToUpdate, keyToUpdate, typeOfEditor, options)

Consider this object :

let dog = {
	"name": "John Dog",
	"age": 4,
}

If you wants to create a control inside your MicroComps instance to update the dog.age, you can proceed like that :

mc.add(dog, 'age', 'number', {
	min : 0, // You can add a minimum value
	max : 10000000, // You can add a maximum value
	onCreate: (value) => {
		console.log('Editor created');
	},
	onChange: (value) => {
		console.log('Editor value changed', value);
	}
});

See more example in /demo/js/main.js and right in the source.

Todo

  • StringEditor
  • NumberEditor
  • BooleanEditor
  • ListEditor
  • ColorEditor
  • XYEditor
  • XYZEditor
  • Range slider
  • More exhaustive documentation
  • ...do not hesitate to ask for more

microcomps's People

Contributors

tsbits avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.