joosy 1.2.0.alpha.54 → 1.2.0.alpha.55
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.codoopts +2 -0
- data/.gitignore +2 -0
- data/.travis.yml +2 -2
- data/Gruntfile.coffee +85 -2
- data/bower.json +1 -1
- data/build/joosy.js +40 -31
- data/generators/templates/application/standalone/Gruntfile.coffee +4 -1
- data/package.json +4 -4
- data/source/joosy/application.coffee +16 -17
- data/source/joosy/events/namespace.coffee +1 -0
- data/source/joosy/modules/dom.coffee +6 -9
- data/source/joosy/modules/events.coffee +1 -0
- data/source/joosy/modules/page/scrolling.coffee +1 -0
- data/source/joosy/modules/page/title.coffee +1 -0
- data/source/joosy/modules/time_manager.coffee +18 -0
- data/source/joosy/page.coffee +2 -2
- data/source/joosy/router.coffee +7 -7
- data/source/joosy/widget.coffee +72 -101
- metadata +3 -3
- data/dummy +0 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 25d487304e9ce59d6de2a9dc4801fb801777239f
|
4
|
+
data.tar.gz: 27ccb7c1ed82c621247e9e00a155845711636ffe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d98c25370509ebb3abf2ade548ecf7d0da6f99304c7e9bd8ac7a83509903edffb46cee46d049b6f9c83a974e8ca479912aa59a89ff9ffd1cef4997115c8122e9
|
7
|
+
data.tar.gz: 39056008866151263195f9888e34c9ddcac102d3c3c58aa8eee62af7eefec1e4f0f65a9c461a2cb9338147090f9a060174b15d73a839ac26d3ff8e8e088fc7b9
|
data/.codoopts
ADDED
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/Gruntfile.coffee
CHANGED
@@ -3,6 +3,7 @@ module.exports = (grunt) ->
|
|
3
3
|
Sugar = require 'sugar'
|
4
4
|
Mincer = require 'mincer'
|
5
5
|
FS = require 'fs'
|
6
|
+
semver = require 'semver'
|
6
7
|
|
7
8
|
#
|
8
9
|
# Locations
|
@@ -135,7 +136,30 @@ module.exports = (grunt) ->
|
|
135
136
|
locations.source.extensions(x).build
|
136
137
|
|
137
138
|
#
|
138
|
-
#
|
139
|
+
# Preparations
|
140
|
+
#
|
141
|
+
grunt.registerTask 'prepare', ->
|
142
|
+
complete = @async()
|
143
|
+
|
144
|
+
base = process.cwd()
|
145
|
+
git = (args, callback) ->
|
146
|
+
grunt.util.spawn {cmd: "git", args: args, opts: {stdio: [0,1,2]}}, callback
|
147
|
+
|
148
|
+
if grunt.file.exists 'doc'
|
149
|
+
grunt.fatal "Documentation directory exists. Please remove it"
|
150
|
+
|
151
|
+
git ["clone", "git@github.com:joosy/joosy.git", "doc"], (error, result) ->
|
152
|
+
grunt.fatal "Erorr cloning repo" if error
|
153
|
+
process.chdir 'doc'
|
154
|
+
|
155
|
+
git ["checkout", "gh-pages"], (error, result) ->
|
156
|
+
grunt.fatal "Erorr checking branch out" if error
|
157
|
+
|
158
|
+
process.chdir base
|
159
|
+
complete()
|
160
|
+
|
161
|
+
#
|
162
|
+
# Builders
|
139
163
|
#
|
140
164
|
grunt.registerMultiTask 'mince', ->
|
141
165
|
Mincer.CoffeeEngine.configure bare: false
|
@@ -156,6 +180,65 @@ module.exports = (grunt) ->
|
|
156
180
|
bower.version = meta.version
|
157
181
|
FS.writeFileSync 'bower.json', JSON.stringify(bower, null, 2)
|
158
182
|
|
183
|
+
#
|
184
|
+
# Documentation
|
185
|
+
#
|
186
|
+
grunt.registerTask 'doc', ->
|
187
|
+
complete = @async()
|
188
|
+
version = require('./package.json').version.split('-')
|
189
|
+
version = version[0]+'-'+version[1]?.split('.')[0]
|
190
|
+
destination = "doc/#{version}"
|
191
|
+
args = ['source', '--output-dir', destination]
|
192
|
+
|
193
|
+
git = (args, callback) ->
|
194
|
+
grunt.util.spawn {cmd: "git", args: args, opts: {stdio: [0,1,2], cwd: 'doc'}}, callback
|
195
|
+
|
196
|
+
date = (version) ->
|
197
|
+
return undefined unless version
|
198
|
+
Date.create(grunt.file.read "doc/#{version}/DATE").format "{d} {Month} {yyyy}"
|
199
|
+
|
200
|
+
git ['pull'], (error, result) ->
|
201
|
+
grunt.fatal "Error pulling from git" if error
|
202
|
+
|
203
|
+
grunt.file.delete destination if grunt.file.exists destination
|
204
|
+
grunt.util.spawn {cmd: "codo", args: args, opts: {stdio: [0,1,2]}}, (error, result) ->
|
205
|
+
grunt.fatal "Error generating docs" if error
|
206
|
+
grunt.file.write "#{destination}/DATE", (new Date).toISOString()
|
207
|
+
|
208
|
+
versions = []
|
209
|
+
for version in grunt.file.expand({cwd: 'doc'}, '*')
|
210
|
+
versions.push version if semver.valid(version)
|
211
|
+
|
212
|
+
versions = versions.sort(semver.rcompare)
|
213
|
+
edge = versions.find (x) -> x.has('-')
|
214
|
+
stable = versions.find (x) -> !x.has('-')
|
215
|
+
versions = versions.remove edge, stable
|
216
|
+
|
217
|
+
versions = {
|
218
|
+
edge:
|
219
|
+
version: edge
|
220
|
+
date: date(edge)
|
221
|
+
stable:
|
222
|
+
version: stable
|
223
|
+
date: date(stable)
|
224
|
+
versions: versions.map (x) -> { version: x, date: date(x) }
|
225
|
+
}
|
226
|
+
grunt.file.write 'doc/versions.js', "window.versions = #{JSON.stringify(versions)}"
|
227
|
+
|
228
|
+
git ['add', '-A'], (error, result) ->
|
229
|
+
grunt.fatal "Error adding files" if error
|
230
|
+
|
231
|
+
git ['commit', '-m', "Updated at #{(new Date).toISOString()}"], (error, result) ->
|
232
|
+
grunt.fatal "Error commiting" if error
|
233
|
+
|
234
|
+
git ['push', 'origin', 'gh-pages'], (error, result) ->
|
235
|
+
grunt.fatal "Error pushing" if error
|
236
|
+
complete()
|
237
|
+
|
238
|
+
|
239
|
+
#
|
240
|
+
# Publishing
|
241
|
+
#
|
159
242
|
grunt.registerTask 'publish:ensureCommits', ->
|
160
243
|
complete = @async()
|
161
244
|
|
@@ -184,4 +267,4 @@ module.exports = (grunt) ->
|
|
184
267
|
grunt.file.delete gem
|
185
268
|
complete(true)
|
186
269
|
|
187
|
-
grunt.registerTask 'publish', ['test', 'publish:ensureCommits', 'release', 'publish:gem']
|
270
|
+
grunt.registerTask 'publish', ['test', 'publish:ensureCommits', 'doc', 'release', 'publish:gem']
|
data/bower.json
CHANGED
data/build/joosy.js
CHANGED
@@ -539,14 +539,6 @@
|
|
539
539
|
_ref.unbind().off();
|
540
540
|
}
|
541
541
|
return this.$container = $();
|
542
|
-
},
|
543
|
-
__loadData: function(done) {
|
544
|
-
var _this = this;
|
545
|
-
this.data = {};
|
546
|
-
return this.__runFetchs([], function() {
|
547
|
-
_this.dataFetched = true;
|
548
|
-
return done();
|
549
|
-
});
|
550
542
|
}
|
551
543
|
};
|
552
544
|
|
@@ -1207,6 +1199,12 @@
|
|
1207
1199
|
this.__intervals.push(timer);
|
1208
1200
|
return timer;
|
1209
1201
|
},
|
1202
|
+
clearTimeout: function(timer) {
|
1203
|
+
return window.clearTimeout(timer);
|
1204
|
+
},
|
1205
|
+
clearInterval: function(timer) {
|
1206
|
+
return window.clearInterval(timer);
|
1207
|
+
},
|
1210
1208
|
__clearTime: function() {
|
1211
1209
|
var entry, _i, _j, _len, _len1, _ref, _ref1, _results;
|
1212
1210
|
if (this.__intervals) {
|
@@ -2306,13 +2304,20 @@
|
|
2306
2304
|
|
2307
2305
|
}).call(this);
|
2308
2306
|
(function() {
|
2309
|
-
Joosy.Application = {
|
2310
|
-
|
2311
|
-
|
2312
|
-
|
2313
|
-
|
2314
|
-
|
2315
|
-
|
2307
|
+
Joosy.Application = (function() {
|
2308
|
+
function Application() {}
|
2309
|
+
|
2310
|
+
Application.Pages = {};
|
2311
|
+
|
2312
|
+
Application.Layouts = {};
|
2313
|
+
|
2314
|
+
Application.Controls = {};
|
2315
|
+
|
2316
|
+
Application.initialized = false;
|
2317
|
+
|
2318
|
+
Application.loading = true;
|
2319
|
+
|
2320
|
+
Application.config = {
|
2316
2321
|
test: false,
|
2317
2322
|
debug: false,
|
2318
2323
|
templater: {
|
@@ -2323,8 +2328,9 @@
|
|
2323
2328
|
base: '',
|
2324
2329
|
prefix: ''
|
2325
2330
|
}
|
2326
|
-
}
|
2327
|
-
|
2331
|
+
};
|
2332
|
+
|
2333
|
+
Application.initialize = function(selector, options) {
|
2328
2334
|
var _this = this;
|
2329
2335
|
this.selector = selector;
|
2330
2336
|
if (options == null) {
|
@@ -2352,8 +2358,9 @@
|
|
2352
2358
|
}
|
2353
2359
|
});
|
2354
2360
|
return this.initialized = true;
|
2355
|
-
}
|
2356
|
-
|
2361
|
+
};
|
2362
|
+
|
2363
|
+
Application.reset = function() {
|
2357
2364
|
var _ref;
|
2358
2365
|
Joosy.Router.reset();
|
2359
2366
|
Joosy.templater(false);
|
@@ -2364,15 +2371,13 @@
|
|
2364
2371
|
delete this.page;
|
2365
2372
|
this.loading = true;
|
2366
2373
|
return this.initialized = false;
|
2367
|
-
}
|
2368
|
-
|
2369
|
-
|
2370
|
-
return (_ref = this.router).navigate.apply(_ref, arguments);
|
2371
|
-
},
|
2372
|
-
content: function() {
|
2374
|
+
};
|
2375
|
+
|
2376
|
+
Application.content = function() {
|
2373
2377
|
return $(this.selector);
|
2374
|
-
}
|
2375
|
-
|
2378
|
+
};
|
2379
|
+
|
2380
|
+
Application.changePage = function(page, params) {
|
2376
2381
|
var attempt;
|
2377
2382
|
attempt = new page(params, this.page);
|
2378
2383
|
if (!attempt.halted) {
|
@@ -2383,8 +2388,9 @@
|
|
2383
2388
|
}
|
2384
2389
|
return this.page = attempt;
|
2385
2390
|
}
|
2386
|
-
}
|
2387
|
-
|
2391
|
+
};
|
2392
|
+
|
2393
|
+
Application.forceSandbox = function() {
|
2388
2394
|
var sandbox;
|
2389
2395
|
sandbox = Joosy.uid();
|
2390
2396
|
this.selector = "#" + sandbox;
|
@@ -2393,8 +2399,11 @@
|
|
2393
2399
|
width: '0px',
|
2394
2400
|
overflow: 'hidden'
|
2395
2401
|
}));
|
2396
|
-
}
|
2397
|
-
|
2402
|
+
};
|
2403
|
+
|
2404
|
+
return Application;
|
2405
|
+
|
2406
|
+
})();
|
2398
2407
|
|
2399
2408
|
if ((typeof define !== "undefined" && define !== null ? define.amd : void 0) != null) {
|
2400
2409
|
define('joosy/application', function() {
|
@@ -15,7 +15,10 @@ module.exports = (grunt) ->
|
|
15
15
|
# config: require('./config.json')
|
16
16
|
|
17
17
|
# Setup built-in development proxy to workaround Cross-Origin
|
18
|
-
#
|
18
|
+
# server:
|
19
|
+
# proxy: [
|
20
|
+
# {src: '/joosy', dest: 'http://joosy.ws'}
|
21
|
+
# ]
|
19
22
|
|
20
23
|
assets:
|
21
24
|
application:
|
data/package.json
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
"keywords": [
|
5
5
|
"joosy"
|
6
6
|
],
|
7
|
-
"version": "1.2.0-alpha.
|
7
|
+
"version": "1.2.0-alpha.55",
|
8
8
|
"author": "Boris Staal <boris@staal.io>",
|
9
9
|
"homepage": "http://joosy.ws/",
|
10
10
|
"repository": {
|
@@ -24,11 +24,10 @@
|
|
24
24
|
"command-router": "0.0.5",
|
25
25
|
"resolve": "~0.4.0",
|
26
26
|
"ejs": "~0.8.4",
|
27
|
-
"commander": "~2.0.0",
|
28
27
|
"commander": "~1.2.0",
|
29
28
|
"colors": "~0.6.0-1",
|
30
29
|
"grunt": "~0.4.1",
|
31
|
-
"mincer": "0.5.
|
30
|
+
"mincer": ">= 0.5.5",
|
32
31
|
"connect": "~2.7.11",
|
33
32
|
"haml-coffee": "~1.11.1",
|
34
33
|
"proxy-middleware": "~0.4.0",
|
@@ -42,6 +41,7 @@
|
|
42
41
|
"grunt-contrib-coffee": "~0.7.0",
|
43
42
|
"grunt-contrib-connect": "~0.3.0",
|
44
43
|
"grunt-coffeelint": "0.0.6",
|
45
|
-
"grunt-release": "~0.3.5"
|
44
|
+
"grunt-release": "~0.3.5",
|
45
|
+
"semver": "~2.1.0"
|
46
46
|
}
|
47
47
|
}
|
@@ -7,17 +7,15 @@
|
|
7
7
|
#
|
8
8
|
# Joosy Application container
|
9
9
|
#
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
Layouts: {}
|
15
|
-
Controls: {}
|
10
|
+
class Joosy.Application
|
11
|
+
@Pages: {}
|
12
|
+
@Layouts: {}
|
13
|
+
@Controls: {}
|
16
14
|
|
17
|
-
initialized: false
|
18
|
-
loading: true
|
15
|
+
@initialized: false
|
16
|
+
@loading: true
|
19
17
|
|
20
|
-
config:
|
18
|
+
@config:
|
21
19
|
test: false
|
22
20
|
debug: false
|
23
21
|
templater:
|
@@ -34,7 +32,7 @@ Joosy.Application =
|
|
34
32
|
# @param [String] selector jQuery-compatible selector of root application element
|
35
33
|
# @param [Object] options
|
36
34
|
#
|
37
|
-
initialize: (@selector, options={}) ->
|
35
|
+
@initialize: (@selector, options={}) ->
|
38
36
|
if @initialized
|
39
37
|
throw new Error 'Attempted to initialize Application twice'
|
40
38
|
|
@@ -56,7 +54,10 @@ Joosy.Application =
|
|
56
54
|
|
57
55
|
@initialized = true
|
58
56
|
|
59
|
-
|
57
|
+
#
|
58
|
+
# Shuts down current application and clears state
|
59
|
+
#
|
60
|
+
@reset: ->
|
60
61
|
Joosy.Router.reset()
|
61
62
|
Joosy.templater false
|
62
63
|
Joosy.debug false
|
@@ -67,13 +68,10 @@ Joosy.Application =
|
|
67
68
|
@loading = true
|
68
69
|
@initialized = false
|
69
70
|
|
70
|
-
navigate: ->
|
71
|
-
@router.navigate arguments...
|
72
|
-
|
73
71
|
#
|
74
72
|
# Gets current application root node
|
75
73
|
#
|
76
|
-
content: ->
|
74
|
+
@content: ->
|
77
75
|
$(@selector)
|
78
76
|
|
79
77
|
#
|
@@ -82,7 +80,7 @@ Joosy.Application =
|
|
82
80
|
# @param [Joosy.Page] page The class (not object) of page to load
|
83
81
|
# @param [Object] params Hash of page params
|
84
82
|
#
|
85
|
-
changePage: (page, params) ->
|
83
|
+
@changePage: (page, params) ->
|
86
84
|
attempt = new page params, @page
|
87
85
|
|
88
86
|
unless attempt.halted
|
@@ -93,7 +91,8 @@ Joosy.Application =
|
|
93
91
|
|
94
92
|
@page = attempt
|
95
93
|
|
96
|
-
|
94
|
+
# @private
|
95
|
+
@forceSandbox: ->
|
97
96
|
sandbox = Joosy.uid()
|
98
97
|
@selector = "##{sandbox}"
|
99
98
|
$('body').append $('<div/>').attr('id', sandbox).css
|
@@ -47,6 +47,7 @@ Joosy.Modules.DOM =
|
|
47
47
|
# Converts '$...' notation to selector from 'elements'
|
48
48
|
#
|
49
49
|
# @param [String] selector Selector to convert
|
50
|
+
# @private
|
50
51
|
#
|
51
52
|
__extractSelector: (selector) ->
|
52
53
|
selector = selector.replace /(\$[A-z0-9\.\$]+)/g, (path) =>
|
@@ -63,6 +64,7 @@ Joosy.Modules.DOM =
|
|
63
64
|
#
|
64
65
|
# Assigns elements defined in 'elements'
|
65
66
|
#
|
67
|
+
# @private
|
66
68
|
# @example Sample elements
|
67
69
|
# @mapElements
|
68
70
|
# foo: '.foo'
|
@@ -85,6 +87,8 @@ Joosy.Modules.DOM =
|
|
85
87
|
#
|
86
88
|
# Wraps actual element closures. Required to clear context to avoid circular reference
|
87
89
|
#
|
90
|
+
# @private
|
91
|
+
#
|
88
92
|
__wrapElement: (value) ->
|
89
93
|
(filter) =>
|
90
94
|
return @$(value) unless filter
|
@@ -93,6 +97,7 @@ Joosy.Modules.DOM =
|
|
93
97
|
#
|
94
98
|
# Binds events defined in 'events' to container
|
95
99
|
#
|
100
|
+
# @private
|
96
101
|
# @example Sample events
|
97
102
|
# @mapEvents
|
98
103
|
# 'click': -> # this will raise on container click
|
@@ -124,20 +129,12 @@ Joosy.Modules.DOM =
|
|
124
129
|
@$container.on eventName, selector, callback
|
125
130
|
Joosy.Modules.Log.debugAs @, "#{eventName} binded on #{selector}"
|
126
131
|
|
132
|
+
# @private
|
127
133
|
__clearContainer: ->
|
128
134
|
@$container?.unbind().off()
|
129
135
|
@$container = $()
|
130
136
|
|
131
137
|
|
132
|
-
# This is not clearly related for container management
|
133
|
-
# But it will be later common for all containers
|
134
|
-
# See https://github.com/joosy/joosy/issues/102
|
135
|
-
__loadData: (done) ->
|
136
|
-
@data = {}
|
137
|
-
@__runFetchs [], =>
|
138
|
-
@dataFetched = true
|
139
|
-
done()
|
140
|
-
|
141
138
|
# AMD wrapper
|
142
139
|
if define?.amd?
|
143
140
|
define 'joosy/modules/dom', -> Joosy.Modules.DOM
|
@@ -12,6 +12,7 @@ Joosy.Modules.TimeManager =
|
|
12
12
|
#
|
13
13
|
# @param [Integer] timeout Miliseconds to wait
|
14
14
|
# @param [Function] action Action to run on timeout
|
15
|
+
# @return [Integer] Timer
|
15
16
|
#
|
16
17
|
setTimeout: (timeout, action) ->
|
17
18
|
@__timeouts ||= []
|
@@ -26,6 +27,7 @@ Joosy.Modules.TimeManager =
|
|
26
27
|
#
|
27
28
|
# @param [Integer] delay Miliseconds between runs
|
28
29
|
# @param [Function] action Action to run
|
30
|
+
# @return [Integer] Timer
|
29
31
|
#
|
30
32
|
setInterval: (delay, action) ->
|
31
33
|
@__intervals ||= []
|
@@ -35,6 +37,22 @@ Joosy.Modules.TimeManager =
|
|
35
37
|
|
36
38
|
timer
|
37
39
|
|
40
|
+
#
|
41
|
+
# Clears tmeout preventing callback from execution
|
42
|
+
#
|
43
|
+
# @param [Integer] timer Timer
|
44
|
+
#
|
45
|
+
clearTimeout: (timer) ->
|
46
|
+
window.clearTimeout timer
|
47
|
+
|
48
|
+
#
|
49
|
+
# Clears inteval preventing callback from execution
|
50
|
+
#
|
51
|
+
# @param [Integer] timer Timer
|
52
|
+
#
|
53
|
+
clearInterval: (timer) ->
|
54
|
+
window.clearInterval timer
|
55
|
+
|
38
56
|
#
|
39
57
|
# Drops all registered timeouts and intervals for this object
|
40
58
|
#
|
data/source/joosy/page.coffee
CHANGED
@@ -27,8 +27,8 @@ class Joosy.Page extends Joosy.Widget
|
|
27
27
|
@extend Joosy.Modules.Page_Title
|
28
28
|
|
29
29
|
#
|
30
|
-
# @
|
31
|
-
# @
|
30
|
+
# @param [Hash] params Route params
|
31
|
+
# @param [Joosy.Page] previous Previous page to unload
|
32
32
|
#
|
33
33
|
constructor: (@params, @previous) ->
|
34
34
|
@layoutShouldChange = @previous?.__layoutClass != @__layoutClass
|
data/source/joosy/router.coffee
CHANGED
@@ -7,13 +7,14 @@
|
|
7
7
|
# Router. Reacts on URI change event and loads proper pages
|
8
8
|
#
|
9
9
|
# Internal storage rules:
|
10
|
-
# * HTML5 Prefix option is stored with both leading and trailing slashes
|
11
|
-
# * Helpers pathes are stored without leading trailing slash
|
12
|
-
# * Route matchers declare leading and trailing slashes as optional
|
13
10
|
#
|
14
|
-
#
|
11
|
+
# * HTML5 Prefix option is stored with both leading and trailing slashes
|
12
|
+
# * Helpers pathes are stored without leading trailing slash
|
13
|
+
# * Route matchers declare leading and trailing slashes as optional
|
14
|
+
#
|
15
|
+
# @example
|
15
16
|
# Joosy.Router.map
|
16
|
-
# 404 : (path) -> alert "Page
|
17
|
+
# 404 : (path) -> alert "Page was not found :("
|
17
18
|
# '/' : Welcome.IndexPage
|
18
19
|
# '/resources' :
|
19
20
|
# '/' : Resource.IndexPage
|
@@ -21,8 +22,6 @@
|
|
21
22
|
# '/:id/edit' : Resource.EditPage
|
22
23
|
# '/new' : Resource.EditPage
|
23
24
|
#
|
24
|
-
# @mixin
|
25
|
-
#
|
26
25
|
class Joosy.Router extends Joosy.Module
|
27
26
|
@extend Joosy.Modules.Events
|
28
27
|
|
@@ -40,6 +39,7 @@ class Joosy.Router extends Joosy.Module
|
|
40
39
|
|
41
40
|
#
|
42
41
|
# Rails-like wrapper around internal raw routes representation
|
42
|
+
# @private
|
43
43
|
#
|
44
44
|
class Drawer
|
45
45
|
@run: (block, namespace='', alias='') ->
|
data/source/joosy/widget.coffee
CHANGED
@@ -10,11 +10,13 @@
|
|
10
10
|
# Base class for all Joosy Widgets.
|
11
11
|
#
|
12
12
|
# Joosy expects you to perceive your actual application as a tree of widgets. Internally all high-level
|
13
|
-
# containers like {Layout} and {Page} are inheriting from Widget. Widget contains logic for:
|
13
|
+
# containers like {Joosy.Layout} and {Joosy.Page} are inheriting from Widget. Widget contains logic for:
|
14
14
|
#
|
15
|
-
#
|
16
|
-
#
|
17
|
-
#
|
15
|
+
# * Recursive nesting (widgets can contain widgets, etc.)
|
16
|
+
#
|
17
|
+
# * Loading and Unloading flows (proper initializations, destructions and replacements)
|
18
|
+
#
|
19
|
+
# * Filtering (afterLoad, beforeLoad and the family of paint filters)
|
18
20
|
#
|
19
21
|
# During the bootstrap, widgets can take either dependent or independent strategy. Dependent widgets form
|
20
22
|
# "dependent chains" that will be rendered together (HTML will be injected into DOM atomically). Such chains
|
@@ -31,16 +33,76 @@
|
|
31
33
|
# Then total chain of asynchronous callbacks goes with the following scenario.
|
32
34
|
#
|
33
35
|
# 1. A collects all the fetches from the whole tree recursively and starts them in parallel.
|
34
|
-
#
|
36
|
+
#
|
37
|
+
# 2. A runs erase on the previous same-level widget (attribute `@previous`) if one is given.
|
38
|
+
#
|
35
39
|
# 3. A runs beforePaint on itself when 2 is done.
|
40
|
+
#
|
36
41
|
# 4. A waits for step 3 and all fetches of containers in recursive dependency chain (equal to B) to complete.
|
42
|
+
#
|
37
43
|
# 5. A builds resulting HTML using:
|
44
|
+
#
|
38
45
|
# * HTML of dependency chain (B)
|
46
|
+
#
|
39
47
|
# * HTML of independent containers that are ready to be rendered (their own recursive dependency chain is fetched completely).
|
48
|
+
#
|
40
49
|
# 5. A forks every independent container that was not rendered (C).
|
50
|
+
#
|
41
51
|
# 6. A starts paint on itself and injects HTML into DOM.
|
52
|
+
#
|
42
53
|
# 7. C repeats steps 2-7 using itself as a base and D as its own recursive dependency chain
|
43
54
|
#
|
55
|
+
# @method .beforeLoad(callback)
|
56
|
+
# Initialization hook that runs in the very begining of bootstrap process.
|
57
|
+
# Call it multiple times to attach several hooks.
|
58
|
+
#
|
59
|
+
# @method .afterLoad(callback)
|
60
|
+
# Hook that runs after the section was properly loaded and injected into DOM.
|
61
|
+
# Call it multiple times to attach several hooks.
|
62
|
+
#
|
63
|
+
# @method .beforeUnload(callback)
|
64
|
+
# Hook that finalizes section desctruction.
|
65
|
+
# Call it multiple times to attach several hooks.
|
66
|
+
#
|
67
|
+
# @method .fetch(callback)
|
68
|
+
# Sets the method which will controll the data fetching proccess.
|
69
|
+
# @note Given method will be called with `complete` function as parameter. As soon as your
|
70
|
+
# preparations are done you should call that function.
|
71
|
+
# @example Basic usage
|
72
|
+
# @fetch (complete) ->
|
73
|
+
# $.get '/rumbas', (@data) => complete()
|
74
|
+
#
|
75
|
+
# @method .beforePaint(callback)
|
76
|
+
# Sets the method which will controll the painting preparation proccess.
|
77
|
+
# This method will be called right ater previous section erase and in parallel with
|
78
|
+
# new data fetching so you can use it to initiate preloader.
|
79
|
+
# @note Given method will be called with `complete` function as parameter. As soon as your
|
80
|
+
# preparations are done you should call that function.
|
81
|
+
# @example Sample before painter
|
82
|
+
# @beforePaint (complete) ->
|
83
|
+
# @$preloader.slideDown -> complete()
|
84
|
+
#
|
85
|
+
# @method .paint(callback)
|
86
|
+
# Sets the method which will controll the painting proccess.
|
87
|
+
# This method will be called after fetching, erasing and beforePaint is complete.
|
88
|
+
# It should be used to setup appearance effects of page.
|
89
|
+
# @note Given method will be called with `complete` function as parameter. As soon as your
|
90
|
+
# preparations are done you should call that function.
|
91
|
+
# @example Sample painter
|
92
|
+
# @paint (complete) ->
|
93
|
+
# @$container.fadeIn -> complete()
|
94
|
+
#
|
95
|
+
# @method .erase(callback)
|
96
|
+
# Sets the method which will controll the erasing proccess.
|
97
|
+
# Use this method to setup hiding effect.
|
98
|
+
# @note Given method will be called with `complete` function as parameter. As soon as your
|
99
|
+
# preparations are done you should call that function.
|
100
|
+
# @note This method will be caled _before_ unload routines so in theory you can
|
101
|
+
# access page data from that. Think twice if you are doing it right though.
|
102
|
+
# @example Sample eraser
|
103
|
+
# @erase (complete) ->
|
104
|
+
# @$container.fadeOut -> complete()
|
105
|
+
#
|
44
106
|
# @include Joosy.Modules.Log
|
45
107
|
# @include Joosy.Modules.Events
|
46
108
|
# @include Joosy.Modules.DOM
|
@@ -77,100 +139,9 @@ class Joosy.Widget extends Joosy.Module
|
|
77
139
|
@independent: ->
|
78
140
|
@::__independent = true
|
79
141
|
|
80
|
-
@registerPlainFilters
|
81
|
-
|
82
|
-
|
83
|
-
#
|
84
|
-
# Initialization hook that runs in the very begining of bootstrap process.
|
85
|
-
# Call it multiple times to attach several hooks.
|
86
|
-
#
|
87
|
-
'beforeLoad',
|
88
|
-
|
89
|
-
#
|
90
|
-
# @method .afterLoad(callback)
|
91
|
-
#
|
92
|
-
# Hook that runs after the section was properly loaded and injected into DOM.
|
93
|
-
# Call it multiple times to attach several hooks.
|
94
|
-
#
|
95
|
-
'afterLoad',
|
96
|
-
|
97
|
-
#
|
98
|
-
# @method .beforeUnload(callback)
|
99
|
-
#
|
100
|
-
# Hook that finalizes section desctruction.
|
101
|
-
# Call it multiple times to attach several hooks.
|
102
|
-
#
|
103
|
-
'afterUnload'
|
104
|
-
|
105
|
-
@registerSequencedFilters \
|
106
|
-
|
107
|
-
#
|
108
|
-
# @method .beforePaint(callback)
|
109
|
-
#
|
110
|
-
# Sets the method which will controll the painting preparation proccess.
|
111
|
-
#
|
112
|
-
# This method will be called right ater previous section erase and in parallel with
|
113
|
-
# new data fetching so you can use it to initiate preloader.
|
114
|
-
#
|
115
|
-
# @note Given method will be called with `complete` function as parameter. As soon as your
|
116
|
-
# preparations are done you should call that function.
|
117
|
-
#
|
118
|
-
# @example Sample before painter
|
119
|
-
# @beforePaint (complete) ->
|
120
|
-
# @$preloader.slideDown -> complete()
|
121
|
-
#
|
122
|
-
#
|
123
|
-
'beforePaint',
|
124
|
-
|
125
|
-
#
|
126
|
-
# @method .paint(callback)
|
127
|
-
#
|
128
|
-
# Sets the method which will controll the painting proccess.
|
129
|
-
#
|
130
|
-
# This method will be called after fetching, erasing and beforePaint is complete.
|
131
|
-
# It should be used to setup appearance effects of page.
|
132
|
-
#
|
133
|
-
# @note Given method will be called with `complete` function as parameter. As soon as your
|
134
|
-
# preparations are done you should call that function.
|
135
|
-
#
|
136
|
-
# @example Sample painter
|
137
|
-
# @paint (complete) ->
|
138
|
-
# @$container.fadeIn -> complete()
|
139
|
-
#
|
140
|
-
'paint',
|
141
|
-
|
142
|
-
#
|
143
|
-
# @method .erase(callback)
|
144
|
-
#
|
145
|
-
# Sets the method which will controll the erasing proccess.
|
146
|
-
#
|
147
|
-
# Use this method to setup hiding effect.
|
148
|
-
#
|
149
|
-
# @note Given method will be called with `complete` function as parameter. As soon as your
|
150
|
-
# preparations are done you should call that function.
|
151
|
-
#
|
152
|
-
# @note This method will be caled _before_ unload routines so in theory you can
|
153
|
-
# access page data from that. Think twice if you are doing it right though.
|
154
|
-
#
|
155
|
-
# @example Sample eraser
|
156
|
-
# @erase (complete) ->
|
157
|
-
# @$container.fadeOut -> complete()
|
158
|
-
#
|
159
|
-
'erase',
|
160
|
-
|
161
|
-
#
|
162
|
-
# @method .fetch(callback)
|
163
|
-
#
|
164
|
-
# Sets the method which will controll the data fetching proccess.
|
165
|
-
#
|
166
|
-
# @note Given method will be called with `complete` function as parameter. As soon as your
|
167
|
-
# preparations are done you should call that function.
|
168
|
-
#
|
169
|
-
# @example Basic usage
|
170
|
-
# @fetch (complete) ->
|
171
|
-
# $.get '/rumbas', (@data) => complete()
|
172
|
-
#
|
173
|
-
'fetch'
|
142
|
+
@registerPlainFilters 'beforeLoad', 'afterLoad', 'afterUnload'
|
143
|
+
|
144
|
+
@registerSequencedFilters 'beforePaint', 'paint', 'erase', 'fetch'
|
174
145
|
|
175
146
|
#
|
176
147
|
# @param [Hash] params Arbitrary parameters
|
@@ -253,10 +224,10 @@ class Joosy.Widget extends Joosy.Module
|
|
253
224
|
#
|
254
225
|
# @example
|
255
226
|
# nestingMap =
|
256
|
-
# '
|
227
|
+
# '.page':
|
257
228
|
# instance: page
|
258
229
|
# nested:
|
259
|
-
# '
|
230
|
+
# '.widget1': {instance: widget1}
|
260
231
|
#
|
261
232
|
# layout.__bootstrap nestingMap, Joosy.Application.content()
|
262
233
|
#
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: joosy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.0.alpha.
|
4
|
+
version: 1.2.0.alpha.55
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Boris Staal
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-08-
|
13
|
+
date: 2013-08-07 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: sprockets
|
@@ -46,6 +46,7 @@ executables: []
|
|
46
46
|
extensions: []
|
47
47
|
extra_rdoc_files: []
|
48
48
|
files:
|
49
|
+
- .codoopts
|
49
50
|
- .gitignore
|
50
51
|
- .travis.yml
|
51
52
|
- Gemfile
|
@@ -57,7 +58,6 @@ files:
|
|
57
58
|
- build/joosy/extensions/preloaders.js
|
58
59
|
- build/joosy/extensions/resources-form.js
|
59
60
|
- build/joosy/extensions/resources.js
|
60
|
-
- dummy
|
61
61
|
- generators/base.coffee
|
62
62
|
- generators/command/command.coffee
|
63
63
|
- generators/command/help.coffee
|
data/dummy
DELETED