Permalink
Browse files

turn into a lib

  • Loading branch information...
1 parent 31756e8 commit 2be5b88b2fad25cc6295d9a062d529e0f23b9a62 @maccman committed Sep 13, 2011
Showing with 33,397 additions and 1,565 deletions.
  1. +1 −0 .gitignore
  2. +14 −0 Cakefile
  3. +0 −1 Procfile
  4. +0 −3 README.md
  5. +0 −26 app/app.coffee
  6. +0 −61 app/controllers/contacts.coffee
  7. +0 −18 app/controllers/index.coffee
  8. +0 −37 app/lib/jquery.touch.coffee
  9. +0 −40 app/lib/panel.coffee
  10. +0 −4 app/models/contact.coffee
  11. +0 −3 app/views/contacts/list.tmpl
  12. +0 −3 app/views/contacts/show.tmpl
  13. +0 −50 index.js
  14. +5 −0 lib/index.js
  15. +0 −503 lib/jquery.tmpl.js
  16. +139 −0 lib/panel.js
  17. +0 −137 lib/spine/spine.ajax.js
  18. +114 −0 lib/stage.js
  19. +75 −0 lib/touch.js
  20. +14 −0 node_modules/gfx/Cakefile
  21. +20 −0 node_modules/gfx/LICENSE
  22. +154 −0 node_modules/gfx/README.md
  23. +169 −0 node_modules/gfx/examples/login/css/application.less
  24. +95 −0 node_modules/gfx/examples/login/css/utils.less
  25. +44 −0 node_modules/gfx/examples/login/index.html
  26. +8 −0 node_modules/gfx/examples/login/lib/coffee-script.js
  27. +16 −0 node_modules/gfx/examples/login/lib/less.js
  28. +90 −0 node_modules/gfx/examples/windows8/css/application.less
  29. +0 −6 {public → node_modules/gfx/examples/windows8}/css/utils.less
  30. +67 −0 node_modules/gfx/examples/windows8/index.html
  31. +8 −0 node_modules/gfx/examples/windows8/lib/coffee-script.js
  32. +16 −0 node_modules/gfx/examples/windows8/lib/less.js
  33. +146 −0 node_modules/gfx/index.html
  34. 0 {lib/gfx → node_modules/gfx/lib}/gfx.cube.js
  35. 0 {lib/gfx → node_modules/gfx/lib}/gfx.flip.js
  36. +1 −1 {lib/gfx → node_modules/gfx/lib}/gfx.js
  37. +11 −6 {lib/gfx → node_modules/gfx/lib}/gfx.overlay.js
  38. +8,983 −0 node_modules/gfx/node_modules/jqueryify/index.js
  39. +14 −0 node_modules/gfx/node_modules/jqueryify/package.json
  40. +20 −0 node_modules/gfx/package.json
  41. +8,936 −0 node_modules/gfx/site/jquery.js
  42. +152 −0 node_modules/gfx/site/site.css
  43. +229 −0 node_modules/gfx/src/gfx.coffee
  44. +116 −0 node_modules/gfx/src/gfx.cube.coffee
  45. +41 −0 node_modules/gfx/src/gfx.flip.coffee
  46. +53 −0 node_modules/gfx/src/gfx.overlay.coffee
  47. +2 −0 node_modules/spine/.gitignore
  48. +14 −0 node_modules/spine/Cakefile
  49. +20 −0 node_modules/spine/LICENSE
  50. +7 −0 node_modules/spine/README.md
  51. 0 {lib → node_modules/spine/examples}/jquery.js
  52. +57 −0 node_modules/spine/examples/route.html
  53. +886 −0 node_modules/spine/index.html
  54. +250 −0 node_modules/spine/lib/ajax.js
  55. +3 −1 lib/spine/spine.list.js → node_modules/spine/lib/list.js
  56. +6 −8 lib/spine/spine.local.js → node_modules/spine/lib/local.js
  57. +17 −12 lib/spine/spine.manager.js → node_modules/spine/lib/manager.js
  58. +7 −8 lib/spine/spine.relation.js → node_modules/spine/lib/relation.js
  59. +9 −5 lib/spine/spine.route.js → node_modules/spine/lib/route.js
  60. +135 −57 {lib/spine → node_modules/spine/lib}/spine.js
  61. +3 −1 lib/spine/spine.tabs.js → node_modules/spine/lib/tabs.js
  62. +4 −3 lib/spine/spine.tmpl.js → node_modules/spine/lib/tmpl.js
  63. +19 −0 node_modules/spine/package.json
  64. +130 −0 node_modules/spine/site/highlight.css
  65. +1 −0 node_modules/spine/site/highlight.js
  66. BIN node_modules/spine/site/images/inheritance.png
  67. +6,240 −0 node_modules/spine/site/jquery.js
  68. +102 −0 node_modules/spine/site/site.css
  69. +746 −0 node_modules/spine/site/site.md
  70. +186 −0 node_modules/spine/src/ajax.coffee
  71. +37 −0 node_modules/spine/src/list.coffee
  72. +16 −0 node_modules/spine/src/local.coffee
  73. +76 −0 node_modules/spine/src/manager.coffee
  74. +106 −0 node_modules/spine/src/relation.coffee
  75. +138 −0 node_modules/spine/src/route.coffee
  76. +477 −0 node_modules/spine/src/spine.coffee
  77. +55 −0 node_modules/spine/src/tabs.coffee
  78. +14 −0 node_modules/spine/src/tmpl.coffee
  79. +21 −0 node_modules/spine/test/ajax.html
  80. +24 −0 node_modules/spine/test/index.html
  81. +20 −0 node_modules/spine/test/lib/MIT.LICENSE
  82. +166 −0 node_modules/spine/test/lib/jasmine.css
  83. +188 −0 node_modules/spine/test/lib/jasmine.html.js
  84. +2,421 −0 node_modules/spine/test/lib/jasmine.js
  85. +22 −0 node_modules/spine/test/persistance.html
  86. +22 −0 node_modules/spine/test/route.html
  87. +122 −0 node_modules/spine/test/specs/ajax.js
  88. +64 −0 node_modules/spine/test/specs/class.js
  89. +73 −0 node_modules/spine/test/specs/controller.js
  90. +84 −0 node_modules/spine/test/specs/events.js
  91. +359 −0 node_modules/spine/test/specs/model.js
  92. +17 −0 node_modules/spine/test/specs/model.local.js
  93. +98 −0 node_modules/spine/test/specs/route.js
  94. +18 −13 package.json
  95. +0 −1 public/application.js
  96. +0 −212 public/css/application.css
  97. +0 −204 public/css/application.less
  98. +0 −97 public/css/theme.less
  99. 0 public/favicon.ico
  100. +0 −30 public/index.html
  101. +3 −0 src/index.coffee
  102. +80 −0 src/panel.coffee
  103. +19 −14 {app/lib → src}/stage.coffee
  104. +62 −0 src/touch.coffee
View
@@ -0,0 +1 @@
+npm_modules
View
@@ -0,0 +1,14 @@
+{print} = require 'sys'
+{spawn} = require 'child_process'
+
+build = (callback) ->
+ coffee = spawn 'coffee', ['-c', '-o', 'lib', 'src']
+ coffee.stderr.on 'data', (data) ->
+ process.stderr.write data.toString()
+ coffee.stdout.on 'data', (data) ->
+ print data.toString()
+ coffee.on 'exit', (code) ->
+ callback?() if code is 0
+
+task 'build', 'Build lib/ from src/', ->
+ build()
View
@@ -1 +0,0 @@
-web: node index.js
View
@@ -1,3 +0,0 @@
-* Sections
-* Alphabet list view
-* Package
View
@@ -1,26 +0,0 @@
-require("lib/jquery.touch")
-
-Stage = require("controllers/index")
-Contacts = require("controllers/contacts")
-Contact = require("models/contact")
-
-class App extends Spine.Controller
- elements:
- "#stage": "stage"
-
- constructor: ->
- super
-
- @stage = new Stage(el: @stage)
- @contacts = new Contacts(stage: @stage)
-
- $.preventDefaultTouch()
- $.setupTouch()
- Spine.Route.setup(shim: true)
-
- @navigate "/contacts"
-
- Contact.create(name: "Alex MacCaw", email: "info@eribium.org")
- Contact.create(name: "Richard MacCaw", email: "ricci@example.com")
-
-module.exports = App
@@ -1,61 +0,0 @@
-Panel = require("lib/panel")
-Contact = require("models/contact")
-
-class ContactsList extends Panel
- title: "Contacts"
- events:
- "tap .item": "click"
-
- constructor: ->
- super
- @content.addClass("list")
- Contact.bind("change refresh", @render)
-
- render: =>
- contacts = Contact.all()
- @html require("views/contacts/list")(contacts)
-
- click: (e) ->
- item = $(e.target).item()
- @navigate("/contacts", item.id, trans: "right")
-
-class ContactsItem extends Panel
- title: "Contact"
- events:
- "tap .back": "back"
-
- constructor: ->
- super
- backButton = $("<button />")
- backButton.text("Back").addClass("left back")
- @header.append(backButton)
- @content.addClass("fillout")
-
- back: ->
- @navigate("/contacts", trans: "left")
-
- render: ->
- @html require("views/contacts/show")(@item)
-
- change: (item) ->
- @item = item
- @render()
-
-class Contacts extends Spine.Controller
- constructor: ->
- super
-
- @list = new ContactsList
- @item = new ContactsItem
-
- # Add to main stage
- @stage.add(@list, @item)
-
- @routes
- "/contacts": (params) ->
- @list.active(params)
- "/contacts/:id": (params) ->
- @item.change Contact.find(params.id)
- @item.active(params)
-
-module.exports = Contacts
@@ -1,18 +0,0 @@
-Stage = require("lib/stage")
-
-class Main extends Stage
- elements:
- "header": "header"
- ".content": "content"
- "footer": "footer"
-
- constructor: ->
- # A global stage
- @global = true
- super
-
- append: (elements...) ->
- elements = (e.el or e for e in elements)
- @content.append(elements...)
-
-module.exports = Main
@@ -1,37 +0,0 @@
-$ = jQuery
-
-$.support.touch = ('ontouchstart' of window)
-
-$.preventDefaultTouch = ->
- $('body').bind 'touchmove', (e) -> e.preventDefault()
-
-$.setupTouch = ->
- touch = {}
-
- parentIfText = (node) ->
- if 'tagName' of node then node else node.parentNode
-
- $('body').bind 'touchstart', (e) ->
- e = e.originalEvent
- now = Date.now()
- touch.target = parentIfText(e.touches[0].target)
- touch.x1 = e.touches[0].pageX
- touch.y1 = e.touches[0].pageY
- touch.last = now
- .bind 'touchmove', (e) ->
- e = e.originalEvent
- touch.x2 = e.touches[0].pageX
- touch.y2 = e.touches[0].pageY
- .bind 'touchend', ->
- if 'last' of touch
- $(touch.target).trigger('tap')
- touch = {}
- .bind 'touchcancel', ->
- touch = {}
-
-unless $.support.touch
- $.setupTouch = ->
- $('body').bind 'click', (e) -> $(e.target).trigger('tap')
-
-types = ['swipe', 'swipeLeft', 'swipeRight', 'swipeUp', 'swipeDown', 'doubleTap', 'tap']
-($.fn[type] = (callback) -> @bind(type, callback)) for type in types
View
@@ -1,40 +0,0 @@
-Stage = require("lib/stage")
-
-class Panel extends Stage
- title: false
-
- constructor: ->
- super
-
- @el.addClass("panel")
- @header = $("<header />")
- @header.append($("<h2 />").html(@title)) if @title
- @content = $("<div />").addClass("content")
-
- @append(@header, @content)
-
- html: -> @content.html.apply(@content, arguments)
-
- effects:
- left: ->
- @el.addClass("active")
- @content.gfxSlideIn(direction: "left")
- @header.gfxSlideIn(direction: "left", fade: true, distance: 50)
-
- right: ->
- @el.addClass("active")
- @content.gfxSlideIn(direction: "right")
- @header.gfxSlideIn(direction: "right", fade: true, distance: 50)
-
- reverseEffects:
- left: ->
- @content.gfxSlideOut(direction: "right")
- @header.gfxSlideOut(direction: "right", fade: true, distance: 50)
- @content.queueNext => @el.removeClass("active")
-
- right: ->
- @content.gfxSlideOut(direction: "left")
- @header.gfxSlideOut(direction: "left", fade: true, distance: 50)
- @content.queueNext => @el.removeClass("active")
-
-module.exports = Panel
@@ -1,4 +0,0 @@
-class Contact extends Spine.Model
- @configure "Contact", "name", "email"
-
-module.exports = Contact
@@ -1,3 +0,0 @@
-<div class="item">
- ${name}
-</div>
@@ -1,3 +0,0 @@
-<p>${name}</p>
-
-<p>${email}</p>
View
@@ -1,50 +0,0 @@
-#!/usr/bin/env node
-var stitch = require('stitch'),
- express = require('express'),
- util = require('util'),
- fs = require('fs'),
- argv = process.argv.slice(2);
-
-stitch.compilers.tmpl = function(module, filename) {
- var content = fs.readFileSync(filename, 'utf8');
- content = ["var template = jQuery.template(", JSON.stringify(content), ");",
- "module.exports = (function(data){ return jQuery.tmpl(template, data); });\n"].join("");
- return module._compile(content, filename);
-};
-
-var package = stitch.createPackage({
- paths: [__dirname + '/app'],
- dependencies: [
- __dirname + '/lib/jquery.js',
- __dirname + '/lib/jquery.tmpl.js',
- __dirname + '/lib/spine/spine.js',
- __dirname + '/lib/spine/spine.tmpl.js',
- __dirname + '/lib/spine/spine.manager.js',
- __dirname + '/lib/spine/spine.ajax.js',
- __dirname + '/lib/spine/spine.local.js',
- __dirname + '/lib/spine/spine.route.js',
- __dirname + '/lib/gfx/gfx.js'
- ]
-});
-
-if (argv[0] == "build") {
- return package.compile(function (err, source){
- source = require('uglify-js')(source)
- fs.writeFileSync(__dirname + '/public/application.js', source);
- util.puts('Compiled application.js');
- });
-}
-
-var app = express.createServer();
-
-app.configure(function() {
- app.set('views', __dirname + '/views');
- app.use(express.compiler({ src: __dirname + '/public', enable: ['less'] }));
- app.use(app.router);
- app.use(express.static(__dirname + '/public'));
- app.get('/application.js', package.createServer());
-});
-
-var port = argv[0] || process.env.PORT || 9294;
-util.puts('Starting server on port: ' + port);
-app.listen(port);
View
@@ -0,0 +1,5 @@
+(function() {
+ require('./touch');
+ exports.Stage = require('./stage');
+ exports.Panel = require('./panel');
+}).call(this);
Oops, something went wrong.

0 comments on commit 2be5b88

Please sign in to comment.