uxrocket / uxrocket.factory Goto Github PK
View Code? Open in Web Editor NEWPlugin Factory
License: MIT License
Plugin Factory
License: MIT License
Add amd module support and require.js etc imports for the plugins build with factory
Each plugin should bind their events with their own namespaces. This is useful, especially during updating and unbinding plugin events.
Here are sample events our Clear plugin
keyup: 'keyup.uxClear',
focus: 'focus.uxClear',
input: 'input.uxClear',
click: 'click.uxClear'
When in single iteration, same key is not replaced more than once
template
<span class="{{class}}"></span>
<span class="{{class}}"></span>
output
<span class="some-class"></span>
<span class="undefined"></span>
For general usage, controlling and modifying elements we add some data values when a plugin binded.
Rocket Data
// data name uxRocket
uxRocket: {
"hasWrapper": true, // when plugin wraps the element, set to true otherwise false
"wrapper": "uxitd-clear-wrap",
"ready": "uxitd-clear-ready",
"selected": selector, // the jQuery selector
"options": options // plugin options
}
Plugin Data
Currently we are storing merged plugin options to element
var opts = $.extend({}, defaults, options, $(el).data(), {'selector': selector});
$el.data("uxClear", opts);
Note that: Plugin defaults can also modified both from options
object while plugin binding or form data
attributes on the element.
In stead of our previously defined callback methods mostly attached via data attributes e.g. data-on-ready="somefunc()"
, we should come with a promise like approach also at some point we also should support "legacy" callback definitions.
Add a .jshinttrc and hinting tasks to grunt
Add setLayout method for plugins that need to wrap or add extra elements around the selected element.
For jQuery modules we need same classes for backward compatibility and styling.
Here are the list of the required classes. For the new factory we can rename the class prefix to ux
or rocket
uxitd-*-ready
where *
indicates the plugin name. e.g. uxitd-clear-ready
. This class should added to selected element on plugin binding.uxitd-plugin-wrap
. This class is present to make sure, we wrap element only once when more than one Rocket plugins binded to it.uxitd-*-wrap
where *
indicates the plugin name. e.g. uxitd-clear-wrap
.uxitd-*-icon
. This class is used when plugin attach an icon to element.Also there are other helper classes according to plugin needs. Make sure that, we can easily define a class namespace for each plugin and use them during development.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.