Requires

Provides

Widget.js

Base widget with all modules included

License:
Public domain (http://unlicense.org).
Authors:
Yaroslaff Fedin

LSD.Widget autoloads all of the modules that are defined in Old.Module namespace unless LSD.modules array is provided.

So if a new module needs to be included into the base class, then it only needs to be required.

  1. 46
  2. 47
  3. 48
  4. 49
if (!LSD.modules) { LSD.modules = [] for (var name in LSD.Module) LSD.modules.push(LSD.Module[name]); }

Pre-generate CSS grammar for layers.

It is not required for rendering process itself, because this action is taken automatically when the first widget gets rendered. Declaring layer css styles upfront lets us use it in other parts of the framework (e.g. in stylesheets to validate styles)

  1. 61
  2. 62
  3. 63
  4. 64
  5. 65
  6. 66
  7. 67
  8. 68
  9. 69
  10. 70
  11. 71
  12. 72
  13. 73
  14. 74
  15. 75
  16. 76
  17. 77
  18. 78
  19. 79
  20. 80
  21. 81
  22. 82
for (var layer in LSD.Layers) LSD.Layer.get(layer, LSD.Layers[layer]); LSD.Widget = new Class({ Includes: Array.concat(LSD.Node, LSD.Base, LSD.modules, [ LSD.Trait.Shape, LSD.Trait.Dimensions, LSD.Trait.Layers ]), options: { writable: false, layers: true }, initialize: function(element, options) { this.dirty = true; this.parent(element, options); if (this.options.writable && !this.attributes.tabindex && (this.options.focusable !== false)) this.setAttribute('tabindex', 0); this.addPseudo(this.options.writable ? 'read-write' : 'read-only'); if (this.options.layers === true) this.options.layers = LSD.Layers; },

Wrapper is where content nodes get appended. Defaults to this.element, but can be redefined in other Modules or Traits (as seen in Container module)

  1. 91
  2. 92
  3. 93
  4. 94
  5. 95
  6. 96
  7. 97
  8. 98
getWrapper: function() { return this.toElement(); } }); LSD.Widget.prototype.addStates('disabled', 'hidden', 'built', 'attached', 'dirty'); new LSD.Type('Widget');