├── .bowerrc
├── .editorconfig
├── .gitattributes
├── .gitignore
├── .jshintrc
├── .travis.yml
├── CHANGELOG.md
├── Gruntfile.js
├── LICENSE.md
├── README.md
├── bower.json
├── contributing.md
├── dist
└── aura.js
├── index.html
├── lib
├── aura.extensions.js
├── aura.js
├── base.js
├── ext
│ ├── components.js
│ ├── debug.js
│ └── mediator.js
├── logger.js
└── platform.js
├── package.json
└── spec
├── aura_components
├── .gitkeep
└── dummy
│ └── main.js
├── index.html
├── lib
├── aura.extensions_spec.js
├── aura_spec.js
└── ext
│ ├── components_spec.js
│ └── mediator_spec.js
├── runner.js
└── support
└── spec_helper.js
/.bowerrc:
--------------------------------------------------------------------------------
1 | {
2 | "directory": "bower_components",
3 | "json": "bower.json"
4 | }
5 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | # editorconfig.org
2 | root = true
3 |
4 | [*]
5 | indent_style = space
6 | indent_size = 2
7 | end_of_line = lf
8 | charset = utf-8
9 | trim_trailing_whitespace = true
10 | insert_final_newline = true
11 |
12 | [*.md]
13 | trim_trailing_whitespace = false
14 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | * text=auto
2 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules
3 | bower_components
4 | components
5 | npm-debug.log
6 | .sass-cache
7 | /docs/
8 |
--------------------------------------------------------------------------------
/.jshintrc:
--------------------------------------------------------------------------------
1 | {
2 | "curly": true,
3 | "eqeqeq": true,
4 | "immed": true,
5 | "latedef": true,
6 | "newcap": true,
7 | "noarg": true,
8 | "sub": true,
9 | "undef": true,
10 | "eqnull": true,
11 | "browser": true,
12 | "nomen": false,
13 | "expr": true,
14 | "globals": {
15 | "module": true,
16 | "console": true,
17 | "require": true,
18 | "define": true,
19 | "_": true,
20 | "$": true
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: node_js
2 | node_js:
3 | - '0.10'
4 | - '0.8'
5 | before_script:
6 | - npm install -g grunt-cli
7 | branches:
8 | only:
9 | - master
10 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # v0.9.3/0.9.4 - 01/2015
2 |
3 | This is a periodic maintenance release which includes minor fixes:
4 |
5 | * Improvements to [callbacks](https://github.com/aurajs/aura/commit/bb3f377a46de119c0f2539a9044e7ffa4dea4d8e)
6 | * [IE8 Fixes](https://github.com/aurajs/aura/commit/a1db9e0a7dbd820a2faced50addf1de11409efe6)
7 | * [Typo improvements](https://github.com/aurajs/aura/commit/e066fe230e0b3840763d2590852644032e95a5ce)
8 | * Simplified [examples](https://github.com/aurajs/aura/commit/748cabaa3c08d822c1defea5847edc0912fc463f)
9 | * [Fixes for IE8 console](https://github.com/aurajs/aura/commit/f42e6b172f4b09f1f2d4fc5b18e00f547ee7c7e6)
10 | * Added [module](https://github.com/aurajs/aura/commit/ba883dc463358b8c227fb0f20916dda35a437943) to globals
11 |
12 | # v0.9.2 - 10/01/2013
13 |
14 | * Component.prototype.invokeWithCallback handles the correct signature (#316 by @xcambar)
15 | * Harmonizes init of app.logger and sandbox.logger (#314 by @xcambar)
16 |
17 |
--------------------------------------------------------------------------------
/Gruntfile.js:
--------------------------------------------------------------------------------
1 | module.exports = function (grunt) {
2 | 'use strict';
3 |
4 | grunt.loadNpmTasks('grunt-contrib-jshint');
5 | grunt.loadNpmTasks('grunt-contrib-connect');
6 | grunt.loadNpmTasks('grunt-contrib-watch');
7 | grunt.loadNpmTasks('grunt-contrib-requirejs');
8 | grunt.loadNpmTasks('grunt-contrib-yuidoc');
9 | grunt.loadNpmTasks('grunt-contrib-concat');
10 | grunt.loadNpmTasks('grunt-mocha');
11 |
12 | var PORT = 8899;
13 |
14 | grunt.initConfig({
15 | pkg: grunt.file.readJSON('package.json'),
16 | meta: {
17 | banner: '/*!\n' +
18 | '* <%= pkg.name %>\n' +
19 | '* v<%= pkg.version %> - ' +
20 | '<%= grunt.template.today("yyyy-mm-dd") %>\n' +
21 | '<%= pkg.homepage ? "* " + pkg.homepage + "\n" : "" %>' +
22 | '* (c) <%= pkg.author.name %>;' +
23 | ' <%= _.pluck(pkg.licenses, "type").join(", ") %> License\n' +
24 | '* Created by: <%= _.pluck(pkg.maintainers, "name").join(", ") %>\n' +
25 | '* Contributors: <%= _.pluck(pkg.contributors, "name").join(", ") %>\n' +
26 | '*/'
27 | },
28 | connect: {
29 | server: {
30 | options: {
31 | port: PORT,
32 | base: '.'
33 | }
34 | }
35 | },
36 | requirejs: {
37 | compile: {
38 | options: {
39 | baseUrl: '.',
40 | optimize: 'uglify2',
41 | preserveLicenseComments: false,
42 | paths: {
43 | aura: 'lib',
44 | jquery: 'empty:',
45 | underscore: 'empty:',
46 | eventemitter: 'bower_components/eventemitter2/lib/eventemitter2'
47 | },
48 | shim: {
49 | underscore: {
50 | exports: '_'
51 | }
52 | },
53 | include: [
54 | 'aura/aura',
55 | 'aura/aura.extensions',
56 | 'aura/ext/debug',
57 | 'aura/ext/mediator',
58 | 'aura/ext/components'
59 | ],
60 | exclude: ['jquery'],
61 | out: 'dist/aura.js'
62 | }
63 | }
64 | },
65 | concat: {
66 | options: {
67 | stripBanners: true,
68 | banner:
69 | "/*! Aura v<%= pkg.version %> | " +
70 | "(c) 2013 The Aura authors | " +
71 | "MIT License " +
72 | "*/\n"
73 | },
74 | dist: {
75 | src: ['dist/aura.js'],
76 | dest: 'dist/aura.js',
77 | },
78 | },
79 | yuidoc: {
80 | compile: {
81 | name: "<%= pkg.name %>",
82 | description: "<%= pkg.description %>",
83 | version: "<%= pkg.version %>",
84 | url: "<%= pkg.homepage %>",
85 | options: {
86 | paths: [ "lib" ],
87 | outdir: "docs",
88 | parseOnly: true
89 | }
90 | }
91 | },
92 | jshint: {
93 | all: {
94 | options: {
95 | jshintrc: '.jshintrc'
96 | },
97 | files: {
98 | src: [
99 | 'lib/**/*.js',
100 | 'spec/lib/**/*.js'
101 | ]
102 | }
103 | }
104 | },
105 | mocha: {
106 | all: {
107 | options: {
108 | urls: ['http://localhost:<%= connect.server.options.port %>/spec/index.html']
109 | }
110 | }
111 | },
112 | watch: {
113 | files: [
114 | 'lib/**/*.js',
115 | 'spec/lib/**/*.js'
116 | ],
117 | tasks: ['spec']
118 | }
119 | });
120 |
121 | grunt.registerTask('spec', ['jshint', 'mocha']);
122 | grunt.registerTask('build', ['connect', 'spec', 'requirejs', 'concat']);
123 | grunt.registerTask('default', ['connect', 'spec', 'watch']);
124 | };
125 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | Copyright (c) the Aura team.
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4 |
5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6 |
7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Aura 0.9.4
2 |
3 |
4 |
5 | # [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url]
6 |
7 | Aura is an event-driven architecture for developing scalable applications using reusable components. It works great with [Backbone.js](http://backbonejs.org), but is framework-agnostic, adapts many best-practice patterns for developing maintainable apps and has first-class support for modern tools like [Bower](http://bower.io), [Grunt](http://gruntjs.com) and [Yeoman](http://yeoman.io).
8 |
9 | Aura has been used to develop applications like [MIT's Reap](http://www.bobholt.me/2012/09/how-it-was-built-mit-reap/) and is currently under active development.
10 |
11 | ## Project updates
12 |
13 | ### January, 2015
14 |
15 | At this time, we are aware that a number of developers are using Aura in production and welcome help with improving
16 | the core codebase via patches, feedback or improvements to our documentation. We have not yet had time to refactor
17 | the codebase into a set of Web Components (per the last periodic update), but are still interested in doing this.
18 |
19 | If you are interested in taking over core maintenance of the project please feel free to get in touch.
20 |
21 | ### December, 2013
22 |
23 | We first started AuraJS two years ago and have evolved it over time (with the help of engineers at [Hull.io](http://hull.io) and our contributors) to meet the needs of the RequireJS community. Today is is an excellent reference framework for how to structure a large-scale application with many of the core patterns necessary to build a system of decoupled modules that cleanly speak to each other.
24 |
25 | Two years on, the maintainers of AuraJS agree that the future of decoupled, scalable applications lie in Web
26 | Components - a set of standards composed of Custom Elements, Templates, Imports and ShadowDOM, aimed at offering
27 | a way to build encapsulated components using features found in the browser.
28 |
29 | To this end, our efforts on AuraJS moving forward will be focused on how it can help enable patterns for scalability
30 | in applications built with Web Components (using polyfills and libraries such as [Polymer](http://polymer-project.org). This may take the form of several Aura 'elements' that can be easily included and reused in large projects.
31 |
32 | Developers using AuraJS 0.9.2 and below will still be able to contribute to the current stable version of the project (there are large projects already built with it), however support for this version will be limited as we work on the designs for our next major version. We are more than happy to accept any contributions that meet our guidelines and will be reviewing the issue tracker for this version as time allows.
33 |
34 | Our team are excited about the future direction of the project and look forward to announcing more news about our work here in the future.
35 |
36 | ## Why Aura?
37 |
38 | We've seen a large shift in the JavaScript community for the past 3 years, with people starting to write web apps in a much more structured way. Yet, assembling the bits and pieces and actually starting to make apps is still a challenge. Another challenge is that most of the time you end up doing the same stuff all over again : you need a way to authenticate users, give them ways to communicate, exchange ideas, work or play together. You have to integrate with external services or APIs like Facebook or Twitter.
39 |
40 | Web apps are all about the end user experience (UI, DOM elements). The web development ecosystem is all about much more low level stuff. We need a way to package higher level abstractions and make them truly reusable, and that's what Aura is all about.
41 |
42 | Need some more reasons to use Aura?:
43 |
44 | * It's basically **glue** for your application components, making it trivial to tie together a number of independently created components into a fully functional application.
45 | * A complete event-bus supporting **application-level and component-level communication** mean you have control over what is getting triggered in your app
46 | * Specify an API end-point for components easily and just **use data-attributes to include any component** or components. Minimal JavaScript for more capabilities.
47 | * **Abstract away utility libraries** you are using (templating, DOM manipulation) so that you can swap them out for alternatives at any time without a great deal of effort
48 | * Hit the ground running quickly components into **reusable modules using AMD**.
49 | * Bower is a first-class citizen in Aura, making it easier to **manage your application dependencies**
50 | * The web platform is moving towards using scoped styles and shadow DOM for keeping parts of your page safe from third-party content that might affect it. Aura does the same for communications by introducing per-component **sandboxes** for your events
51 | * Tooling for **scaffolding** out new components without having to write as much boilerplate
52 | * Can be used with your MVC framework of choice - we're just there as a helper.
53 | * First-class support for the Hull.io platform. If you don't want to create a component yourself, you can easily use them as a components-source and create apps in less time.
54 | * Extensible via the extensions system, which make a good basis for a rich ecosystem around the project.
55 |
56 |
57 | ## Concepts
58 |
59 | #### The `Aura` object
60 |
61 | Your application will be an instance of the `Aura` object.
62 |
63 | Its responsibilities are to load extensions when the app starts and clean them up when the app stops.
64 |
65 | #### Extension
66 |
67 | Extensions are loaded in your application when it starts. They allow you to add features to the application, and are available to the components through their `sandbox`.
68 |
69 | #### Core
70 |
71 | The `core` implements aliases for DOM manipulation, templating and other lower-level utilities that pipe back to a library of choice. Aliases allow switching libraries with minimum impact on your application.
72 |
73 | #### Sandbox
74 |
75 | A `sandbox` is just a way to implement the [facade](http://addyosmani.com/resources/essentialjsdesignpatterns/book/#facadepatternjavascript) pattern on top of features provided by `core`. It lets you expose the parts of a JavaScript library that are safe to use instead of exposing the entire API. This is particularly useful when working in teams.
76 |
77 | When your app starts, it will create an instance of `sandbox` in each of your components.
78 |
79 | #### Component
80 |
81 | A component represents a unit of a page. Each component is independent.
82 | This means that they know nothing about each other. To make them communicate, a [Publish/Subscribe (Mediator)](http://addyosmani.com/resources/essentialjsdesignpatterns/book/#mediatorpatternjavascript) pattern is used.
83 |
84 |
85 | ## Getting started
86 |
87 | The simplest usable Aura app using a component and extension can be found in our [boilerplate](https://github.com/aurajs/boilerplate) repo. We do however recommend reading the rest of the getting started guide below to get acquainted with the general workflow.
88 |
89 | #### Requirements
90 |
91 | 1. [bower](http://bower.io/): run `npm install -g bower` if needed
92 | 2. [grunt-cli](https://github.com/gruntjs/grunt-cli): run `npm install -g grunt-cli` if needed
93 |
94 | #### Building Aura.js
95 |
96 | 1. Run `npm install` to install build dependencies.
97 | 2. Run `bower install` to install lib dependencies.
98 | 3. Run `grunt build` and `aura.js` will be placed in `dist/`.
99 |
100 | ### Running Tests
101 |
102 | #### Browser
103 |
104 | Run `grunt`. Then visit `http://localhost:8899/spec/`.
105 |
106 | #### CLI
107 |
108 | Run `npm test`.
109 |
110 | ## Creating an Application
111 |
112 | The first step in creating an Aura application is to make an instance of `Aura`.
113 |
114 | ```js
115 | var app = new Aura();
116 | ```
117 |
118 | Now that we have our `app`, we can start it.
119 |
120 | ```js
121 | app.start({
122 | components: 'body'
123 | });
124 | ```
125 |
126 | This starts the app by saying that it should search for components anywhere in the `body` of your HTML document.
127 |
128 | ## Creating a Component
129 |
130 | By default, components are retrieved from a directory called `components/` that must be at the same level as your HTML document.
131 |
132 | Let's say we want to create a "hello" component. To do that, we need to create a `components/hello/` directory
133 |
134 | This directory must contain:
135 |
136 | - A `main.js` file. It will bootstrap and describe the component. It is mandatory, no matter how small it can be.
137 | - All the other files that your component needs (models, templates, ...).
138 |
139 | For our "hello" component the `main.js` will be:
140 |
141 | ```js
142 | define({
143 | initialize: function () {
144 | this.$el.html('