mirror of
https://github.com/pebble-dev/clay.git
synced 2026-08-31 14:26:45 -04:00
Documentation! + some little fixes to add consistency between components
This commit is contained in:
@@ -7,6 +7,7 @@ module.exports = {
|
||||
manipulator: 'checkboxgroup',
|
||||
defaults: {
|
||||
label: '',
|
||||
options: []
|
||||
options: [],
|
||||
attributes: {}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -3,8 +3,5 @@
|
||||
module.exports = {
|
||||
name: 'footer',
|
||||
template: require('../../templates/components/footer.tpl'),
|
||||
manipulator: 'html',
|
||||
defaults: {
|
||||
attributes: {}
|
||||
}
|
||||
manipulator: 'html'
|
||||
};
|
||||
|
||||
@@ -5,7 +5,6 @@ module.exports = {
|
||||
template: require('../../templates/components/heading.tpl'),
|
||||
manipulator: 'html',
|
||||
defaults: {
|
||||
attributes: {},
|
||||
size: 4
|
||||
}
|
||||
};
|
||||
|
||||
@@ -7,6 +7,7 @@ module.exports = {
|
||||
manipulator: 'radiogroup',
|
||||
defaults: {
|
||||
label: '',
|
||||
options: []
|
||||
options: [],
|
||||
attributes: {}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -7,7 +7,8 @@ module.exports = {
|
||||
manipulator: 'val',
|
||||
defaults: {
|
||||
label: '',
|
||||
options: []
|
||||
options: [],
|
||||
attributes: {}
|
||||
},
|
||||
initialize: function() {
|
||||
var self = this;
|
||||
|
||||
@@ -3,9 +3,8 @@
|
||||
module.exports = {
|
||||
name: 'submit',
|
||||
template: require('../../templates/components/submit.tpl'),
|
||||
manipulator: 'val',
|
||||
manipulator: 'html',
|
||||
defaults: {
|
||||
label: '',
|
||||
attributes: {}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -3,8 +3,5 @@
|
||||
module.exports = {
|
||||
name: 'text',
|
||||
template: require('../../templates/components/text.tpl'),
|
||||
manipulator: 'html',
|
||||
defaults: {
|
||||
attributes: {}
|
||||
}
|
||||
manipulator: 'html'
|
||||
};
|
||||
|
||||
@@ -113,7 +113,7 @@ function ClayConfig(settings, config, $rootContainer) {
|
||||
utils.updateProperties(self.EVENTS, {writable: false});
|
||||
|
||||
/**
|
||||
* @returns {ClayItem}
|
||||
* @returns {Array.<ClayItem>}
|
||||
*/
|
||||
self.getAllItems = function() {
|
||||
_checkBuilt('getAllItems');
|
||||
@@ -121,21 +121,21 @@ function ClayConfig(settings, config, $rootContainer) {
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string} key
|
||||
* @param {string} appKey
|
||||
* @returns {ClayItem}
|
||||
*/
|
||||
self.getItemByAppKey = function(key) {
|
||||
self.getItemByAppKey = function(appKey) {
|
||||
_checkBuilt('getItemByAppKey');
|
||||
return _itemsByAppKey[key];
|
||||
return _itemsByAppKey[appKey];
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string} key
|
||||
* @param {string} id
|
||||
* @returns {ClayItem}
|
||||
*/
|
||||
self.getItemById = function(key) {
|
||||
self.getItemById = function(id) {
|
||||
_checkBuilt('getItemById');
|
||||
return _itemsById[key];
|
||||
return _itemsById[id];
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -181,6 +181,9 @@ function ClayConfig(settings, config, $rootContainer) {
|
||||
// prevent external modifications of properties
|
||||
utils.updateProperties(self, { writable: false, configurable: false });
|
||||
|
||||
// expose the config to allow developers to update it before the build is run
|
||||
self.config = config;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -191,7 +194,7 @@ function ClayConfig(settings, config, $rootContainer) {
|
||||
* @param {string|{}} component.manipulator - methods to attach to the component
|
||||
* @param {function} component.manipulator.set - set manipulator method
|
||||
* @param {function} component.manipulator.get - get manipulator method
|
||||
* @param {{}} component.defaults - template defaults
|
||||
* @param {{}} [component.defaults] - template defaults
|
||||
* @param {function} [component.initialize] - method to scaffold the component
|
||||
* @return {boolean} - Returns true if component was registered correctly
|
||||
*/
|
||||
|
||||
@@ -23,7 +23,7 @@ function ClayItem(config) {
|
||||
'Make sure to register it with ClayConfig.registerComponent()');
|
||||
}
|
||||
|
||||
var _templateData = _.extend({}, _component.defaults, config);
|
||||
var _templateData = _.extend({}, _component.defaults || {}, config);
|
||||
|
||||
/** @type {string|null} */
|
||||
self.id = config.id || null;
|
||||
|
||||
Vendored
-3
@@ -43,9 +43,6 @@ module.exports = function (file, options) {
|
||||
}
|
||||
|
||||
if (typeof file !== 'string') {
|
||||
// Factory: return a function.
|
||||
// Set options variable here so it is ready for when browserifyTransform
|
||||
// is called. Note: first argument is the options.
|
||||
options = file;
|
||||
return browserifyTransform;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user