Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

turn on stylus. fix some issue with browserify

  • Loading branch information...
commit 6e7ee6f26c0cf14d2ed071ea6151434dae031e9a 1 parent 532c180
Ian Johnson authored
View
3  package.json
@@ -29,7 +29,8 @@
"d3":"3.1.4",
"inlet":"git://github.com/enjalot/Inlet.git",
"underscore":"1.4.4",
- "jquery":"1.8.3",
+ "jquery":"*",
+ "jquery-browserify":"*",
"backbone":"1.0.0",
"codemirror":"3.11.01",
"queue-async": "1.0.1",
View
11 sandbox/templates/inlet.handlebars
@@ -130,6 +130,8 @@
<script src="/static/lib/coffee-script.js"></script>
<script src="/static/lib/jsonlint.js"></script>
+<script src="/static/lib/stylus.js"></script>
+
<!-- three.js should probably be done as a plugin -->
<!--<script src="/static/lib/three.min.js"></script>-->
<script src="/static/lib/three.js"></script>
@@ -189,6 +191,12 @@ tb.events.on("loaded", function() {
tb.events.trigger("execute");
}
);
+ tb.loadPlugin("/static/plugins/tb-screenshot-plugin/plugin.json", {},
+ function(e) { /*console.log("callback: ",e); */}
+ );
+ tb.loadPlugin("/static/plugins/stylus/plugin.json", {},
+ function(e) { /*console.log("callback: ",e); */}
+ );
/*
//example simple plugin
tb.loadPlugin("/static/plugins/simple/plugin.json"
@@ -196,9 +204,6 @@ tb.events.on("loaded", function() {
, function (err) { console.log("plugin load err?", err) }
);
*/
- tb.loadPlugin("/static/plugins/tb-screenshot-plugin/plugin.json", {},
- function(e) { /*console.log("callback: ",e); */}
- );
})
View
4 sandbox/templates/sandbox-templates.js
@@ -32,7 +32,7 @@ function program5(depth0,data) {
stack1 = depth0.fullscreen;
stack1 = helpers['if'].call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(3, program3, data)});
if(stack1 || stack1 === 0) { buffer += stack1; }
- buffer += ">\n <section id=\"files\">\n <ul id=\"file-list\">\n </ul>\n </section>\n\n <section id=\"config\" >\n <button id=\"config-toggle\">Config</button>\n <button id=\"library-toggle\">Add libraries</button>\n <button id=\"fullscreen\">Fullscreen</button>\n\n\n <div id=\"config-content\" class=\"config-content\" style=\"display: none;\">\n <h4>Display <small><i class=\"explain-this-shit icon-help-circled\"></i></small></h4>\n <select>\n <option value=\"svg\">SVG</option>\n <option value=\"canvas\">Canvas</option>\n <option value=\"webgl\">WebGL</option>\n <option value=\"div\">HTML</option>\n </select>\n\n \n\n <div id=\"editorcontrols\">\n <h4>Editor Controls <small><i class=\"explain-this-shit icon-help-circled\"></i></small></h4>\n <button id=\"logerrors\" >Log Errors</button>\n <button id=\"updatecode\" class=\"active\">Auto Update</button>\n </div>\n\n <div id=\"thumbnail-content\">\n <h4>Add thumbnail <small><i class=\"explain-this-shit icon-help-circled\"></i></small></h4>\n <img id=\"trib-thumbnail\" style=\"display:none;\"></img>\n <i id=\"thumb-load\" class=\"icon-load animate-spin\" style=\"opacity: 0;\" original-title=\"\"></i>\n <input type=\"file\" name=\"files[]\" />\n </div>\n\n </div>\n\n <div id=\"library-content\" class=\"config-content\" style=\"display: none;\">\n <ul id=\"library-checklist\">\n <!--\n <li class=\"lib\"> <input type=\"checkbox\" /> Tabletop </li>\n <li class=\"lib\"> <input type=\"checkbox\" /> Paper.js </li>\n <li class=\"lib\"> <input type=\"checkbox\" /> Kartogram </li>\n <li class=\"lib\"> <input type=\"checkbox\" /> TopoJSON </li>\n -->\n </ul>\n <h4>Import URL</h4>\n <ul id=\"library-links\">\n <li class=\"add-link\">Title: <input type=\"text\" class=\"library-title\"> URL: <input type=\"text\" class=\"library-url\">\n <button class=\"add-library\">Add</button>\n </li>\n </ul>\n </div>\n\n </section>\n <section id=\"code\">\n\n </section>\n\n <section id=\"controls\">\n </section>\n\n </aside>\n \n <section id=\"plugins\">\n </section>\n\n</div>\n\n\n<!-- Essential 3rd party libraries (that can't be browserified for now) -->\n<script src=\"/static/lib/coffee-script.js\"></script>\n<script src=\"/static/lib/jsonlint.js\"></script>\n\n<!-- three.js should probably be done as a plugin -->\n<!--<script src=\"/static/lib/three.min.js\"></script>-->\n<script src=\"/static/lib/three.js\"></script>\n<script src=\"/static/lib/Stats.js\"></script>\n\n<!-- 3rd party libs we want available as global variables (should be libs in the add libraries list) -->\n<script src=\"/static/lib/underscore-min.js\"></script>\n<script src=\"/static/lib/queue.min.js\"></script>\n<!-- extra 3rd party libs \nTODO: add these as defualt libs in the list\n<script src=\"http://d3js.org/topojson.v0.min.js\"></script>\n<script src=\"http://d3js.org/d3.geo.projection.v0.min.js\"></script>\n-->\n\n\n<!-- Tributary -->\n<script src=\"/static/tributary.min.js?v=0.9\"></script>\n\n<!-- UI related -->\n<script src=\"/static/lib/handlebars-1.0.rc.1.js\"></script>\n<script src=\"/static/templates.js\"></script>\n<script src=\"/static/tributary-ui.min.js\"></script>\n\n<!-- canvg for screenshots -->\n<script type=\"text/javascript\" src=\"/static/plugins/tb-screenshot-plugin/lib/rgbcolor.js\"></script>\n<script type=\"text/javascript\" src=\"/static/plugins/tb-screenshot-plugin/lib/StackBlur.js\"></script>\n<script type=\"text/javascript\" src=\"/static/plugins/tb-screenshot-plugin/lib/canvg.js\"></script>\n<script type=\"text/javascript\" src=\"/static/plugins/tb-screenshot-plugin/lib/html2canvas.js\"></script>\n\n<script type=\"text/javascript\">\n \n/*\n//get rid of selection when dragging things\nif(typeof document.body.style.MozUserSelect!=\"undefined\")\n document.body.style.MozUserSelect=\"none\";\nelse if(typeof document.body.onselectstart!=\"undefined\")\n document.body.onselectstart=function(){return false};\nelse\n document.body.onmousedown=function(){return false};\ndocument.body.style.cursor = \"default\";\n*/\n\n\nvar tb = Tributary();\ntb._origin = \"";
+ buffer += ">\n <section id=\"files\">\n <ul id=\"file-list\">\n </ul>\n </section>\n\n <section id=\"config\" >\n <button id=\"config-toggle\">Config</button>\n <button id=\"library-toggle\">Add libraries</button>\n <button id=\"fullscreen\">Fullscreen</button>\n\n\n <div id=\"config-content\" class=\"config-content\" style=\"display: none;\">\n <h4>Display <small><i class=\"explain-this-shit icon-help-circled\"></i></small></h4>\n <select>\n <option value=\"svg\">SVG</option>\n <option value=\"canvas\">Canvas</option>\n <option value=\"webgl\">WebGL</option>\n <option value=\"div\">HTML</option>\n </select>\n\n \n\n <div id=\"editorcontrols\">\n <h4>Editor Controls <small><i class=\"explain-this-shit icon-help-circled\"></i></small></h4>\n <button id=\"logerrors\" >Log Errors</button>\n <button id=\"updatecode\" class=\"active\">Auto Update</button>\n </div>\n\n <div id=\"thumbnail-content\">\n <h4>Add thumbnail <small><i class=\"explain-this-shit icon-help-circled\"></i></small></h4>\n <img id=\"trib-thumbnail\" style=\"display:none;\"></img>\n <i id=\"thumb-load\" class=\"icon-load animate-spin\" style=\"opacity: 0;\" original-title=\"\"></i>\n <input type=\"file\" name=\"files[]\" />\n </div>\n\n </div>\n\n <div id=\"library-content\" class=\"config-content\" style=\"display: none;\">\n <ul id=\"library-checklist\">\n <!--\n <li class=\"lib\"> <input type=\"checkbox\" /> Tabletop </li>\n <li class=\"lib\"> <input type=\"checkbox\" /> Paper.js </li>\n <li class=\"lib\"> <input type=\"checkbox\" /> Kartogram </li>\n <li class=\"lib\"> <input type=\"checkbox\" /> TopoJSON </li>\n -->\n </ul>\n <h4>Import URL</h4>\n <ul id=\"library-links\">\n <li class=\"add-link\">Title: <input type=\"text\" class=\"library-title\"> URL: <input type=\"text\" class=\"library-url\">\n <button class=\"add-library\">Add</button>\n </li>\n </ul>\n </div>\n\n </section>\n <section id=\"code\">\n\n </section>\n\n <section id=\"controls\">\n </section>\n\n </aside>\n \n <section id=\"plugins\">\n </section>\n\n</div>\n\n\n<!-- Essential 3rd party libraries (that can't be browserified for now) -->\n<script src=\"/static/lib/coffee-script.js\"></script>\n<script src=\"/static/lib/jsonlint.js\"></script>\n\n<script src=\"/static/lib/stylus.js\"></script>\n\n<!-- three.js should probably be done as a plugin -->\n<!--<script src=\"/static/lib/three.min.js\"></script>-->\n<script src=\"/static/lib/three.js\"></script>\n<script src=\"/static/lib/Stats.js\"></script>\n\n<!-- 3rd party libs we want available as global variables (should be libs in the add libraries list) -->\n<script src=\"/static/lib/underscore-min.js\"></script>\n<script src=\"/static/lib/queue.min.js\"></script>\n<!-- extra 3rd party libs \nTODO: add these as defualt libs in the list\n<script src=\"http://d3js.org/topojson.v0.min.js\"></script>\n<script src=\"http://d3js.org/d3.geo.projection.v0.min.js\"></script>\n-->\n\n\n<!-- Tributary -->\n<script src=\"/static/tributary.min.js?v=0.9\"></script>\n\n<!-- UI related -->\n<script src=\"/static/lib/handlebars-1.0.rc.1.js\"></script>\n<script src=\"/static/templates.js\"></script>\n<script src=\"/static/tributary-ui.min.js\"></script>\n\n<!-- canvg for screenshots -->\n<script type=\"text/javascript\" src=\"/static/plugins/tb-screenshot-plugin/lib/rgbcolor.js\"></script>\n<script type=\"text/javascript\" src=\"/static/plugins/tb-screenshot-plugin/lib/StackBlur.js\"></script>\n<script type=\"text/javascript\" src=\"/static/plugins/tb-screenshot-plugin/lib/canvg.js\"></script>\n<script type=\"text/javascript\" src=\"/static/plugins/tb-screenshot-plugin/lib/html2canvas.js\"></script>\n\n<script type=\"text/javascript\">\n \n/*\n//get rid of selection when dragging things\nif(typeof document.body.style.MozUserSelect!=\"undefined\")\n document.body.style.MozUserSelect=\"none\";\nelse if(typeof document.body.onselectstart!=\"undefined\")\n document.body.onselectstart=function(){return false};\nelse\n document.body.onmousedown=function(){return false};\ndocument.body.style.cursor = \"default\";\n*/\n\n\nvar tb = Tributary();\ntb._origin = \"";
foundHelper = helpers.origin;
if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); }
else { stack1 = depth0.origin; stack1 = typeof stack1 === functionType ? stack1() : stack1; }
@@ -40,6 +40,6 @@ function program5(depth0,data) {
stack1 = depth0.fullscreen;
stack1 = helpers['if'].call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(5, program5, data)});
if(stack1 || stack1 === 0) { buffer += stack1; }
- buffer += "\n\n//decorate the tributary object with the ui logic\nTributaryUi(tb);\n\ntb.ui.setup();\n\ntb.events.on(\"loaded\", function() {\n tb.loadPlugin(\"/static/plugins/play/plugin.json\"\n , {}\n , function (err, pluginId) { /*console.log(\"plugin load err?\", err)*/\n tb.events.trigger(\"execute\");\n }\n );\n /*\n //example simple plugin\n tb.loadPlugin(\"/static/plugins/simple/plugin.json\"\n , {}\n , function (err) { console.log(\"plugin load err?\", err) }\n );\n */\n tb.loadPlugin(\"/static/plugins/tb-screenshot-plugin/plugin.json\", {},\n function(e) { /*console.log(\"callback: \",e); */}\n );\n})\n\n\n$('i').tipsy({fade: true, gravity: 'n', opacity: 0.86});\n</script>\n\n</body>\n</html>\n";
+ buffer += "\n\n//decorate the tributary object with the ui logic\nTributaryUi(tb);\n\ntb.ui.setup();\n\ntb.events.on(\"loaded\", function() {\n tb.loadPlugin(\"/static/plugins/play/plugin.json\"\n , {}\n , function (err, pluginId) { /*console.log(\"plugin load err?\", err)*/\n tb.events.trigger(\"execute\");\n }\n );\n tb.loadPlugin(\"/static/plugins/tb-screenshot-plugin/plugin.json\", {},\n function(e) { /*console.log(\"callback: \",e); */}\n );\n tb.loadPlugin(\"/static/plugins/stylus/plugin.json\", {},\n function(e) { /*console.log(\"callback: \",e); */}\n );\n /*\n //example simple plugin\n tb.loadPlugin(\"/static/plugins/simple/plugin.json\"\n , {}\n , function (err) { console.log(\"plugin load err?\", err) }\n );\n */\n})\n\n\n$('i').tipsy({fade: true, gravity: 'n', opacity: 0.86});\n</script>\n\n</body>\n</html>\n";
return buffer;});
})();
View
2  src/start.js
@@ -2,8 +2,10 @@
var d3 = require('d3');
var queue = require('queue-async');
+//var $ = require('jquery-browserify')
var _ = require('underscore');
var Backbone = require('backbone');
+Backbone.$ = $;
var Inlet = require('inlet');
var cm = require('CodeMirror');
//Third party includes the codemirror modes and addons, as well as jshint
View
1  src/ui/start.js
@@ -1,3 +1,4 @@
var Backbone = require('backbone');
+Backbone.$ = $;
TributaryUi = function(tributary) {
View
14 src/util.js
@@ -106,6 +106,12 @@ Tributary.makeContext = function(options) {
config: config,
model: model,
});
+ } else if(type === "styl") {
+ model.set("mode", "stylus")
+ context = new tributary.StylusContext({
+ config: config,
+ model: model,
+ });
} else if(type === "html") {
model.set("mode", "text/html")
context = new tributary.HTMLContext({
@@ -142,10 +148,10 @@ Tributary.makeContext = function(options) {
}
-d3.selection.prototype.moveToFront = function() {
- return this.each(function() {
- this.parentNode.appendChild(this);
- });
+d3.selection.prototype.moveToFront = function() {
+ return this.each(function() {
+ this.parentNode.appendChild(this);
+ });
};
View
2  static/css/style.css
@@ -566,6 +566,8 @@ px 68 160 252 344 436 528 620 712 804 896 */
/*background-color: #ffffff;*/
+ /*background-color: #ffffff;*/
+
background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(255, 255, 255, 0)), to(rgba(66, 66, 66, 0.6)));
background-image: -webkit-linear-gradient(top, rgba(255, 255, 255, 0), rgba(66, 66, 66, 0.6));
background-image: -moz-linear-gradient(top, rgba(255, 255, 255, 0), rgba(66, 66, 66, 0.6));
View
1  static/header.js
@@ -283,6 +283,7 @@
setThumbnail(image);
} else {
//oops
+ getConfig();
}
})
}
View
1,282 static/lib/stylus.js
@@ -4,9 +4,9 @@ stylus = require('stylus');
},{"stylus":2}],2:[function(require,module,exports){
-module.exports = require('./lib/stylus');
+module.exports = require('./stylus');
-},{"./lib/stylus":3}],3:[function(require,module,exports){
+},{"./stylus":3}],3:[function(require,module,exports){
/*!
* Stylus
@@ -2270,67 +2270,63 @@ exports.merge = function(a, b){
return a;
}
-},{"path":17,"fs":19,"./nodes":12}],23:[function(require,module,exports){
+},{"path":17,"fs":19,"./nodes":12}],12:[function(require,module,exports){
/*!
- * Stylus - errors
+ * Stylus - nodes
* Copyright(c) 2010 LearnBoost <dev@learnboost.com>
* MIT Licensed
*/
/**
- * Expose constructors.
- */
-
-exports.ParseError = ParseError;
-exports.SyntaxError = SyntaxError;
-
-/**
- * Inherit from `Error.prototype`.
- */
-
-SyntaxError.prototype.__proto__ = Error.prototype;
-
-/**
- * Initialize a new `ParseError` with the given `msg`.
- *
- * @param {String} msg
- * @api private
- */
-
-function ParseError(msg) {
- this.name = 'ParseError';
- this.message = msg;
- Error.captureStackTrace(this, ParseError);
-}
-
-/**
- * Inherit from `Error.prototype`.
- */
-
-ParseError.prototype.__proto__ = Error.prototype;
-
-/**
- * Initialize a new `SyntaxError` with the given `msg`.
- *
- * @param {String} msg
- * @api private
+ * Constructors
*/
-function SyntaxError(msg) {
- this.name = 'SyntaxError';
- this.message = msg;
- Error.captureStackTrace(this, ParseError);
-}
+exports.Node = require('./node');
+exports.Root = require('./root');
+exports.Null = require('./null');
+exports.Each = require('./each');
+exports.If = require('./if');
+exports.Call = require('./call');
+exports.Page = require('./page');
+exports.FontFace = require('./fontface');
+exports.UnaryOp = require('./unaryop');
+exports.BinOp = require('./binop');
+exports.Ternary = require('./ternary');
+exports.Block = require('./block');
+exports.Unit = require('./unit');
+exports.String = require('./string');
+exports.HSLA = require('./hsla');
+exports.RGBA = require('./rgba');
+exports.Ident = require('./ident');
+exports.Group = require('./group');
+exports.Literal = require('./literal');
+exports.JSLiteral = require('./jsliteral');
+exports.Boolean = require('./boolean');
+exports.Return = require('./return');
+exports.Media = require('./media');
+exports.Params = require('./params');
+exports.Comment = require('./comment');
+exports.Keyframes = require('./keyframes');
+exports.Charset = require('./charset');
+exports.Import = require('./import');
+exports.Extend = require('./extend');
+exports.Function = require('./function');
+exports.Property = require('./property');
+exports.Selector = require('./selector');
+exports.Expression = require('./expression');
+exports.Arguments = require('./arguments');
+exports.MozDocument = require('./mozdocument');
/**
- * Inherit from `Error.prototype`.
+ * Singletons.
*/
-SyntaxError.prototype.__proto__ = Error.prototype;
-
+exports.true = new exports.Boolean(true);
+exports.false = new exports.Boolean(false);
+exports.null = new exports.Null;
-},{}],24:[function(require,module,exports){
+},{"./node":23,"./root":24,"./null":25,"./each":26,"./if":27,"./call":28,"./page":29,"./fontface":30,"./unaryop":31,"./binop":32,"./ternary":33,"./block":34,"./string":35,"./unit":36,"./hsla":37,"./rgba":38,"./ident":39,"./group":40,"./literal":41,"./jsliteral":42,"./boolean":43,"./return":44,"./media":45,"./params":46,"./comment":47,"./keyframes":48,"./charset":49,"./import":50,"./extend":51,"./property":52,"./function":53,"./selector":54,"./expression":55,"./mozdocument":56,"./arguments":57}],58:[function(require,module,exports){
/*!
* Stylus - Token
@@ -2385,63 +2381,67 @@ Token.prototype.toString = function(){
: this.val).toString();
};
-},{"util":18}],12:[function(require,module,exports){
+},{"util":18}],59:[function(require,module,exports){
/*!
- * Stylus - nodes
+ * Stylus - errors
* Copyright(c) 2010 LearnBoost <dev@learnboost.com>
* MIT Licensed
*/
/**
- * Constructors
+ * Expose constructors.
*/
-exports.Node = require('./node');
-exports.Root = require('./root');
-exports.Null = require('./null');
-exports.Each = require('./each');
-exports.If = require('./if');
-exports.Call = require('./call');
-exports.Page = require('./page');
-exports.FontFace = require('./fontface');
-exports.UnaryOp = require('./unaryop');
-exports.BinOp = require('./binop');
-exports.Ternary = require('./ternary');
-exports.Block = require('./block');
-exports.Unit = require('./unit');
-exports.String = require('./string');
-exports.HSLA = require('./hsla');
-exports.RGBA = require('./rgba');
-exports.Ident = require('./ident');
-exports.Group = require('./group');
-exports.Literal = require('./literal');
-exports.JSLiteral = require('./jsliteral');
-exports.Boolean = require('./boolean');
-exports.Return = require('./return');
-exports.Media = require('./media');
-exports.Params = require('./params');
-exports.Comment = require('./comment');
-exports.Keyframes = require('./keyframes');
-exports.Charset = require('./charset');
-exports.Import = require('./import');
-exports.Extend = require('./extend');
-exports.Function = require('./function');
-exports.Property = require('./property');
-exports.Selector = require('./selector');
-exports.Expression = require('./expression');
-exports.Arguments = require('./arguments');
-exports.MozDocument = require('./mozdocument');
+exports.ParseError = ParseError;
+exports.SyntaxError = SyntaxError;
/**
- * Singletons.
+ * Inherit from `Error.prototype`.
*/
-exports.true = new exports.Boolean(true);
-exports.false = new exports.Boolean(false);
-exports.null = new exports.Null;
+SyntaxError.prototype.__proto__ = Error.prototype;
+
+/**
+ * Initialize a new `ParseError` with the given `msg`.
+ *
+ * @param {String} msg
+ * @api private
+ */
+
+function ParseError(msg) {
+ this.name = 'ParseError';
+ this.message = msg;
+ Error.captureStackTrace(this, ParseError);
+}
+
+/**
+ * Inherit from `Error.prototype`.
+ */
+
+ParseError.prototype.__proto__ = Error.prototype;
+
+/**
+ * Initialize a new `SyntaxError` with the given `msg`.
+ *
+ * @param {String} msg
+ * @api private
+ */
+
+function SyntaxError(msg) {
+ this.name = 'SyntaxError';
+ this.message = msg;
+ Error.captureStackTrace(this, ParseError);
+}
+
+/**
+ * Inherit from `Error.prototype`.
+ */
+
+SyntaxError.prototype.__proto__ = Error.prototype;
+
-},{"./node":25,"./root":26,"./null":27,"./each":28,"./call":29,"./if":30,"./page":31,"./fontface":32,"./unaryop":33,"./binop":34,"./block":35,"./ternary":36,"./unit":37,"./string":38,"./hsla":39,"./rgba":40,"./ident":41,"./group":42,"./literal":43,"./jsliteral":44,"./boolean":45,"./return":46,"./media":47,"./params":48,"./comment":49,"./keyframes":50,"./charset":51,"./import":52,"./extend":53,"./function":54,"./property":55,"./selector":56,"./expression":57,"./arguments":58,"./mozdocument":59}],9:[function(require,module,exports){
+},{}],9:[function(require,module,exports){
/*!
* Stylus - Compiler
* Copyright(c) 2010 LearnBoost <dev@learnboost.com>
@@ -5795,7 +5795,7 @@ Parser.prototype = {
}
};
-},{"util":18,"./lexer":64,"./token":24,"./errors":23,"./nodes":12,"debug":65}],7:[function(require,module,exports){
+},{"util":18,"./lexer":64,"./token":58,"./errors":59,"./nodes":12,"debug":65}],7:[function(require,module,exports){
(function(){/*!
* Stylus - middleware
* Copyright(c) 2010 LearnBoost <dev@learnboost.com>
@@ -6817,7 +6817,7 @@ Lexer.prototype = {
}
};
-},{"./token":24,"./errors":23,"./units":60,"./nodes":12}],22:[function(require,module,exports){
+},{"./token":58,"./units":60,"./errors":59,"./nodes":12}],22:[function(require,module,exports){
/*!
* Stylus - Normalizer
@@ -7100,136 +7100,73 @@ Normalizer.prototype.compileSelectors = function(arr){
return selectors;
};
-},{"fs":19,"../utils":6,"./":14,"../nodes":12}],65:[function(require,module,exports){
+},{"fs":19,"../utils":6,"./":14,"../nodes":12}],24:[function(require,module,exports){
+
+/*!
+ * Stylus - Root
+ * Copyright(c) 2010 LearnBoost <dev@learnboost.com>
+ * MIT Licensed
+ */
/**
- * Expose `debug()` as the module.
+ * Module dependencies.
*/
-module.exports = debug;
+var Node = require('./node');
/**
- * Create a debugger with the given `name`.
+ * Initialize a new `Root` node.
*
- * @param {String} name
- * @return {Type}
* @api public
*/
-function debug(name) {
- if (!debug.enabled(name)) return function(){};
-
- return function(fmt){
- var curr = new Date;
- var ms = curr - (debug[name] || curr);
- debug[name] = curr;
-
- fmt = name
- + ' '
- + fmt
- + ' +' + debug.humanize(ms);
-
- // This hackery is required for IE8
- // where `console.log` doesn't have 'apply'
- window.console
- && console.log
- && Function.prototype.apply.call(console.log, console, arguments);
- }
-}
+var Root = module.exports = function Root(){
+ this.nodes = [];
+};
/**
- * The currently active debug mode names.
+ * Inherit from `Node.prototype`.
*/
-debug.names = [];
-debug.skips = [];
+Root.prototype.__proto__ = Node.prototype;
/**
- * Enables a debug mode by name. This can include modes
- * separated by a colon and wildcards.
+ * Push a `node` to this block.
*
- * @param {String} name
+ * @param {Node} node
* @api public
*/
-debug.enable = function(name) {
- try {
- localStorage.debug = name;
- } catch(e){}
-
- var split = (name || '').split(/[\s,]+/)
- , len = split.length;
-
- for (var i = 0; i < len; i++) {
- name = split[i].replace('*', '.*?');
- if (name[0] === '-') {
- debug.skips.push(new RegExp('^' + name.substr(1) + '$'));
- }
- else {
- debug.names.push(new RegExp('^' + name + '$'));
- }
- }
+Root.prototype.push = function(node){
+ this.nodes.push(node);
};
/**
- * Disable debug output.
+ * Unshift a `node` to this block.
*
+ * @param {Node} node
* @api public
*/
-debug.disable = function(){
- debug.enable('');
+Root.prototype.unshift = function(node){
+ this.nodes.unshift(node);
};
/**
- * Humanize the given `ms`.
+ * Return "root".
*
- * @param {Number} m
* @return {String}
- * @api private
+ * @api public
*/
-debug.humanize = function(ms) {
- var sec = 1000
- , min = 60 * 1000
- , hour = 60 * min;
-
- if (ms >= hour) return (ms / hour).toFixed(1) + 'h';
- if (ms >= min) return (ms / min).toFixed(1) + 'm';
- if (ms >= sec) return (ms / sec | 0) + 's';
- return ms + 'ms';
-};
-
-/**
- * Returns true if the given mode name is enabled, false otherwise.
- *
- * @param {String} name
- * @return {Boolean}
- * @api public
- */
-
-debug.enabled = function(name) {
- for (var i = 0, len = debug.skips.length; i < len; i++) {
- if (debug.skips[i].test(name)) {
- return false;
- }
- }
- for (var i = 0, len = debug.names.length; i < len; i++) {
- if (debug.names[i].test(name)) {
- return true;
- }
- }
- return false;
+Root.prototype.toString = function(){
+ return '[Root]';
};
-// persist
-
-if (window.localStorage) debug.enable(localStorage.debug);
-
-},{}],26:[function(require,module,exports){
+},{"./node":23}],27:[function(require,module,exports){
/*!
- * Stylus - Root
+ * Stylus - If
* Copyright(c) 2010 LearnBoost <dev@learnboost.com>
* MIT Licensed
*/
@@ -7241,55 +7178,50 @@ if (window.localStorage) debug.enable(localStorage.debug);
var Node = require('./node');
/**
- * Initialize a new `Root` node.
+ * Initialize a new `If` with the given `cond`.
*
+ * @param {Expression} cond
+ * @param {Boolean|Block} negate, block
* @api public
*/
-var Root = module.exports = function Root(){
- this.nodes = [];
+var If = module.exports = function If(cond, negate){
+ Node.call(this);
+ this.cond = cond;
+ this.elses = [];
+ if (negate && negate.nodeName) {
+ this.block = negate;
+ } else {
+ this.negate = negate;
+ }
};
/**
* Inherit from `Node.prototype`.
*/
-Root.prototype.__proto__ = Node.prototype;
-
-/**
- * Push a `node` to this block.
- *
- * @param {Node} node
- * @api public
- */
-
-Root.prototype.push = function(node){
- this.nodes.push(node);
-};
-
-/**
- * Unshift a `node` to this block.
- *
- * @param {Node} node
- * @api public
- */
-
-Root.prototype.unshift = function(node){
- this.nodes.unshift(node);
-};
+If.prototype.__proto__ = Node.prototype;
/**
- * Return "root".
- *
- * @return {String}
+ * Return a clone of this node.
+ *
+ * @return {Node}
* @api public
*/
-Root.prototype.toString = function(){
- return '[Root]';
+If.prototype.clone = function(){
+ var cond = this.cond.clone()
+ , block = this.block.clone();
+ var clone = new If(cond, block);
+ clone.elses = this.elses.map(function(node){ return node.clone(); });
+ clone.negate = this.negate;
+ clone.postfix = this.postfix;
+ clone.lineno = this.lineno;
+ clone.filename = this.filename;
+ return clone;
};
-},{"./node":25}],29:[function(require,module,exports){
+},{"./node":23}],28:[function(require,module,exports){
/*!
* Stylus - Call
@@ -7347,65 +7279,7 @@ Call.prototype.clone = function(){
Call.prototype.toString = function(){
return this.name + '()';
};
-},{"./node":25}],30:[function(require,module,exports){
-
-/*!
- * Stylus - If
- * Copyright(c) 2010 LearnBoost <dev@learnboost.com>
- * MIT Licensed
- */
-
-/**
- * Module dependencies.
- */
-
-var Node = require('./node');
-
-/**
- * Initialize a new `If` with the given `cond`.
- *
- * @param {Expression} cond
- * @param {Boolean|Block} negate, block
- * @api public
- */
-
-var If = module.exports = function If(cond, negate){
- Node.call(this);
- this.cond = cond;
- this.elses = [];
- if (negate && negate.nodeName) {
- this.block = negate;
- } else {
- this.negate = negate;
- }
-};
-
-/**
- * Inherit from `Node.prototype`.
- */
-
-If.prototype.__proto__ = Node.prototype;
-
-/**
- * Return a clone of this node.
- *
- * @return {Node}
- * @api public
- */
-
-If.prototype.clone = function(){
- var cond = this.cond.clone()
- , block = this.block.clone();
- var clone = new If(cond, block);
- clone.elses = this.elses.map(function(node){ return node.clone(); });
- clone.negate = this.negate;
- clone.postfix = this.postfix;
- clone.lineno = this.lineno;
- clone.filename = this.filename;
- return clone;
-};
-
-},{"./node":25}],31:[function(require,module,exports){
+},{"./node":23}],29:[function(require,module,exports){
/*!
* Stylus - Page
@@ -7450,7 +7324,7 @@ Page.prototype.toString = function(){
return '@page ' + this.selector;
};
-},{"./node":25}],32:[function(require,module,exports){
+},{"./node":23}],30:[function(require,module,exports){
/*!
* Stylus - FontFace
@@ -7507,7 +7381,7 @@ FontFace.prototype.toString = function(){
return '@font-face';
};
-},{"./node":25}],33:[function(require,module,exports){
+},{"./node":23}],31:[function(require,module,exports){
/*!
* Stylus - UnaryOp
@@ -7554,7 +7428,7 @@ UnaryOp.prototype.clone = function(){
clone.filename = this.filename;
return clone;
};
-},{"./node":25}],34:[function(require,module,exports){
+},{"./node":23}],32:[function(require,module,exports){
/*!
* Stylus - BinOp
@@ -7609,7 +7483,59 @@ BinOp.prototype.clone = function(){
if (this.val) clone.val = this.val.clone();
return clone;
};
-},{"./node":25}],35:[function(require,module,exports){
+},{"./node":23}],33:[function(require,module,exports){
+
+/*!
+ * Stylus - Ternary
+ * Copyright(c) 2010 LearnBoost <dev@learnboost.com>
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var Node = require('./node');
+
+/**
+ * Initialize a new `Ternary` with `cond`, `trueExpr` and `falseExpr`.
+ *
+ * @param {Expression} cond
+ * @param {Expression} trueExpr
+ * @param {Expression} falseExpr
+ * @api public
+ */
+
+var Ternary = module.exports = function Ternary(cond, trueExpr, falseExpr){
+ Node.call(this);
+ this.cond = cond;
+ this.trueExpr = trueExpr;
+ this.falseExpr = falseExpr;
+};
+
+/**
+ * Inherit from `Node.prototype`.
+ */
+
+Ternary.prototype.__proto__ = Node.prototype;
+
+/**
+ * Return a clone of this node.
+ *
+ * @return {Node}
+ * @api public
+ */
+
+Ternary.prototype.clone = function(){
+ var clone = new Ternary(
+ this.cond.clone()
+ , this.trueExpr.clone()
+ , this.falseExpr.clone());
+ clone.lineno = this.lineno;
+ clone.filename = this.filename;
+ return clone;
+};
+},{"./node":23}],34:[function(require,module,exports){
/*!
* Stylus - Block
@@ -7710,59 +7636,7 @@ Block.prototype.push = function(node){
this.nodes.push(node);
};
-},{"./node":25}],36:[function(require,module,exports){
-
-/*!
- * Stylus - Ternary
- * Copyright(c) 2010 LearnBoost <dev@learnboost.com>
- * MIT Licensed
- */
-
-/**
- * Module dependencies.
- */
-
-var Node = require('./node');
-
-/**
- * Initialize a new `Ternary` with `cond`, `trueExpr` and `falseExpr`.
- *
- * @param {Expression} cond
- * @param {Expression} trueExpr
- * @param {Expression} falseExpr
- * @api public
- */
-
-var Ternary = module.exports = function Ternary(cond, trueExpr, falseExpr){
- Node.call(this);
- this.cond = cond;
- this.trueExpr = trueExpr;
- this.falseExpr = falseExpr;
-};
-
-/**
- * Inherit from `Node.prototype`.
- */
-
-Ternary.prototype.__proto__ = Node.prototype;
-
-/**
- * Return a clone of this node.
- *
- * @return {Node}
- * @api public
- */
-
-Ternary.prototype.clone = function(){
- var clone = new Ternary(
- this.cond.clone()
- , this.trueExpr.clone()
- , this.falseExpr.clone());
- clone.lineno = this.lineno;
- clone.filename = this.filename;
- return clone;
-};
-},{"./node":25}],42:[function(require,module,exports){
+},{"./node":23}],40:[function(require,module,exports){
/*!
* Stylus - Group
@@ -7844,7 +7718,7 @@ Group.prototype.clone = function(){
return clone;
};
-},{"./node":25}],48:[function(require,module,exports){
+},{"./node":23}],46:[function(require,module,exports){
/*!
* Stylus - Params
@@ -7918,7 +7792,7 @@ Params.prototype.clone = function(){
};
-},{"./node":25}],49:[function(require,module,exports){
+},{"./node":23}],47:[function(require,module,exports){
/*!
* Stylus - Comment
@@ -7952,7 +7826,7 @@ var Comment = module.exports = function Comment(str, suppress){
Comment.prototype.__proto__ = Node.prototype;
-},{"./node":25}],50:[function(require,module,exports){
+},{"./node":23}],48:[function(require,module,exports){
/*!
* Stylus - Keyframes
@@ -8032,7 +7906,7 @@ Keyframes.prototype.toString = function(){
return '@keyframes ' + this.name;
};
-},{"./node":25}],52:[function(require,module,exports){
+},{"./node":23}],50:[function(require,module,exports){
/*!
* Stylus - Import
@@ -8064,7 +7938,7 @@ var Import = module.exports = function Import(expr){
Import.prototype.__proto__ = Node.prototype;
-},{"./node":25}],53:[function(require,module,exports){
+},{"./node":23}],51:[function(require,module,exports){
/*!
* Stylus - Extend
@@ -8118,10 +7992,10 @@ Extend.prototype.toString = function(){
return '@extend ' + this.selector;
};
-},{"./node":25}],54:[function(require,module,exports){
+},{"./node":23}],52:[function(require,module,exports){
/*!
- * Stylus - Function
+ * Stylus - Property
* Copyright(c) 2010 LearnBoost <dev@learnboost.com>
* MIT Licensed
*/
@@ -8133,12 +8007,87 @@ Extend.prototype.toString = function(){
var Node = require('./node');
/**
- * Initialize a new `Function` with `name`, `params`, and `body`.
+ * Initialize a new `Property` with the given `segs` and optional `expr`.
*
- * @param {String} name
- * @param {Params|Function} params
- * @param {Block} body
- * @api public
+ * @param {Array} segs
+ * @param {Expression} expr
+ * @api public
+ */
+
+var Property = module.exports = function Property(segs, expr){
+ Node.call(this);
+ this.segments = segs;
+ this.expr = expr;
+};
+
+/**
+ * Inherit from `Node.prototype`.
+ */
+
+Property.prototype.__proto__ = Node.prototype;
+
+/**
+ * Return a clone of this node.
+ *
+ * @return {Node}
+ * @api public
+ */
+
+Property.prototype.clone = function(){
+ var clone = new Property(this.segments);
+ clone.name = this.name;
+ clone.lineno = this.lineno;
+ clone.filename = this.filename;
+ clone.segments = this.segments.map(function(node){ return node.clone(); });
+ if (this.expr) clone.expr = this.expr.clone();
+ return clone;
+};
+
+/**
+ * Return string representation of this node.
+ *
+ * @return {String}
+ * @api public
+ */
+
+Property.prototype.toString = function(){
+ return 'property(' + this.segments.join('') + ', ' + this.expr + ')';
+};
+
+/**
+ * Operate on the property expression.
+ *
+ * @param {String} op
+ * @param {Node} right
+ * @return {Node}
+ * @api public
+ */
+
+Property.prototype.operate = function(op, right, val){
+ return this.expr.operate(op, right, val);
+};
+
+},{"./node":23}],53:[function(require,module,exports){
+
+/*!
+ * Stylus - Function
+ * Copyright(c) 2010 LearnBoost <dev@learnboost.com>
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var Node = require('./node');
+
+/**
+ * Initialize a new `Function` with `name`, `params`, and `body`.
+ *
+ * @param {String} name
+ * @param {Params|Function} params
+ * @param {Block} body
+ * @api public
*/
var Function = module.exports = function Function(name, params, body){
@@ -8224,82 +8173,7 @@ Function.prototype.toString = function(){
}
};
-},{"./node":25}],55:[function(require,module,exports){
-
-/*!
- * Stylus - Property
- * Copyright(c) 2010 LearnBoost <dev@learnboost.com>
- * MIT Licensed
- */
-
-/**
- * Module dependencies.
- */
-
-var Node = require('./node');
-
-/**
- * Initialize a new `Property` with the given `segs` and optional `expr`.
- *
- * @param {Array} segs
- * @param {Expression} expr
- * @api public
- */
-
-var Property = module.exports = function Property(segs, expr){
- Node.call(this);
- this.segments = segs;
- this.expr = expr;
-};
-
-/**
- * Inherit from `Node.prototype`.
- */
-
-Property.prototype.__proto__ = Node.prototype;
-
-/**
- * Return a clone of this node.
- *
- * @return {Node}
- * @api public
- */
-
-Property.prototype.clone = function(){
- var clone = new Property(this.segments);
- clone.name = this.name;
- clone.lineno = this.lineno;
- clone.filename = this.filename;
- clone.segments = this.segments.map(function(node){ return node.clone(); });
- if (this.expr) clone.expr = this.expr.clone();
- return clone;
-};
-
-/**
- * Return string representation of this node.
- *
- * @return {String}
- * @api public
- */
-
-Property.prototype.toString = function(){
- return 'property(' + this.segments.join('') + ', ' + this.expr + ')';
-};
-
-/**
- * Operate on the property expression.
- *
- * @param {String} op
- * @param {Node} right
- * @return {Node}
- * @api public
- */
-
-Property.prototype.operate = function(op, right, val){
- return this.expr.operate(op, right, val);
-};
-
-},{"./node":25}],56:[function(require,module,exports){
+},{"./node":23}],54:[function(require,module,exports){
/*!
* Stylus - Selector
@@ -8359,7 +8233,7 @@ Selector.prototype.clone = function(){
return clone;
};
-},{"./block":35,"./node":25}],66:[function(require,module,exports){
+},{"./block":34,"./node":23}],66:[function(require,module,exports){
(function(process){var path = require('path');
var fs = require('fs');
@@ -10033,7 +9907,7 @@ Converter.prototype.visitStyle = function(node){
--this.indents;
return buf + '\n';
};
-},{"cssom":69}],25:[function(require,module,exports){
+},{"cssom":69}],23:[function(require,module,exports){
/*!
* Stylus - Node
@@ -10258,7 +10132,7 @@ Node.prototype.coerce = function(other){
throw new CoercionError('cannot coerce ' + other + ' to ' + this.nodeName);
};
-},{"../visitor/evaluator":8,"../utils":6,"./":12}],27:[function(require,module,exports){
+},{"../visitor/evaluator":8,"../utils":6,"./":12}],25:[function(require,module,exports){
/*!
* Stylus - Null
@@ -10331,7 +10205,7 @@ Null.prototype.__defineGetter__('isNull', function(){
Null.prototype.__defineGetter__('hash', function(){
return null;
});
-},{"./node":25,"./":12}],28:[function(require,module,exports){
+},{"./node":23,"./":12}],26:[function(require,module,exports){
/*!
* Stylus - Each
@@ -10388,7 +10262,131 @@ Each.prototype.clone = function(){
clone.filename = this.filename;
return clone;
};
-},{"./node":25,"./":12}],37:[function(require,module,exports){
+},{"./node":23,"./":12}],35:[function(require,module,exports){
+
+/*!
+ * Stylus - String
+ * Copyright(c) 2010 LearnBoost <dev@learnboost.com>
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var Node = require('./node')
+ , sprintf = require('../functions').s
+ , utils = require('../utils')
+ , nodes = require('./');
+
+/**
+ * Initialize a new `String` with the given `val`.
+ *
+ * @param {String} val
+ * @param {String} quote
+ * @api public
+ */
+
+var String = module.exports = function String(val, quote){
+ Node.call(this);
+ this.val = val;
+ this.string = val;
+ this.quote = quote || "'";
+};
+
+/**
+ * Inherit from `Node.prototype`.
+ */
+
+String.prototype.__proto__ = Node.prototype;
+
+/**
+ * Return quoted string.
+ *
+ * @return {String}
+ * @api public
+ */
+
+String.prototype.toString = function(){
+ return this.quote + this.val + this.quote;
+};
+
+/**
+ * Return a clone of this node.
+ *
+ * @return {Node}
+ * @api public
+ */
+
+String.prototype.clone = function(){
+ var clone = new String(this.val, this.quote);
+ clone.lineno = this.lineno;
+ clone.filename = this.filename;
+ return clone;
+};
+
+/**
+ * Return Boolean based on the length of this string.
+ *
+ * @return {Boolean}
+ * @api public
+ */
+
+String.prototype.toBoolean = function(){
+ return nodes.Boolean(this.val.length);
+};
+
+/**
+ * Coerce `other` to a string.
+ *
+ * @param {Node} other
+ * @return {String}
+ * @api public
+ */
+
+String.prototype.coerce = function(other){
+ switch (other.nodeName) {
+ case 'string':
+ return other;
+ case 'expression':
+ return new String(other.nodes.map(function(node){
+ return this.coerce(node).val;
+ }, this).join(' '));
+ default:
+ return new String(other.toString());
+ }
+};
+
+/**
+ * Operate on `right` with the given `op`.
+ *
+ * @param {String} op
+ * @param {Node} right
+ * @return {Node}
+ * @api public
+ */
+
+String.prototype.operate = function(op, right){
+ switch (op) {
+ case '%':
+ var expr = new nodes.Expression;
+ expr.push(this);
+
+ // constructargs
+ var args = 'expression' == right.nodeName
+ ? utils.unwrap(right).nodes
+ : [right];
+
+ // apply
+ return sprintf.apply(null, [expr].concat(args));
+ case '+':
+ return new String(this.val + this.coerce(right).val);
+ default:
+ return Node.prototype.operate.call(this, op, right);
+ }
+};
+
+},{"../utils":6,"./node":23,"../functions":13,"./":12}],36:[function(require,module,exports){
/*!
* Stylus - Unit
@@ -10580,149 +10578,25 @@ Unit.prototype.coerce = function(other){
switch (b.type) {
case 'kHz':
return new nodes.Unit(b.val * 1000, 'Hz');
- }
- case 'kHz':
- switch (b.type) {
- case 'Hz':
- return new nodes.Unit(b.val / 1000, 'kHz');
- }
- default:
- return new nodes.Unit(b.val, a.type);
- }
- } else if ('string' == other.nodeName) {
- var val = parseInt(other.val, 10);
- if (isNaN(val)) Node.prototype.coerce.call(this, other);
- return new nodes.Unit(val);
- } else {
- return Node.prototype.coerce.call(this, other);
- }
-};
-
-},{"./node":25,"./":12}],38:[function(require,module,exports){
-
-/*!
- * Stylus - String
- * Copyright(c) 2010 LearnBoost <dev@learnboost.com>
- * MIT Licensed
- */
-
-/**
- * Module dependencies.
- */
-
-var Node = require('./node')
- , sprintf = require('../functions').s
- , utils = require('../utils')
- , nodes = require('./');
-
-/**
- * Initialize a new `String` with the given `val`.
- *
- * @param {String} val
- * @param {String} quote
- * @api public
- */
-
-var String = module.exports = function String(val, quote){
- Node.call(this);
- this.val = val;
- this.string = val;
- this.quote = quote || "'";
-};
-
-/**
- * Inherit from `Node.prototype`.
- */
-
-String.prototype.__proto__ = Node.prototype;
-
-/**
- * Return quoted string.
- *
- * @return {String}
- * @api public
- */
-
-String.prototype.toString = function(){
- return this.quote + this.val + this.quote;
-};
-
-/**
- * Return a clone of this node.
- *
- * @return {Node}
- * @api public
- */
-
-String.prototype.clone = function(){
- var clone = new String(this.val, this.quote);
- clone.lineno = this.lineno;
- clone.filename = this.filename;
- return clone;
-};
-
-/**
- * Return Boolean based on the length of this string.
- *
- * @return {Boolean}
- * @api public
- */
-
-String.prototype.toBoolean = function(){
- return nodes.Boolean(this.val.length);
-};
-
-/**
- * Coerce `other` to a string.
- *
- * @param {Node} other
- * @return {String}
- * @api public
- */
-
-String.prototype.coerce = function(other){
- switch (other.nodeName) {
- case 'string':
- return other;
- case 'expression':
- return new String(other.nodes.map(function(node){
- return this.coerce(node).val;
- }, this).join(' '));
- default:
- return new String(other.toString());
- }
-};
-
-/**
- * Operate on `right` with the given `op`.
- *
- * @param {String} op
- * @param {Node} right
- * @return {Node}
- * @api public
- */
-
-String.prototype.operate = function(op, right){
- switch (op) {
- case '%':
- var expr = new nodes.Expression;
- expr.push(this);
-
- // constructargs
- var args = 'expression' == right.nodeName
- ? utils.unwrap(right).nodes
- : [right];
-
- // apply
- return sprintf.apply(null, [expr].concat(args));
- case '+':
- return new String(this.val + this.coerce(right).val);
- default:
- return Node.prototype.operate.call(this, op, right);
+ }
+ case 'kHz':
+ switch (b.type) {
+ case 'Hz':
+ return new nodes.Unit(b.val / 1000, 'kHz');
+ }
+ default:
+ return new nodes.Unit(b.val, a.type);
+ }
+ } else if ('string' == other.nodeName) {
+ var val = parseInt(other.val, 10);
+ if (isNaN(val)) Node.prototype.coerce.call(this, other);
+ return new nodes.Unit(val);
+ } else {
+ return Node.prototype.coerce.call(this, other);
}
};
-},{"./node":25,"../utils":6,"../functions":13,"./":12}],39:[function(require,module,exports){
+},{"./node":23,"./":12}],37:[function(require,module,exports){
/*!
* Stylus - HSLA
@@ -10980,7 +10854,7 @@ function clampAlpha(n) {
return Math.max(0, Math.min(n, 1));
}
-},{"./node":25,"./":12}],40:[function(require,module,exports){
+},{"./node":23,"./":12}],38:[function(require,module,exports){
/*!
* Stylus - RGBA
@@ -11319,7 +11193,7 @@ function clampAlpha(n) {
return Math.max(0, Math.min(n, 1));
}
-},{"./node":25,"./hsla":39,"../functions":13,"./":12}],41:[function(require,module,exports){
+},{"./node":23,"./hsla":37,"../functions":13,"./":12}],39:[function(require,module,exports){
/*!
* Stylus - Ident
@@ -11448,7 +11322,7 @@ Ident.prototype.operate = function(op, right){
return Node.prototype.operate.call(this, op, right);
};
-},{"./node":25,"./":12}],43:[function(require,module,exports){
+},{"./node":23,"./":12}],41:[function(require,module,exports){
/*!
* Stylus - Literal
@@ -11542,7 +11416,7 @@ Literal.prototype.operate = function(op, right){
}
};
-},{"./node":25,"./":12}],44:[function(require,module,exports){
+},{"./node":23,"./":12}],42:[function(require,module,exports){
/*!
* Stylus - JSLiteral
@@ -11576,7 +11450,7 @@ var JSLiteral = module.exports = function JSLiteral(str){
JSLiteral.prototype.__proto__ = Node.prototype;
-},{"./node":25,"./":12}],45:[function(require,module,exports){
+},{"./node":23,"./":12}],43:[function(require,module,exports){
/*!
* Stylus - Boolean
@@ -11680,10 +11554,10 @@ Boolean.prototype.toString = function(){
? 'true'
: 'false';
};
-},{"./node":25,"./":12}],46:[function(require,module,exports){
+},{"./node":23,"./":12}],45:[function(require,module,exports){
/*!
- * Stylus - Return
+ * Stylus - Media
* Copyright(c) 2010 LearnBoost <dev@learnboost.com>
* MIT Licensed
*/
@@ -11696,39 +11570,51 @@ var Node = require('./node')
, nodes = require('./');
/**
- * Initialize a new `Return` node with the given `expr`.
+ * Initialize a new `Media` with the given `val`
*
- * @param {Expression} expr
+ * @param {String} val
* @api public
*/
-var Return = module.exports = function Return(expr){
- this.expr = expr || nodes.null;
+var Media = module.exports = function Media(val){
+ Node.call(this);
+ this.val = val;
};
/**
* Inherit from `Node.prototype`.
*/
-Return.prototype.__proto__ = Node.prototype;
+Media.prototype.__proto__ = Node.prototype;
/**
- * Return a clone of this node.
- *
- * @return {Node}
+ * Clone this node.
+ *
+ * @return {Media}
* @api public
*/
-Return.prototype.clone = function(){
- var clone = new Return(this.expr.clone());
- clone.lineno = this.lineno;
- clone.filename = this.filename;
+Media.prototype.clone = function(){
+ var clone = new Media(this.val);
+ clone.block = this.block.clone();
return clone;
};
-},{"./node":25,"./":12}],47:[function(require,module,exports){
+
+/**
+ * Return @media "val".
+ *
+ * @return {String}
+ * @api public
+ */
+
+Media.prototype.toString = function(){
+ return '@media ' + this.val;
+};
+
+},{"./node":23,"./":12}],44:[function(require,module,exports){
/*!
- * Stylus - Media
+ * Stylus - Return
* Copyright(c) 2010 LearnBoost <dev@learnboost.com>
* MIT Licensed
*/
@@ -11741,48 +11627,36 @@ var Node = require('./node')
, nodes = require('./');
/**
- * Initialize a new `Media` with the given `val`
+ * Initialize a new `Return` node with the given `expr`.
*
- * @param {String} val
+ * @param {Expression} expr
* @api public
*/
-var Media = module.exports = function Media(val){
- Node.call(this);
- this.val = val;
+var Return = module.exports = function Return(expr){
+ this.expr = expr || nodes.null;
};
/**
* Inherit from `Node.prototype`.
*/
-Media.prototype.__proto__ = Node.prototype;
+Return.prototype.__proto__ = Node.prototype;
/**
- * Clone this node.
- *
- * @return {Media}
+ * Return a clone of this node.
+ *
+ * @return {Node}
* @api public
*/
-Media.prototype.clone = function(){
- var clone = new Media(this.val);
- clone.block = this.block.clone();
+Return.prototype.clone = function(){
+ var clone = new Return(this.expr.clone());
+ clone.lineno = this.lineno;
+ clone.filename = this.filename;
return clone;
};
-
-/**
- * Return @media "val".
- *
- * @return {String}
- * @api public
- */
-
-Media.prototype.toString = function(){
- return '@media ' + this.val;
-};
-
-},{"./node":25,"./":12}],51:[function(require,module,exports){
+},{"./node":23,"./":12}],49:[function(require,module,exports){
/*!
* Stylus - Charset
@@ -11826,7 +11700,7 @@ Charset.prototype.toString = function(){
return '@charset ' + this.val;
};
-},{"./node":25,"./":12}],57:[function(require,module,exports){
+},{"./node":23,"./":12}],55:[function(require,module,exports){
/*!
* Stylus - Expression
@@ -12021,7 +11895,28 @@ Expression.prototype.toString = function(){
};
-},{"./node":25,"../utils":6,"../nodes":12}],58:[function(require,module,exports){
+},{"./node":23,"../utils":6,"../nodes":12}],56:[function(require,module,exports){
+var Node = require('./node')
+ , nodes = require('./');
+
+var MozDocument = module.exports = function MozDocument(val){
+ Node.call(this);
+ this.val = val;
+};
+
+MozDocument.prototype.__proto__ = Node.prototype;
+
+MozDocument.prototype.clone = function(){
+ var clone = new MozDocument(this.val);
+ clone.block = this.block.clone();
+ return clone;
+};
+
+MozDocument.prototype.toString = function(){
+ return '@-moz-document ' + this.val;
+}
+
+},{"./node":23,"./":12}],57:[function(require,module,exports){
/*!
* Stylus - Arguments
@@ -12088,28 +11983,7 @@ Arguments.prototype.clone = function(){
};
-},{"./node":25,"../utils":6,"../nodes":12}],59:[function(require,module,exports){
-var Node = require('./node')
- , nodes = require('./');
-
-var MozDocument = module.exports = function MozDocument(val){
- Node.call(this);
- this.val = val;
-};
-
-MozDocument.prototype.__proto__ = Node.prototype;
-
-MozDocument.prototype.clone = function(){
- var clone = new MozDocument(this.val);
- clone.block = this.block.clone();
- return clone;
-};
-
-MozDocument.prototype.toString = function(){
- return '@-moz-document ' + this.val;
-}
-
-},{"./node":25,"./":12}],70:[function(require,module,exports){
+},{"./node":23,"../utils":6,"../nodes":12}],70:[function(require,module,exports){
require=(function(e,t,n,r){function i(r){if(!n[r]){if(!t[r]){if(e)return e(r);throw new Error("Cannot find module '"+r+"'")}var s=n[r]={exports:{}};t[r][0](function(e){var n=t[r][1][e];return i(n?n:e)},s,s.exports)}return n[r].exports}for(var s=0;s<r.length;s++)i(r[s]);return i})(typeof require!=="undefined"&&require,{1:[function(require,module,exports){
exports.readIEEE754 = function(buffer, offset, isBE, mLen, nBytes) {
var e, m,
@@ -16619,7 +16493,7 @@ CSSOM.CSSMediaRule.prototype.__defineGetter__("cssText", function() {
exports.CSSMediaRule = CSSOM.CSSMediaRule;
///CommonJS
-},{"./MediaList":74,"./CSSRule":72}],76:[function(require,module,exports){
+},{"./CSSRule":72,"./MediaList":74}],76:[function(require,module,exports){
//.CommonJS
var CSSOM = {
CSSRule: require("./CSSRule").CSSRule,
@@ -17293,7 +17167,7 @@ CSSOM.CSSKeyframeRule = require('./CSSKeyframeRule').CSSKeyframeRule;
CSSOM.CSSKeyframesRule = require('./CSSKeyframesRule').CSSKeyframesRule;
///CommonJS
-},{"./CSSStyleSheet":79,"./CSSStyleRule":73,"./CSSImportRule":76,"./CSSMediaRule":75,"./CSSFontFaceRule":77,"./CSSStyleDeclaration":71,"./CSSKeyframesRule":80,"./CSSKeyframeRule":81}],83:[function(require,module,exports){
+},{"./CSSStyleSheet":79,"./CSSStyleRule":73,"./CSSImportRule":76,"./CSSMediaRule":75,"./CSSFontFaceRule":77,"./CSSStyleDeclaration":71,"./CSSKeyframeRule":81,"./CSSKeyframesRule":80}],83:[function(require,module,exports){
//.CommonJS
var CSSOM = {
CSSStyleSheet: require("./CSSStyleSheet").CSSStyleSheet,
@@ -17371,5 +17245,131 @@ CSSOM.clone = function clone(stylesheet) {
exports.clone = CSSOM.clone;
///CommonJS
-},{"./CSSStyleSheet":79,"./CSSStyleRule":73,"./CSSMediaRule":75,"./CSSStyleDeclaration":71,"./CSSKeyframeRule":81,"./CSSKeyframesRule":80}]},{},[1])
-;
+},{"./CSSStyleSheet":79,"./CSSStyleRule":73,"./CSSMediaRule":75,"./CSSStyleDeclaration":71,"./CSSKeyframeRule":81,"./CSSKeyframesRule":80}],65:[function(require,module,exports){
+
+/**
+ * Expose `debug()` as the module.
+ */
+
+module.exports = debug;
+
+/**
+ * Create a debugger with the given `name`.
+ *
+ * @param {String} name
+ * @return {Type}
+ * @api public
+ */
+
+function debug(name) {
+ if (!debug.enabled(name)) return function(){};
+
+ return function(fmt){
+ var curr = new Date;
+ var ms = curr - (debug[name] || curr);
+ debug[name] = curr;
+
+ fmt = name
+ + ' '
+ + fmt
+ + ' +' + debug.humanize(ms);
+
+ // This hackery is required for IE8
+ // where `console.log` doesn't have 'apply'
+ window.console
+ && console.log
+ && Function.prototype.apply.call(console.log, console, arguments);
+ }
+}
+
+/**
+ * The currently active debug mode names.
+ */
+
+debug.names = [];
+debug.skips = [];
+
+/**
+ * Enables a debug mode by name. This can include modes
+ * separated by a colon and wildcards.
+ *
+ * @param {String} name
+ * @api public
+ */
+
+debug.enable = function(name) {
+ try {
+ localStorage.debug = name;
+ } catch(e){}
+
+ var split = (name || '').split(/[\s,]+/)
+ , len = split.length;
+
+ for (var i = 0; i < len; i++) {
+ name = split[i].replace('*', '.*?');
+ if (name[0] === '-') {
+ debug.skips.push(new RegExp('^' + name.substr(1) + '$'));
+ }
+ else {
+ debug.names.push(new RegExp('^' + name + '$'));
+ }
+ }
+};
+
+/**
+ * Disable debug output.
+ *
+ * @api public
+ */
+
+debug.disable = function(){
+ debug.enable('');
+};
+
+/**
+ * Humanize the given `ms`.
+ *
+ * @param {Number} m
+ * @return {String}
+ * @api private
+ */
+
+debug.humanize = function(ms) {
+ var sec = 1000
+ , min = 60 * 1000
+ , hour = 60 * min;
+
+ if (ms >= hour) return (ms / hour).toFixed(1) + 'h';
+ if (ms >= min) return (ms / min).toFixed(1) + 'm';
+ if (ms >= sec) return (ms / sec | 0) + 's';
+ return ms + 'ms';
+};
+
+/**
+ * Returns true if the given mode name is enabled, false otherwise.
+ *
+ * @param {String} name
+ * @return {Boolean}
+ * @api public
+ */
+
+debug.enabled = function(name) {
+ for (var i = 0, len = debug.skips.length; i < len; i++) {
+ if (debug.skips[i].test(name)) {
+ return false;
+ }
+ }
+ for (var i = 0, len = debug.names.length; i < len; i++) {
+ if (debug.names[i].test(name)) {
+ return true;
+ }
+ }
+ return false;
+};
+
+// persist
+
+//if (window.localStorage) debug.enable(localStorage.debug);
+
+},{}]},{},[1])
+;
View
2  static/tributary-ui.js
@@ -1,5 +1,7 @@
var Backbone = require("backbone");
+Backbone.$ = $;
+
TributaryUi = function(tributary) {
if (!tributary.ui) {
tributary.ui = {};
View
988 static/tributary-ui.min.js
@@ -1,366 +1,5 @@
-;(function(e,t,n){function i(n,s){if(!t[n]){if(!e[n]){var o=typeof require=="function"&&require;if(!s&&o)return o(n,!0);if(r)return r(n,!0);throw new Error("Cannot find module '"+n+"'")}var u=t[n]={exports:{}};e[n][0](function(t){var r=e[n][1][t];return i(r?r:t)},u,u.exports)}return t[n].exports}var r=typeof require=="function"&&require;for(var s=0;s<n.length;s++)i(n[s]);return i})({1:[function(require,module,exports){
-var Backbone = require("backbone");
-
-TributaryUi = function(tributary) {
- if (!tributary.ui) {
- tributary.ui = {};
- }
- tributary.trace = false;
- tributary.hint = false;
- var parentWindow;
- if (window) {
- function receiveMessage(event) {
- if (event.origin !== tributary._origin || !event.data) return;
- var data = event.data;
- if (data.request === "load") {
- if (data.gistid) {
- getGist(data.gistid, function(err, gist) {
- tributary.loadGist(gist, _assemble);
- });
- } else {
- tributary.loadGist(undefined, _assemble);
- }
- parentWindow = event.source;
- tributary.query = data.query;
- } else if (data.request === "save") {
- if (!tributary.__config__.get("thumbnail")) {
- tributary._screenshot();
- } else {
- var json = serializeGist();
- event.source.postMessage({
- request: "save",
- config: json,
- salt: data.salt
- }, event.origin);
- }
- } else if (data.request === "description") {
- tributary.__config__.set("description", data.description);
- } else if (data.request === "exitfullscreen") {
- tributary.events.trigger("fullscreen", false);
- } else if (data.request === "thumbnail") {
- var image = data.image;
- d3.select("#thumb-load").transition().duration(1e3).style("opacity", 0);
- d3.select("#trib-thumbnail").attr("src", image.data.link);
- d3.select("#trib-thumbnail").style("display", "");
- tributary.__config__.set("thumbnail", image.data.link);
- }
- }
- window.addEventListener("message", receiveMessage, false);
- }
- tributary.events.on("warnchanged", function() {
- if (parentWindow) parentWindow.postMessage({
- request: "warnchanged"
- }, tributary._origin);
- });
- tributary.events.on("imgur", function(img) {
- if (parentWindow) {
- d3.select("#thumb-load").style("opacity", 1);
- parentWindow.postMessage({
- request: "imgur",
- img: img
- }, tributary._origin);
- }
- });
- function goFullscreen() {
- if (parentWindow) parentWindow.postMessage({
- request: "fullscreen"
- }, tributary._origin);
- }
- tributary.ui.setup = function() {
- tributary.events.on("resize", function() {
- if ($("#container").width() > 767) {
- tributary.sw = $("#container").width() - $("#panel").width();
- } else {
- tributary.sw = $("#container").width();
- }
- if ($("#container").hasClass("fullscreen")) {
- tributary.sw = $("#container").width();
- }
- $("#display").width(tributary.sw + "px");
- tributary.sh = $("#display").height();
- tributary.events.trigger("execute");
- });
- tributary.events.trigger("resize");
- };
- function _assemble(error, ret) {
- if (error) {
- console.log("error!", error);
- return;
- }
- var config = ret.config;
- tributary.__config__ = config;
- var context;
- var edel;
- var editor;
- var type;
- var endpoint = config.get("endpoint");
- if (tributary.endpoint) {
- endpoint = tributary.endpoint;
- }
- if (endpoint === "delta") {
- config.set("display", "svg");
- config.set("play", true);
- config.set("loop", true);
- config.set("autoinit", true);
- } else if (endpoint === "cypress") {
- config.set("display", "canvas");
- config.set("play", true);
- config.set("autoinit", true);
- } else if (endpoint === "hourglass") {
- config.set("display", "svg");
- config.set("play", true);
- config.set("autoinit", true);
- } else if (endpoint === "curiosity") {
- config.set("display", "webgl");
- config.set("play", true);
- config.set("autoinit", true);
- } else if (endpoint === "bigfish") {
- config.set("display", "svg");
- config.set("play", true);
- config.set("autoinit", false);
- config.set("restart", true);
- } else if (endpoint === "fly") {
- config.set("display", "canvas");
- config.set("play", true);
- config.set("autoinit", false);
- config.set("restart", true);
- } else if (endpoint === "ocean") {
- config.set("display", "div");
- }
- if (!config.get("display")) {
- config.set("display", "svg");
- }
- config.set("endpoint", "");
- var edit = d3.select("#code");
- tributary.edit = edit;
- ret.models.each(function(m) {
- type = m.get("type");
- context = Tributary.makeContext({
- config: config,
- model: m,
- display: d3.select("#display")
- });
- if (context) {
- config.contexts.push(context);
- context.render();
- if (tributary.__mainfiles__.indexOf(m.get("filename")) < 0) {
- context.execute();
- }
- context.editor = Tributary.makeEditor({
- model: m,
- parent: edit
- });
- m.trigger("hide");
- }
- });
- config.contexts.forEach(function(c) {
- if (tributary.__mainfiles__.indexOf(c.model.get("filename")) >= 0) {
- c.model.trigger("show");
- tributary.autoinit = true;
- c.execute();
- tributary.autoinit = config.get("autoinit");
- }
- });
- var files_view = new Tributary.FilesView({
- el: "#file-list",
- model: config
- });
- files_view.render();
- var config_view = new tributary.ConfigView({
- el: "#config",
- model: config
- });
- config_view.render();
- $("#config-toggle").on("click", function() {
- $("#config-content").toggle();
- if ($("#config-toggle").text() == "Config") {
- $("#config-toggle").text("Close Config");
- } else {
- $("#config-toggle").text("Config");
- }
- });
- $("#library-toggle").on("click", function() {
- $("#library-content").toggle();
- if ($("#library-toggle").text() == "Add libraries") {
- $("#library-toggle").text("Close libraries");
- } else {
- $("#library-toggle").text("Add libraries");
- }
- });
- function fullscreenEvent(fullscreen) {
- if (fullscreen || tributary.__fullscreen__) {
- config.set("fullscreen", true);
- $("#container").addClass("fullscreen");
- goFullscreen();
- tributary.events.trigger("resize");
- } else {
- config.set("fullscreen", false);
- $("#container").removeClass("fullscreen");
- tributary.events.trigger("resize");
- }
- }
- $("#fullscreen").on("click", function() {
- fullscreenEvent(true);
- });
- tributary.events.on("fullscreen", fullscreenEvent);
- tributary.events.trigger("fullscreen", config.get("fullscreen"));
- tributary.events.trigger("loaded");
- }
- function serializeGist() {
- var config = tributary.__config__;
- var gist = {
- description: config.get("description"),
- "public": config.get("public"),
- files: {}
- };
- var code = "";
- config.contexts.forEach(function(context) {
- code = context.model.get("code");
- if (code === "") code = "{}";
- gist.files[context.model.get("filename")] = {
- content: code
- };
- });
- if (config.todelete) {
- config.todelete.forEach(function(filename) {
- gist.files[filename] = null;
- });
- }
- gist.files["config.json"] = {
- content: JSON.stringify(config.toJSON())
- };
- return gist;
- }
- function getGist(id, callback) {
- var ret = {};
- var cachebust = "?cachebust=" + Math.random() * 0xf12765df4c9b2;
- var url = "https://api.github.com/gists/" + id + cachebust;
- $.ajax({
- url: url,
- contentType: "application/json",
- dataType: "json",
- success: function(data) {
- callback(null, data);
- },
- error: function(e) {
- console.log("err", e);
- url = "/gist/" + id + cachebust;
- $.ajax({
- url: url,
- contentType: "application/json",
- dataType: "json",
- success: function(data) {
- callback(null, data);
- },
- error: function(er) {
- console.log("err", er);
- callback(er, null);
- }
- });
- }
- });
- }
- Tributary.FilesView = Backbone.View.extend({
- initialize: function(options) {},
- render: function() {
- var that = this;
- var template = Handlebars.templates.files;
- var config = this.model;
- var contexts = _.map(config.contexts, function(ctx) {
- return ctx.model.toJSON();
- });
- contexts = contexts.sort(function(a, b) {
- if (a.filename < b.filename) return -1;
- return 1;
- });
- var inlet = _.find(contexts, function(d) {
- return d.filename === "inlet.js" || d.filename === "inlet.coffee";
- });
- if (inlet) {
- contexts.splice(contexts.indexOf(inlet), 1);
- contexts.unshift(inlet);