Permalink
Browse files

Gallery Build Tag: gallery-2011.01.26-20-33

  • Loading branch information...
1 parent c467cb8 commit 9ba590d0383a0c1c146c517bc8805454903988c1 YUI Builder committed Jan 26, 2011
Showing with 1,460 additions and 732 deletions.
  1. +106 −25 build/gallery-base-componentmgr/gallery-base-componentmgr-debug.js
  2. +2 −2 build/gallery-base-componentmgr/gallery-base-componentmgr-min.js
  3. +105 −25 build/gallery-base-componentmgr/gallery-base-componentmgr.js
  4. +11 −7 build/gallery-charts/gallery-charts-debug.js
  5. +14 −14 build/gallery-charts/gallery-charts-min.js
  6. +11 −7 build/gallery-charts/gallery-charts.js
  7. +13 −2 build/gallery-form/gallery-form-debug.js
  8. +2 −2 build/gallery-form/gallery-form-min.js
  9. +13 −2 build/gallery-form/gallery-form.js
  10. +11 −0 build/gallery-patch-330-async-queue-bubble/gallery-patch-330-async-queue-bubble-debug.js
  11. +1 −0 build/gallery-patch-330-async-queue-bubble/gallery-patch-330-async-queue-bubble-min.js
  12. +11 −0 build/gallery-patch-330-async-queue-bubble/gallery-patch-330-async-queue-bubble.js
  13. +97 −0 build/gallery-patch-330-delegate-cat/gallery-patch-330-delegate-cat-debug.js
  14. +1 −0 build/gallery-patch-330-delegate-cat/gallery-patch-330-delegate-cat-min.js
  15. +96 −0 build/gallery-patch-330-delegate-cat/gallery-patch-330-delegate-cat.js
  16. +37 −0 build/gallery-patch-330-toggleview/gallery-patch-330-toggleview-debug.js
  17. +1 −0 build/gallery-patch-330-toggleview/gallery-patch-330-toggleview-min.js
  18. +37 −0 build/gallery-patch-330-toggleview/gallery-patch-330-toggleview.js
  19. +50 −45 build/gallery-resource/gallery-resource-debug.js
  20. +1 −9 build/gallery-resource/gallery-resource-min.js
  21. +50 −45 build/gallery-resource/gallery-resource.js
  22. BIN build/gallery-taglist/assets/edit.png
  23. +65 −0 build/gallery-taglist/assets/gallery-taglist-core.css
  24. BIN build/gallery-taglist/assets/minus-circle.png
  25. +289 −276 build/gallery-taglist/gallery-taglist-debug.js
  26. +1 −1 build/gallery-taglist/gallery-taglist-min.js
  27. +272 −260 build/gallery-taglist/gallery-taglist.js
  28. 0 build/gallery-treeble/assets/gallery-treeble-core.css
  29. BIN build/gallery-treeble/assets/skins/sam/closed.png
  30. +33 −0 build/gallery-treeble/assets/skins/sam/gallery-treeble-skin.css
  31. +1 −0 build/gallery-treeble/assets/skins/sam/gallery-treeble.css
  32. BIN build/gallery-treeble/assets/skins/sam/open.png
  33. +63 −4 build/gallery-treeble/gallery-treeble-debug.js
  34. +3 −2 build/gallery-treeble/gallery-treeble-min.js
  35. +63 −4 build/gallery-treeble/gallery-treeble.js
@@ -4,18 +4,20 @@ YUI.add('gallery-base-componentmgr', function(Y) {
* Base Component Manager
*
* Oddnut Software
- * Copyright (c) 2010 Eric Ferraiuolo - http://eric.ferraiuolo.name
+ * Copyright (c) 2010-2011 Eric Ferraiuolo - http://eric.ferraiuolo.name
* YUI BSD License - http://developer.yahoo.com/yui/license.html
*/
var ComponentMgr,
REQUIRES = 'requires',
INITIALIZER = 'initializer',
+ DESTRUCTOR = 'destructor',
INSTANCE = 'instance',
E_INIT_COMPONENT = 'initComponent',
E_INIT_COMPONENTS = 'initComponents',
+ E_DESTROY_COMPONENT = 'destroyComponent',
YLang = Y.Lang,
isArray = YLang.isArray,
@@ -34,7 +36,7 @@ YUI.add('gallery-base-componentmgr', function(Y) {
// *** Static *** //
- ComponentMgr._COMPONENT_CFG = [REQUIRES, INITIALIZER, INSTANCE];
+ ComponentMgr._COMPONENT_CFG = [REQUIRES, INITIALIZER, DESTRUCTOR, INSTANCE];
// *** Prototype *** //
@@ -53,8 +55,21 @@ YUI.add('gallery-base-componentmgr', function(Y) {
this._initComponentHierarchy();
/**
+ * Fired right after init event to allow implementers to add components to be eagerly initialized.
+ * A <code>componentsToInit</code> array is passed to subscribers whom can push on components to be initialized,
+ * components can be referenced by string name or object reference.
+ *
+ * @event initComponents
+ * @param event {Event} The event object for initComponents; has property: componentsToInit
+ */
+ this.publish(E_INIT_COMPONENTS, {
+ defaultFn : this._defInitComponentsFn,
+ fireOnce : true
+ });
+
+ /**
* Fired when a component is going to be initialized.
- * The <code>componentToInit</code> property is the String name of the component going to be intialized.
+ * The <code>componentToInit</code> property is the String name of the component going to be initialized.
* Developers can listen to the 'on' moment to prevent the default action of initializing the component.
* Listening to the 'after' moment, a <code>component</code> property on the Event Object is the component instance.
*
@@ -64,17 +79,14 @@ YUI.add('gallery-base-componentmgr', function(Y) {
this.publish(E_INIT_COMPONENT, { defaultFn: this._defInitComponentFn });
/**
- * Fired right after init event to allow implementers to add components to be eagerly initialized.
- * A <code>componentsToInit</code> array is passed to subscribers whom can push on components to be initialized,
- * components can be referenced by string name or object reference.
+ * Fired when a component is going to be destroyed.
+ * The <code>component</code> property is the String name of the component going to be destroyed.
+ * Developers can listen to the 'on' moment to prevent the default action of destroying the component.
*
- * @event initComponents
- * @param event {Event} The event object for initComponents; has property: componentsToInit
+ * @event destroyComponent
+ * @param event {Event} The event object for destoryComponent; has properties: component
*/
- this.publish(E_INIT_COMPONENTS, {
- defaultFn : this._defInitComponentsFn,
- fireOnce : true
- });
+ this.publish(E_DESTROY_COMPONENT, { defaultFn: this._defDestoryComponentFn });
// Fire initComponents during Y.Base initialization
if (this.get('initialized')) {
@@ -84,6 +96,8 @@ YUI.add('gallery-base-componentmgr', function(Y) {
this.fire(E_INIT_COMPONENTS, { componentsToInit: [] });
});
}
+
+ Y.before(this._destroyComponents, this.constructor.prototype, 'destructor', this);
},
// *** Public Methods *** //
@@ -106,19 +120,24 @@ YUI.add('gallery-base-componentmgr', function(Y) {
var components = this._components,
requires = config.requires,
initializer = config.initializer,
+ destructor = config.destructor,
instance = config.instance;
- initializer = isFunction(initializer) ? initializer :
- isString(initializer) && isFunction(this[initializer]) ? this[initializer] : noop;
+ initializer = isFunction(initializer) ? initializer :
+ isString(initializer) && isFunction(this[initializer]) ? this[initializer] : null;
+
+ destructor = isFunction(destructor) ? destructor :
+ isString(destructor) && isFunction(this[destructor]) ? this[destructor] : null;
components.add(name, REQUIRES, requires);
components.add(name, INITIALIZER, initializer);
+ components.add(name, DESTRUCTOR, destructor);
components.add(name, INSTANCE, instance);
},
/**
- * Retrieves component an instance by string name or reference.
- * The components must have previously been initialized otherwise null is returned.
+ * Retrieves component an instance by string name.
+ * The component must have previously been initialized otherwise null is returned.
*
* @method getComponent
* @param component {String} component to get instance of
@@ -131,7 +150,29 @@ YUI.add('gallery-base-componentmgr', function(Y) {
},
/**
- * Supplies the callback with component instance(s) that were requested by string name or reference,
+ * Destroys a component or set of components by string name.
+ * This will call the component???s configured destructor fn (preferred), or
+ * if the instance has a <code>destroy</code> method that will be used by convention.
+ *
+ * @method destroyComponent
+ * @param component {String | String... | Array} components to destroy
+ * @return void
+ */
+ destroyComponent : function () {
+
+ var args = Y.Array(arguments, 0, true),
+ components = isArray(args[0]) ? args[0] : args;
+
+ Y.log('destroyComponent called', 'info', 'baseComponentMgr');
+ Y.Array.each(components, function(c){
+ if (this._components.get(c, INSTANCE)) {
+ this._destroyComponent(c);
+ }
+ }, this);
+ },
+
+ /**
+ * Supplies the callback with component instance(s) that were requested by string name,
* any non-initialized components will be initialized.
* Component instance(s) will be passed to the callback as arguments in the order requested.
*
@@ -225,6 +266,32 @@ YUI.add('gallery-base-componentmgr', function(Y) {
this.fire(E_INIT_COMPONENT, { componentToInit: c });
},
+ _destroyComponent : function (c) {
+
+ this.fire(E_DESTROY_COMPONENT, { component: c });
+ },
+
+ _destroyComponents : function () {
+
+ var instances = this._components.data[INSTANCE];
+
+ Y.each(instances, function(instance, component){
+ if (instance) {
+ this._destroyComponent(component);
+ }
+ }, this);
+ },
+
+ _defInitComponentsFn : function (e) {
+
+ var components = e.componentsToInit,
+ requires = this._getRequires(components);
+
+ Y.use.apply(Y, requires.concat(Y.bind(function(Y){
+ Y.Array.each(components, this._initComponent, this);
+ }, this)));
+ },
+
_defInitComponentFn : function (e) {
var components = this._components,
@@ -244,19 +311,33 @@ YUI.add('gallery-base-componentmgr', function(Y) {
e.component = instance;
},
- _defInitComponentsFn : function (e) {
+ _defDestoryComponentFn : function (e) {
- var components = e.componentsToInit,
- requires = this._getRequires(components);
-
- Y.use.apply(Y, requires.concat(Y.bind(function(Y){
- Y.Array.each(components, this._initComponent, this);
- }, this)));
+ var components = this._components,
+ component = e.component,
+ destructor = components.get(component, DESTRUCTOR),
+ instance = components.get(component, INSTANCE);
+
+ if ( ! instance ) { return; }
+
+ // removes us as an event bubble target for the instance
+ if (instance._yuievt && isFunction(instance.removeTarget)) {
+ instance.removeTarget(this);
+ }
+
+ // prefer the configured destructor fn, or use use destroy instance method by convention
+ if (isFunction(destructor)) {
+ destructor.call(this, instance);
+ } else if (isFunction(instance.destroy)) {
+ instance.destroy();
+ }
+
+ components.remove(component, INSTANCE);
}
};
Y.BaseComponentMgr = ComponentMgr;
-}, 'gallery-2011.01.03-18-30' ,{requires:['base-base', 'collection']});
+}, 'gallery-2011.01.26-20-33' ,{requires:['base-base', 'collection']});

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
Oops, something went wrong.

0 comments on commit 9ba590d

Please sign in to comment.