From 9f00a07cd71eb09e04e68f0e2738437d34b1c1e2 Mon Sep 17 00:00:00 2001 From: Amin Meyghani Date: Fri, 18 Sep 2015 15:14:00 -0400 Subject: [PATCH 01/10] add description of fiture --- loading-pattern.doc.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 loading-pattern.doc.md diff --git a/loading-pattern.doc.md b/loading-pattern.doc.md new file mode 100644 index 0000000..5fb1eb0 --- /dev/null +++ b/loading-pattern.doc.md @@ -0,0 +1,23 @@ +## loading-pattern + +It seems like the folder structure of components have changed. When you install a component, the folder structure for each component looks something like the following: + +``` +component-name + |_ x.y.z + |_ component.json + |_ index.js + +``` +It seems like this pattern is consistent for all of the components and there might not even be a need to read all the `component.json` files for every component and figure out version values. There might still be value for getting the name of the component, but as a quick fix, it should be ok to rely on the pattern. + +The other difference is the name of components in the `component.json` file. When a component is installed with `component install component/nameofcompoennt` the dependency fields gets updated and looks something like this: + +``` +"dependencies": { + "component/calendar": "~0.2.0", + "component/datepicker": "^1.0.1" +} +``` + +The `component/` is added which as a quick fix can be replaced with empty string when parsed. From 452ea24fa4b810db265c031a11fc8a50ab61223a Mon Sep 17 00:00:00 2001 From: Amin Meyghani Date: Fri, 18 Sep 2015 15:31:36 -0400 Subject: [PATCH 02/10] set up fixture --- fixture/.gitignore | 30 ++++++++++++++++ fixture/component.json | 18 ++++++++++ fixture/entry.js | 2 ++ fixture/index.html | 10 ++++++ fixture/install | 6 ++++ .../local-comp/1.0.0/component.json | 7 ++++ .../my-components/local-comp/1.0.0/main.js | 1 + fixture/package.json | 20 +++++++++++ fixture/webpack.config.js | 35 +++++++++++++++++++ 9 files changed, 129 insertions(+) create mode 100644 fixture/.gitignore create mode 100644 fixture/component.json create mode 100644 fixture/entry.js create mode 100644 fixture/index.html create mode 100755 fixture/install create mode 100644 fixture/my-components/local-comp/1.0.0/component.json create mode 100644 fixture/my-components/local-comp/1.0.0/main.js create mode 100644 fixture/package.json create mode 100644 fixture/webpack.config.js diff --git a/fixture/.gitignore b/fixture/.gitignore new file mode 100644 index 0000000..788c597 --- /dev/null +++ b/fixture/.gitignore @@ -0,0 +1,30 @@ +# Logs +logs +*.log + +# Runtime data +pids +*.pid +*.seed + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (http://nodejs.org/api/addons.html) +build/Release + +# Dependency directory +# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git +node_modules + +# DS_Store +.DS_Store diff --git a/fixture/component.json b/fixture/component.json new file mode 100644 index 0000000..9cab0db --- /dev/null +++ b/fixture/component.json @@ -0,0 +1,18 @@ +{ + "name": "my-component", + "scripts": [ + "client.js" + ], + "main": "client.js", + "styles": [ + "styles.css" + ], + "paths": [], + "local": [ + "local-comp" + ], + "dependencies": { + "component/calendar": "~0.2.0", + "component/datepicker": "^1.0.1" + } +} diff --git a/fixture/entry.js b/fixture/entry.js new file mode 100644 index 0000000..1e77dd3 --- /dev/null +++ b/fixture/entry.js @@ -0,0 +1,2 @@ +var l = require('local-comp'); +console.log(l); diff --git a/fixture/index.html b/fixture/index.html new file mode 100644 index 0000000..0b11286 --- /dev/null +++ b/fixture/index.html @@ -0,0 +1,10 @@ + + + + + components + + + + + diff --git a/fixture/install b/fixture/install new file mode 100755 index 0000000..e83388a --- /dev/null +++ b/fixture/install @@ -0,0 +1,6 @@ +#! /bin/bash +## usage: ./install nameofcomponent +## used by `get` inside package json +## to use it from npm `>2.0` do: `npm run get_comp -- nameofcompoennt` +## or you can use the alias: `npm run gc -- nameofcompoennt` +./node_modules/component/bin/component install component/$1 diff --git a/fixture/my-components/local-comp/1.0.0/component.json b/fixture/my-components/local-comp/1.0.0/component.json new file mode 100644 index 0000000..696e572 --- /dev/null +++ b/fixture/my-components/local-comp/1.0.0/component.json @@ -0,0 +1,7 @@ +{ + "name": "local-comp", + "version": "1.0.1", + "scripts": ["main.js"], + "main": "main.js", + "license": "MIT" +} diff --git a/fixture/my-components/local-comp/1.0.0/main.js b/fixture/my-components/local-comp/1.0.0/main.js new file mode 100644 index 0000000..acaaede --- /dev/null +++ b/fixture/my-components/local-comp/1.0.0/main.js @@ -0,0 +1 @@ +module.exports = 'I am local comp'; diff --git a/fixture/package.json b/fixture/package.json new file mode 100644 index 0000000..49caac1 --- /dev/null +++ b/fixture/package.json @@ -0,0 +1,20 @@ +{ + "name": "fixture", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "get_comp": "./install", + "gc": "npm run get_comp", + "dev": "./node_modules/webpack-dev-server/bin/webpack-dev-server.js" + }, + "author": "Amin Meyghani (http://meyghani.com)", + "license": "ISC", + "devDependencies": { + "component": "^1.1.0", + "css-loader": "^0.18.0", + "style-loader": "^0.12.4", + "webpack": "^1.12.2", + "webpack-dev-server": "^1.11.0" + } +} diff --git a/fixture/webpack.config.js b/fixture/webpack.config.js new file mode 100644 index 0000000..f11d1d8 --- /dev/null +++ b/fixture/webpack.config.js @@ -0,0 +1,35 @@ +var ComponentPlugin = require('../index'); +var resolve = require('path').resolve; +module.exports = { + entry: { + bundle: './entry.js' + }, + output: { + path: resolve('./dist'), + filename: '[name].js' + }, + resolve: { + modulesDirectories: ['node_modules', 'component', 'components/component'] + }, + module: { + loaders: [ + {test: /\.html$|\.htm$/, loader: 'raw'}, + {test: /\.css$/, loader: 'style!css'} + ] + }, + plugins: [ + new ComponentPlugin({ + // This is equal to: xyz: "[file]" + + // Load xyz field with the xyz-loader + // scripts: "!babel-loader![file]" + + }, [ + // Lookup paths + "my-components", + "components", + "components/component" + ] + ) + ] +}; From 9b02fe44e2bb842710d5d21e295311711f7b7fd4 Mon Sep 17 00:00:00 2001 From: Amin Meyghani Date: Fri, 18 Sep 2015 15:39:20 -0400 Subject: [PATCH 03/10] normalize components names, get correct paths. --- index.js | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 9ab0025..d5957f5 100644 --- a/index.js +++ b/index.js @@ -57,13 +57,22 @@ ComponentPlugin.prototype.apply = function(compiler) { // 2. get the full name for the module // i. e. "emitter" -> "sokra/emitter" + + // when you install a component, it gets registered as: + // component/name. We can just get rid of the `component/` part: + function normalizeCompName (arr) { return arr.map(function (c) { return c.replace("component/", ""); }); } + function findModule() { var modules = componentFileContent.local ? componentFileContent.local : []; if(componentFileContent.dependencies) { - modules = modules.concat(Object.keys(componentFileContent.dependencies)); + modules = modules.concat( + normalizeCompName(Object.keys(componentFileContent.dependencies)) + ); } if(componentFileContent.development) { - modules = modules.concat(Object.keys(componentFileContent.development)); + modules = modules.concat( + normalizeCompName(Object.keys(componentFileContent.development)) + ); } var fullName, requestName = request.request; for(var i = 0; i < modules.length; i++) { @@ -107,7 +116,25 @@ ComponentPlugin.prototype.apply = function(compiler) { paths = paths.concat(lookupPaths); this.forEachBail(paths, function(path, callback) { var modulesFolderPath = this.join(componentPath, path); - var modulePath = this.join(modulesFolderPath, fullName.replace(/\//g, "-")); + + var modulePath = this.join(modulesFolderPath, fullName); + // The module path is more like `component/version/` + // This is a quick fix to get the correct path of the + // component. It seems like all the components follow the same + // pattern with some small variation: + // `component/v.x.y.z` + // or + // `component/x.y.z + // not the most robust solution but at least it makes it work. + try { + var versionFolder = require('fs').readdirSync(modulePath); + } catch(e) { + log('This path does not contain a module' + e); + } + if (versionFolder) { + versionFolder = versionFolder.filter(function (c) { return !/^\./.test(c) && /^v|\d\.\d\.\d/.test(c); }); + modulePath = this.join(modulePath, versionFolder[0]); + } fs.stat(modulePath, function(err, stat) { if(err || !stat) { log(modulePath + " doesn't exist"); From c41adcaf7502fba3d51152efbff5722e13cfa5d7 Mon Sep 17 00:00:00 2001 From: Amin Meyghani Date: Fri, 18 Sep 2015 15:44:35 -0400 Subject: [PATCH 04/10] add calendar example --- fixture/component.json | 2 +- .../code42day/bounds/1.0.1/component.json | 19 + .../code42day/bounds/1.0.1/index.js | 108 +++++ .../component/bind/1.0.0/component.json | 15 + .../components/component/bind/1.0.0/index.js | 23 + .../component/calendar/0.2.0/component.json | 46 ++ .../component/calendar/0.2.0/index.js | 2 + .../component/calendar/0.2.0/lib/calendar.css | 23 + .../component/calendar/0.2.0/lib/calendar.js | 240 +++++++++ .../component/calendar/0.2.0/lib/dayrange.js | 29 ++ .../component/calendar/0.2.0/lib/days.js | 459 ++++++++++++++++++ .../calendar/0.2.0/lib/template.html | 11 + .../component/calendar/0.2.0/lib/utils.js | 14 + .../component/classes/1.2.4/component.json | 25 + .../component/classes/1.2.4/index.js | 187 +++++++ .../component/clone/0.2.2/component.json | 16 + .../components/component/clone/0.2.2/index.js | 57 +++ .../component/domify/1.4.0/component.json | 23 + .../component/domify/1.4.0/index.js | 112 +++++ .../component/emitter/1.0.0/component.json | 14 + .../component/emitter/1.0.0/index.js | 156 ++++++ .../component/event/0.1.4/component.json | 15 + .../components/component/event/0.1.4/index.js | 35 ++ .../in-groups-of/1.0.0/component.json | 14 + .../component/in-groups-of/1.0.0/index.js | 19 + .../component/indexof/0.0.3/component.json | 21 + .../component/indexof/0.0.3/index.js | 7 + .../component/map/0.0.1/component.json | 19 + .../components/component/map/0.0.1/index.js | 24 + .../component/props/1.1.2/component.json | 19 + .../components/component/props/1.1.2/index.js | 85 ++++ .../component/range/1.0.0/component.json | 18 + .../components/component/range/1.0.0/index.js | 11 + .../to-function/2.0.6/component.json | 18 + .../component/to-function/2.0.6/index.js | 152 ++++++ .../component/type/v1.2.0/component.json | 21 + .../components/component/type/v1.2.0/index.js | 36 ++ .../normalize/0.0.1/component.json | 19 + .../stephenmathieson/normalize/0.0.1/index.js | 47 ++ .../yields/empty/0.0.1/component.json | 21 + .../components/yields/empty/0.0.1/index.js | 12 + fixture/entry.js | 58 +++ fixture/index.html | 5 + fixture/package.json | 7 + fixture/styles.css | 44 ++ 45 files changed, 2307 insertions(+), 1 deletion(-) create mode 100644 fixture/components/code42day/bounds/1.0.1/component.json create mode 100644 fixture/components/code42day/bounds/1.0.1/index.js create mode 100644 fixture/components/component/bind/1.0.0/component.json create mode 100644 fixture/components/component/bind/1.0.0/index.js create mode 100644 fixture/components/component/calendar/0.2.0/component.json create mode 100644 fixture/components/component/calendar/0.2.0/index.js create mode 100644 fixture/components/component/calendar/0.2.0/lib/calendar.css create mode 100644 fixture/components/component/calendar/0.2.0/lib/calendar.js create mode 100644 fixture/components/component/calendar/0.2.0/lib/dayrange.js create mode 100644 fixture/components/component/calendar/0.2.0/lib/days.js create mode 100644 fixture/components/component/calendar/0.2.0/lib/template.html create mode 100644 fixture/components/component/calendar/0.2.0/lib/utils.js create mode 100644 fixture/components/component/classes/1.2.4/component.json create mode 100644 fixture/components/component/classes/1.2.4/index.js create mode 100644 fixture/components/component/clone/0.2.2/component.json create mode 100644 fixture/components/component/clone/0.2.2/index.js create mode 100644 fixture/components/component/domify/1.4.0/component.json create mode 100644 fixture/components/component/domify/1.4.0/index.js create mode 100644 fixture/components/component/emitter/1.0.0/component.json create mode 100644 fixture/components/component/emitter/1.0.0/index.js create mode 100644 fixture/components/component/event/0.1.4/component.json create mode 100644 fixture/components/component/event/0.1.4/index.js create mode 100644 fixture/components/component/in-groups-of/1.0.0/component.json create mode 100644 fixture/components/component/in-groups-of/1.0.0/index.js create mode 100644 fixture/components/component/indexof/0.0.3/component.json create mode 100644 fixture/components/component/indexof/0.0.3/index.js create mode 100644 fixture/components/component/map/0.0.1/component.json create mode 100644 fixture/components/component/map/0.0.1/index.js create mode 100644 fixture/components/component/props/1.1.2/component.json create mode 100644 fixture/components/component/props/1.1.2/index.js create mode 100644 fixture/components/component/range/1.0.0/component.json create mode 100644 fixture/components/component/range/1.0.0/index.js create mode 100644 fixture/components/component/to-function/2.0.6/component.json create mode 100644 fixture/components/component/to-function/2.0.6/index.js create mode 100644 fixture/components/component/type/v1.2.0/component.json create mode 100644 fixture/components/component/type/v1.2.0/index.js create mode 100644 fixture/components/stephenmathieson/normalize/0.0.1/component.json create mode 100644 fixture/components/stephenmathieson/normalize/0.0.1/index.js create mode 100644 fixture/components/yields/empty/0.0.1/component.json create mode 100644 fixture/components/yields/empty/0.0.1/index.js create mode 100644 fixture/styles.css diff --git a/fixture/component.json b/fixture/component.json index 9cab0db..c965319 100644 --- a/fixture/component.json +++ b/fixture/component.json @@ -15,4 +15,4 @@ "component/calendar": "~0.2.0", "component/datepicker": "^1.0.1" } -} +} \ No newline at end of file diff --git a/fixture/components/code42day/bounds/1.0.1/component.json b/fixture/components/code42day/bounds/1.0.1/component.json new file mode 100644 index 0000000..4861928 --- /dev/null +++ b/fixture/components/code42day/bounds/1.0.1/component.json @@ -0,0 +1,19 @@ +{ + "name": "bounds", + "description": "Mixin for checking if value is inside or outside of bounds", + "version": "1.0.1", + "keywords": [ + "range", + "compare" + ], + "dependencies": { + "component/clone": "*" + }, + "development": {}, + "license": "MIT", + "scripts": [ + "index.js" + ], + "repository": "code42day/bounds", + "resolved": "a83c24ff1c0bfd28324b97b5ac87c7853f98f243" +} \ No newline at end of file diff --git a/fixture/components/code42day/bounds/1.0.1/index.js b/fixture/components/code42day/bounds/1.0.1/index.js new file mode 100644 index 0000000..aa80a03 --- /dev/null +++ b/fixture/components/code42day/bounds/1.0.1/index.js @@ -0,0 +1,108 @@ +var clone; + +if ('undefined' == typeof window) { + clone = require('clone-component'); +} else { + clone = require('clone'); +} + +module.exports = Bounds; + + +function calculateReversed(self) { + return self._min + && self._max + && self.before(self._max); +} + +function Bounds(obj) { + if (obj) return mixin(obj); +} + +function mixin(obj) { + for (var key in Bounds.prototype) { + obj[key] = Bounds.prototype[key]; + } + return obj; +} + +Bounds.prototype.compare = function(fn) { + this._compare = fn; + return this; +}; + +Bounds.prototype.distance = function(fn) { + this._distance = fn; + return this; +}; + +Bounds.prototype.min = function(v) { + if (!arguments.length) { + return this._min; + } + this._min = v; + delete this._reversed; + return this; +}; + +Bounds.prototype.max = function(v) { + if (!arguments.length) { + return this._max; + } + this._max = v; + delete this._reversed; + return this; +}; + +Bounds.prototype.before = function(v) { + return this._min && (this._compare(v, this._min) < 0); +}; + +Bounds.prototype.after = function(v) { + return this._max && (this._compare(v, this._max) > 0); +}; + +Bounds.prototype.out = function(v) { + return this.before(v) || this.after(v); +}; + +Bounds.prototype.in = function(v) { + return !this.out(v); +}; + +Bounds.prototype.valid = function(v) { + if (this.reversed()) { + return !this.after(v) || !this.before(v); + } + return this.in(v); +}; + +Bounds.prototype.invalid = function(v) { + return !this.valid(v); +}; + +Bounds.prototype.reversed = function() { + if (this._reversed === undefined) { + this._reversed = calculateReversed(this); + } + return this._reversed; +}; + +Bounds.prototype.restrict = function(v) { + if (this.reversed()) { + if(this.after(v) && this.before(v)) { + // select closer bound + return (this._distance(this._max, v) < this._distance(v, this._min)) + ? clone(this._max) + : clone(this._min); + } + return v; + } + if(this.before(v)) { + return clone(this._min); + } + if(this.after(v)) { + return clone(this._max); + } + return v; +}; diff --git a/fixture/components/component/bind/1.0.0/component.json b/fixture/components/component/bind/1.0.0/component.json new file mode 100644 index 0000000..19ab32d --- /dev/null +++ b/fixture/components/component/bind/1.0.0/component.json @@ -0,0 +1,15 @@ +{ + "name": "bind", + "version": "1.0.0", + "description": "function binding utility", + "keywords": [ + "bind", + "utility" + ], + "dependencies": {}, + "scripts": [ + "index.js" + ], + "repository": "component/bind", + "resolved": "0a0b368653bd53bd162646806e184d384134f402" +} \ No newline at end of file diff --git a/fixture/components/component/bind/1.0.0/index.js b/fixture/components/component/bind/1.0.0/index.js new file mode 100644 index 0000000..4eeb2c0 --- /dev/null +++ b/fixture/components/component/bind/1.0.0/index.js @@ -0,0 +1,23 @@ +/** + * Slice reference. + */ + +var slice = [].slice; + +/** + * Bind `obj` to `fn`. + * + * @param {Object} obj + * @param {Function|String} fn or string + * @return {Function} + * @api public + */ + +module.exports = function(obj, fn){ + if ('string' == typeof fn) fn = obj[fn]; + if ('function' != typeof fn) throw new Error('bind() requires a function'); + var args = slice.call(arguments, 2); + return function(){ + return fn.apply(obj, args.concat(slice.call(arguments))); + } +}; diff --git a/fixture/components/component/calendar/0.2.0/component.json b/fixture/components/component/calendar/0.2.0/component.json new file mode 100644 index 0000000..861e55d --- /dev/null +++ b/fixture/components/component/calendar/0.2.0/component.json @@ -0,0 +1,46 @@ +{ + "name": "calendar", + "description": "Calendar component", + "version": "0.2.0", + "keywords": [ + "calendar", + "date", + "ui" + ], + "dependencies": { + "code42day/bounds": "*", + "component/bind": "*", + "component/domify": "*", + "component/classes": "*", + "component/event": "*", + "component/map": "*", + "component/range": "1.0.0", + "component/emitter": "1.0.0", + "component/in-groups-of": "1.0.0", + "component/type": "*", + "yields/empty": "*", + "stephenmathieson/normalize": "*" + }, + "development": { + "dependencies": { + "component/aurora-calendar": "*" + } + }, + "styles": [ + "lib/calendar.css" + ], + "scripts": [ + "index.js", + "lib/utils.js", + "lib/calendar.js", + "lib/dayrange.js", + "lib/days.js" + ], + "templates": [ + "lib/template.html" + ], + "demo": "http://component.github.io/calendar/", + "license": "MIT", + "repository": "component/calendar", + "resolved": "88c0ca134161ca3819cb8318a4f63e12ffdffaec" +} \ No newline at end of file diff --git a/fixture/components/component/calendar/0.2.0/index.js b/fixture/components/component/calendar/0.2.0/index.js new file mode 100644 index 0000000..ee1abc8 --- /dev/null +++ b/fixture/components/component/calendar/0.2.0/index.js @@ -0,0 +1,2 @@ + +module.exports = require('./lib/calendar'); \ No newline at end of file diff --git a/fixture/components/component/calendar/0.2.0/lib/calendar.css b/fixture/components/component/calendar/0.2.0/lib/calendar.css new file mode 100644 index 0000000..643ff41 --- /dev/null +++ b/fixture/components/component/calendar/0.2.0/lib/calendar.css @@ -0,0 +1,23 @@ + +.calendar-table { + border: 1px solid #eee; + padding: 5px; + margin: 5px; +} + +.calendar-table .prev-day, +.calendar-table .next-day { + color: #999; +} + +.calendar-table td { + text-align: center; +} + +.calendar-table td { + user-select: none; +} + +.calendar-table td a { + cursor: pointer; +} diff --git a/fixture/components/component/calendar/0.2.0/lib/calendar.js b/fixture/components/component/calendar/0.2.0/lib/calendar.js new file mode 100644 index 0000000..0376288 --- /dev/null +++ b/fixture/components/component/calendar/0.2.0/lib/calendar.js @@ -0,0 +1,240 @@ + +/** + * Module dependencies. + */ + +var bind = require('bind') + , domify = require('domify') + , Emitter = require('emitter') + , classes = require('classes') + , Days = require('./days'); + +/** + * Expose `Calendar`. + */ + +module.exports = Calendar; + +/** + * Initialize a new `Calendar` + * with the given `date` defaulting + * to now. + * + * Events: + * + * - `prev` when the prev link is clicked + * - `next` when the next link is clicked + * - `change` (date) when the selected date is modified + * + * @params {Date} date + * @api public + */ + +function Calendar(date) { + if (!(this instanceof Calendar)) { + return new Calendar(date); + } + + Emitter.call(this); + var self = this; + this.el = domify('
'); + this.days = new Days; + this.el.appendChild(this.days.el); + this.on('change', bind(this, this.show)); + this.days.on('prev', bind(this, this.prev)); + this.days.on('next', bind(this, this.next)); + this.days.on('year', bind(this, this.menuChange, 'year')); + this.days.on('month', bind(this, this.menuChange, 'month')); + this.show(date || new Date); + this.days.on('change', function(date){ + self.emit('change', date); + }); +} + +/** + * Mixin emitter. + */ + +Emitter(Calendar.prototype); + +/** + * Add class `name` to differentiate this + * specific calendar for styling purposes, + * for example `calendar.addClass('date-picker')`. + * + * @param {String} name + * @return {Calendar} + * @api public + */ + +Calendar.prototype.addClass = function(name){ + classes(this.el).add(name); + return this; +}; + +/** + * Select `date`. + * + * @param {Date} date + * @return {Calendar} + * @api public + */ + +Calendar.prototype.select = function(date){ + if (this.days.validRange.valid(date)) { + this.selected = date; + this.days.select(date); + } + this.show(date); + return this; +}; + +/** + * Show `date`. + * + * @param {Date} date + * @return {Calendar} + * @api public + */ + +Calendar.prototype.show = function(date){ + this._date = date; + this.days.show(date); + return this; +}; + +/** + * Set minimum valid date (inclusive) + * + * @param {Date} date + * @api public + */ + +Calendar.prototype.min = function(date) { + this.days.validRange.min(date); + return this; +}; + + +/** + * Set maximum valid date (inclusive) + * + * @param {Date} date + * @api public + */ + +Calendar.prototype.max = function(date) { + this.days.validRange.max(date); + return this; +}; + +/** + * Enable a year dropdown. + * + * @param {Number} from + * @param {Number} to + * @return {Calendar} + * @api public + */ + +Calendar.prototype.showYearSelect = function(from, to){ + from = from || this._date.getFullYear() - 10; + to = to || this._date.getFullYear() + 10; + this.days.yearMenu(from, to); + this.show(this._date); + return this; +}; + +/** + * Enable a month dropdown. + * + * @return {Calendar} + * @api public + */ + +Calendar.prototype.showMonthSelect = function(){ + this.days.monthMenu(); + this.show(this._date); + return this; +}; + +/** + * Return the previous month. + * + * @return {Date} + * @api private + */ + +Calendar.prototype.prevMonth = function(){ + var date = new Date(this._date); + date.setDate(1); + date.setMonth(date.getMonth() - 1); + return date; +}; + +/** + * Return the next month. + * + * @return {Date} + * @api private + */ + +Calendar.prototype.nextMonth = function(){ + var date = new Date(this._date); + date.setDate(1); + date.setMonth(date.getMonth() + 1); + return date; +}; + +/** + * Show the prev view. + * + * @return {Calendar} + * @api public + */ + +Calendar.prototype.prev = function(){ + this.show(this.prevMonth()); + this.emit('view change', this.days.selectedMonth(), 'prev'); + return this; +}; + +/** + * Show the next view. + * + * @return {Calendar} + * @api public + */ + +Calendar.prototype.next = function(){ + this.show(this.nextMonth()); + this.emit('view change', this.days.selectedMonth(), 'next'); + return this; +}; + +/** + * Switch to the year or month selected by dropdown menu. + * + * @return {Calendar} + * @api public + */ + +Calendar.prototype.menuChange = function(action){ + var date = this.days.selectedMonth(); + this.show(date); + this.emit('view change', date, action); + return this; +}; + +/** + * Select locale + * + * @param {months, weekdaysMin} - array of months labels and array of weekdays shortcuts + * @api public + */ + + Calendar.prototype.locale = function(locale) { + this.days.setLocale(locale); + this.days.show(this._date); + return this; + }; diff --git a/fixture/components/component/calendar/0.2.0/lib/dayrange.js b/fixture/components/component/calendar/0.2.0/lib/dayrange.js new file mode 100644 index 0000000..7bf18ec --- /dev/null +++ b/fixture/components/component/calendar/0.2.0/lib/dayrange.js @@ -0,0 +1,29 @@ +var Bounds = require('bounds'); + +var type; + +if (typeof window !== 'undefined') { + type = require('type'); +} else { + type = require('type-component'); +} + +module.exports = DayRange; + +function date(d) { + return type(d) === 'date' ? d : new Date(d[0], d[1], d[2]); +} + +function DayRange(min, max) { + return this.min(min).max(max); +} + +Bounds(DayRange.prototype); + +DayRange.prototype._compare = function(a, b) { + return date(a).getTime() - date(b).getTime(); +} + +DayRange.prototype._distance = function(a, b) { + return Math.abs(this.compare(a, b)); +} diff --git a/fixture/components/component/calendar/0.2.0/lib/days.js b/fixture/components/component/calendar/0.2.0/lib/days.js new file mode 100644 index 0000000..59aa911 --- /dev/null +++ b/fixture/components/component/calendar/0.2.0/lib/days.js @@ -0,0 +1,459 @@ + +/** + * Module dependencies. + */ + +var domify = require('domify') + , Emitter = require('emitter') + , classes = require('classes') + , events = require('event') + , map = require('map') + , template = require('./template.html') + , inGroupsOf = require('in-groups-of') + , clamp = require('./utils').clamp + , range = require('range') + , empty = require('empty') + , normalize = require('normalize') + , DayRange = require('./dayrange'); + +/** + * Default locale - en + */ + +var LOCALE = { + months: 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'), + weekdaysMin: 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_') +}; + + +/** + * Get days in `month` for `year`. + * + * @param {Number} month + * @param {Number} year + * @return {Number} + * @api private + */ + +function daysInMonth(month, year) { + return [31, (isLeapYear(year) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month]; +} + +/** + * Check if `year` is a leap year. + * + * @param {Number} year + * @return {Boolean} + * @api private + */ + +function isLeapYear(year) { + return (0 === year % 400) + || ((0 === year % 4) && (0 !== year % 100)) + || (0 === year); +} + + +/** + * Expose `Days`. + */ + +module.exports = Days; + +/** + * Initialize a new `Days` view. + * + * Emits: + * + * - `prev` when prev link is clicked + * - `next` when next link is clicked + * - `change` (date) when a date is selected + * + * @api public + */ + +function Days() { + Emitter.call(this); + var self = this; + this.el = domify(template); + classes(this.el).add('calendar-days'); + this.head = this.el.tHead; + this.body = this.el.tBodies[0]; + this.title = this.head.querySelector('.title'); + this.select(new Date); + this.validRange = new DayRange; + this.locale = LOCALE; + + // emit "day" + events.bind(this.body, 'click', normalize(function(e){ + if (e.target.tagName !== 'A') { + return true; + } + + e.preventDefault(); + + var el = e.target; + var data = el.getAttribute('data-date').split('-'); + if (!self.validRange.valid(data)) { + return false; + } + var year = data[0]; + var month = data[1]; + var day = data[2]; + var date = new Date(year, month, day); + self.select(date); + self.emit('change', date); + return false; + })); + + // emit "prev" + events.bind(this.el.querySelector('.prev'), 'click', normalize(function(ev){ + ev.preventDefault(); + + self.emit('prev'); + return false; + })); + + // emit "next" + events.bind(this.el.querySelector('.next'), 'click', normalize(function(ev){ + ev.preventDefault(); + + self.emit('next'); + return false; + })); +} + +/** + * Mixin emitter. + */ + +Emitter(Days.prototype); + +/** + * Select the given `date`. + * + * @param {Date} date + * @return {Days} + * @api public + */ + +Days.prototype.select = function(date){ + this.selected = date; + return this; +}; + + +/** + * Select locale + * + * @param {months, weekdaysMin} - array of months labels and array of weekdays shortcuts + * @api public + */ + + Days.prototype.setLocale = function(locale) { + this.locale = locale; + return this; + }; + +/** + * Show date selection. + * + * @param {Date} date + * @api public + */ + +Days.prototype.show = function(date){ + var year = date.getFullYear(); + var month = date.getMonth(); + this.showSelectedYear(year); + this.showSelectedMonth(month); + var subhead = this.head.querySelector('.subheading'); + if (subhead) { + subhead.parentElement.removeChild(subhead); + } + + this.head.appendChild(this.renderHeading(this.locale.weekdaysMin)); + empty(this.body); + this.body.appendChild(this.renderDays(date)); +}; + +/** + * Enable a year dropdown. + * + * @param {Number} from + * @param {Number} to + * @api public + */ + +Days.prototype.yearMenu = function(from, to){ + this.selectYear = true; + this.title.querySelector('.year').innerHTML = yearDropdown(from, to); + var self = this; + events.bind(this.title.querySelector('.year .calendar-select'), 'change', function(){ + self.emit('year'); + return false; + }); +}; + +/** + * Enable a month dropdown. + * + * @api public + */ + +Days.prototype.monthMenu = function(){ + this.selectMonth = true; + this.title.querySelector('.month').innerHTML = monthDropdown(this.locale.months); + var self = this; + events.bind(this.title.querySelector('.month .calendar-select'), 'change', function(){ + self.emit('month'); + return false; + }); +}; + +/** + * Return current year of view from title. + * + * @api private + */ + +Days.prototype.titleYear = function(){ + if (this.selectYear) { + return this.title.querySelector('.year .calendar-select').value; + } else { + return this.title.querySelector('.year').innerHTML; + } +}; + +/** + * Return current month of view from title. + * + * @api private + */ + +Days.prototype.titleMonth = function(){ + if (this.selectMonth) { + return this.title.querySelector('.month .calendar-select').value; + } else { + return this.title.querySelector('.month').innerHTML; + } +}; + +/** + * Return a date based on the field-selected month. + * + * @api public + */ + +Days.prototype.selectedMonth = function(){ + return new Date(this.titleYear(), this.titleMonth(), 1); +}; + +/** + * Render days of the week heading with + * the given `length`, for example 2 for "Tu", + * 3 for "Tue" etc. + * + * @param {String} len + * @return {Element} + * @api private + */ + +Days.prototype.renderHeading = function(days){ + var rows = '' + map(days, function(day){ + return '' + day + ''; + }).join('') + ''; + return domify(rows); +}; + +/** + * Render days for `date`. + * + * @param {Date} date + * @return {Element} + * @api private + */ + +Days.prototype.renderDays = function(date){ + var rows = this.rowsFor(date); + var html = map(rows, function(row){ + return '' + row.join('') + ''; + }).join('\n'); + return domify(html); +}; + +/** + * Return rows array for `date`. + * + * This method calculates the "overflow" + * from the previous month and into + * the next in order to display an + * even 5 rows. + * + * @param {Date} date + * @return {Array} + * @api private + */ + +Days.prototype.rowsFor = function(date){ + var selected = this.selected; + var selectedDay = selected.getDate(); + var selectedMonth = selected.getMonth(); + var selectedYear = selected.getFullYear(); + var month = date.getMonth(); + var year = date.getFullYear(); + + // calculate overflow + var start = new Date(date); + start.setDate(1); + var before = start.getDay(); + var total = daysInMonth(month, year); + var perRow = 7; + var totalShown = perRow * Math.ceil((total + before) / perRow); + var after = totalShown - (total + before); + var cells = []; + + // cells before + cells = cells.concat(cellsBefore(before, month, year, this.validRange)); + + // current cells + for (var i = 0; i < total; ++i) { + var day = i + 1 + , select = (day == selectedDay && month == selectedMonth && year == selectedYear); + cells.push(renderDay([year, month, day], this.validRange, select)); + } + + // after cells + cells = cells.concat(cellsAfter(after, month, year, this.validRange)); + + return inGroupsOf(cells, 7); +}; + +/** + * Update view title or select input for `year`. + * + * @param {Number} year + * @api private + */ + +Days.prototype.showSelectedYear = function(year){ + if (this.selectYear) { + this.title.querySelector('.year .calendar-select').value = year; + } else { + this.title.querySelector('.year').innerHTML = year; + } +}; + +/** + * Update view title or select input for `month`. + * + * @param {Number} month + * @api private + */ + +Days.prototype.showSelectedMonth = function(month) { + if (this.selectMonth) { + this.title.querySelector('.month .calendar-select').value = month; + } else { + this.title.querySelector('.month').innerHTML = this.locale.months[month]; + } +}; + +/** + * Return `n` days before `month`. + * + * @param {Number} n + * @param {Number} month + * @return {Array} + * @api private + */ + +function cellsBefore(n, month, year, validRange){ + var cells = []; + if (month === 0) --year; + var prev = clamp(month - 1); + var before = daysInMonth(prev, year); + while (n--) cells.push(renderDay([year, prev, before--], validRange, false, 'prev-day')); + return cells.reverse(); +} + +/** + * Return `n` days after `month`. + * + * @param {Number} n + * @param {Number} month + * @return {Array} + * @api private + */ + +function cellsAfter(n, month, year, validRange){ + var cells = []; + var day = 0; + if (month == 11) ++year; + var next = clamp(month + 1); + while (n--) cells.push(renderDay([year, next, ++day], validRange, false, 'next-day')); + return cells; +} + + +/** + * Day template. + */ + +function renderDay(ymd, validRange, selected, style) { + var date = 'data-date=' + ymd.join('-') + , styles = [] + , tdClass = '' + , aClass = ''; + + if (selected) { + tdClass = ' class="selected"'; + } + if (style) { + styles.push(style); + } + if (!validRange.valid(ymd)) { + styles.push('invalid'); + } + if (styles.length) { + aClass = ' class="' + styles.join(' ') + '"'; + } + + + return '' + ymd[2] + ''; +} + +/** + * Year dropdown template. + */ + +function yearDropdown(from, to) { + var years = range(from, to, 'inclusive'); + var options = map(years, yearOption).join(''); + return ''; +} + +/** + * Month dropdown template. + */ + +function monthDropdown(months) { + var options = map(months, monthOption).join(''); + return ''; +} + +/** + * Year dropdown option template. + */ + +function yearOption(year) { + return ''; +} + +/** + * Month dropdown option template. + */ + +function monthOption(month, i) { + return ''; +} diff --git a/fixture/components/component/calendar/0.2.0/lib/template.html b/fixture/components/component/calendar/0.2.0/lib/template.html new file mode 100644 index 0000000..01c7970 --- /dev/null +++ b/fixture/components/component/calendar/0.2.0/lib/template.html @@ -0,0 +1,11 @@ + + + + + + + + + + +
\ No newline at end of file diff --git a/fixture/components/component/calendar/0.2.0/lib/utils.js b/fixture/components/component/calendar/0.2.0/lib/utils.js new file mode 100644 index 0000000..d777f63 --- /dev/null +++ b/fixture/components/component/calendar/0.2.0/lib/utils.js @@ -0,0 +1,14 @@ + +/** + * Clamp `month`. + * + * @param {Number} month + * @return {Number} + * @api public + */ + +exports.clamp = function(month){ + if (month > 11) return 0; + if (month < 0) return 11; + return month; +}; diff --git a/fixture/components/component/classes/1.2.4/component.json b/fixture/components/component/classes/1.2.4/component.json new file mode 100644 index 0000000..fd4f3a6 --- /dev/null +++ b/fixture/components/component/classes/1.2.4/component.json @@ -0,0 +1,25 @@ +{ + "name": "classes", + "version": "1.2.4", + "description": "Cross-browser element class list", + "keywords": [ + "dom", + "html", + "classList", + "class", + "ui" + ], + "scripts": [ + "index.js" + ], + "dependencies": { + "component/indexof": "*" + }, + "development": { + "dependencies": { + "component/assert": "*" + } + }, + "repository": "component/classes", + "resolved": "7e8440cdfed498c410b43d4318be63e9a9d32cf1" +} \ No newline at end of file diff --git a/fixture/components/component/classes/1.2.4/index.js b/fixture/components/component/classes/1.2.4/index.js new file mode 100644 index 0000000..d60b1db --- /dev/null +++ b/fixture/components/component/classes/1.2.4/index.js @@ -0,0 +1,187 @@ +/** + * Module dependencies. + */ + +var index = require('indexof'); + +/** + * Whitespace regexp. + */ + +var re = /\s+/; + +/** + * toString reference. + */ + +var toString = Object.prototype.toString; + +/** + * Wrap `el` in a `ClassList`. + * + * @param {Element} el + * @return {ClassList} + * @api public + */ + +module.exports = function(el){ + return new ClassList(el); +}; + +/** + * Initialize a new ClassList for `el`. + * + * @param {Element} el + * @api private + */ + +function ClassList(el) { + if (!el || !el.nodeType) { + throw new Error('A DOM element reference is required'); + } + this.el = el; + this.list = el.classList; +} + +/** + * Add class `name` if not already present. + * + * @param {String} name + * @return {ClassList} + * @api public + */ + +ClassList.prototype.add = function(name){ + // classList + if (this.list) { + this.list.add(name); + return this; + } + + // fallback + var arr = this.array(); + var i = index(arr, name); + if (!~i) arr.push(name); + this.el.className = arr.join(' '); + return this; +}; + +/** + * Remove class `name` when present, or + * pass a regular expression to remove + * any which match. + * + * @param {String|RegExp} name + * @return {ClassList} + * @api public + */ + +ClassList.prototype.remove = function(name){ + if ('[object RegExp]' == toString.call(name)) { + return this.removeMatching(name); + } + + // classList + if (this.list) { + this.list.remove(name); + return this; + } + + // fallback + var arr = this.array(); + var i = index(arr, name); + if (~i) arr.splice(i, 1); + this.el.className = arr.join(' '); + return this; +}; + +/** + * Remove all classes matching `re`. + * + * @param {RegExp} re + * @return {ClassList} + * @api private + */ + +ClassList.prototype.removeMatching = function(re){ + var arr = this.array(); + for (var i = 0; i < arr.length; i++) { + if (re.test(arr[i])) { + this.remove(arr[i]); + } + } + return this; +}; + +/** + * Toggle class `name`, can force state via `force`. + * + * For browsers that support classList, but do not support `force` yet, + * the mistake will be detected and corrected. + * + * @param {String} name + * @param {Boolean} force + * @return {ClassList} + * @api public + */ + +ClassList.prototype.toggle = function(name, force){ + // classList + if (this.list) { + if ("undefined" !== typeof force) { + if (force !== this.list.toggle(name, force)) { + this.list.toggle(name); // toggle again to correct + } + } else { + this.list.toggle(name); + } + return this; + } + + // fallback + if ("undefined" !== typeof force) { + if (!force) { + this.remove(name); + } else { + this.add(name); + } + } else { + if (this.has(name)) { + this.remove(name); + } else { + this.add(name); + } + } + + return this; +}; + +/** + * Return an array of classes. + * + * @return {Array} + * @api public + */ + +ClassList.prototype.array = function(){ + var className = this.el.getAttribute('class') || ''; + var str = className.replace(/^\s+|\s+$/g, ''); + var arr = str.split(re); + if ('' === arr[0]) arr.shift(); + return arr; +}; + +/** + * Check if class `name` is present. + * + * @param {String} name + * @return {ClassList} + * @api public + */ + +ClassList.prototype.has = +ClassList.prototype.contains = function(name){ + return this.list + ? this.list.contains(name) + : !! ~index(this.array(), name); +}; diff --git a/fixture/components/component/clone/0.2.2/component.json b/fixture/components/component/clone/0.2.2/component.json new file mode 100644 index 0000000..a7757cd --- /dev/null +++ b/fixture/components/component/clone/0.2.2/component.json @@ -0,0 +1,16 @@ +{ + "name": "clone", + "version": "0.2.2", + "dependencies": { + "component/type": "*" + }, + "devDependencies": { + "visionmedia/mocha": "*", + "guille/expect.js": "*" + }, + "scripts": [ + "index.js" + ], + "repository": "component/clone", + "resolved": "a0158687a5a141275949ca8149494bdb06383cbf" +} \ No newline at end of file diff --git a/fixture/components/component/clone/0.2.2/index.js b/fixture/components/component/clone/0.2.2/index.js new file mode 100644 index 0000000..a74bc22 --- /dev/null +++ b/fixture/components/component/clone/0.2.2/index.js @@ -0,0 +1,57 @@ +/** + * Module dependencies. + */ + +var type; +try { + type = require('component-type'); +} catch (_) { + type = require('type'); +} + +/** + * Module exports. + */ + +module.exports = clone; + +/** + * Clones objects. + * + * @param {Mixed} any object + * @api public + */ + +function clone(obj){ + switch (type(obj)) { + case 'object': + var copy = {}; + for (var key in obj) { + if (obj.hasOwnProperty(key)) { + copy[key] = clone(obj[key]); + } + } + return copy; + + case 'array': + var copy = new Array(obj.length); + for (var i = 0, l = obj.length; i < l; i++) { + copy[i] = clone(obj[i]); + } + return copy; + + case 'regexp': + // from millermedeiros/amd-utils - MIT + var flags = ''; + flags += obj.multiline ? 'm' : ''; + flags += obj.global ? 'g' : ''; + flags += obj.ignoreCase ? 'i' : ''; + return new RegExp(obj.source, flags); + + case 'date': + return new Date(obj.getTime()); + + default: // string, number, boolean, … + return obj; + } +} diff --git a/fixture/components/component/domify/1.4.0/component.json b/fixture/components/component/domify/1.4.0/component.json new file mode 100644 index 0000000..9b77cf8 --- /dev/null +++ b/fixture/components/component/domify/1.4.0/component.json @@ -0,0 +1,23 @@ +{ + "name": "domify", + "version": "1.4.0", + "description": "turn HTML into DOM elements", + "development": { + "dependencies": { + "component/assert": "*" + } + }, + "keywords": [ + "dom", + "html", + "client", + "browser", + "component" + ], + "scripts": [ + "index.js" + ], + "license": "MIT", + "repository": "component/domify", + "resolved": "ac5066bf08ffec3dad4c64d6852f27f014021059" +} \ No newline at end of file diff --git a/fixture/components/component/domify/1.4.0/index.js b/fixture/components/component/domify/1.4.0/index.js new file mode 100644 index 0000000..78d3547 --- /dev/null +++ b/fixture/components/component/domify/1.4.0/index.js @@ -0,0 +1,112 @@ + +/** + * Expose `parse`. + */ + +module.exports = parse; + +/** + * Tests for browser support. + */ + +var innerHTMLBug = false; +var bugTestDiv; +if (typeof document !== 'undefined') { + bugTestDiv = document.createElement('div'); + // Setup + bugTestDiv.innerHTML = '
a'; + // Make sure that link elements get serialized correctly by innerHTML + // This requires a wrapper element in IE + innerHTMLBug = !bugTestDiv.getElementsByTagName('link').length; + bugTestDiv = undefined; +} + +/** + * Wrap map from jquery. + */ + +var map = { + legend: [1, '
', '
'], + tr: [2, '', '
'], + col: [2, '', '
'], + // for script/link/style tags to work in IE6-8, you have to wrap + // in a div with a non-whitespace character in front, ha! + _default: innerHTMLBug ? [1, 'X
', '
'] : [0, '', ''] +}; + +map.td = +map.th = [3, '', '
']; + +map.option = +map.optgroup = [1, '']; + +map.thead = +map.tbody = +map.colgroup = +map.caption = +map.tfoot = [1, '', '
']; + +map.polyline = +map.ellipse = +map.polygon = +map.circle = +map.text = +map.line = +map.path = +map.rect = +map.g = [1, '','']; + +/** + * Parse `html` and return a DOM Node instance, which could be a TextNode, + * HTML DOM Node of some kind (
for example), or a DocumentFragment + * instance, depending on the contents of the `html` string. + * + * @param {String} html - HTML string to "domify" + * @param {Document} doc - The `document` instance to create the Node for + * @return {DOMNode} the TextNode, DOM Node, or DocumentFragment instance + * @api private + */ + +function parse(html, doc) { + if ('string' != typeof html) throw new TypeError('String expected'); + + // default to the global `document` object + if (!doc) doc = document; + + // tag name + var m = /<([\w:]+)/.exec(html); + if (!m) return doc.createTextNode(html); + + html = html.replace(/^\s+|\s+$/g, ''); // Remove leading/trailing whitespace + + var tag = m[1]; + + // body support + if (tag == 'body') { + var el = doc.createElement('html'); + el.innerHTML = html; + return el.removeChild(el.lastChild); + } + + // wrap map + var wrap = map[tag] || map._default; + var depth = wrap[0]; + var prefix = wrap[1]; + var suffix = wrap[2]; + var el = doc.createElement('div'); + el.innerHTML = prefix + html + suffix; + while (depth--) el = el.lastChild; + + // one element + if (el.firstChild == el.lastChild) { + return el.removeChild(el.firstChild); + } + + // several elements + var fragment = doc.createDocumentFragment(); + while (el.firstChild) { + fragment.appendChild(el.removeChild(el.firstChild)); + } + + return fragment; +} diff --git a/fixture/components/component/emitter/1.0.0/component.json b/fixture/components/component/emitter/1.0.0/component.json new file mode 100644 index 0000000..795818f --- /dev/null +++ b/fixture/components/component/emitter/1.0.0/component.json @@ -0,0 +1,14 @@ +{ + "name": "emitter", + "description": "Event emitter", + "keywords": [ + "emitter", + "events" + ], + "version": "1.0.0", + "scripts": [ + "index.js" + ], + "repository": "component/emitter", + "resolved": "9c5379b4d1985a9a16745abe7bbc31524b8a090e" +} \ No newline at end of file diff --git a/fixture/components/component/emitter/1.0.0/index.js b/fixture/components/component/emitter/1.0.0/index.js new file mode 100644 index 0000000..fa50d5f --- /dev/null +++ b/fixture/components/component/emitter/1.0.0/index.js @@ -0,0 +1,156 @@ + +/** + * Expose `Emitter`. + */ + +module.exports = Emitter; + +/** + * Initialize a new `Emitter`. + * + * @api public + */ + +function Emitter(obj) { + if (obj) return mixin(obj); +}; + +/** + * Mixin the emitter properties. + * + * @param {Object} obj + * @return {Object} + * @api private + */ + +function mixin(obj) { + for (var key in Emitter.prototype) { + obj[key] = Emitter.prototype[key]; + } + return obj; +} + +/** + * Listen on the given `event` with `fn`. + * + * @param {String} event + * @param {Function} fn + * @return {Emitter} + * @api public + */ + +Emitter.prototype.on = function(event, fn){ + this._callbacks = this._callbacks || {}; + (this._callbacks[event] = this._callbacks[event] || []) + .push(fn); + return this; +}; + +/** + * Adds an `event` listener that will be invoked a single + * time then automatically removed. + * + * @param {String} event + * @param {Function} fn + * @return {Emitter} + * @api public + */ + +Emitter.prototype.once = function(event, fn){ + var self = this; + this._callbacks = this._callbacks || {}; + + function on() { + self.off(event, on); + fn.apply(this, arguments); + } + + fn._off = on; + this.on(event, on); + return this; +}; + +/** + * Remove the given callback for `event` or all + * registered callbacks. + * + * @param {String} event + * @param {Function} fn + * @return {Emitter} + * @api public + */ + +Emitter.prototype.off = +Emitter.prototype.removeListener = +Emitter.prototype.removeAllListeners = function(event, fn){ + this._callbacks = this._callbacks || {}; + + // all + if (0 == arguments.length) { + this._callbacks = {}; + return this; + } + + // specific event + var callbacks = this._callbacks[event]; + if (!callbacks) return this; + + // remove all handlers + if (1 == arguments.length) { + delete this._callbacks[event]; + return this; + } + + // remove specific handler + var i = callbacks.indexOf(fn._off || fn); + if (~i) callbacks.splice(i, 1); + return this; +}; + +/** + * Emit `event` with the given args. + * + * @param {String} event + * @param {Mixed} ... + * @return {Emitter} + */ + +Emitter.prototype.emit = function(event){ + this._callbacks = this._callbacks || {}; + var args = [].slice.call(arguments, 1) + , callbacks = this._callbacks[event]; + + if (callbacks) { + callbacks = callbacks.slice(0); + for (var i = 0, len = callbacks.length; i < len; ++i) { + callbacks[i].apply(this, args); + } + } + + return this; +}; + +/** + * Return array of callbacks for `event`. + * + * @param {String} event + * @return {Array} + * @api public + */ + +Emitter.prototype.listeners = function(event){ + this._callbacks = this._callbacks || {}; + return this._callbacks[event] || []; +}; + +/** + * Check if this emitter has `event` handlers. + * + * @param {String} event + * @return {Boolean} + * @api public + */ + +Emitter.prototype.hasListeners = function(event){ + return !! this.listeners(event).length; +}; diff --git a/fixture/components/component/event/0.1.4/component.json b/fixture/components/component/event/0.1.4/component.json new file mode 100644 index 0000000..6bd6ccf --- /dev/null +++ b/fixture/components/component/event/0.1.4/component.json @@ -0,0 +1,15 @@ +{ + "name": "event", + "description": "Event binding component", + "version": "0.1.4", + "keywords": [ + "browser", + "event", + "events" + ], + "scripts": [ + "index.js" + ], + "repository": "component/event", + "resolved": "fa60a092b3670ae2e62bfd3620dc2b7196098b3c" +} \ No newline at end of file diff --git a/fixture/components/component/event/0.1.4/index.js b/fixture/components/component/event/0.1.4/index.js new file mode 100644 index 0000000..ef05d5c --- /dev/null +++ b/fixture/components/component/event/0.1.4/index.js @@ -0,0 +1,35 @@ +var bind = window.addEventListener ? 'addEventListener' : 'attachEvent', + unbind = window.removeEventListener ? 'removeEventListener' : 'detachEvent', + prefix = bind !== 'addEventListener' ? 'on' : ''; + +/** + * Bind `el` event `type` to `fn`. + * + * @param {Element} el + * @param {String} type + * @param {Function} fn + * @param {Boolean} capture + * @return {Function} + * @api public + */ + +exports.bind = function(el, type, fn, capture){ + el[bind](prefix + type, fn, capture || false); + return fn; +}; + +/** + * Unbind `el` event `type`'s callback `fn`. + * + * @param {Element} el + * @param {String} type + * @param {Function} fn + * @param {Boolean} capture + * @return {Function} + * @api public + */ + +exports.unbind = function(el, type, fn, capture){ + el[unbind](prefix + type, fn, capture || false); + return fn; +}; \ No newline at end of file diff --git a/fixture/components/component/in-groups-of/1.0.0/component.json b/fixture/components/component/in-groups-of/1.0.0/component.json new file mode 100644 index 0000000..e910689 --- /dev/null +++ b/fixture/components/component/in-groups-of/1.0.0/component.json @@ -0,0 +1,14 @@ +{ + "name": "in-groups-of", + "description": "Return an array of arrays in groups of N", + "version": "1.0.0", + "keywords": [], + "dependencies": {}, + "development": {}, + "scripts": [ + "index.js" + ], + "license": "MIT", + "repository": "component/in-groups-of", + "resolved": "09af9a093a4cb0c6c9b67b72ae6aa7dd8c3292e7" +} \ No newline at end of file diff --git a/fixture/components/component/in-groups-of/1.0.0/index.js b/fixture/components/component/in-groups-of/1.0.0/index.js new file mode 100644 index 0000000..5b61f76 --- /dev/null +++ b/fixture/components/component/in-groups-of/1.0.0/index.js @@ -0,0 +1,19 @@ + +module.exports = function(arr, n){ + var ret = []; + var group = []; + var len = arr.length; + var per = len * (n / len); + + for (var i = 0; i < len; ++i) { + group.push(arr[i]); + if ((i + 1) % n == 0) { + ret.push(group); + group = []; + } + } + + if (group.length) ret.push(group); + + return ret; +}; \ No newline at end of file diff --git a/fixture/components/component/indexof/0.0.3/component.json b/fixture/components/component/indexof/0.0.3/component.json new file mode 100644 index 0000000..57d46b7 --- /dev/null +++ b/fixture/components/component/indexof/0.0.3/component.json @@ -0,0 +1,21 @@ +{ + "name": "indexof", + "description": "Microsoft sucks", + "version": "0.0.3", + "keywords": [ + "index", + "array", + "indexOf" + ], + "dependencies": {}, + "development": { + "dependencies": { + "component/assert": "*" + } + }, + "scripts": [ + "index.js" + ], + "repository": "component/indexof", + "resolved": "d65c1a37e5e3b976f35ed103bc6e199f75e97d2b" +} \ No newline at end of file diff --git a/fixture/components/component/indexof/0.0.3/index.js b/fixture/components/component/indexof/0.0.3/index.js new file mode 100644 index 0000000..7f6005c --- /dev/null +++ b/fixture/components/component/indexof/0.0.3/index.js @@ -0,0 +1,7 @@ +module.exports = function(arr, obj){ + if (arr.indexOf) return arr.indexOf(obj); + for (var i = 0; i < arr.length; ++i) { + if (arr[i] === obj) return i; + } + return -1; +}; \ No newline at end of file diff --git a/fixture/components/component/map/0.0.1/component.json b/fixture/components/component/map/0.0.1/component.json new file mode 100644 index 0000000..61fd345 --- /dev/null +++ b/fixture/components/component/map/0.0.1/component.json @@ -0,0 +1,19 @@ +{ + "name": "map", + "description": "Array map utility", + "version": "0.0.1", + "keywords": [ + "array", + "map", + "utility" + ], + "dependencies": { + "component/to-function": "*" + }, + "development": {}, + "scripts": [ + "index.js" + ], + "repository": "component/map", + "resolved": "a33e131c24495d1f363c12118e263e41353d1109" +} \ No newline at end of file diff --git a/fixture/components/component/map/0.0.1/index.js b/fixture/components/component/map/0.0.1/index.js new file mode 100644 index 0000000..875a6d1 --- /dev/null +++ b/fixture/components/component/map/0.0.1/index.js @@ -0,0 +1,24 @@ + +/** + * Module dependencies. + */ + +var toFunction = require('to-function'); + +/** + * Map the given `arr` with callback `fn(val, i)`. + * + * @param {Array} arr + * @param {Function} fn + * @return {Array} + * @api public + */ + +module.exports = function(arr, fn){ + var ret = []; + fn = toFunction(fn); + for (var i = 0; i < arr.length; ++i) { + ret.push(fn(arr[i], i)); + } + return ret; +}; \ No newline at end of file diff --git a/fixture/components/component/props/1.1.2/component.json b/fixture/components/component/props/1.1.2/component.json new file mode 100644 index 0000000..e666a1b --- /dev/null +++ b/fixture/components/component/props/1.1.2/component.json @@ -0,0 +1,19 @@ +{ + "name": "props", + "description": "Parse immediate identifiers from a js expression", + "version": "1.1.2", + "keywords": [ + "template", + "engine", + "parse", + "parser" + ], + "dependencies": {}, + "development": {}, + "license": "MIT", + "scripts": [ + "index.js" + ], + "repository": "component/props", + "resolved": "e45d06d3b2827013035a992963e0e46000e96e45" +} \ No newline at end of file diff --git a/fixture/components/component/props/1.1.2/index.js b/fixture/components/component/props/1.1.2/index.js new file mode 100644 index 0000000..3bf657d --- /dev/null +++ b/fixture/components/component/props/1.1.2/index.js @@ -0,0 +1,85 @@ +/** + * Global Names + */ + +var globals = /\b(this|Array|Date|Object|Math|JSON)\b/g; + +/** + * Return immediate identifiers parsed from `str`. + * + * @param {String} str + * @param {String|Function} map function or prefix + * @return {Array} + * @api public + */ + +module.exports = function(str, fn){ + var p = unique(props(str)); + if (fn && 'string' == typeof fn) fn = prefixed(fn); + if (fn) return map(str, p, fn); + return p; +}; + +/** + * Return immediate identifiers in `str`. + * + * @param {String} str + * @return {Array} + * @api private + */ + +function props(str) { + return str + .replace(/\.\w+|\w+ *\(|"[^"]*"|'[^']*'|\/([^/]+)\//g, '') + .replace(globals, '') + .match(/[$a-zA-Z_]\w*/g) + || []; +} + +/** + * Return `str` with `props` mapped with `fn`. + * + * @param {String} str + * @param {Array} props + * @param {Function} fn + * @return {String} + * @api private + */ + +function map(str, props, fn) { + var re = /\.\w+|\w+ *\(|"[^"]*"|'[^']*'|\/([^/]+)\/|[a-zA-Z_]\w*/g; + return str.replace(re, function(_){ + if ('(' == _[_.length - 1]) return fn(_); + if (!~props.indexOf(_)) return _; + return fn(_); + }); +} + +/** + * Return unique array. + * + * @param {Array} arr + * @return {Array} + * @api private + */ + +function unique(arr) { + var ret = []; + + for (var i = 0; i < arr.length; i++) { + if (~ret.indexOf(arr[i])) continue; + ret.push(arr[i]); + } + + return ret; +} + +/** + * Map with prefix `str`. + */ + +function prefixed(str) { + return function(_){ + return str + _; + }; +} diff --git a/fixture/components/component/range/1.0.0/component.json b/fixture/components/component/range/1.0.0/component.json new file mode 100644 index 0000000..5f8509d --- /dev/null +++ b/fixture/components/component/range/1.0.0/component.json @@ -0,0 +1,18 @@ +{ + "name": "range", + "description": "Return a range of integers", + "version": "1.0.0", + "keywords": [ + "range", + "utility", + "array" + ], + "dependencies": {}, + "development": {}, + "scripts": [ + "index.js" + ], + "license": "MIT", + "repository": "component/range", + "resolved": "9517514aaf185c9650d3738005887c448af559f9" +} \ No newline at end of file diff --git a/fixture/components/component/range/1.0.0/index.js b/fixture/components/component/range/1.0.0/index.js new file mode 100644 index 0000000..5328119 --- /dev/null +++ b/fixture/components/component/range/1.0.0/index.js @@ -0,0 +1,11 @@ + +module.exports = function(from, to, inclusive){ + var ret = []; + if (inclusive) to++; + + for (var n = from; n < to; ++n) { + ret.push(n); + } + + return ret; +} \ No newline at end of file diff --git a/fixture/components/component/to-function/2.0.6/component.json b/fixture/components/component/to-function/2.0.6/component.json new file mode 100644 index 0000000..33a8114 --- /dev/null +++ b/fixture/components/component/to-function/2.0.6/component.json @@ -0,0 +1,18 @@ +{ + "name": "to-function", + "description": "Convert property access strings into functions", + "version": "2.0.6", + "keywords": [ + "utility", + "function" + ], + "dependencies": { + "component/props": "*" + }, + "development": {}, + "scripts": [ + "index.js" + ], + "repository": "component/to-function", + "resolved": "8ea555132a66c0d951e5917580f91fa0b1b4441a" +} \ No newline at end of file diff --git a/fixture/components/component/to-function/2.0.6/index.js b/fixture/components/component/to-function/2.0.6/index.js new file mode 100644 index 0000000..3416091 --- /dev/null +++ b/fixture/components/component/to-function/2.0.6/index.js @@ -0,0 +1,152 @@ + +/** + * Module Dependencies + */ + +var expr; +try { + expr = require('props'); +} catch(e) { + expr = require('component-props'); +} + +/** + * Expose `toFunction()`. + */ + +module.exports = toFunction; + +/** + * Convert `obj` to a `Function`. + * + * @param {Mixed} obj + * @return {Function} + * @api private + */ + +function toFunction(obj) { + switch ({}.toString.call(obj)) { + case '[object Object]': + return objectToFunction(obj); + case '[object Function]': + return obj; + case '[object String]': + return stringToFunction(obj); + case '[object RegExp]': + return regexpToFunction(obj); + default: + return defaultToFunction(obj); + } +} + +/** + * Default to strict equality. + * + * @param {Mixed} val + * @return {Function} + * @api private + */ + +function defaultToFunction(val) { + return function(obj){ + return val === obj; + }; +} + +/** + * Convert `re` to a function. + * + * @param {RegExp} re + * @return {Function} + * @api private + */ + +function regexpToFunction(re) { + return function(obj){ + return re.test(obj); + }; +} + +/** + * Convert property `str` to a function. + * + * @param {String} str + * @return {Function} + * @api private + */ + +function stringToFunction(str) { + // immediate such as "> 20" + if (/^ *\W+/.test(str)) return new Function('_', 'return _ ' + str); + + // properties such as "name.first" or "age > 18" or "age > 18 && age < 36" + return new Function('_', 'return ' + get(str)); +} + +/** + * Convert `object` to a function. + * + * @param {Object} object + * @return {Function} + * @api private + */ + +function objectToFunction(obj) { + var match = {}; + for (var key in obj) { + match[key] = typeof obj[key] === 'string' + ? defaultToFunction(obj[key]) + : toFunction(obj[key]); + } + return function(val){ + if (typeof val !== 'object') return false; + for (var key in match) { + if (!(key in val)) return false; + if (!match[key](val[key])) return false; + } + return true; + }; +} + +/** + * Built the getter function. Supports getter style functions + * + * @param {String} str + * @return {String} + * @api private + */ + +function get(str) { + var props = expr(str); + if (!props.length) return '_.' + str; + + var val, i, prop; + for (i = 0; i < props.length; i++) { + prop = props[i]; + val = '_.' + prop; + val = "('function' == typeof " + val + " ? " + val + "() : " + val + ")"; + + // mimic negative lookbehind to avoid problems with nested properties + str = stripNested(prop, str, val); + } + + return str; +} + +/** + * Mimic negative lookbehind to avoid problems with nested properties. + * + * See: http://blog.stevenlevithan.com/archives/mimic-lookbehind-javascript + * + * @param {String} prop + * @param {String} str + * @param {String} val + * @return {String} + * @api private + */ + +function stripNested (prop, str, val) { + return str.replace(new RegExp('(\\.)?' + prop, 'g'), function($0, $1) { + return $1 ? $0 : val; + }); +} diff --git a/fixture/components/component/type/v1.2.0/component.json b/fixture/components/component/type/v1.2.0/component.json new file mode 100644 index 0000000..9b6e3fa --- /dev/null +++ b/fixture/components/component/type/v1.2.0/component.json @@ -0,0 +1,21 @@ +{ + "name": "type", + "description": "Cross-browser type assertions (less broken typeof)", + "version": "1.2.0", + "keywords": [ + "typeof", + "type", + "utility" + ], + "dependencies": {}, + "development": { + "dependencies": { + "component/assert": "*" + } + }, + "scripts": [ + "index.js" + ], + "repository": "component/type", + "resolved": "168462c30c13a5f777974e336c2e18d6ead64ef5" +} \ No newline at end of file diff --git a/fixture/components/component/type/v1.2.0/index.js b/fixture/components/component/type/v1.2.0/index.js new file mode 100644 index 0000000..906a34b --- /dev/null +++ b/fixture/components/component/type/v1.2.0/index.js @@ -0,0 +1,36 @@ +/** + * toString ref. + */ + +var toString = Object.prototype.toString; + +/** + * Return the type of `val`. + * + * @param {Mixed} val + * @return {String} + * @api public + */ + +module.exports = function(val){ + switch (toString.call(val)) { + case '[object Date]': return 'date'; + case '[object RegExp]': return 'regexp'; + case '[object Arguments]': return 'arguments'; + case '[object Array]': return 'array'; + case '[object Error]': return 'error'; + } + + if (val === null) return 'null'; + if (val === undefined) return 'undefined'; + if (val !== val) return 'nan'; + if (val && val.nodeType === 1) return 'element'; + + if (typeof Buffer != 'undefined' && Buffer.isBuffer(val)) return 'buffer'; + + val = val.valueOf + ? val.valueOf() + : Object.prototype.valueOf.apply(val) + + return typeof val; +}; diff --git a/fixture/components/stephenmathieson/normalize/0.0.1/component.json b/fixture/components/stephenmathieson/normalize/0.0.1/component.json new file mode 100644 index 0000000..0726ac7 --- /dev/null +++ b/fixture/components/stephenmathieson/normalize/0.0.1/component.json @@ -0,0 +1,19 @@ +{ + "name": "normalize", + "description": "Normalize events", + "version": "0.0.1", + "keywords": [], + "dependencies": {}, + "development": { + "dependencies": { + "component/event": "*" + } + }, + "license": "MIT", + "main": "index.js", + "scripts": [ + "index.js" + ], + "repository": "stephenmathieson/normalize", + "resolved": "37e14f03f454526f2425731cded883d55ee0b1ff" +} \ No newline at end of file diff --git a/fixture/components/stephenmathieson/normalize/0.0.1/index.js b/fixture/components/stephenmathieson/normalize/0.0.1/index.js new file mode 100644 index 0000000..ec2aa28 --- /dev/null +++ b/fixture/components/stephenmathieson/normalize/0.0.1/index.js @@ -0,0 +1,47 @@ + +/** + * Normalize the events provided to `fn` + * + * @api public + * @param {Function|Event} fn + * @return {Function|Event} + */ + +exports = module.exports = function (fn) { + // handle functions which are passed an event + if (typeof fn === 'function') { + return function (event) { + event = exports.normalize(event); + fn.call(this, event); + }; + } + + // just normalize the event + return exports.normalize(fn); +}; + +/** + * Normalize the given `event` + * + * @api private + * @param {Event} event + * @return {Event} + */ + +exports.normalize = function (event) { + event = event || window.event; + + event.target = event.target || event.srcElement; + + event.which = event.which || event.keyCode || event.charCode; + + event.preventDefault = event.preventDefault || function () { + this.returnValue = false; + }; + + event.stopPropagation = event.stopPropagation || function () { + this.cancelBubble = true; + }; + + return event; +}; diff --git a/fixture/components/yields/empty/0.0.1/component.json b/fixture/components/yields/empty/0.0.1/component.json new file mode 100644 index 0000000..e0aa4b0 --- /dev/null +++ b/fixture/components/yields/empty/0.0.1/component.json @@ -0,0 +1,21 @@ +{ + "name": "empty", + "description": "empty an element.", + "version": "0.0.1", + "keywords": [ + "empty" + ], + "dependencies": {}, + "development": { + "dependencies": { + "visionmedia/mocha": "*" + } + }, + "license": "MIT", + "main": "index.js", + "scripts": [ + "index.js" + ], + "repository": "yields/empty", + "resolved": "2859e4348e7b3a7268655397b959b850f7376dd5" +} \ No newline at end of file diff --git a/fixture/components/yields/empty/0.0.1/index.js b/fixture/components/yields/empty/0.0.1/index.js new file mode 100644 index 0000000..24ebeb8 --- /dev/null +++ b/fixture/components/yields/empty/0.0.1/index.js @@ -0,0 +1,12 @@ + +/** + * Empty the given `el`. + * + * @param {Element} el + * @return {Element} + */ + +module.exports = function(el, node){ + while (node = el.firstChild) el.removeChild(node); + return el; +}; diff --git a/fixture/entry.js b/fixture/entry.js index 1e77dd3..1205d96 100644 --- a/fixture/entry.js +++ b/fixture/entry.js @@ -1,2 +1,60 @@ var l = require('local-comp'); console.log(l); +// some styles +require('./styles.css'); + +// more fixture +var Calendar = require('calendar'); +require('calendar/0.2.0/lib/calendar.css'); +// require('datepicker/1.0.1/datepicker.css'); + +var one = new Calendar().showMonthSelect().showYearSelect(); + +one.on('view change', function(date, action){ + console.log('change %s', action); + var twoDate = new Date(date); + twoDate.setMonth(date.getMonth() + 1) + small.show(twoDate); +}); + +one.on('change', function(date){ + console.log('selected: %s of %s %s', + date.getDate(), + date.getMonth(), + date.getFullYear()); + var newDate = new Date(date); + newDate.setMonth(date.getMonth() + 1); + large.select(newDate); +}); + +var container = document.querySelector('#standard'); +container.appendChild(one.el); + +var small = new Calendar; +small.addClass('small'); +container.appendChild(small.el); +small.next(); + +var frLocale = { + months : 'janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre'.split('_'), + weekdaysMin : 'Di_Lu_Ma_Me_Je_Ve_Sa'.split('_'), +}; +var large = new Calendar; +large + .addClass('large') + .locale(frLocale); +container.appendChild(large.el); + + +container = document.querySelector('#restricted'); +var restricted = new Calendar(new Date(2004, 6, 11)) + .min(new Date(2004, 5, 12)) + .max([2004, 7, 19]) + .select(new Date(2004, 7, 19)); +container.appendChild(restricted.el); +restricted = new Calendar(new Date(2004, 6, 11)) + .max(new Date(2004, 5, 12)) + .min([2004, 5, 18]) + .show(new Date(2004, 5, 19)); +container.appendChild(restricted.el); + diff --git a/fixture/index.html b/fixture/index.html index 0b11286..f9b37d8 100644 --- a/fixture/index.html +++ b/fixture/index.html @@ -5,6 +5,11 @@ components +
+

Calendar

+
+
+
diff --git a/fixture/package.json b/fixture/package.json index 49caac1..ab546e9 100644 --- a/fixture/package.json +++ b/fixture/package.json @@ -13,8 +13,15 @@ "devDependencies": { "component": "^1.1.0", "css-loader": "^0.18.0", + "raw-loader": "^0.5.1", "style-loader": "^0.12.4", "webpack": "^1.12.2", "webpack-dev-server": "^1.11.0" + }, + "dependencies": { + "clone-component": "^0.2.2", + "component-props": "^1.1.1", + "component-type": "^1.2.0", + "type-component": "0.0.1" } } diff --git a/fixture/styles.css b/fixture/styles.css new file mode 100644 index 0000000..2a53877 --- /dev/null +++ b/fixture/styles.css @@ -0,0 +1,44 @@ + body { + font: 14px "Helvetica Neue", Helvetica, Arial; + /*padding: 80px;*/ + color: #333; + } + + .calendar.large { + float: left; + clear: both; + } + + .calendar.large tbody td { + padding: 50px; + border: 1px solid #eee; + position: relative; + } + + .calendar.large tbody a { + position: absolute; + top: 5px; + right: 5px; + } + + .calendar.small th { + font-size: 10px; + } + + .calendar.small td a { + font-size: 10px; + padding: 3px; + } + + .calendar td a.invalid { + opacity: .2; + background-color: rgba(0, 0, 0, .2); + cursor: default; + } + + #restricted { + clear: left; + } + #restricted .calendar { + float: left; + } From da3dc4c618868cf8a776fb7641c019e80a9de6a3 Mon Sep 17 00:00:00 2001 From: Amin Meyghani Date: Fri, 18 Sep 2015 15:48:22 -0400 Subject: [PATCH 05/10] add date picker example --- .../aurora-calendar/1.0.0/component.json | 21 + .../component/aurora-calendar/1.0.0/style.css | 54 ++ .../aurora-popover/master/aurora-popover.css | 21 + .../aurora-popover/master/component.json | 19 + .../component/aurora-tip/1.0.0/aurora-tip.css | 93 ++++ .../component/aurora-tip/1.0.0/component.json | 19 + .../component/aurora/master/component.json | 17 + .../component/classes/1.2.1/component.json | 20 + .../component/classes/1.2.1/index.js | 184 +++++++ .../component/closest/1.0.0/component.json | 15 + .../component/closest/1.0.0/index.js | 32 ++ .../component/css/0.0.6/component.json | 35 ++ .../components/component/css/0.0.6/index.js | 58 +++ .../component/css/0.0.6/lib/computed.js | 48 ++ .../components/component/css/0.0.6/lib/css.js | 80 +++ .../component/css/0.0.6/lib/hooks.js | 162 ++++++ .../component/css/0.0.6/lib/prop.js | 36 ++ .../component/css/0.0.6/lib/style.js | 106 ++++ .../component/css/0.0.6/lib/styles.js | 20 + .../component/css/0.0.6/lib/support.js | 101 ++++ .../component/css/0.0.6/lib/swap.js | 32 ++ .../component/css/0.0.6/lib/vendor.js | 36 ++ .../component/datepicker/1.0.1/component.json | 27 + .../component/datepicker/1.0.1/datepicker.css | 12 + .../component/datepicker/1.0.1/index.js | 56 ++ .../component/delegate/0.2.3/component.json | 20 + .../component/delegate/0.2.3/index.js | 42 ++ .../component/domify/1.3.0/component.json | 23 + .../component/domify/1.3.0/index.js | 93 ++++ .../component/each/0.2.6/component.json | 22 + .../components/component/each/0.2.6/index.js | 89 ++++ .../component/emitter/1.1.3/component.json | 15 + .../component/emitter/1.1.3/index.js | 164 ++++++ .../component/events/1.0.9/component.json | 21 + .../component/events/1.0.9/index.js | 176 +++++++ .../component/inherit/0.0.3/component.json | 15 + .../component/inherit/0.0.3/index.js | 7 + .../matches-selector/0.1.5/component.json | 23 + .../component/matches-selector/0.1.5/index.js | 46 ++ .../component/popover/1.1.1/component.json | 26 + .../component/popover/1.1.1/index.js | 85 +++ .../component/popover/1.1.1/template.js | 1 + .../component/query/0.0.3/component.json | 24 + .../components/component/query/0.0.3/index.js | 21 + .../component/tip/2.5.0/component.json | 43 ++ .../components/component/tip/2.5.0/index.js | 485 ++++++++++++++++++ .../component/tip/2.5.0/template.html | 4 + .../components/component/tip/2.5.0/tip.css | 20 + .../component/type/1.0.0/component.json | 21 + .../components/component/type/1.0.0/index.js | 32 ++ .../within-document/0.0.1/component.json | 15 + .../component/within-document/0.0.1/index.js | 16 + .../to-camel-case/0.2.1/component.json | 25 + .../to-camel-case/0.2.1/index.js | 24 + .../to-no-case/0.1.0/component.json | 27 + .../ianstormtaylor/to-no-case/0.1.0/index.js | 74 +++ .../to-space-case/0.1.2/component.json | 25 + .../to-space-case/0.1.2/index.js | 24 + .../rauchg/ms.js/0.7.1/component.json | 16 + .../components/rauchg/ms.js/0.7.1/index.js | 125 +++++ .../visionmedia/debug/2.2.0/browser.js | 168 ++++++ .../visionmedia/debug/2.2.0/component.json | 20 + .../visionmedia/debug/2.2.0/debug.js | 197 +++++++ .../bounding-client-rect/1.0.5/component.json | 28 + .../bounding-client-rect/1.0.5/index.js | 57 ++ .../get-document/1.0.0/component.json | 20 + .../webmodules/get-document/1.0.0/index.js | 57 ++ fixture/entry.js | 6 + fixture/index.html | 11 + fixture/package.json | 1 + 70 files changed, 3758 insertions(+) create mode 100644 fixture/components/component/aurora-calendar/1.0.0/component.json create mode 100644 fixture/components/component/aurora-calendar/1.0.0/style.css create mode 100644 fixture/components/component/aurora-popover/master/aurora-popover.css create mode 100644 fixture/components/component/aurora-popover/master/component.json create mode 100644 fixture/components/component/aurora-tip/1.0.0/aurora-tip.css create mode 100644 fixture/components/component/aurora-tip/1.0.0/component.json create mode 100644 fixture/components/component/aurora/master/component.json create mode 100644 fixture/components/component/classes/1.2.1/component.json create mode 100644 fixture/components/component/classes/1.2.1/index.js create mode 100644 fixture/components/component/closest/1.0.0/component.json create mode 100644 fixture/components/component/closest/1.0.0/index.js create mode 100644 fixture/components/component/css/0.0.6/component.json create mode 100644 fixture/components/component/css/0.0.6/index.js create mode 100644 fixture/components/component/css/0.0.6/lib/computed.js create mode 100644 fixture/components/component/css/0.0.6/lib/css.js create mode 100644 fixture/components/component/css/0.0.6/lib/hooks.js create mode 100644 fixture/components/component/css/0.0.6/lib/prop.js create mode 100644 fixture/components/component/css/0.0.6/lib/style.js create mode 100644 fixture/components/component/css/0.0.6/lib/styles.js create mode 100644 fixture/components/component/css/0.0.6/lib/support.js create mode 100644 fixture/components/component/css/0.0.6/lib/swap.js create mode 100644 fixture/components/component/css/0.0.6/lib/vendor.js create mode 100644 fixture/components/component/datepicker/1.0.1/component.json create mode 100644 fixture/components/component/datepicker/1.0.1/datepicker.css create mode 100644 fixture/components/component/datepicker/1.0.1/index.js create mode 100644 fixture/components/component/delegate/0.2.3/component.json create mode 100644 fixture/components/component/delegate/0.2.3/index.js create mode 100644 fixture/components/component/domify/1.3.0/component.json create mode 100644 fixture/components/component/domify/1.3.0/index.js create mode 100644 fixture/components/component/each/0.2.6/component.json create mode 100644 fixture/components/component/each/0.2.6/index.js create mode 100644 fixture/components/component/emitter/1.1.3/component.json create mode 100644 fixture/components/component/emitter/1.1.3/index.js create mode 100644 fixture/components/component/events/1.0.9/component.json create mode 100644 fixture/components/component/events/1.0.9/index.js create mode 100644 fixture/components/component/inherit/0.0.3/component.json create mode 100644 fixture/components/component/inherit/0.0.3/index.js create mode 100644 fixture/components/component/matches-selector/0.1.5/component.json create mode 100644 fixture/components/component/matches-selector/0.1.5/index.js create mode 100644 fixture/components/component/popover/1.1.1/component.json create mode 100644 fixture/components/component/popover/1.1.1/index.js create mode 100644 fixture/components/component/popover/1.1.1/template.js create mode 100644 fixture/components/component/query/0.0.3/component.json create mode 100644 fixture/components/component/query/0.0.3/index.js create mode 100644 fixture/components/component/tip/2.5.0/component.json create mode 100644 fixture/components/component/tip/2.5.0/index.js create mode 100644 fixture/components/component/tip/2.5.0/template.html create mode 100644 fixture/components/component/tip/2.5.0/tip.css create mode 100644 fixture/components/component/type/1.0.0/component.json create mode 100644 fixture/components/component/type/1.0.0/index.js create mode 100644 fixture/components/component/within-document/0.0.1/component.json create mode 100644 fixture/components/component/within-document/0.0.1/index.js create mode 100644 fixture/components/ianstormtaylor/to-camel-case/0.2.1/component.json create mode 100644 fixture/components/ianstormtaylor/to-camel-case/0.2.1/index.js create mode 100644 fixture/components/ianstormtaylor/to-no-case/0.1.0/component.json create mode 100644 fixture/components/ianstormtaylor/to-no-case/0.1.0/index.js create mode 100644 fixture/components/ianstormtaylor/to-space-case/0.1.2/component.json create mode 100644 fixture/components/ianstormtaylor/to-space-case/0.1.2/index.js create mode 100644 fixture/components/rauchg/ms.js/0.7.1/component.json create mode 100644 fixture/components/rauchg/ms.js/0.7.1/index.js create mode 100644 fixture/components/visionmedia/debug/2.2.0/browser.js create mode 100644 fixture/components/visionmedia/debug/2.2.0/component.json create mode 100644 fixture/components/visionmedia/debug/2.2.0/debug.js create mode 100644 fixture/components/webmodules/bounding-client-rect/1.0.5/component.json create mode 100644 fixture/components/webmodules/bounding-client-rect/1.0.5/index.js create mode 100644 fixture/components/webmodules/get-document/1.0.0/component.json create mode 100644 fixture/components/webmodules/get-document/1.0.0/index.js diff --git a/fixture/components/component/aurora-calendar/1.0.0/component.json b/fixture/components/component/aurora-calendar/1.0.0/component.json new file mode 100644 index 0000000..dcd42bf --- /dev/null +++ b/fixture/components/component/aurora-calendar/1.0.0/component.json @@ -0,0 +1,21 @@ +{ + "name": "aurora-calendar", + "description": "Aurora calendar theme", + "version": "1.0.0", + "keywords": [ + "aurora", + "theme", + "calendar" + ], + "dependencies": {}, + "development": { + "dependencies": { + "component/calendar": "*" + } + }, + "styles": [ + "style.css" + ], + "repository": "component/aurora-calendar", + "resolved": "333903f965f68e39f54f164141a0c3d49f2a4f06" +} \ No newline at end of file diff --git a/fixture/components/component/aurora-calendar/1.0.0/style.css b/fixture/components/component/aurora-calendar/1.0.0/style.css new file mode 100644 index 0000000..7587f81 --- /dev/null +++ b/fixture/components/component/aurora-calendar/1.0.0/style.css @@ -0,0 +1,54 @@ +.calendar a { + display: block; + padding: 5px; + text-decoration: none; + color: inherit; + -o-border-radius: 3px; + -ms-border-radius: 3px; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px +} + +.calendar a:hover { + background: #efefef +} + +.calendar a:active { + opacity: .75; + -ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=75); + filter: alpha(opacity=75) +} + +.calendar-table { + font-size: 13px; + border-bottom: 1px solid #ddd; + -o-border-radius: 5px; + -ms-border-radius: 5px; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; + border-radius: 5px; + -o-box-shadow: 0 1px 2px #eee; + -ms-box-shadow: 0 1px 2px #eee; + -moz-box-shadow: 0 1px 2px #eee; + -webkit-box-shadow: 0 1px 2px #eee; + box-shadow: 0 1px 2px #eee +} + +.calendar-table .selected { + background: none +} + +.calendar-table .selected a { + background: -o-linear-gradient(#76aaef, #0085CC); + background: -ms-linear-gradient(#76aaef, #0085CC); + background: -moz-linear-gradient(#76aaef, #0085CC); + background: -webkit-linear-gradient(#76aaef, #0085CC); + background: linear-gradient(#76aaef, #0085CC); + color: white; + -o-box-shadow: inset 0 1px #2b8dea; + -ms-box-shadow: inset 0 1px #2b8dea; + -moz-box-shadow: inset 0 1px #2b8dea; + -webkit-box-shadow: inset 0 1px #2b8dea; + box-shadow: inset 0 1px #2b8dea +} \ No newline at end of file diff --git a/fixture/components/component/aurora-popover/master/aurora-popover.css b/fixture/components/component/aurora-popover/master/aurora-popover.css new file mode 100644 index 0000000..e3b493e --- /dev/null +++ b/fixture/components/component/aurora-popover/master/aurora-popover.css @@ -0,0 +1,21 @@ + +.popover .tip-inner { + padding: 0; + border: 2px solid #1c1c1c; + background: white; + color: inherit; +} + +.popover-title { + display: block; + width: 100%; + text-align: left; + font-weight: bold; + padding: 10px; +} + +.popover-content { + padding: 10px; + padding-top: 0; +} + diff --git a/fixture/components/component/aurora-popover/master/component.json b/fixture/components/component/aurora-popover/master/component.json new file mode 100644 index 0000000..b25369c --- /dev/null +++ b/fixture/components/component/aurora-popover/master/component.json @@ -0,0 +1,19 @@ +{ + "name": "aurora-popover", + "description": "Aurora Popover theme", + "version": "0.0.1", + "keywords": [ + "aurora", + "popover", + "theme" + ], + "dependencies": { + "component/aurora-tip": "*" + }, + "development": {}, + "styles": [ + "aurora-popover.css" + ], + "repository": "component/aurora-popover", + "resolved": "f2af638507d865f9e7d78fdb3971d82defb15fa8" +} \ No newline at end of file diff --git a/fixture/components/component/aurora-tip/1.0.0/aurora-tip.css b/fixture/components/component/aurora-tip/1.0.0/aurora-tip.css new file mode 100644 index 0000000..c1af877 --- /dev/null +++ b/fixture/components/component/aurora-tip/1.0.0/aurora-tip.css @@ -0,0 +1,93 @@ + +/** + * Tip. + * + * .tip.tip-[direction] + * .tip-inner + * .tip-arrow + */ + +.tip { + font-size: 11px; +} + +.tip-inner { + background-color: rgba(0,0,0,.75); + color: #fff; + padding: 8px 10px 7px 10px; + text-align: center; +} + +.tip-inner { + border-radius: 3px; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; +} + +.tip-arrow { + position: absolute; + width: 0; + height: 0; + line-height: 0; + border: 5px dashed rgba(0,0,0,.75); +} + +.tip-arrow-top { border-top-color: rgba(0,0,0,.75) } +.tip-arrow-bottom { border-bottom-color: rgba(0,0,0,.75) } +.tip-arrow-left { border-left-color: rgba(0,0,0,.75) } +.tip-arrow-right { border-right-color: rgba(0,0,0,.75) } + +.tip-top .tip-arrow, +.tip-top-left .tip-arrow, +.tip-top-right .tip-arrow { + bottom: 0; + left: 50%; + margin-left: -5px; + border-top-style: solid; + border-bottom: none; + border-left-color: transparent; + border-right-color: transparent +} + +.tip-bottom .tip-arrow, +.tip-bottom-left .tip-arrow, +.tip-bottom-right .tip-arrow { + top: 0px; + left: 50%; + margin-left: -5px; + border-bottom-style: solid; + border-top: none; + border-left-color: transparent; + border-right-color: transparent +} + +.tip-left .tip-arrow { + right: 0; + top: 50%; + margin-top: -5px; + border-left-style: solid; + border-right: none; + border-top-color: transparent; + border-bottom-color: transparent +} + +.tip-right .tip-arrow { + left: 0; + top: 50%; + margin-top: -5px; + border-right-style: solid; + border-left: none; + border-top-color: transparent; + border-bottom-color: transparent +} + +.tip-top-left .tip-arrow, +.tip-bottom-left .tip-arrow { + left: 85%; +} + + +.tip-top-right .tip-arrow, +.tip-bottom-right .tip-arrow { + left: 15px; +} \ No newline at end of file diff --git a/fixture/components/component/aurora-tip/1.0.0/component.json b/fixture/components/component/aurora-tip/1.0.0/component.json new file mode 100644 index 0000000..0271a44 --- /dev/null +++ b/fixture/components/component/aurora-tip/1.0.0/component.json @@ -0,0 +1,19 @@ +{ + "name": "aurora-tip", + "description": "Aurora theme for tool tips", + "version": "1.0.0", + "keywords": [ + "aurora", + "theme", + "tip", + "tooltip", + "tooltips" + ], + "dependencies": {}, + "development": {}, + "styles": [ + "aurora-tip.css" + ], + "repository": "component/aurora-tip", + "resolved": "39951990a134916a9d1ef41c38c83a64b1c177cd" +} \ No newline at end of file diff --git a/fixture/components/component/aurora/master/component.json b/fixture/components/component/aurora/master/component.json new file mode 100644 index 0000000..f70256f --- /dev/null +++ b/fixture/components/component/aurora/master/component.json @@ -0,0 +1,17 @@ +{ + "name": "aurora", + "description": "Aurora theme for Calendar, Popover, and Tip", + "version": "0.0.1", + "keywords": [ + "aurora", + "theme", + "bundle" + ], + "dependencies": { + "component/aurora-popover": "*", + "component/aurora-calendar": "*" + }, + "development": {}, + "repository": "component/aurora", + "resolved": "e69b69706cd75d82452437ba54a427e4e042a291" +} \ No newline at end of file diff --git a/fixture/components/component/classes/1.2.1/component.json b/fixture/components/component/classes/1.2.1/component.json new file mode 100644 index 0000000..e585952 --- /dev/null +++ b/fixture/components/component/classes/1.2.1/component.json @@ -0,0 +1,20 @@ +{ + "name": "classes", + "version": "1.2.1", + "description": "Cross-browser element class list", + "keywords": [ + "dom", + "html", + "classList", + "class", + "ui" + ], + "scripts": [ + "index.js" + ], + "dependencies": { + "component/indexof": "*" + }, + "repository": "component/classes", + "resolved": "8c6a364b96ba2b1729e91bf76aeb66a8b7a7b5ed" +} \ No newline at end of file diff --git a/fixture/components/component/classes/1.2.1/index.js b/fixture/components/component/classes/1.2.1/index.js new file mode 100644 index 0000000..335c68d --- /dev/null +++ b/fixture/components/component/classes/1.2.1/index.js @@ -0,0 +1,184 @@ +/** + * Module dependencies. + */ + +var index = require('indexof'); + +/** + * Whitespace regexp. + */ + +var re = /\s+/; + +/** + * toString reference. + */ + +var toString = Object.prototype.toString; + +/** + * Wrap `el` in a `ClassList`. + * + * @param {Element} el + * @return {ClassList} + * @api public + */ + +module.exports = function(el){ + return new ClassList(el); +}; + +/** + * Initialize a new ClassList for `el`. + * + * @param {Element} el + * @api private + */ + +function ClassList(el) { + if (!el) throw new Error('A DOM element reference is required'); + this.el = el; + this.list = el.classList; +} + +/** + * Add class `name` if not already present. + * + * @param {String} name + * @return {ClassList} + * @api public + */ + +ClassList.prototype.add = function(name){ + // classList + if (this.list) { + this.list.add(name); + return this; + } + + // fallback + var arr = this.array(); + var i = index(arr, name); + if (!~i) arr.push(name); + this.el.className = arr.join(' '); + return this; +}; + +/** + * Remove class `name` when present, or + * pass a regular expression to remove + * any which match. + * + * @param {String|RegExp} name + * @return {ClassList} + * @api public + */ + +ClassList.prototype.remove = function(name){ + if ('[object RegExp]' == toString.call(name)) { + return this.removeMatching(name); + } + + // classList + if (this.list) { + this.list.remove(name); + return this; + } + + // fallback + var arr = this.array(); + var i = index(arr, name); + if (~i) arr.splice(i, 1); + this.el.className = arr.join(' '); + return this; +}; + +/** + * Remove all classes matching `re`. + * + * @param {RegExp} re + * @return {ClassList} + * @api private + */ + +ClassList.prototype.removeMatching = function(re){ + var arr = this.array(); + for (var i = 0; i < arr.length; i++) { + if (re.test(arr[i])) { + this.remove(arr[i]); + } + } + return this; +}; + +/** + * Toggle class `name`, can force state via `force`. + * + * For browsers that support classList, but do not support `force` yet, + * the mistake will be detected and corrected. + * + * @param {String} name + * @param {Boolean} force + * @return {ClassList} + * @api public + */ + +ClassList.prototype.toggle = function(name, force){ + // classList + if (this.list) { + if ("undefined" !== typeof force) { + if (force !== this.list.toggle(name, force)) { + this.list.toggle(name); // toggle again to correct + } + } else { + this.list.toggle(name); + } + return this; + } + + // fallback + if ("undefined" !== typeof force) { + if (!force) { + this.remove(name); + } else { + this.add(name); + } + } else { + if (this.has(name)) { + this.remove(name); + } else { + this.add(name); + } + } + + return this; +}; + +/** + * Return an array of classes. + * + * @return {Array} + * @api public + */ + +ClassList.prototype.array = function(){ + var str = this.el.className.replace(/^\s+|\s+$/g, ''); + var arr = str.split(re); + if ('' === arr[0]) arr.shift(); + return arr; +}; + +/** + * Check if class `name` is present. + * + * @param {String} name + * @return {ClassList} + * @api public + */ + +ClassList.prototype.has = +ClassList.prototype.contains = function(name){ + return this.list + ? this.list.contains(name) + : !! ~index(this.array(), name); +}; diff --git a/fixture/components/component/closest/1.0.0/component.json b/fixture/components/component/closest/1.0.0/component.json new file mode 100644 index 0000000..d9d4c23 --- /dev/null +++ b/fixture/components/component/closest/1.0.0/component.json @@ -0,0 +1,15 @@ +{ + "name": "closest", + "description": "Find the closest ancestor matching a selector string", + "version": "1.0.0", + "dependencies": { + "component/matches-selector": "0.1.5" + }, + "main": "index.js", + "scripts": [ + "index.js" + ], + "license": "MIT", + "repository": "component/closest", + "resolved": "ea5e19ca0766b40b86eb4997ca21e5fe2d000475" +} \ No newline at end of file diff --git a/fixture/components/component/closest/1.0.0/index.js b/fixture/components/component/closest/1.0.0/index.js new file mode 100644 index 0000000..bab079d --- /dev/null +++ b/fixture/components/component/closest/1.0.0/index.js @@ -0,0 +1,32 @@ +/** + * Module Dependencies + */ + +var matches = require('matches-selector') + +/** + * Export `closest` + */ + +module.exports = closest + +/** + * Closest + * + * @param {Element} el + * @param {String} selector + * @param {Element} scope (optional) + */ + +function closest (el, selector, scope) { + scope = scope || document.documentElement; + + // walk up the dom + while (el && el !== scope) { + if (matches(el, selector)) return el; + el = el.parentNode; + } + + // check scope for match + return matches(el, selector) ? el : null; +} diff --git a/fixture/components/component/css/0.0.6/component.json b/fixture/components/component/css/0.0.6/component.json new file mode 100644 index 0000000..eeeccc4 --- /dev/null +++ b/fixture/components/component/css/0.0.6/component.json @@ -0,0 +1,35 @@ +{ + "name": "css", + "description": "jquery's css()", + "version": "0.0.6", + "keywords": [], + "dependencies": { + "component/each": "*", + "visionmedia/debug": "*", + "ianstormtaylor/to-camel-case": "0.2.1", + "component/within-document": "0.0.1" + }, + "development": { + "dependencies": { + "component/domify": "*", + "component/assert": "*", + "component/load-styles": "*" + } + }, + "license": "MIT", + "main": "index.js", + "scripts": [ + "index.js", + "lib/css.js", + "lib/prop.js", + "lib/swap.js", + "lib/style.js", + "lib/hooks.js", + "lib/styles.js", + "lib/vendor.js", + "lib/support.js", + "lib/computed.js" + ], + "repository": "component/css", + "resolved": "a4f39ee46b185c6545bc0855be276a192720a7e4" +} \ No newline at end of file diff --git a/fixture/components/component/css/0.0.6/index.js b/fixture/components/component/css/0.0.6/index.js new file mode 100644 index 0000000..f5fb335 --- /dev/null +++ b/fixture/components/component/css/0.0.6/index.js @@ -0,0 +1,58 @@ +/** + * Module Dependencies + */ + +var debug = require('debug')('css'); +var set = require('./lib/style'); +var get = require('./lib/css'); + +/** + * Expose `css` + */ + +module.exports = css; + +/** + * Get and set css values + * + * @param {Element} el + * @param {String|Object} prop + * @param {Mixed} val + * @return {Element} el + * @api public + */ + +function css(el, prop, val) { + if (!el) return; + + if (undefined !== val) { + var obj = {}; + obj[prop] = val; + debug('setting styles %j', obj); + return setStyles(el, obj); + } + + if ('object' == typeof prop) { + debug('setting styles %j', prop); + return setStyles(el, prop); + } + + debug('getting %s', prop); + return get(el, prop); +} + +/** + * Set the styles on an element + * + * @param {Element} el + * @param {Object} props + * @return {Element} el + */ + +function setStyles(el, props) { + for (var prop in props) { + set(el, prop, props[prop]); + } + + return el; +} diff --git a/fixture/components/component/css/0.0.6/lib/computed.js b/fixture/components/component/css/0.0.6/lib/computed.js new file mode 100644 index 0000000..921ad62 --- /dev/null +++ b/fixture/components/component/css/0.0.6/lib/computed.js @@ -0,0 +1,48 @@ +/** + * Module Dependencies + */ + +var debug = require('debug')('css:computed'); +var withinDocument = require('within-document'); +var styles = require('./styles'); + +/** + * Expose `computed` + */ + +module.exports = computed; + +/** + * Get the computed style + * + * @param {Element} el + * @param {String} prop + * @param {Array} precomputed (optional) + * @return {Array} + * @api private + */ + +function computed(el, prop, precomputed) { + var computed = precomputed || styles(el); + var ret; + + if (!computed) return; + + if (computed.getPropertyValue) { + ret = computed.getPropertyValue(prop) || computed[prop]; + } else { + ret = computed[prop]; + } + + if ('' === ret && !withinDocument(el)) { + debug('element not within document, try finding from style attribute'); + var style = require('./style'); + ret = style(el, prop); + } + + debug('computed value of %s: %s', prop, ret); + + // Support: IE + // IE returns zIndex value as an integer. + return undefined === ret ? ret : ret + ''; +} diff --git a/fixture/components/component/css/0.0.6/lib/css.js b/fixture/components/component/css/0.0.6/lib/css.js new file mode 100644 index 0000000..7137d8f --- /dev/null +++ b/fixture/components/component/css/0.0.6/lib/css.js @@ -0,0 +1,80 @@ +/** + * Module Dependencies + */ + +var debug = require('debug')('css:css'); +var camelcase = require('to-camel-case'); +var computed = require('./computed'); +var property = require('./prop'); + +/** + * Expose `css` + */ + +module.exports = css; + +/** + * CSS Normal Transforms + */ + +var cssNormalTransform = { + letterSpacing: 0, + fontWeight: 400 +}; + +/** + * Get a CSS value + * + * @param {Element} el + * @param {String} prop + * @param {Mixed} extra + * @param {Array} styles + * @return {String} + */ + +function css(el, prop, extra, styles) { + var hooks = require('./hooks'); + var orig = camelcase(prop); + var style = el.style; + var val; + + prop = property(prop, style); + var hook = hooks[prop] || hooks[orig]; + + // If a hook was provided get the computed value from there + if (hook && hook.get) { + debug('get hook provided. use that'); + val = hook.get(el, true, extra); + } + + // Otherwise, if a way to get the computed value exists, use that + if (undefined == val) { + debug('fetch the computed value of %s', prop); + val = computed(el, prop); + } + + if ('normal' == val && cssNormalTransform[prop]) { + val = cssNormalTransform[prop]; + debug('normal => %s', val); + } + + // Return, converting to number if forced or a qualifier was provided and val looks numeric + if ('' == extra || extra) { + debug('converting value: %s into a number', val); + var num = parseFloat(val); + return true === extra || isNumeric(num) ? num || 0 : val; + } + + return val; +} + +/** + * Is Numeric + * + * @param {Mixed} obj + * @return {Boolean} + */ + +function isNumeric(obj) { + return !isNan(parseFloat(obj)) && isFinite(obj); +} diff --git a/fixture/components/component/css/0.0.6/lib/hooks.js b/fixture/components/component/css/0.0.6/lib/hooks.js new file mode 100644 index 0000000..7468ab2 --- /dev/null +++ b/fixture/components/component/css/0.0.6/lib/hooks.js @@ -0,0 +1,162 @@ +/** + * Module Dependencies + */ + +var each = require('each'); +var css = require('./css'); +var cssShow = { position: 'absolute', visibility: 'hidden', display: 'block' }; +var pnum = (/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/).source; +var rnumnonpx = new RegExp( '^(' + pnum + ')(?!px)[a-z%]+$', 'i'); +var rnumsplit = new RegExp( '^(' + pnum + ')(.*)$', 'i'); +var rdisplayswap = /^(none|table(?!-c[ea]).+)/; +var styles = require('./styles'); +var support = require('./support'); +var swap = require('./swap'); +var computed = require('./computed'); +var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; + +/** + * Height & Width + */ + +each(['width', 'height'], function(name) { + exports[name] = {}; + + exports[name].get = function(el, compute, extra) { + if (!compute) return; + // certain elements can have dimension info if we invisibly show them + // however, it must have a current display style that would benefit from this + return 0 == el.offsetWidth && rdisplayswap.test(css(el, 'display')) + ? swap(el, cssShow, function() { return getWidthOrHeight(el, name, extra); }) + : getWidthOrHeight(el, name, extra); + } + + exports[name].set = function(el, val, extra) { + var styles = extra && styles(el); + return setPositiveNumber(el, val, extra + ? augmentWidthOrHeight(el, name, extra, 'border-box' == css(el, 'boxSizing', false, styles), styles) + : 0 + ); + }; + +}); + +/** + * Opacity + */ + +exports.opacity = {}; +exports.opacity.get = function(el, compute) { + if (!compute) return; + var ret = computed(el, 'opacity'); + return '' == ret ? '1' : ret; +} + +/** + * Utility: Set Positive Number + * + * @param {Element} el + * @param {Mixed} val + * @param {Number} subtract + * @return {Number} + */ + +function setPositiveNumber(el, val, subtract) { + var matches = rnumsplit.exec(val); + return matches ? + // Guard against undefined 'subtract', e.g., when used as in cssHooks + Math.max(0, matches[1]) + (matches[2] || 'px') : + val; +} + +/** + * Utility: Get the width or height + * + * @param {Element} el + * @param {String} prop + * @param {Mixed} extra + * @return {String} + */ + +function getWidthOrHeight(el, prop, extra) { + // Start with offset property, which is equivalent to the border-box value + var valueIsBorderBox = true; + var val = prop === 'width' ? el.offsetWidth : el.offsetHeight; + var styles = computed(el); + var isBorderBox = support.boxSizing && css(el, 'boxSizing') === 'border-box'; + + // some non-html elements return undefined for offsetWidth, so check for null/undefined + // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 + // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668 + if (val <= 0 || val == null) { + // Fall back to computed then uncomputed css if necessary + val = computed(el, prop, styles); + + if (val < 0 || val == null) { + val = el.style[prop]; + } + + // Computed unit is not pixels. Stop here and return. + if (rnumnonpx.test(val)) { + return val; + } + + // we need the check for style in case a browser which returns unreliable values + // for getComputedStyle silently falls back to the reliable el.style + valueIsBorderBox = isBorderBox && (support.boxSizingReliable() || val === el.style[prop]); + + // Normalize ', auto, and prepare for extra + val = parseFloat(val) || 0; + } + + // use the active box-sizing model to add/subtract irrelevant styles + extra = extra || (isBorderBox ? 'border' : 'content'); + val += augmentWidthOrHeight(el, prop, extra, valueIsBorderBox, styles); + return val + 'px'; +} + +/** + * Utility: Augment the width or the height + * + * @param {Element} el + * @param {String} prop + * @param {Mixed} extra + * @param {Boolean} isBorderBox + * @param {Array} styles + */ + +function augmentWidthOrHeight(el, prop, extra, isBorderBox, styles) { + // If we already have the right measurement, avoid augmentation, + // Otherwise initialize for horizontal or vertical properties + var i = extra === (isBorderBox ? 'border' : 'content') ? 4 : 'width' == prop ? 1 : 0; + var val = 0; + + for (; i < 4; i += 2) { + // both box models exclude margin, so add it if we want it + if (extra === 'margin') { + val += css(el, extra + cssExpand[i], true, styles); + } + + if (isBorderBox) { + // border-box includes padding, so remove it if we want content + if (extra === 'content') { + val -= css(el, 'padding' + cssExpand[i], true, styles); + } + + // at this point, extra isn't border nor margin, so remove border + if (extra !== 'margin') { + val -= css(el, 'border' + cssExpand[i] + 'Width', true, styles); + } + } else { + // at this point, extra isn't content, so add padding + val += css(el, 'padding' + cssExpand[i], true, styles); + + // at this point, extra isn't content nor padding, so add border + if (extra !== 'padding') { + val += css(el, 'border' + cssExpand[i] + 'Width', true, styles); + } + } + } + + return val; +} diff --git a/fixture/components/component/css/0.0.6/lib/prop.js b/fixture/components/component/css/0.0.6/lib/prop.js new file mode 100644 index 0000000..6abd9a0 --- /dev/null +++ b/fixture/components/component/css/0.0.6/lib/prop.js @@ -0,0 +1,36 @@ +/** + * Module dependencies + */ + +var debug = require('debug')('css:prop'); +var camelcase = require('to-camel-case'); +var vendor = require('./vendor'); + +/** + * Export `prop` + */ + +module.exports = prop; + +/** + * Normalize Properties + */ + +var cssProps = { + 'float': 'cssFloat' in document.documentElement.style ? 'cssFloat' : 'styleFloat' +}; + +/** + * Get the vendor prefixed property + * + * @param {String} prop + * @param {String} style + * @return {String} prop + * @api private + */ + +function prop(prop, style) { + prop = cssProps[prop] || (cssProps[prop] = vendor(prop, style)); + debug('transform property: %s => %s', prop, style); + return prop; +} diff --git a/fixture/components/component/css/0.0.6/lib/style.js b/fixture/components/component/css/0.0.6/lib/style.js new file mode 100644 index 0000000..8e87c5e --- /dev/null +++ b/fixture/components/component/css/0.0.6/lib/style.js @@ -0,0 +1,106 @@ +/** + * Module Dependencies + */ + +var debug = require('debug')('css:style'); +var camelcase = require('to-camel-case'); +var support = require('./support'); +var property = require('./prop'); +var hooks = require('./hooks'); + +/** + * Expose `style` + */ + +module.exports = style; + +/** + * Possibly-unitless properties + * + * Don't automatically add 'px' to these properties + */ + +var cssNumber = { + "columnCount": true, + "fillOpacity": true, + "fontWeight": true, + "lineHeight": true, + "opacity": true, + "order": true, + "orphans": true, + "widows": true, + "zIndex": true, + "zoom": true +}; + +/** + * Set a css value + * + * @param {Element} el + * @param {String} prop + * @param {Mixed} val + * @param {Mixed} extra + */ + +function style(el, prop, val, extra) { + // Don't set styles on text and comment nodes + if (!el || el.nodeType === 3 || el.nodeType === 8 || !el.style ) return; + + var orig = camelcase(prop); + var style = el.style; + var type = typeof val; + + if (!val) return get(el, prop, orig, extra); + + prop = property(prop, style); + + var hook = hooks[prop] || hooks[orig]; + + // If a number was passed in, add 'px' to the (except for certain CSS properties) + if ('number' == type && !cssNumber[orig]) { + debug('adding "px" to end of number'); + val += 'px'; + } + + // Fixes jQuery #8908, it can be done more correctly by specifying setters in cssHooks, + // but it would mean to define eight (for every problematic property) identical functions + if (!support.clearCloneStyle && '' === val && 0 === prop.indexOf('background')) { + debug('set property (%s) value to "inherit"', prop); + style[prop] = 'inherit'; + } + + // If a hook was provided, use that value, otherwise just set the specified value + if (!hook || !hook.set || undefined !== (val = hook.set(el, val, extra))) { + // Support: Chrome, Safari + // Setting style to blank string required to delete "style: x !important;" + debug('set hook defined. setting property (%s) to %s', prop, val); + style[prop] = ''; + style[prop] = val; + } + +} + +/** + * Get the style + * + * @param {Element} el + * @param {String} prop + * @param {String} orig + * @param {Mixed} extra + * @return {String} + */ + +function get(el, prop, orig, extra) { + var style = el.style; + var hook = hooks[prop] || hooks[orig]; + var ret; + + if (hook && hook.get && undefined !== (ret = hook.get(el, false, extra))) { + debug('get hook defined, returning: %s', ret); + return ret; + } + + ret = style[prop]; + debug('getting %s', ret); + return ret; +} diff --git a/fixture/components/component/css/0.0.6/lib/styles.js b/fixture/components/component/css/0.0.6/lib/styles.js new file mode 100644 index 0000000..5a93b01 --- /dev/null +++ b/fixture/components/component/css/0.0.6/lib/styles.js @@ -0,0 +1,20 @@ +/** + * Expose `styles` + */ + +module.exports = styles; + +/** + * Get all the styles + * + * @param {Element} el + * @return {Array} + */ + +function styles(el) { + if (window.getComputedStyle) { + return el.ownerDocument.defaultView.getComputedStyle(el, null); + } else { + return el.currentStyle; + } +} diff --git a/fixture/components/component/css/0.0.6/lib/support.js b/fixture/components/component/css/0.0.6/lib/support.js new file mode 100644 index 0000000..e6c8620 --- /dev/null +++ b/fixture/components/component/css/0.0.6/lib/support.js @@ -0,0 +1,101 @@ +/** + * Support values + */ + +var reliableMarginRight; +var boxSizingReliableVal; +var pixelPositionVal; +var clearCloneStyle; + +/** + * Container setup + */ + +var docElem = document.documentElement; +var container = document.createElement('div'); +var div = document.createElement('div'); + +/** + * Clear clone style + */ + +div.style.backgroundClip = 'content-box'; +div.cloneNode(true).style.backgroundClip = ''; +exports.clearCloneStyle = div.style.backgroundClip === 'content-box'; + +container.style.cssText = 'border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px'; +container.appendChild(div); + +/** + * Pixel position + * + * Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 + * getComputedStyle returns percent when specified for top/left/bottom/right + * rather than make the css module depend on the offset module, we just check for it here + */ + +exports.pixelPosition = function() { + if (undefined == pixelPositionVal) computePixelPositionAndBoxSizingReliable(); + return pixelPositionVal; +} + +/** + * Reliable box sizing + */ + +exports.boxSizingReliable = function() { + if (undefined == boxSizingReliableVal) computePixelPositionAndBoxSizingReliable(); + return boxSizingReliableVal; +} + +/** + * Reliable margin right + * + * Support: Android 2.3 + * Check if div with explicit width and no margin-right incorrectly + * gets computed margin-right based on width of container. (#3333) + * WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right + * This support function is only executed once so no memoizing is needed. + * + * @return {Boolean} + */ + +exports.reliableMarginRight = function() { + var ret; + var marginDiv = div.appendChild(document.createElement("div" )); + + marginDiv.style.cssText = div.style.cssText = divReset; + marginDiv.style.marginRight = marginDiv.style.width = "0"; + div.style.width = "1px"; + docElem.appendChild(container); + + ret = !parseFloat(window.getComputedStyle(marginDiv, null).marginRight); + + docElem.removeChild(container); + + // Clean up the div for other support tests. + div.innerHTML = ""; + + return ret; +} + +/** + * Executing both pixelPosition & boxSizingReliable tests require only one layout + * so they're executed at the same time to save the second computation. + */ + +function computePixelPositionAndBoxSizingReliable() { + // Support: Firefox, Android 2.3 (Prefixed box-sizing versions). + div.style.cssText = "-webkit-box-sizing:border-box;-moz-box-sizing:border-box;" + + "box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;" + + "position:absolute;top:1%"; + docElem.appendChild(container); + + var divStyle = window.getComputedStyle(div, null); + pixelPositionVal = divStyle.top !== "1%"; + boxSizingReliableVal = divStyle.width === "4px"; + + docElem.removeChild(container); +} + + diff --git a/fixture/components/component/css/0.0.6/lib/swap.js b/fixture/components/component/css/0.0.6/lib/swap.js new file mode 100644 index 0000000..b9b9942 --- /dev/null +++ b/fixture/components/component/css/0.0.6/lib/swap.js @@ -0,0 +1,32 @@ +/** + * Export `swap` + */ + +module.exports = swap; + +/** + * Initialize `swap` + * + * @param {Element} el + * @param {Object} options + * @param {Function} fn + * @param {Array} args + * @return {Mixed} + */ + +function swap(el, options, fn, args) { + // Remember the old values, and insert the new ones + for (var key in options) { + old[key] = el.style[key]; + el.style[key] = options[key]; + } + + ret = fn.apply(el, args || []); + + // Revert the old values + for (key in options) { + el.style[key] = old[key]; + } + + return ret; +} diff --git a/fixture/components/component/css/0.0.6/lib/vendor.js b/fixture/components/component/css/0.0.6/lib/vendor.js new file mode 100644 index 0000000..7612576 --- /dev/null +++ b/fixture/components/component/css/0.0.6/lib/vendor.js @@ -0,0 +1,36 @@ +/** + * Module Dependencies + */ + +var prefixes = ['Webkit', 'O', 'Moz', 'ms']; + +/** + * Expose `vendor` + */ + +module.exports = vendor; + +/** + * Get the vendor prefix for a given property + * + * @param {String} prop + * @param {Object} style + * @return {String} + */ + +function vendor(prop, style) { + // shortcut for names that are not vendor prefixed + if (style[prop]) return prop; + + // check for vendor prefixed names + var capName = prop[0].toUpperCase() + prop.slice(1); + var original = prop; + var i = prefixes.length; + + while (i--) { + prop = prefixes[i] + capName; + if (prop in style) return prop; + } + + return original; +} diff --git a/fixture/components/component/datepicker/1.0.1/component.json b/fixture/components/component/datepicker/1.0.1/component.json new file mode 100644 index 0000000..fae85fa --- /dev/null +++ b/fixture/components/component/datepicker/1.0.1/component.json @@ -0,0 +1,27 @@ +{ + "name": "datepicker", + "description": "Datepicker ui component built on component/calendar", + "version": "1.0.1", + "keywords": [ + "date", + "picker", + "calendar" + ], + "dependencies": { + "component/bind": "*", + "component/calendar": "*", + "component/popover": "*", + "component/aurora": "*", + "component/event": "*" + }, + "development": {}, + "license": "MIT", + "scripts": [ + "index.js" + ], + "styles": [ + "datepicker.css" + ], + "repository": "component/datepicker", + "resolved": "f6e4836163a436ef5755bbafee0f12d9e281c414" +} \ No newline at end of file diff --git a/fixture/components/component/datepicker/1.0.1/datepicker.css b/fixture/components/component/datepicker/1.0.1/datepicker.css new file mode 100644 index 0000000..9eb1690 --- /dev/null +++ b/fixture/components/component/datepicker/1.0.1/datepicker.css @@ -0,0 +1,12 @@ + +.datepicker-calendar { + font: 10px "Helvetica Neue", Helvetica, Arial, sans-serif; +} + +.datepicker-popover .tip-arrow { + top: auto; +} + +.datepicker-popover .tip-inner { + border: none; +} \ No newline at end of file diff --git a/fixture/components/component/datepicker/1.0.1/index.js b/fixture/components/component/datepicker/1.0.1/index.js new file mode 100644 index 0000000..223c81c --- /dev/null +++ b/fixture/components/component/datepicker/1.0.1/index.js @@ -0,0 +1,56 @@ +/** + * Module dependencies. + */ + +var bind = require('bind') + , Calendar = require('calendar') + , Popover = require('popover') + , event = require('event') + +/** + * Expose `Datepicker`. + */ + +module.exports = Datepicker; + +/** + * Initialize a new date picker with the given input `el`. + * + * @param {Element} el + * @api public + */ + +function Datepicker(el) { + if (!(this instanceof Datepicker)) return new Datepicker(el); + this.el = el; + this.cal = new Calendar; + this.cal.addClass('datepicker-calendar'); + event.bind(el, 'click', bind(this, this.onclick)); +} + +/** + * Handle input clicks. + */ + +Datepicker.prototype.onclick = function(e){ + if (this.popover) return; + this.cal.once('change', bind(this, this.onchange)); + this.popover = new Popover(this.cal.el); + this.popover.classname = 'datepicker-popover popover'; + this.popover.show(this.el); +}; + +/** + * Handle date changes. + */ + +Datepicker.prototype.onchange = function(date){ + this.el.value = date.getFullYear() + + '/' + + (date.getMonth() + 1) + + '/' + + date.getDate(); + + this.popover.remove(); + this.popover = null; +}; diff --git a/fixture/components/component/delegate/0.2.3/component.json b/fixture/components/component/delegate/0.2.3/component.json new file mode 100644 index 0000000..7a45229 --- /dev/null +++ b/fixture/components/component/delegate/0.2.3/component.json @@ -0,0 +1,20 @@ +{ + "name": "delegate", + "description": "Event delegation component", + "version": "0.2.3", + "keywords": [ + "event", + "events", + "delegate", + "delegation" + ], + "dependencies": { + "component/closest": "*", + "component/event": "*" + }, + "scripts": [ + "index.js" + ], + "repository": "component/delegate", + "resolved": "7fff6b7dddced675248c2e24d6da179d83bc52b2" +} \ No newline at end of file diff --git a/fixture/components/component/delegate/0.2.3/index.js b/fixture/components/component/delegate/0.2.3/index.js new file mode 100644 index 0000000..0500bf9 --- /dev/null +++ b/fixture/components/component/delegate/0.2.3/index.js @@ -0,0 +1,42 @@ +/** + * Module dependencies. + */ + +var closest = require('closest') + , event = require('event'); + +/** + * Delegate event `type` to `selector` + * and invoke `fn(e)`. A callback function + * is returned which may be passed to `.unbind()`. + * + * @param {Element} el + * @param {String} selector + * @param {String} type + * @param {Function} fn + * @param {Boolean} capture + * @return {Function} + * @api public + */ + +exports.bind = function(el, selector, type, fn, capture){ + return event.bind(el, type, function(e){ + var target = e.target || e.srcElement; + e.delegateTarget = closest(target, selector, true, el); + if (e.delegateTarget) fn.call(el, e); + }, capture); +}; + +/** + * Unbind event `type`'s callback `fn`. + * + * @param {Element} el + * @param {String} type + * @param {Function} fn + * @param {Boolean} capture + * @api public + */ + +exports.unbind = function(el, type, fn, capture){ + event.unbind(el, type, fn, capture); +}; diff --git a/fixture/components/component/domify/1.3.0/component.json b/fixture/components/component/domify/1.3.0/component.json new file mode 100644 index 0000000..c389465 --- /dev/null +++ b/fixture/components/component/domify/1.3.0/component.json @@ -0,0 +1,23 @@ +{ + "name": "domify", + "version": "1.3.0", + "description": "turn HTML into DOM elements", + "development": { + "dependencies": { + "component/assert": "*" + } + }, + "keywords": [ + "dom", + "html", + "client", + "browser", + "component" + ], + "scripts": [ + "index.js" + ], + "license": "MIT", + "repository": "component/domify", + "resolved": "55b02fd3e3401292a9d15f1ed6d16cd061b8ea80" +} \ No newline at end of file diff --git a/fixture/components/component/domify/1.3.0/index.js b/fixture/components/component/domify/1.3.0/index.js new file mode 100644 index 0000000..361f3ea --- /dev/null +++ b/fixture/components/component/domify/1.3.0/index.js @@ -0,0 +1,93 @@ + +/** + * Expose `parse`. + */ + +module.exports = parse; + +/** + * Wrap map from jquery. + */ + +var map = { + legend: [1, '
', '
'], + tr: [2, '', '
'], + col: [2, '', '
'], + _default: [0, '', ''] +}; + +map.td = +map.th = [3, '', '
']; + +map.option = +map.optgroup = [1, '']; + +map.thead = +map.tbody = +map.colgroup = +map.caption = +map.tfoot = [1, '', '
']; + +map.text = +map.circle = +map.ellipse = +map.line = +map.path = +map.polygon = +map.polyline = +map.rect = [1, '','']; + +/** + * Parse `html` and return a DOM Node instance, which could be a TextNode, + * HTML DOM Node of some kind (
for example), or a DocumentFragment + * instance, depending on the contents of the `html` string. + * + * @param {String} html - HTML string to "domify" + * @param {Document} doc - The `document` instance to create the Node for + * @return {DOMNode} the TextNode, DOM Node, or DocumentFragment instance + * @api private + */ + +function parse(html, doc) { + if ('string' != typeof html) throw new TypeError('String expected'); + + // default to the global `document` object + if (!doc) doc = document; + + // tag name + var m = /<([\w:]+)/.exec(html); + if (!m) return doc.createTextNode(html); + + html = html.replace(/^\s+|\s+$/g, ''); // Remove leading/trailing whitespace + + var tag = m[1]; + + // body support + if (tag == 'body') { + var el = doc.createElement('html'); + el.innerHTML = html; + return el.removeChild(el.lastChild); + } + + // wrap map + var wrap = map[tag] || map._default; + var depth = wrap[0]; + var prefix = wrap[1]; + var suffix = wrap[2]; + var el = doc.createElement('div'); + el.innerHTML = prefix + html + suffix; + while (depth--) el = el.lastChild; + + // one element + if (el.firstChild == el.lastChild) { + return el.removeChild(el.firstChild); + } + + // several elements + var fragment = doc.createDocumentFragment(); + while (el.firstChild) { + fragment.appendChild(el.removeChild(el.firstChild)); + } + + return fragment; +} diff --git a/fixture/components/component/each/0.2.6/component.json b/fixture/components/component/each/0.2.6/component.json new file mode 100644 index 0000000..4fc934b --- /dev/null +++ b/fixture/components/component/each/0.2.6/component.json @@ -0,0 +1,22 @@ +{ + "name": "each", + "description": "Array / object / string iteration utility", + "version": "0.2.6", + "keywords": [ + "object", + "string", + "array", + "each", + "utility" + ], + "dependencies": { + "component/type": "1.0.0", + "component/to-function": "2.0.6" + }, + "development": {}, + "scripts": [ + "index.js" + ], + "repository": "component/each", + "resolved": "3cf32b22bf235eb922019d660b7cabc85d33ff7f" +} \ No newline at end of file diff --git a/fixture/components/component/each/0.2.6/index.js b/fixture/components/component/each/0.2.6/index.js new file mode 100644 index 0000000..d663bf6 --- /dev/null +++ b/fixture/components/component/each/0.2.6/index.js @@ -0,0 +1,89 @@ + +/** + * Module dependencies. + */ + +try { + var type = require('type'); +} catch (err) { + var type = require('component-type'); +} + +var toFunction = require('to-function'); + +/** + * HOP reference. + */ + +var has = Object.prototype.hasOwnProperty; + +/** + * Iterate the given `obj` and invoke `fn(val, i)` + * in optional context `ctx`. + * + * @param {String|Array|Object} obj + * @param {Function} fn + * @param {Object} [ctx] + * @api public + */ + +module.exports = function(obj, fn, ctx){ + fn = toFunction(fn); + ctx = ctx || this; + switch (type(obj)) { + case 'array': + return array(obj, fn, ctx); + case 'object': + if ('number' == typeof obj.length) return array(obj, fn, ctx); + return object(obj, fn, ctx); + case 'string': + return string(obj, fn, ctx); + } +}; + +/** + * Iterate string chars. + * + * @param {String} obj + * @param {Function} fn + * @param {Object} ctx + * @api private + */ + +function string(obj, fn, ctx) { + for (var i = 0; i < obj.length; ++i) { + fn.call(ctx, obj.charAt(i), i); + } +} + +/** + * Iterate object keys. + * + * @param {Object} obj + * @param {Function} fn + * @param {Object} ctx + * @api private + */ + +function object(obj, fn, ctx) { + for (var key in obj) { + if (has.call(obj, key)) { + fn.call(ctx, key, obj[key]); + } + } +} + +/** + * Iterate array-ish. + * + * @param {Array|Object} obj + * @param {Function} fn + * @param {Object} ctx + * @api private + */ + +function array(obj, fn, ctx) { + for (var i = 0; i < obj.length; ++i) { + fn.call(ctx, obj[i], i); + } +} diff --git a/fixture/components/component/emitter/1.1.3/component.json b/fixture/components/component/emitter/1.1.3/component.json new file mode 100644 index 0000000..8d35543 --- /dev/null +++ b/fixture/components/component/emitter/1.1.3/component.json @@ -0,0 +1,15 @@ +{ + "name": "emitter", + "description": "Event emitter", + "keywords": [ + "emitter", + "events" + ], + "version": "1.1.3", + "scripts": [ + "index.js" + ], + "license": "MIT", + "repository": "component/emitter", + "resolved": "1bd7d81f841323a29ced2f18532af21cada1c3b9" +} \ No newline at end of file diff --git a/fixture/components/component/emitter/1.1.3/index.js b/fixture/components/component/emitter/1.1.3/index.js new file mode 100644 index 0000000..ad71163 --- /dev/null +++ b/fixture/components/component/emitter/1.1.3/index.js @@ -0,0 +1,164 @@ + +/** + * Expose `Emitter`. + */ + +module.exports = Emitter; + +/** + * Initialize a new `Emitter`. + * + * @api public + */ + +function Emitter(obj) { + if (obj) return mixin(obj); +}; + +/** + * Mixin the emitter properties. + * + * @param {Object} obj + * @return {Object} + * @api private + */ + +function mixin(obj) { + for (var key in Emitter.prototype) { + obj[key] = Emitter.prototype[key]; + } + return obj; +} + +/** + * Listen on the given `event` with `fn`. + * + * @param {String} event + * @param {Function} fn + * @return {Emitter} + * @api public + */ + +Emitter.prototype.on = +Emitter.prototype.addEventListener = function(event, fn){ + this._callbacks = this._callbacks || {}; + (this._callbacks[event] = this._callbacks[event] || []) + .push(fn); + return this; +}; + +/** + * Adds an `event` listener that will be invoked a single + * time then automatically removed. + * + * @param {String} event + * @param {Function} fn + * @return {Emitter} + * @api public + */ + +Emitter.prototype.once = function(event, fn){ + var self = this; + this._callbacks = this._callbacks || {}; + + function on() { + self.off(event, on); + fn.apply(this, arguments); + } + + on.fn = fn; + this.on(event, on); + return this; +}; + +/** + * Remove the given callback for `event` or all + * registered callbacks. + * + * @param {String} event + * @param {Function} fn + * @return {Emitter} + * @api public + */ + +Emitter.prototype.off = +Emitter.prototype.removeListener = +Emitter.prototype.removeAllListeners = +Emitter.prototype.removeEventListener = function(event, fn){ + this._callbacks = this._callbacks || {}; + + // all + if (0 == arguments.length) { + this._callbacks = {}; + return this; + } + + // specific event + var callbacks = this._callbacks[event]; + if (!callbacks) return this; + + // remove all handlers + if (1 == arguments.length) { + delete this._callbacks[event]; + return this; + } + + // remove specific handler + var cb; + for (var i = 0; i < callbacks.length; i++) { + cb = callbacks[i]; + if (cb === fn || cb.fn === fn) { + callbacks.splice(i, 1); + break; + } + } + return this; +}; + +/** + * Emit `event` with the given args. + * + * @param {String} event + * @param {Mixed} ... + * @return {Emitter} + */ + +Emitter.prototype.emit = function(event){ + this._callbacks = this._callbacks || {}; + var args = [].slice.call(arguments, 1) + , callbacks = this._callbacks[event]; + + if (callbacks) { + callbacks = callbacks.slice(0); + for (var i = 0, len = callbacks.length; i < len; ++i) { + callbacks[i].apply(this, args); + } + } + + return this; +}; + +/** + * Return array of callbacks for `event`. + * + * @param {String} event + * @return {Array} + * @api public + */ + +Emitter.prototype.listeners = function(event){ + this._callbacks = this._callbacks || {}; + return this._callbacks[event] || []; +}; + +/** + * Check if this emitter has `event` handlers. + * + * @param {String} event + * @return {Boolean} + * @api public + */ + +Emitter.prototype.hasListeners = function(event){ + return !! this.listeners(event).length; +}; diff --git a/fixture/components/component/events/1.0.9/component.json b/fixture/components/component/events/1.0.9/component.json new file mode 100644 index 0000000..3e3b708 --- /dev/null +++ b/fixture/components/component/events/1.0.9/component.json @@ -0,0 +1,21 @@ +{ + "name": "events", + "description": "Higher level dom event management", + "version": "1.0.9", + "keywords": [ + "event", + "events", + "subscriptions" + ], + "dependencies": { + "component/event": "0.1.4", + "component/delegate": "0.2.3" + }, + "development": {}, + "license": "MIT", + "scripts": [ + "index.js" + ], + "repository": "component/events", + "resolved": "e79bae32cc8861901520326859420783506f9bd1" +} \ No newline at end of file diff --git a/fixture/components/component/events/1.0.9/index.js b/fixture/components/component/events/1.0.9/index.js new file mode 100644 index 0000000..d3ed75b --- /dev/null +++ b/fixture/components/component/events/1.0.9/index.js @@ -0,0 +1,176 @@ + +/** + * Module dependencies. + */ + +var events = require('event'); +var delegate = require('delegate'); + +/** + * Expose `Events`. + */ + +module.exports = Events; + +/** + * Initialize an `Events` with the given + * `el` object which events will be bound to, + * and the `obj` which will receive method calls. + * + * @param {Object} el + * @param {Object} obj + * @api public + */ + +function Events(el, obj) { + if (!(this instanceof Events)) return new Events(el, obj); + if (!el) throw new Error('element required'); + if (!obj) throw new Error('object required'); + this.el = el; + this.obj = obj; + this._events = {}; +} + +/** + * Subscription helper. + */ + +Events.prototype.sub = function(event, method, cb){ + this._events[event] = this._events[event] || {}; + this._events[event][method] = cb; +}; + +/** + * Bind to `event` with optional `method` name. + * When `method` is undefined it becomes `event` + * with the "on" prefix. + * + * Examples: + * + * Direct event handling: + * + * events.bind('click') // implies "onclick" + * events.bind('click', 'remove') + * events.bind('click', 'sort', 'asc') + * + * Delegated event handling: + * + * events.bind('click li > a') + * events.bind('click li > a', 'remove') + * events.bind('click a.sort-ascending', 'sort', 'asc') + * events.bind('click a.sort-descending', 'sort', 'desc') + * + * @param {String} event + * @param {String|function} [method] + * @return {Function} callback + * @api public + */ + +Events.prototype.bind = function(event, method){ + var e = parse(event); + var el = this.el; + var obj = this.obj; + var name = e.name; + var method = method || 'on' + name; + var args = [].slice.call(arguments, 2); + + // callback + function cb(){ + var a = [].slice.call(arguments).concat(args); + obj[method].apply(obj, a); + } + + // bind + if (e.selector) { + cb = delegate.bind(el, e.selector, name, cb); + } else { + events.bind(el, name, cb); + } + + // subscription for unbinding + this.sub(name, method, cb); + + return cb; +}; + +/** + * Unbind a single binding, all bindings for `event`, + * or all bindings within the manager. + * + * Examples: + * + * Unbind direct handlers: + * + * events.unbind('click', 'remove') + * events.unbind('click') + * events.unbind() + * + * Unbind delegate handlers: + * + * events.unbind('click', 'remove') + * events.unbind('click') + * events.unbind() + * + * @param {String|Function} [event] + * @param {String|Function} [method] + * @api public + */ + +Events.prototype.unbind = function(event, method){ + if (0 == arguments.length) return this.unbindAll(); + if (1 == arguments.length) return this.unbindAllOf(event); + + // no bindings for this event + var bindings = this._events[event]; + if (!bindings) return; + + // no bindings for this method + var cb = bindings[method]; + if (!cb) return; + + events.unbind(this.el, event, cb); +}; + +/** + * Unbind all events. + * + * @api private + */ + +Events.prototype.unbindAll = function(){ + for (var event in this._events) { + this.unbindAllOf(event); + } +}; + +/** + * Unbind all events for `event`. + * + * @param {String} event + * @api private + */ + +Events.prototype.unbindAllOf = function(event){ + var bindings = this._events[event]; + if (!bindings) return; + + for (var method in bindings) { + this.unbind(event, method); + } +}; + +/** + * Parse `event`. + * + * @param {String} event + * @return {Object} + * @api private + */ + +function parse(event) { + var parts = event.split(/ +/); + return { + name: parts.shift(), + selector: parts.join(' ') + } +} diff --git a/fixture/components/component/inherit/0.0.3/component.json b/fixture/components/component/inherit/0.0.3/component.json new file mode 100644 index 0000000..80639c3 --- /dev/null +++ b/fixture/components/component/inherit/0.0.3/component.json @@ -0,0 +1,15 @@ +{ + "name": "inherit", + "description": "Prototype inheritance utility", + "version": "0.0.3", + "keywords": [ + "inherit", + "utility" + ], + "dependencies": {}, + "scripts": [ + "index.js" + ], + "repository": "component/inherit", + "resolved": "c49c723aaa5b66d7a4e1dcfe96440ebd85b5bfe9" +} \ No newline at end of file diff --git a/fixture/components/component/inherit/0.0.3/index.js b/fixture/components/component/inherit/0.0.3/index.js new file mode 100644 index 0000000..aaebc03 --- /dev/null +++ b/fixture/components/component/inherit/0.0.3/index.js @@ -0,0 +1,7 @@ + +module.exports = function(a, b){ + var fn = function(){}; + fn.prototype = b.prototype; + a.prototype = new fn; + a.prototype.constructor = a; +}; \ No newline at end of file diff --git a/fixture/components/component/matches-selector/0.1.5/component.json b/fixture/components/component/matches-selector/0.1.5/component.json new file mode 100644 index 0000000..43edf72 --- /dev/null +++ b/fixture/components/component/matches-selector/0.1.5/component.json @@ -0,0 +1,23 @@ +{ + "name": "matches-selector", + "description": "Check if an element matches a given selector", + "version": "0.1.5", + "keywords": [ + "match", + "element", + "selector" + ], + "dependencies": { + "component/query": "*" + }, + "development": { + "dependencies": { + "component/domify": "*" + } + }, + "scripts": [ + "index.js" + ], + "repository": "component/matches-selector", + "resolved": "b6a46650d8aa7a54f1ac431f83f50aa2c65f0153" +} \ No newline at end of file diff --git a/fixture/components/component/matches-selector/0.1.5/index.js b/fixture/components/component/matches-selector/0.1.5/index.js new file mode 100644 index 0000000..5d86755 --- /dev/null +++ b/fixture/components/component/matches-selector/0.1.5/index.js @@ -0,0 +1,46 @@ +/** + * Module dependencies. + */ + +var query = require('query'); + +/** + * Element prototype. + */ + +var proto = Element.prototype; + +/** + * Vendor function. + */ + +var vendor = proto.matches + || proto.webkitMatchesSelector + || proto.mozMatchesSelector + || proto.msMatchesSelector + || proto.oMatchesSelector; + +/** + * Expose `match()`. + */ + +module.exports = match; + +/** + * Match `el` to `selector`. + * + * @param {Element} el + * @param {String} selector + * @return {Boolean} + * @api public + */ + +function match(el, selector) { + if (!el || el.nodeType !== 1) return false; + if (vendor) return vendor.call(el, selector); + var nodes = query.all(selector, el.parentNode); + for (var i = 0; i < nodes.length; ++i) { + if (nodes[i] == el) return true; + } + return false; +} diff --git a/fixture/components/component/popover/1.1.1/component.json b/fixture/components/component/popover/1.1.1/component.json new file mode 100644 index 0000000..5f77b81 --- /dev/null +++ b/fixture/components/component/popover/1.1.1/component.json @@ -0,0 +1,26 @@ +{ + "name": "popover", + "description": "Popover component", + "version": "1.1.1", + "keywords": [ + "toolpopover", + "popover", + "ui" + ], + "dependencies": { + "component/tip": "*", + "component/query": "*", + "component/inherit": "0.0.3" + }, + "development": { + "dependencies": { + "component/aurora-popover": "*" + } + }, + "scripts": [ + "index.js", + "template.js" + ], + "repository": "component/popover", + "resolved": "8fc4a9b058df4915b6c577561b0af0a278ff70eb" +} \ No newline at end of file diff --git a/fixture/components/component/popover/1.1.1/index.js b/fixture/components/component/popover/1.1.1/index.js new file mode 100644 index 0000000..e284824 --- /dev/null +++ b/fixture/components/component/popover/1.1.1/index.js @@ -0,0 +1,85 @@ +/** + * Module dependencies. + */ + +var Tip = require('tip') + , q = require('query') + , inherit = require('inherit'); + +/** + * Expose `Popover`. + */ + +module.exports = Popover; + +/** + * Initialize a `Popover` with the given `content` + * and optional `title`. + * + * @param {Mixed} content + * @param {Mixed} title + * @api public + */ + +function Popover(content, title) { + Tip.call(this, require('./template')); + this.classname = 'popover'; + this.classes.add('popover'); + if (title) this.title(title); + else this.hideTitle(); + this.content(content); + if (Popover.effect) this.effect(Popover.effect); +} + +/** + * Inherits from `Tip.prototype`. + */ + +inherit(Popover, Tip); + +/** + * Replace `content`. + * + * @param {Mixed} content + * @return {Popover} + * @api public + */ + +Popover.prototype.content = function(content){ + var contentEl = q('.popover-content', this.el); + if (typeof content === 'string') + contentEl.innerHTML = content; + else + contentEl.appendChild(content); + return this; +}; + +/** + * Change `title`. + * + * @param {String} title + * @return {Popover} + * @api public + */ + +Popover.prototype.title = function(title){ + var titleEl = q('.popover-title', this.el); + if (typeof title === 'string') + titleEl.innerHTML = title; + else + titleEl.appendChild(title); + return this; +}; + +/** + * Hide the title. + * + * @return {Popover} + * @api private + */ + +Popover.prototype.hideTitle = function(){ + var titleEl = q('.popover-title', this.el); + titleEl.parentNode.removeChild(titleEl); + return this; +}; diff --git a/fixture/components/component/popover/1.1.1/template.js b/fixture/components/component/popover/1.1.1/template.js new file mode 100644 index 0000000..9acebb0 --- /dev/null +++ b/fixture/components/component/popover/1.1.1/template.js @@ -0,0 +1 @@ +module.exports = '
\n \n
\n
'; \ No newline at end of file diff --git a/fixture/components/component/query/0.0.3/component.json b/fixture/components/component/query/0.0.3/component.json new file mode 100644 index 0000000..8733285 --- /dev/null +++ b/fixture/components/component/query/0.0.3/component.json @@ -0,0 +1,24 @@ +{ + "name": "query", + "description": "Query the DOM with selector engine fallback support", + "version": "0.0.3", + "keywords": [ + "query", + "selector", + "engine", + "dom", + "elements" + ], + "dependencies": {}, + "development": { + "dependencies": { + "component/assert": "*" + } + }, + "license": "MIT", + "scripts": [ + "index.js" + ], + "repository": "component/query", + "resolved": "cfa981c3be3df3603c3b1d42106490f7246059c4" +} \ No newline at end of file diff --git a/fixture/components/component/query/0.0.3/index.js b/fixture/components/component/query/0.0.3/index.js new file mode 100644 index 0000000..cd2cf3a --- /dev/null +++ b/fixture/components/component/query/0.0.3/index.js @@ -0,0 +1,21 @@ +function one(selector, el) { + return el.querySelector(selector); +} + +exports = module.exports = function(selector, el){ + el = el || document; + return one(selector, el); +}; + +exports.all = function(selector, el){ + el = el || document; + return el.querySelectorAll(selector); +}; + +exports.engine = function(obj){ + if (!obj.one) throw new Error('.one callback required'); + if (!obj.all) throw new Error('.all callback required'); + one = obj.one; + exports.all = obj.all; + return exports; +}; diff --git a/fixture/components/component/tip/2.5.0/component.json b/fixture/components/component/tip/2.5.0/component.json new file mode 100644 index 0000000..bd88d9a --- /dev/null +++ b/fixture/components/component/tip/2.5.0/component.json @@ -0,0 +1,43 @@ +{ + "name": "tip", + "description": "Tip component", + "version": "2.5.0", + "keywords": [ + "browser", + "component", + "tooltip", + "tip", + "ui" + ], + "dependencies": { + "component/bind": "*", + "component/emitter": "1.1.3", + "component/query": "0.0.3", + "component/events": "1.0.9", + "component/domify": "1.3.0", + "component/classes": "1.2.1", + "component/css": "0.0.6", + "webmodules/bounding-client-rect": "1.0.5" + }, + "development": { + "dependencies": { + "component/aurora-tip": "*", + "component/event": "*" + } + }, + "scripts": [ + "index.js" + ], + "styles": [ + "tip.css" + ], + "templates": [ + "template.html" + ], + "demo": [ + "http://component.github.io/tip/" + ], + "license": "MIT", + "repository": "component/tip", + "resolved": "14bb6349e988b6493f6df69b274790b905e3cbd6" +} \ No newline at end of file diff --git a/fixture/components/component/tip/2.5.0/index.js b/fixture/components/component/tip/2.5.0/index.js new file mode 100644 index 0000000..f1ac5a0 --- /dev/null +++ b/fixture/components/component/tip/2.5.0/index.js @@ -0,0 +1,485 @@ +/** + * Module dependencies. + */ + +var css = require('css'); +var bind = require('bind'); +var query = require('query'); +var domify = require('domify'); +var events = require('events'); +var Emitter = require('emitter'); +var classes = require('classes'); +var getBoundingClientRect = require('bounding-client-rect'); + +var html = domify(require('./template.html')); + +/** + * Expose `Tip`. + */ + +module.exports = Tip; + +/** + * Apply the average use-case of simply + * showing a tool-tip on `el` hover. + * + * Options: + * + * - `delay` hide delay in milliseconds [0] + * - `value` defaulting to the element's title attribute + * + * @param {Mixed} elem + * @param {Object|String} options or value + * @api public + */ + +function tip(elem, options) { + if ('string' == typeof options) options = { value : options }; + var els = ('string' == typeof elem) ? query.all(elem) : [elem]; + for(var i = 0, el; el = els[i]; i++) { + var val = options.value || el.getAttribute('title'); + var tip = new Tip(val, options); + el.setAttribute('title', ''); + tip.cancelHideOnHover(); + tip.attach(el); + } +} + +/** + * Initialize a `Tip` with the given `content`. + * + * @param {Mixed} content + * @api public + */ + +function Tip(content, options) { + options = options || {}; + if (!(this instanceof Tip)) return tip(content, options); + Emitter.call(this); + this.classname = ''; + this.delay = options.delay || 300; + this.pad = null == options.pad ? 15 : options.pad; + this.el = html.cloneNode(true); + this.events = events(this.el, this); + this.classes = classes(this.el); + this.inner = query('.tip-inner', this.el); + this.message(content); + this.position('top'); + this.static = !!options.static; + if (Tip.effect) this.effect(Tip.effect); +} + +/** + * Mixin emitter. + */ + +Emitter(Tip.prototype); + +/** + * Set tip `content`. + * + * @param {String|Element} content + * @return {Tip} self + * @api public + */ + +Tip.prototype.message = function(content){ + if ('string' == typeof content) content = domify(content); + this.inner.appendChild(content); + return this; +}; + +/** + * Attach to the given `el` with optional hide `delay`. + * + * @param {Element} el + * @param {Number} delay + * @return {Tip} + * @api public + */ + +Tip.prototype.attach = function(el){ + this.target = el; + this.handleEvents = events(el, this); + this.handleEvents.bind('mouseover'); + this.handleEvents.bind('mouseout'); + return this; +}; + +/** + * On mouse over + * + * @param {Event} e + * @return {Tip} + * @api private + */ + +Tip.prototype.onmouseover = function() { + this.show(this.target); + this.cancelHide(); +}; + +/** + * On mouse out + * + * @param {Event} e + * @return {Tip} + * @api private + */ + +Tip.prototype.onmouseout = function() { + this.hide(this.delay); +}; + +/** + * Cancel hide on hover, hide with the given `delay`. + * + * @param {Number} delay + * @return {Tip} + * @api public + */ + +Tip.prototype.cancelHideOnHover = function(){ + this.events.bind('mouseover', 'cancelHide'); + this.events.bind('mouseout', 'hide'); + return this; +}; + +/** + * Set the effect to `type`. + * + * @param {String} type + * @return {Tip} + * @api public + */ + +Tip.prototype.effect = function(type){ + this._effect = type; + this.classes.add(type); + return this; +}; + +/** + * Set position: + * + * - `top` + * - `top left` + * - `top right` + * - `bottom` + * - `bottom left` + * - `bottom right` + * - `left` + * - `right` + * + * @param {String} pos + * @param {Object} options + * @return {Tip} + * @api public + */ + +Tip.prototype.position = function(pos, options){ + options = options || {}; + this._position = pos; + this._auto = false != options.auto; + this.replaceClass(pos); + this.emit('reposition'); + return this; +}; + +/** + * Show the tip attached to `el`. + * + * Emits "show" (el) event. + * + * @param {String|Element|Number} el or x + * @param {Number} [y] + * @return {Tip} + * @api public + */ + +Tip.prototype.show = function(el){ + if ('string' == typeof el) el = query(el); + + // show it + document.body.appendChild(this.el); + this.classes.add('tip-' + this._position.replace(/\s+/g, '-')); + this.classes.remove('tip-hide'); + + // x,y + if ('number' == typeof el) { + var x = arguments[0]; + var y = arguments[1]; + this.emit('show'); + css(this.el, { + top: y, + left: x + }); + return this; + } + + // el + this.target = el; + this.reposition(); + this.emit('show', this.target); + + if (!this.winEvents && !this.static) { + this.winEvents = events(window, this); + this.winEvents.bind('resize', 'reposition'); + this.winEvents.bind('scroll', 'reposition'); + } + + return this; +}; + +/** + * Reposition the tip if necessary. + * + * @api private + */ + +Tip.prototype.reposition = function(){ + var pos = this._position; + var off = this.offset(pos); + var newpos = this._auto && this.suggested(pos, off); + if (newpos && newpos !== pos) { + pos = newpos; + off = this.offset(pos); + } + this.replaceClass(pos); + this.emit('reposition'); + css(this.el, off); +}; + +/** + * Compute the "suggested" position favouring `pos`. + * + * Returns `pos` if no suggestion can be determined. + * + * @param {String} pos + * @param {Object} offset + * @return {String} + * @api private + */ + +Tip.prototype.suggested = function(pos, off){ + var el = this.el; + + var ew = el.clientWidth; + var eh = el.clientHeight; + var top = window.scrollY; + var left = window.scrollX; + var w = window.innerWidth; + var h = window.innerHeight; + + var good = { + top: true, + bottom: true, + left: true, + right: true + }; + + // too low + if (off.top + eh > top + h) good.bottom = false; + + // too high + if (off.top < top) good.top = false; + + // too far to the right + if (off.left + ew > left + w) good.right = false; + + // too far to the left + if (off.left < left) good.left = false; + + var i; + var positions = pos.split(/\s+/); + + // attempt to give the preferred position first, consider "bottom right" + for (i = 0; i < positions.length; i++) { + if (!good[positions[i]]) break; + if (i === positions.length - 1) { + // last one! + return pos; + } + } + + // attempt to get close to preferred position, i.e. "bottom" or "right" + for (i = 0; i < positions.length; i++) { + if (good[positions[i]]) return positions[i]; + } + + if (good[pos]) return pos; + if (good.top) return 'top'; + if (good.bottom) return 'bottom'; + if (good.left) return 'left'; + if (good.right) return 'right'; +}; + +/** + * Replace position class `name`. + * + * @param {String} name + * @api private + */ + +Tip.prototype.replaceClass = function(name){ + name = name.split(' ').join('-'); + var classname = this.classname + ' tip tip-' + name; + if (this._effect) classname += ' ' + this._effect; + this.el.setAttribute('class', classname); +}; + +/** + * Compute the offset for `.target` + * based on the given `pos`. + * + * @param {String} pos + * @return {Object} + * @api private + */ + +Tip.prototype.offset = function(pos){ + var pad = this.pad; + + var tipRect = getBoundingClientRect(this.el); + if (!tipRect) throw new Error('could not get bounding client rect of Tip element'); + var ew = tipRect.width; + var eh = tipRect.height; + + var targetRect = getBoundingClientRect(this.target); + if (!targetRect) throw new Error('could not get bounding client rect of `target`'); + var tw = targetRect.width; + var th = targetRect.height; + + var to = offset(targetRect, document); + if (!to) throw new Error('could not determine page offset of `target`'); + + switch (pos) { + case 'top': + return { + top: to.top - eh, + left: to.left + tw / 2 - ew / 2 + } + case 'bottom': + return { + top: to.top + th, + left: to.left + tw / 2 - ew / 2 + } + case 'right': + return { + top: to.top + th / 2 - eh / 2, + left: to.left + tw + } + case 'left': + return { + top: to.top + th / 2 - eh / 2, + left: to.left - ew + } + case 'top left': + return { + top: to.top - eh, + left: to.left + tw / 2 - ew + pad + } + case 'top right': + return { + top: to.top - eh, + left: to.left + tw / 2 - pad + } + case 'bottom left': + return { + top: to.top + th, + left: to.left + tw / 2 - ew + pad + } + case 'bottom right': + return { + top: to.top + th, + left: to.left + tw / 2 - pad + } + default: + throw new Error('invalid position "' + pos + '"'); + } +}; + +/** + * Cancel the `.hide()` timeout. + * + * @api private + */ + +Tip.prototype.cancelHide = function(){ + clearTimeout(this._hide); +}; + +/** + * Hide the tip with optional `ms` delay. + * + * Emits "hide" event. + * + * @param {Number} ms + * @return {Tip} + * @api public + */ + +Tip.prototype.hide = function(ms){ + var self = this; + + this.emit('hiding'); + + // duration + if (ms) { + this._hide = setTimeout(bind(this, this.hide), ms); + return this; + } + + // hide + this.classes.add('tip-hide'); + if (this._effect) { + setTimeout(bind(this, this.remove), 300); + } else { + self.remove(); + } + + return this; +}; + +/** + * Hide the tip without potential animation. + * + * @return {Tip} + * @api public + */ + +Tip.prototype.remove = function(){ + if (this.winEvents) { + this.winEvents.unbind(); + this.winEvents = null; + } + this.emit('hide'); + + var parent = this.el.parentNode; + if (parent) parent.removeChild(this.el); + return this; +}; + +/** + * Extracted from `timoxley/offset`, but directly using a + * TextRectangle instead of getting another version. + * + * @param {TextRectangle} box - result from a `getBoundingClientRect()` call + * @param {Document} doc - Document instance to use + * @return {Object} an object with `top` and `left` Number properties + * @api private + */ + +function offset (box, doc) { + var body = doc.body || doc.getElementsByTagName('body')[0]; + var docEl = doc.documentElement || body.parentNode; + var clientTop = docEl.clientTop || body.clientTop || 0; + var clientLeft = docEl.clientLeft || body.clientLeft || 0; + var scrollTop = window.pageYOffset || docEl.scrollTop; + var scrollLeft = window.pageXOffset || docEl.scrollLeft; + + return { + top: box.top + scrollTop - clientTop, + left: box.left + scrollLeft - clientLeft + }; +} diff --git a/fixture/components/component/tip/2.5.0/template.html b/fixture/components/component/tip/2.5.0/template.html new file mode 100644 index 0000000..b79d0b0 --- /dev/null +++ b/fixture/components/component/tip/2.5.0/template.html @@ -0,0 +1,4 @@ +
+
+
+
\ No newline at end of file diff --git a/fixture/components/component/tip/2.5.0/tip.css b/fixture/components/component/tip/2.5.0/tip.css new file mode 100644 index 0000000..3a7ba8d --- /dev/null +++ b/fixture/components/component/tip/2.5.0/tip.css @@ -0,0 +1,20 @@ +.tip { + position: absolute; + padding: 5px; + z-index: 1000; + /* default offset for edge-cases: https://github.com/component/tip/pull/12 */ + top: 0; + left: 0; +} + +/* effects */ + +.tip.fade { + transition: opacity 100ms; + -moz-transition: opacity 100ms; + -webkit-transition: opacity 100ms; +} + +.tip-hide { + opacity: 0; +} diff --git a/fixture/components/component/type/1.0.0/component.json b/fixture/components/component/type/1.0.0/component.json new file mode 100644 index 0000000..f4463c2 --- /dev/null +++ b/fixture/components/component/type/1.0.0/component.json @@ -0,0 +1,21 @@ +{ + "name": "type", + "description": "Cross-browser type assertions (less broken typeof)", + "version": "1.0.0", + "keywords": [ + "typeof", + "type", + "utility" + ], + "dependencies": {}, + "development": { + "dependencies": { + "component/assert": "*" + } + }, + "scripts": [ + "index.js" + ], + "repository": "component/type", + "resolved": "bcc541832ef44fedfcd0dfc2d0dc5dfd613e3069" +} \ No newline at end of file diff --git a/fixture/components/component/type/1.0.0/index.js b/fixture/components/component/type/1.0.0/index.js new file mode 100644 index 0000000..0e0e3aa --- /dev/null +++ b/fixture/components/component/type/1.0.0/index.js @@ -0,0 +1,32 @@ + +/** + * toString ref. + */ + +var toString = Object.prototype.toString; + +/** + * Return the type of `val`. + * + * @param {Mixed} val + * @return {String} + * @api public + */ + +module.exports = function(val){ + switch (toString.call(val)) { + case '[object Function]': return 'function'; + case '[object Date]': return 'date'; + case '[object RegExp]': return 'regexp'; + case '[object Arguments]': return 'arguments'; + case '[object Array]': return 'array'; + case '[object String]': return 'string'; + } + + if (val === null) return 'null'; + if (val === undefined) return 'undefined'; + if (val && val.nodeType === 1) return 'element'; + if (val === Object(val)) return 'object'; + + return typeof val; +}; diff --git a/fixture/components/component/within-document/0.0.1/component.json b/fixture/components/component/within-document/0.0.1/component.json new file mode 100644 index 0000000..b1f3f64 --- /dev/null +++ b/fixture/components/component/within-document/0.0.1/component.json @@ -0,0 +1,15 @@ +{ + "name": "within-document", + "description": "check if an element is within the document", + "version": "0.0.1", + "keywords": [ + "dom" + ], + "dependencies": {}, + "development": {}, + "scripts": [ + "index.js" + ], + "repository": "component/within-document", + "resolved": "4a8208425915c7302291f835c242b38e4d690703" +} \ No newline at end of file diff --git a/fixture/components/component/within-document/0.0.1/index.js b/fixture/components/component/within-document/0.0.1/index.js new file mode 100644 index 0000000..89c584c --- /dev/null +++ b/fixture/components/component/within-document/0.0.1/index.js @@ -0,0 +1,16 @@ + +/** + * Check if `el` is within the document. + * + * @param {Element} el + * @return {Boolean} + * @api private + */ + +module.exports = function(el) { + var node = el; + while (node = node.parentNode) { + if (node == document) return true; + } + return false; +}; \ No newline at end of file diff --git a/fixture/components/ianstormtaylor/to-camel-case/0.2.1/component.json b/fixture/components/ianstormtaylor/to-camel-case/0.2.1/component.json new file mode 100644 index 0000000..d5bb546 --- /dev/null +++ b/fixture/components/ianstormtaylor/to-camel-case/0.2.1/component.json @@ -0,0 +1,25 @@ +{ + "name": "to-camel-case", + "license": "MIT", + "version": "0.2.1", + "description": "Convert a string to a camel case.", + "keywords": [ + "camel", + "case", + "camelcase", + "string" + ], + "dependencies": { + "ianstormtaylor/to-space-case": "0.1.2" + }, + "development": { + "dependencies": { + "component/assert": "*" + } + }, + "scripts": [ + "index.js" + ], + "repository": "ianstormtaylor/to-camel-case", + "resolved": "02759f7dcf1b3a9c05568183dc14c738d2a0e229" +} \ No newline at end of file diff --git a/fixture/components/ianstormtaylor/to-camel-case/0.2.1/index.js b/fixture/components/ianstormtaylor/to-camel-case/0.2.1/index.js new file mode 100644 index 0000000..e788778 --- /dev/null +++ b/fixture/components/ianstormtaylor/to-camel-case/0.2.1/index.js @@ -0,0 +1,24 @@ + +var toSpace = require('to-space-case'); + + +/** + * Expose `toCamelCase`. + */ + +module.exports = toCamelCase; + + +/** + * Convert a `string` to camel case. + * + * @param {String} string + * @return {String} + */ + + +function toCamelCase (string) { + return toSpace(string).replace(/\s(\w)/g, function (matches, letter) { + return letter.toUpperCase(); + }); +} \ No newline at end of file diff --git a/fixture/components/ianstormtaylor/to-no-case/0.1.0/component.json b/fixture/components/ianstormtaylor/to-no-case/0.1.0/component.json new file mode 100644 index 0000000..02950b5 --- /dev/null +++ b/fixture/components/ianstormtaylor/to-no-case/0.1.0/component.json @@ -0,0 +1,27 @@ +{ + "name": "to-no-case", + "license": "MIT", + "version": "0.1.0", + "description": "Remove an existing case from a string.", + "keywords": [ + "case", + "remove", + "camel", + "camelcase", + "snake", + "snakecase", + "slug", + "slugcase", + "string" + ], + "development": { + "dependencies": { + "component/assert": "*" + } + }, + "scripts": [ + "index.js" + ], + "repository": "ianstormtaylor/to-no-case", + "resolved": "297a62d594f71efcdd75ed44a27b3e6c751faa2b" +} \ No newline at end of file diff --git a/fixture/components/ianstormtaylor/to-no-case/0.1.0/index.js b/fixture/components/ianstormtaylor/to-no-case/0.1.0/index.js new file mode 100644 index 0000000..36a2094 --- /dev/null +++ b/fixture/components/ianstormtaylor/to-no-case/0.1.0/index.js @@ -0,0 +1,74 @@ + +/** + * Expose `toNoCase`. + */ + +module.exports = toNoCase; + + +/** + * Test whether a string is camel-case. + */ + +var hasSpace = /\s/; +var hasCamel = /[a-z][A-Z]/; +var hasSeparator = /[\W_]/; + + +/** + * Remove any starting case from a `string`, like camel or snake, but keep + * spaces and punctuation that may be important otherwise. + * + * @param {String} string + * @return {String} + */ + +function toNoCase (string) { + if (hasSpace.test(string)) return string.toLowerCase(); + + if (hasSeparator.test(string)) string = unseparate(string); + if (hasCamel.test(string)) string = uncamelize(string); + return string.toLowerCase(); +} + + +/** + * Separator splitter. + */ + +var separatorSplitter = /[\W_]+(.|$)/g; + + +/** + * Un-separate a `string`. + * + * @param {String} string + * @return {String} + */ + +function unseparate (string) { + return string.replace(separatorSplitter, function (m, next) { + return next ? ' ' + next : ''; + }); +} + + +/** + * Camelcase splitter. + */ + +var camelSplitter = /(.)([A-Z]+)/g; + + +/** + * Un-camelcase a `string`. + * + * @param {String} string + * @return {String} + */ + +function uncamelize (string) { + return string.replace(camelSplitter, function (m, previous, uppers) { + return previous + ' ' + uppers.toLowerCase().split('').join(' '); + }); +} \ No newline at end of file diff --git a/fixture/components/ianstormtaylor/to-space-case/0.1.2/component.json b/fixture/components/ianstormtaylor/to-space-case/0.1.2/component.json new file mode 100644 index 0000000..5f59ff2 --- /dev/null +++ b/fixture/components/ianstormtaylor/to-space-case/0.1.2/component.json @@ -0,0 +1,25 @@ +{ + "name": "to-space-case", + "license": "MIT", + "version": "0.1.2", + "description": "Convert a string to a space case.", + "keywords": [ + "space", + "case", + "spacecase", + "string" + ], + "dependencies": { + "ianstormtaylor/to-no-case": "0.1.0" + }, + "development": { + "dependencies": { + "component/assert": "*" + } + }, + "scripts": [ + "index.js" + ], + "repository": "ianstormtaylor/to-space-case", + "resolved": "b083e4329693941d57304707b7375d7fc2f1a4d5" +} \ No newline at end of file diff --git a/fixture/components/ianstormtaylor/to-space-case/0.1.2/index.js b/fixture/components/ianstormtaylor/to-space-case/0.1.2/index.js new file mode 100644 index 0000000..ef2b8b2 --- /dev/null +++ b/fixture/components/ianstormtaylor/to-space-case/0.1.2/index.js @@ -0,0 +1,24 @@ + +var clean = require('to-no-case'); + + +/** + * Expose `toSpaceCase`. + */ + +module.exports = toSpaceCase; + + +/** + * Convert a `string` to space case. + * + * @param {String} string + * @return {String} + */ + + +function toSpaceCase (string) { + return clean(string).replace(/[\W_]+(.|$)/g, function (matches, match) { + return match ? ' ' + match : ''; + }); +} \ No newline at end of file diff --git a/fixture/components/rauchg/ms.js/0.7.1/component.json b/fixture/components/rauchg/ms.js/0.7.1/component.json new file mode 100644 index 0000000..34ffbd4 --- /dev/null +++ b/fixture/components/rauchg/ms.js/0.7.1/component.json @@ -0,0 +1,16 @@ +{ + "name": "ms", + "version": "0.7.1", + "description": "ms parsing / formatting", + "keywords": [ + "ms", + "parse", + "format" + ], + "scripts": [ + "index.js" + ], + "license": "MIT", + "repository": "guille/ms.js", + "resolved": "713dcf26d9e6fd9dbc95affe7eff9783b7f1b909" +} \ No newline at end of file diff --git a/fixture/components/rauchg/ms.js/0.7.1/index.js b/fixture/components/rauchg/ms.js/0.7.1/index.js new file mode 100644 index 0000000..4f92771 --- /dev/null +++ b/fixture/components/rauchg/ms.js/0.7.1/index.js @@ -0,0 +1,125 @@ +/** + * Helpers. + */ + +var s = 1000; +var m = s * 60; +var h = m * 60; +var d = h * 24; +var y = d * 365.25; + +/** + * Parse or format the given `val`. + * + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} options + * @return {String|Number} + * @api public + */ + +module.exports = function(val, options){ + options = options || {}; + if ('string' == typeof val) return parse(val); + return options.long + ? long(val) + : short(val); +}; + +/** + * Parse the given `str` and return milliseconds. + * + * @param {String} str + * @return {Number} + * @api private + */ + +function parse(str) { + str = '' + str; + if (str.length > 10000) return; + var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(str); + if (!match) return; + var n = parseFloat(match[1]); + var type = (match[2] || 'ms').toLowerCase(); + switch (type) { + case 'years': + case 'year': + case 'yrs': + case 'yr': + case 'y': + return n * y; + case 'days': + case 'day': + case 'd': + return n * d; + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h; + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m; + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s; + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n; + } +} + +/** + * Short format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function short(ms) { + if (ms >= d) return Math.round(ms / d) + 'd'; + if (ms >= h) return Math.round(ms / h) + 'h'; + if (ms >= m) return Math.round(ms / m) + 'm'; + if (ms >= s) return Math.round(ms / s) + 's'; + return ms + 'ms'; +} + +/** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function long(ms) { + return plural(ms, d, 'day') + || plural(ms, h, 'hour') + || plural(ms, m, 'minute') + || plural(ms, s, 'second') + || ms + ' ms'; +} + +/** + * Pluralization helper. + */ + +function plural(ms, n, name) { + if (ms < n) return; + if (ms < n * 1.5) return Math.floor(ms / n) + ' ' + name; + return Math.ceil(ms / n) + ' ' + name + 's'; +} diff --git a/fixture/components/visionmedia/debug/2.2.0/browser.js b/fixture/components/visionmedia/debug/2.2.0/browser.js new file mode 100644 index 0000000..7c76452 --- /dev/null +++ b/fixture/components/visionmedia/debug/2.2.0/browser.js @@ -0,0 +1,168 @@ + +/** + * This is the web browser implementation of `debug()`. + * + * Expose `debug()` as the module. + */ + +exports = module.exports = require('./debug'); +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.storage = 'undefined' != typeof chrome + && 'undefined' != typeof chrome.storage + ? chrome.storage.local + : localstorage(); + +/** + * Colors. + */ + +exports.colors = [ + 'lightseagreen', + 'forestgreen', + 'goldenrod', + 'dodgerblue', + 'darkorchid', + 'crimson' +]; + +/** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. + * + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ + +function useColors() { + // is webkit? http://stackoverflow.com/a/16459606/376773 + return ('WebkitAppearance' in document.documentElement.style) || + // is firebug? http://stackoverflow.com/a/398120/376773 + (window.console && (console.firebug || (console.exception && console.table))) || + // is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + (navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31); +} + +/** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + +exports.formatters.j = function(v) { + return JSON.stringify(v); +}; + + +/** + * Colorize log arguments if enabled. + * + * @api public + */ + +function formatArgs() { + var args = arguments; + var useColors = this.useColors; + + args[0] = (useColors ? '%c' : '') + + this.namespace + + (useColors ? ' %c' : ' ') + + args[0] + + (useColors ? '%c ' : ' ') + + '+' + exports.humanize(this.diff); + + if (!useColors) return args; + + var c = 'color: ' + this.color; + args = [args[0], c, 'color: inherit'].concat(Array.prototype.slice.call(args, 1)); + + // the final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + var index = 0; + var lastC = 0; + args[0].replace(/%[a-z%]/g, function(match) { + if ('%%' === match) return; + index++; + if ('%c' === match) { + // we only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + + args.splice(lastC, 0, c); + return args; +} + +/** + * Invokes `console.log()` when available. + * No-op when `console.log` is not a "function". + * + * @api public + */ + +function log() { + // this hackery is required for IE8/9, where + // the `console.log` function doesn't have 'apply' + return 'object' === typeof console + && console.log + && Function.prototype.apply.call(console.log, console, arguments); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ + +function save(namespaces) { + try { + if (null == namespaces) { + exports.storage.removeItem('debug'); + } else { + exports.storage.debug = namespaces; + } + } catch(e) {} +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + +function load() { + var r; + try { + r = exports.storage.debug; + } catch(e) {} + return r; +} + +/** + * Enable namespaces listed in `localStorage.debug` initially. + */ + +exports.enable(load()); + +/** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + +function localstorage(){ + try { + return window.localStorage; + } catch (e) {} +} diff --git a/fixture/components/visionmedia/debug/2.2.0/component.json b/fixture/components/visionmedia/debug/2.2.0/component.json new file mode 100644 index 0000000..e957e5c --- /dev/null +++ b/fixture/components/visionmedia/debug/2.2.0/component.json @@ -0,0 +1,20 @@ +{ + "name": "debug", + "description": "small debugging utility", + "version": "2.2.0", + "keywords": [ + "debug", + "log", + "debugger" + ], + "main": "browser.js", + "scripts": [ + "browser.js", + "debug.js" + ], + "dependencies": { + "rauchg/ms.js": "0.7.1" + }, + "repository": "visionmedia/debug", + "resolved": "b38458422b5aa8aa6d286b10dfe427e8a67e2b35" +} \ No newline at end of file diff --git a/fixture/components/visionmedia/debug/2.2.0/debug.js b/fixture/components/visionmedia/debug/2.2.0/debug.js new file mode 100644 index 0000000..7571a86 --- /dev/null +++ b/fixture/components/visionmedia/debug/2.2.0/debug.js @@ -0,0 +1,197 @@ + +/** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + * + * Expose `debug()` as the module. + */ + +exports = module.exports = debug; +exports.coerce = coerce; +exports.disable = disable; +exports.enable = enable; +exports.enabled = enabled; +exports.humanize = require('ms'); + +/** + * The currently active debug mode names, and names to skip. + */ + +exports.names = []; +exports.skips = []; + +/** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lowercased letter, i.e. "n". + */ + +exports.formatters = {}; + +/** + * Previously assigned color. + */ + +var prevColor = 0; + +/** + * Previous log timestamp. + */ + +var prevTime; + +/** + * Select a color. + * + * @return {Number} + * @api private + */ + +function selectColor() { + return exports.colors[prevColor++ % exports.colors.length]; +} + +/** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + +function debug(namespace) { + + // define the `disabled` version + function disabled() { + } + disabled.enabled = false; + + // define the `enabled` version + function enabled() { + + var self = enabled; + + // set `diff` timestamp + var curr = +new Date(); + var ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; + + // add the `color` if not set + if (null == self.useColors) self.useColors = exports.useColors(); + if (null == self.color && self.useColors) self.color = selectColor(); + + var args = Array.prototype.slice.call(arguments); + + args[0] = exports.coerce(args[0]); + + if ('string' !== typeof args[0]) { + // anything else let's inspect with %o + args = ['%o'].concat(args); + } + + // apply any `formatters` transformations + var index = 0; + args[0] = args[0].replace(/%([a-z%])/g, function(match, format) { + // if we encounter an escaped % then don't increase the array index + if (match === '%%') return match; + index++; + var formatter = exports.formatters[format]; + if ('function' === typeof formatter) { + var val = args[index]; + match = formatter.call(self, val); + + // now we need to remove `args[index]` since it's inlined in the `format` + args.splice(index, 1); + index--; + } + return match; + }); + + if ('function' === typeof exports.formatArgs) { + args = exports.formatArgs.apply(self, args); + } + var logFn = enabled.log || exports.log || console.log.bind(console); + logFn.apply(self, args); + } + enabled.enabled = true; + + var fn = exports.enabled(namespace) ? enabled : disabled; + + fn.namespace = namespace; + + return fn; +} + +/** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + +function enable(namespaces) { + exports.save(namespaces); + + var split = (namespaces || '').split(/[\s,]+/); + var len = split.length; + + for (var i = 0; i < len; i++) { + if (!split[i]) continue; // ignore empty strings + namespaces = split[i].replace(/\*/g, '.*?'); + if (namespaces[0] === '-') { + exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); + } else { + exports.names.push(new RegExp('^' + namespaces + '$')); + } + } +} + +/** + * Disable debug output. + * + * @api public + */ + +function disable() { + exports.enable(''); +} + +/** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + +function enabled(name) { + var i, len; + for (i = 0, len = exports.skips.length; i < len; i++) { + if (exports.skips[i].test(name)) { + return false; + } + } + for (i = 0, len = exports.names.length; i < len; i++) { + if (exports.names[i].test(name)) { + return true; + } + } + return false; +} + +/** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + +function coerce(val) { + if (val instanceof Error) return val.stack || val.message; + return val; +} diff --git a/fixture/components/webmodules/bounding-client-rect/1.0.5/component.json b/fixture/components/webmodules/bounding-client-rect/1.0.5/component.json new file mode 100644 index 0000000..ae4256a --- /dev/null +++ b/fixture/components/webmodules/bounding-client-rect/1.0.5/component.json @@ -0,0 +1,28 @@ +{ + "name": "bounding-client-rect", + "version": "1.0.5", + "description": "Cross-browser `getBoundingClientRect()` for all Node types", + "keywords": [ + "browser", + "bounding", + "client", + "rect", + "getBoundingClientRect", + "TextRectangle", + "TextNode", + "Node", + "Range", + "HTMLElement" + ], + "main": "index.js", + "author": "Nathan Rajlich ", + "license": "MIT", + "scripts": [ + "index.js" + ], + "dependencies": { + "webmodules/get-document": "1.0.0" + }, + "repository": "webmodules/bounding-client-rect", + "resolved": "b0f8a679ac05b3a7b9942dfc0be19473110197f8" +} \ No newline at end of file diff --git a/fixture/components/webmodules/bounding-client-rect/1.0.5/index.js b/fixture/components/webmodules/bounding-client-rect/1.0.5/index.js new file mode 100644 index 0000000..acc971f --- /dev/null +++ b/fixture/components/webmodules/bounding-client-rect/1.0.5/index.js @@ -0,0 +1,57 @@ + +/** + * Module dependencies. + */ + +var getDocument = require('get-document'); + +/** + * Module exports. + */ + +module.exports = getBoundingClientRect; + +/** + * Returns the "bounding client rectangle" of the given `TextNode`, + * `HTMLElement`, or `Range`. + * + * @param {Node} node + * @return {TextRectangle} + * @public + */ + +function getBoundingClientRect (node) { + var rect = null; + var doc = getDocument(node); + + if (node.nodeType === 3 /* TEXT_NODE */) { + // see: http://stackoverflow.com/a/6966613/376773 + var range = doc.createRange(); + range.selectNodeContents(node); + node = range; + } + + if ('function' === typeof node.getBoundingClientRect) { + rect = node.getBoundingClientRect(); + + if (node.startContainer && rect.left === 0 && rect.top === 0) { + // Range instances sometimes report all `0`s + // see: http://stackoverflow.com/a/6847328/376773 + var span = doc.createElement('span'); + + // Ensure span has dimensions and position by + // adding a zero-width space character + span.appendChild(doc.createTextNode('\u200b')); + node.insertNode(span); + rect = span.getBoundingClientRect(); + + // Remove temp SPAN and glue any broken text nodes back together + var spanParent = span.parentNode; + spanParent.removeChild(span); + spanParent.normalize(); + } + + } + + return rect; +} diff --git a/fixture/components/webmodules/get-document/1.0.0/component.json b/fixture/components/webmodules/get-document/1.0.0/component.json new file mode 100644 index 0000000..3bc7a04 --- /dev/null +++ b/fixture/components/webmodules/get-document/1.0.0/component.json @@ -0,0 +1,20 @@ +{ + "name": "get-document", + "version": "1.0.0", + "description": "Returns the `document` object from a DOM object", + "keywords": [ + "dom", + "document", + "node", + "range", + "element", + "browser" + ], + "main": "index.js", + "scripts": [ + "index.js" + ], + "dependencies": {}, + "repository": "webmodules/get-document", + "resolved": "1ba68f43808a24a721307ce67f188c9eb38d1747" +} \ No newline at end of file diff --git a/fixture/components/webmodules/get-document/1.0.0/index.js b/fixture/components/webmodules/get-document/1.0.0/index.js new file mode 100644 index 0000000..028211d --- /dev/null +++ b/fixture/components/webmodules/get-document/1.0.0/index.js @@ -0,0 +1,57 @@ + +/** + * Module exports. + */ + +module.exports = getDocument; + +// defined by w3c +var DOCUMENT_NODE = 9; + +/** + * Returns `true` if `w` is a Document object, or `false` otherwise. + * + * @param {?} d - Document object, maybe + * @return {Boolean} + * @private + */ + +function isDocument (d) { + return d && d.nodeType === DOCUMENT_NODE; +} + +/** + * Returns the `document` object associated with the given `node`, which may be + * a DOM element, the Window object, a Selection, a Range. Basically any DOM + * object that references the Document in some way, this function will find it. + * + * @param {Mixed} node - DOM node, selection, or range in which to find the `document` object + * @return {Document} the `document` object associated with `node` + * @public + */ + +function getDocument(node) { + if (isDocument(node)) { + return node; + + } else if (isDocument(node.ownerDocument)) { + return node.ownerDocument; + + } else if (isDocument(node.document)) { + return node.document; + + } else if (node.parentNode) { + return getDocument(node.parentNode); + + // Range support + } else if (node.commonAncestorContainer) { + return getDocument(node.commonAncestorContainer); + + } else if (node.startContainer) { + return getDocument(node.startContainer); + + // Selection support + } else if (node.anchorNode) { + return getDocument(node.anchorNode); + } +} diff --git a/fixture/entry.js b/fixture/entry.js index 1205d96..dcef135 100644 --- a/fixture/entry.js +++ b/fixture/entry.js @@ -2,6 +2,7 @@ var l = require('local-comp'); console.log(l); // some styles require('./styles.css'); +require('datepicker/1.0.1/datepicker.css'); // more fixture var Calendar = require('calendar'); @@ -58,3 +59,8 @@ restricted = new Calendar(new Date(2004, 6, 11)) .show(new Date(2004, 5, 19)); container.appendChild(restricted.el); + +// date picker +var picker = require('datepicker'); +var el = document.querySelector('[name=date]'); +picker(el); diff --git a/fixture/index.html b/fixture/index.html index f9b37d8..baf9fd0 100644 --- a/fixture/index.html +++ b/fixture/index.html @@ -6,10 +6,21 @@
+
+

Date Picker

+ + +

Calendar

+ diff --git a/fixture/package.json b/fixture/package.json index ab546e9..f91fd76 100644 --- a/fixture/package.json +++ b/fixture/package.json @@ -22,6 +22,7 @@ "clone-component": "^0.2.2", "component-props": "^1.1.1", "component-type": "^1.2.0", + "ms": "^0.7.1", "type-component": "0.0.1" } } From 31fe95ab61bf12ec7e1d8c790ca48da2b5a2bcee Mon Sep 17 00:00:00 2001 From: Amin Meyghani Date: Fri, 18 Sep 2015 15:52:44 -0400 Subject: [PATCH 06/10] add readme --- fixture/.gitignore | 3 +++ fixture/package.json | 3 ++- fixture/readme.md | 11 +++++++++++ fixture/standalone.html | 25 +++++++++++++++++++++++++ 4 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 fixture/readme.md create mode 100644 fixture/standalone.html diff --git a/fixture/.gitignore b/fixture/.gitignore index 788c597..3e7bb1e 100644 --- a/fixture/.gitignore +++ b/fixture/.gitignore @@ -28,3 +28,6 @@ node_modules # DS_Store .DS_Store + +#dist +dist diff --git a/fixture/package.json b/fixture/package.json index f91fd76..83985b6 100644 --- a/fixture/package.json +++ b/fixture/package.json @@ -6,7 +6,8 @@ "scripts": { "get_comp": "./install", "gc": "npm run get_comp", - "dev": "./node_modules/webpack-dev-server/bin/webpack-dev-server.js" + "dev": "./node_modules/webpack-dev-server/bin/webpack-dev-server.js --port 9191", + "build": "./node_modules/webpack/bin/webpack.js -p" }, "author": "Amin Meyghani (http://meyghani.com)", "license": "ISC", diff --git a/fixture/readme.md b/fixture/readme.md new file mode 100644 index 0000000..b241779 --- /dev/null +++ b/fixture/readme.md @@ -0,0 +1,11 @@ +# Setup + +`npm i` + +# Start dev server + +`npm run dev` and then go to `http://localhost:9191/webpack-dev-server/index.html` + +# build + + diff --git a/fixture/standalone.html b/fixture/standalone.html new file mode 100644 index 0000000..fe2038e --- /dev/null +++ b/fixture/standalone.html @@ -0,0 +1,25 @@ + + + + + dist + + +
+
+

Date Picker

+ + +
+

Calendar

+
+
+
+ + + From 6cc1409a492a81575d9cc8ae1dd047cd0fb9de68 Mon Sep 17 00:00:00 2001 From: Amin Meyghani Date: Fri, 18 Sep 2015 15:53:16 -0400 Subject: [PATCH 07/10] build with: npm run build --- fixture/readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fixture/readme.md b/fixture/readme.md index b241779..1cd1868 100644 --- a/fixture/readme.md +++ b/fixture/readme.md @@ -8,4 +8,4 @@ # build - +`npm run build` From 1f44988ed151ce48d00ac55330210e04ddc7c203 Mon Sep 17 00:00:00 2001 From: Amin Meyghani Date: Fri, 18 Sep 2015 15:57:23 -0400 Subject: [PATCH 08/10] ignore components --- fixture/.gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fixture/.gitignore b/fixture/.gitignore index 3e7bb1e..f6adf79 100644 --- a/fixture/.gitignore +++ b/fixture/.gitignore @@ -31,3 +31,6 @@ node_modules #dist dist + +# components +components From 867be0eafc1a9bd50e07589721e8b8f82eb2ed48 Mon Sep 17 00:00:00 2001 From: Amin Meyghani Date: Fri, 18 Sep 2015 16:04:10 -0400 Subject: [PATCH 09/10] add local-comp as a dev dep --- fixture/component.json | 8 ++++---- fixture/package.json | 1 + fixture/readme.md | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/fixture/component.json b/fixture/component.json index c965319..7129f97 100644 --- a/fixture/component.json +++ b/fixture/component.json @@ -8,11 +8,11 @@ "styles.css" ], "paths": [], - "local": [ - "local-comp" - ], + "development": { + "local-comp": "*" + }, "dependencies": { "component/calendar": "~0.2.0", "component/datepicker": "^1.0.1" } -} \ No newline at end of file +} diff --git a/fixture/package.json b/fixture/package.json index 83985b6..2b7b0ad 100644 --- a/fixture/package.json +++ b/fixture/package.json @@ -4,6 +4,7 @@ "description": "", "main": "index.js", "scripts": { + "component": "./node_modules/component/bin/component", "get_comp": "./install", "gc": "npm run get_comp", "dev": "./node_modules/webpack-dev-server/bin/webpack-dev-server.js --port 9191", diff --git a/fixture/readme.md b/fixture/readme.md index 1cd1868..616a2b2 100644 --- a/fixture/readme.md +++ b/fixture/readme.md @@ -1,6 +1,6 @@ # Setup -`npm i` +`npm i && npm run component -- install` # Start dev server From 2550f5a77bd64100be70ca343ab0c3e4064da2f4 Mon Sep 17 00:00:00 2001 From: Amin Meyghani Date: Fri, 18 Sep 2015 16:04:32 -0400 Subject: [PATCH 10/10] clean cache --- .../code42day/bounds/1.0.1/component.json | 19 - .../code42day/bounds/1.0.1/index.js | 108 ---- .../aurora-calendar/1.0.0/component.json | 21 - .../component/aurora-calendar/1.0.0/style.css | 54 -- .../aurora-popover/master/aurora-popover.css | 21 - .../aurora-popover/master/component.json | 19 - .../component/aurora-tip/1.0.0/aurora-tip.css | 93 ---- .../component/aurora-tip/1.0.0/component.json | 19 - .../component/aurora/master/component.json | 17 - .../component/bind/1.0.0/component.json | 15 - .../components/component/bind/1.0.0/index.js | 23 - .../component/calendar/0.2.0/component.json | 46 -- .../component/calendar/0.2.0/index.js | 2 - .../component/calendar/0.2.0/lib/calendar.css | 23 - .../component/calendar/0.2.0/lib/calendar.js | 240 --------- .../component/calendar/0.2.0/lib/dayrange.js | 29 -- .../component/calendar/0.2.0/lib/days.js | 459 ----------------- .../calendar/0.2.0/lib/template.html | 11 - .../component/calendar/0.2.0/lib/utils.js | 14 - .../component/classes/1.2.1/component.json | 20 - .../component/classes/1.2.1/index.js | 184 ------- .../component/classes/1.2.4/component.json | 25 - .../component/classes/1.2.4/index.js | 187 ------- .../component/clone/0.2.2/component.json | 16 - .../components/component/clone/0.2.2/index.js | 57 -- .../component/closest/1.0.0/component.json | 15 - .../component/closest/1.0.0/index.js | 32 -- .../component/css/0.0.6/component.json | 35 -- .../components/component/css/0.0.6/index.js | 58 --- .../component/css/0.0.6/lib/computed.js | 48 -- .../components/component/css/0.0.6/lib/css.js | 80 --- .../component/css/0.0.6/lib/hooks.js | 162 ------ .../component/css/0.0.6/lib/prop.js | 36 -- .../component/css/0.0.6/lib/style.js | 106 ---- .../component/css/0.0.6/lib/styles.js | 20 - .../component/css/0.0.6/lib/support.js | 101 ---- .../component/css/0.0.6/lib/swap.js | 32 -- .../component/css/0.0.6/lib/vendor.js | 36 -- .../component/datepicker/1.0.1/component.json | 27 - .../component/datepicker/1.0.1/datepicker.css | 12 - .../component/datepicker/1.0.1/index.js | 56 -- .../component/delegate/0.2.3/component.json | 20 - .../component/delegate/0.2.3/index.js | 42 -- .../component/domify/1.3.0/component.json | 23 - .../component/domify/1.3.0/index.js | 93 ---- .../component/domify/1.4.0/component.json | 23 - .../component/domify/1.4.0/index.js | 112 ---- .../component/each/0.2.6/component.json | 22 - .../components/component/each/0.2.6/index.js | 89 ---- .../component/emitter/1.0.0/component.json | 14 - .../component/emitter/1.0.0/index.js | 156 ------ .../component/emitter/1.1.3/component.json | 15 - .../component/emitter/1.1.3/index.js | 164 ------ .../component/event/0.1.4/component.json | 15 - .../components/component/event/0.1.4/index.js | 35 -- .../component/events/1.0.9/component.json | 21 - .../component/events/1.0.9/index.js | 176 ------- .../in-groups-of/1.0.0/component.json | 14 - .../component/in-groups-of/1.0.0/index.js | 19 - .../component/indexof/0.0.3/component.json | 21 - .../component/indexof/0.0.3/index.js | 7 - .../component/inherit/0.0.3/component.json | 15 - .../component/inherit/0.0.3/index.js | 7 - .../component/map/0.0.1/component.json | 19 - .../components/component/map/0.0.1/index.js | 24 - .../matches-selector/0.1.5/component.json | 23 - .../component/matches-selector/0.1.5/index.js | 46 -- .../component/popover/1.1.1/component.json | 26 - .../component/popover/1.1.1/index.js | 85 --- .../component/popover/1.1.1/template.js | 1 - .../component/props/1.1.2/component.json | 19 - .../components/component/props/1.1.2/index.js | 85 --- .../component/query/0.0.3/component.json | 24 - .../components/component/query/0.0.3/index.js | 21 - .../component/range/1.0.0/component.json | 18 - .../components/component/range/1.0.0/index.js | 11 - .../component/tip/2.5.0/component.json | 43 -- .../components/component/tip/2.5.0/index.js | 485 ------------------ .../component/tip/2.5.0/template.html | 4 - .../components/component/tip/2.5.0/tip.css | 20 - .../to-function/2.0.6/component.json | 18 - .../component/to-function/2.0.6/index.js | 152 ------ .../component/type/1.0.0/component.json | 21 - .../components/component/type/1.0.0/index.js | 32 -- .../component/type/v1.2.0/component.json | 21 - .../components/component/type/v1.2.0/index.js | 36 -- .../within-document/0.0.1/component.json | 15 - .../component/within-document/0.0.1/index.js | 16 - .../to-camel-case/0.2.1/component.json | 25 - .../to-camel-case/0.2.1/index.js | 24 - .../to-no-case/0.1.0/component.json | 27 - .../ianstormtaylor/to-no-case/0.1.0/index.js | 74 --- .../to-space-case/0.1.2/component.json | 25 - .../to-space-case/0.1.2/index.js | 24 - .../rauchg/ms.js/0.7.1/component.json | 16 - .../components/rauchg/ms.js/0.7.1/index.js | 125 ----- .../normalize/0.0.1/component.json | 19 - .../stephenmathieson/normalize/0.0.1/index.js | 47 -- .../visionmedia/debug/2.2.0/browser.js | 168 ------ .../visionmedia/debug/2.2.0/component.json | 20 - .../visionmedia/debug/2.2.0/debug.js | 197 ------- .../bounding-client-rect/1.0.5/component.json | 28 - .../bounding-client-rect/1.0.5/index.js | 57 -- .../get-document/1.0.0/component.json | 20 - .../webmodules/get-document/1.0.0/index.js | 57 -- .../yields/empty/0.0.1/component.json | 21 - .../components/yields/empty/0.0.1/index.js | 12 - 107 files changed, 5932 deletions(-) delete mode 100644 fixture/components/code42day/bounds/1.0.1/component.json delete mode 100644 fixture/components/code42day/bounds/1.0.1/index.js delete mode 100644 fixture/components/component/aurora-calendar/1.0.0/component.json delete mode 100644 fixture/components/component/aurora-calendar/1.0.0/style.css delete mode 100644 fixture/components/component/aurora-popover/master/aurora-popover.css delete mode 100644 fixture/components/component/aurora-popover/master/component.json delete mode 100644 fixture/components/component/aurora-tip/1.0.0/aurora-tip.css delete mode 100644 fixture/components/component/aurora-tip/1.0.0/component.json delete mode 100644 fixture/components/component/aurora/master/component.json delete mode 100644 fixture/components/component/bind/1.0.0/component.json delete mode 100644 fixture/components/component/bind/1.0.0/index.js delete mode 100644 fixture/components/component/calendar/0.2.0/component.json delete mode 100644 fixture/components/component/calendar/0.2.0/index.js delete mode 100644 fixture/components/component/calendar/0.2.0/lib/calendar.css delete mode 100644 fixture/components/component/calendar/0.2.0/lib/calendar.js delete mode 100644 fixture/components/component/calendar/0.2.0/lib/dayrange.js delete mode 100644 fixture/components/component/calendar/0.2.0/lib/days.js delete mode 100644 fixture/components/component/calendar/0.2.0/lib/template.html delete mode 100644 fixture/components/component/calendar/0.2.0/lib/utils.js delete mode 100644 fixture/components/component/classes/1.2.1/component.json delete mode 100644 fixture/components/component/classes/1.2.1/index.js delete mode 100644 fixture/components/component/classes/1.2.4/component.json delete mode 100644 fixture/components/component/classes/1.2.4/index.js delete mode 100644 fixture/components/component/clone/0.2.2/component.json delete mode 100644 fixture/components/component/clone/0.2.2/index.js delete mode 100644 fixture/components/component/closest/1.0.0/component.json delete mode 100644 fixture/components/component/closest/1.0.0/index.js delete mode 100644 fixture/components/component/css/0.0.6/component.json delete mode 100644 fixture/components/component/css/0.0.6/index.js delete mode 100644 fixture/components/component/css/0.0.6/lib/computed.js delete mode 100644 fixture/components/component/css/0.0.6/lib/css.js delete mode 100644 fixture/components/component/css/0.0.6/lib/hooks.js delete mode 100644 fixture/components/component/css/0.0.6/lib/prop.js delete mode 100644 fixture/components/component/css/0.0.6/lib/style.js delete mode 100644 fixture/components/component/css/0.0.6/lib/styles.js delete mode 100644 fixture/components/component/css/0.0.6/lib/support.js delete mode 100644 fixture/components/component/css/0.0.6/lib/swap.js delete mode 100644 fixture/components/component/css/0.0.6/lib/vendor.js delete mode 100644 fixture/components/component/datepicker/1.0.1/component.json delete mode 100644 fixture/components/component/datepicker/1.0.1/datepicker.css delete mode 100644 fixture/components/component/datepicker/1.0.1/index.js delete mode 100644 fixture/components/component/delegate/0.2.3/component.json delete mode 100644 fixture/components/component/delegate/0.2.3/index.js delete mode 100644 fixture/components/component/domify/1.3.0/component.json delete mode 100644 fixture/components/component/domify/1.3.0/index.js delete mode 100644 fixture/components/component/domify/1.4.0/component.json delete mode 100644 fixture/components/component/domify/1.4.0/index.js delete mode 100644 fixture/components/component/each/0.2.6/component.json delete mode 100644 fixture/components/component/each/0.2.6/index.js delete mode 100644 fixture/components/component/emitter/1.0.0/component.json delete mode 100644 fixture/components/component/emitter/1.0.0/index.js delete mode 100644 fixture/components/component/emitter/1.1.3/component.json delete mode 100644 fixture/components/component/emitter/1.1.3/index.js delete mode 100644 fixture/components/component/event/0.1.4/component.json delete mode 100644 fixture/components/component/event/0.1.4/index.js delete mode 100644 fixture/components/component/events/1.0.9/component.json delete mode 100644 fixture/components/component/events/1.0.9/index.js delete mode 100644 fixture/components/component/in-groups-of/1.0.0/component.json delete mode 100644 fixture/components/component/in-groups-of/1.0.0/index.js delete mode 100644 fixture/components/component/indexof/0.0.3/component.json delete mode 100644 fixture/components/component/indexof/0.0.3/index.js delete mode 100644 fixture/components/component/inherit/0.0.3/component.json delete mode 100644 fixture/components/component/inherit/0.0.3/index.js delete mode 100644 fixture/components/component/map/0.0.1/component.json delete mode 100644 fixture/components/component/map/0.0.1/index.js delete mode 100644 fixture/components/component/matches-selector/0.1.5/component.json delete mode 100644 fixture/components/component/matches-selector/0.1.5/index.js delete mode 100644 fixture/components/component/popover/1.1.1/component.json delete mode 100644 fixture/components/component/popover/1.1.1/index.js delete mode 100644 fixture/components/component/popover/1.1.1/template.js delete mode 100644 fixture/components/component/props/1.1.2/component.json delete mode 100644 fixture/components/component/props/1.1.2/index.js delete mode 100644 fixture/components/component/query/0.0.3/component.json delete mode 100644 fixture/components/component/query/0.0.3/index.js delete mode 100644 fixture/components/component/range/1.0.0/component.json delete mode 100644 fixture/components/component/range/1.0.0/index.js delete mode 100644 fixture/components/component/tip/2.5.0/component.json delete mode 100644 fixture/components/component/tip/2.5.0/index.js delete mode 100644 fixture/components/component/tip/2.5.0/template.html delete mode 100644 fixture/components/component/tip/2.5.0/tip.css delete mode 100644 fixture/components/component/to-function/2.0.6/component.json delete mode 100644 fixture/components/component/to-function/2.0.6/index.js delete mode 100644 fixture/components/component/type/1.0.0/component.json delete mode 100644 fixture/components/component/type/1.0.0/index.js delete mode 100644 fixture/components/component/type/v1.2.0/component.json delete mode 100644 fixture/components/component/type/v1.2.0/index.js delete mode 100644 fixture/components/component/within-document/0.0.1/component.json delete mode 100644 fixture/components/component/within-document/0.0.1/index.js delete mode 100644 fixture/components/ianstormtaylor/to-camel-case/0.2.1/component.json delete mode 100644 fixture/components/ianstormtaylor/to-camel-case/0.2.1/index.js delete mode 100644 fixture/components/ianstormtaylor/to-no-case/0.1.0/component.json delete mode 100644 fixture/components/ianstormtaylor/to-no-case/0.1.0/index.js delete mode 100644 fixture/components/ianstormtaylor/to-space-case/0.1.2/component.json delete mode 100644 fixture/components/ianstormtaylor/to-space-case/0.1.2/index.js delete mode 100644 fixture/components/rauchg/ms.js/0.7.1/component.json delete mode 100644 fixture/components/rauchg/ms.js/0.7.1/index.js delete mode 100644 fixture/components/stephenmathieson/normalize/0.0.1/component.json delete mode 100644 fixture/components/stephenmathieson/normalize/0.0.1/index.js delete mode 100644 fixture/components/visionmedia/debug/2.2.0/browser.js delete mode 100644 fixture/components/visionmedia/debug/2.2.0/component.json delete mode 100644 fixture/components/visionmedia/debug/2.2.0/debug.js delete mode 100644 fixture/components/webmodules/bounding-client-rect/1.0.5/component.json delete mode 100644 fixture/components/webmodules/bounding-client-rect/1.0.5/index.js delete mode 100644 fixture/components/webmodules/get-document/1.0.0/component.json delete mode 100644 fixture/components/webmodules/get-document/1.0.0/index.js delete mode 100644 fixture/components/yields/empty/0.0.1/component.json delete mode 100644 fixture/components/yields/empty/0.0.1/index.js diff --git a/fixture/components/code42day/bounds/1.0.1/component.json b/fixture/components/code42day/bounds/1.0.1/component.json deleted file mode 100644 index 4861928..0000000 --- a/fixture/components/code42day/bounds/1.0.1/component.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "bounds", - "description": "Mixin for checking if value is inside or outside of bounds", - "version": "1.0.1", - "keywords": [ - "range", - "compare" - ], - "dependencies": { - "component/clone": "*" - }, - "development": {}, - "license": "MIT", - "scripts": [ - "index.js" - ], - "repository": "code42day/bounds", - "resolved": "a83c24ff1c0bfd28324b97b5ac87c7853f98f243" -} \ No newline at end of file diff --git a/fixture/components/code42day/bounds/1.0.1/index.js b/fixture/components/code42day/bounds/1.0.1/index.js deleted file mode 100644 index aa80a03..0000000 --- a/fixture/components/code42day/bounds/1.0.1/index.js +++ /dev/null @@ -1,108 +0,0 @@ -var clone; - -if ('undefined' == typeof window) { - clone = require('clone-component'); -} else { - clone = require('clone'); -} - -module.exports = Bounds; - - -function calculateReversed(self) { - return self._min - && self._max - && self.before(self._max); -} - -function Bounds(obj) { - if (obj) return mixin(obj); -} - -function mixin(obj) { - for (var key in Bounds.prototype) { - obj[key] = Bounds.prototype[key]; - } - return obj; -} - -Bounds.prototype.compare = function(fn) { - this._compare = fn; - return this; -}; - -Bounds.prototype.distance = function(fn) { - this._distance = fn; - return this; -}; - -Bounds.prototype.min = function(v) { - if (!arguments.length) { - return this._min; - } - this._min = v; - delete this._reversed; - return this; -}; - -Bounds.prototype.max = function(v) { - if (!arguments.length) { - return this._max; - } - this._max = v; - delete this._reversed; - return this; -}; - -Bounds.prototype.before = function(v) { - return this._min && (this._compare(v, this._min) < 0); -}; - -Bounds.prototype.after = function(v) { - return this._max && (this._compare(v, this._max) > 0); -}; - -Bounds.prototype.out = function(v) { - return this.before(v) || this.after(v); -}; - -Bounds.prototype.in = function(v) { - return !this.out(v); -}; - -Bounds.prototype.valid = function(v) { - if (this.reversed()) { - return !this.after(v) || !this.before(v); - } - return this.in(v); -}; - -Bounds.prototype.invalid = function(v) { - return !this.valid(v); -}; - -Bounds.prototype.reversed = function() { - if (this._reversed === undefined) { - this._reversed = calculateReversed(this); - } - return this._reversed; -}; - -Bounds.prototype.restrict = function(v) { - if (this.reversed()) { - if(this.after(v) && this.before(v)) { - // select closer bound - return (this._distance(this._max, v) < this._distance(v, this._min)) - ? clone(this._max) - : clone(this._min); - } - return v; - } - if(this.before(v)) { - return clone(this._min); - } - if(this.after(v)) { - return clone(this._max); - } - return v; -}; diff --git a/fixture/components/component/aurora-calendar/1.0.0/component.json b/fixture/components/component/aurora-calendar/1.0.0/component.json deleted file mode 100644 index dcd42bf..0000000 --- a/fixture/components/component/aurora-calendar/1.0.0/component.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "aurora-calendar", - "description": "Aurora calendar theme", - "version": "1.0.0", - "keywords": [ - "aurora", - "theme", - "calendar" - ], - "dependencies": {}, - "development": { - "dependencies": { - "component/calendar": "*" - } - }, - "styles": [ - "style.css" - ], - "repository": "component/aurora-calendar", - "resolved": "333903f965f68e39f54f164141a0c3d49f2a4f06" -} \ No newline at end of file diff --git a/fixture/components/component/aurora-calendar/1.0.0/style.css b/fixture/components/component/aurora-calendar/1.0.0/style.css deleted file mode 100644 index 7587f81..0000000 --- a/fixture/components/component/aurora-calendar/1.0.0/style.css +++ /dev/null @@ -1,54 +0,0 @@ -.calendar a { - display: block; - padding: 5px; - text-decoration: none; - color: inherit; - -o-border-radius: 3px; - -ms-border-radius: 3px; - -moz-border-radius: 3px; - -webkit-border-radius: 3px; - border-radius: 3px -} - -.calendar a:hover { - background: #efefef -} - -.calendar a:active { - opacity: .75; - -ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=75); - filter: alpha(opacity=75) -} - -.calendar-table { - font-size: 13px; - border-bottom: 1px solid #ddd; - -o-border-radius: 5px; - -ms-border-radius: 5px; - -moz-border-radius: 5px; - -webkit-border-radius: 5px; - border-radius: 5px; - -o-box-shadow: 0 1px 2px #eee; - -ms-box-shadow: 0 1px 2px #eee; - -moz-box-shadow: 0 1px 2px #eee; - -webkit-box-shadow: 0 1px 2px #eee; - box-shadow: 0 1px 2px #eee -} - -.calendar-table .selected { - background: none -} - -.calendar-table .selected a { - background: -o-linear-gradient(#76aaef, #0085CC); - background: -ms-linear-gradient(#76aaef, #0085CC); - background: -moz-linear-gradient(#76aaef, #0085CC); - background: -webkit-linear-gradient(#76aaef, #0085CC); - background: linear-gradient(#76aaef, #0085CC); - color: white; - -o-box-shadow: inset 0 1px #2b8dea; - -ms-box-shadow: inset 0 1px #2b8dea; - -moz-box-shadow: inset 0 1px #2b8dea; - -webkit-box-shadow: inset 0 1px #2b8dea; - box-shadow: inset 0 1px #2b8dea -} \ No newline at end of file diff --git a/fixture/components/component/aurora-popover/master/aurora-popover.css b/fixture/components/component/aurora-popover/master/aurora-popover.css deleted file mode 100644 index e3b493e..0000000 --- a/fixture/components/component/aurora-popover/master/aurora-popover.css +++ /dev/null @@ -1,21 +0,0 @@ - -.popover .tip-inner { - padding: 0; - border: 2px solid #1c1c1c; - background: white; - color: inherit; -} - -.popover-title { - display: block; - width: 100%; - text-align: left; - font-weight: bold; - padding: 10px; -} - -.popover-content { - padding: 10px; - padding-top: 0; -} - diff --git a/fixture/components/component/aurora-popover/master/component.json b/fixture/components/component/aurora-popover/master/component.json deleted file mode 100644 index b25369c..0000000 --- a/fixture/components/component/aurora-popover/master/component.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "aurora-popover", - "description": "Aurora Popover theme", - "version": "0.0.1", - "keywords": [ - "aurora", - "popover", - "theme" - ], - "dependencies": { - "component/aurora-tip": "*" - }, - "development": {}, - "styles": [ - "aurora-popover.css" - ], - "repository": "component/aurora-popover", - "resolved": "f2af638507d865f9e7d78fdb3971d82defb15fa8" -} \ No newline at end of file diff --git a/fixture/components/component/aurora-tip/1.0.0/aurora-tip.css b/fixture/components/component/aurora-tip/1.0.0/aurora-tip.css deleted file mode 100644 index c1af877..0000000 --- a/fixture/components/component/aurora-tip/1.0.0/aurora-tip.css +++ /dev/null @@ -1,93 +0,0 @@ - -/** - * Tip. - * - * .tip.tip-[direction] - * .tip-inner - * .tip-arrow - */ - -.tip { - font-size: 11px; -} - -.tip-inner { - background-color: rgba(0,0,0,.75); - color: #fff; - padding: 8px 10px 7px 10px; - text-align: center; -} - -.tip-inner { - border-radius: 3px; - -moz-border-radius: 3px; - -webkit-border-radius: 3px; -} - -.tip-arrow { - position: absolute; - width: 0; - height: 0; - line-height: 0; - border: 5px dashed rgba(0,0,0,.75); -} - -.tip-arrow-top { border-top-color: rgba(0,0,0,.75) } -.tip-arrow-bottom { border-bottom-color: rgba(0,0,0,.75) } -.tip-arrow-left { border-left-color: rgba(0,0,0,.75) } -.tip-arrow-right { border-right-color: rgba(0,0,0,.75) } - -.tip-top .tip-arrow, -.tip-top-left .tip-arrow, -.tip-top-right .tip-arrow { - bottom: 0; - left: 50%; - margin-left: -5px; - border-top-style: solid; - border-bottom: none; - border-left-color: transparent; - border-right-color: transparent -} - -.tip-bottom .tip-arrow, -.tip-bottom-left .tip-arrow, -.tip-bottom-right .tip-arrow { - top: 0px; - left: 50%; - margin-left: -5px; - border-bottom-style: solid; - border-top: none; - border-left-color: transparent; - border-right-color: transparent -} - -.tip-left .tip-arrow { - right: 0; - top: 50%; - margin-top: -5px; - border-left-style: solid; - border-right: none; - border-top-color: transparent; - border-bottom-color: transparent -} - -.tip-right .tip-arrow { - left: 0; - top: 50%; - margin-top: -5px; - border-right-style: solid; - border-left: none; - border-top-color: transparent; - border-bottom-color: transparent -} - -.tip-top-left .tip-arrow, -.tip-bottom-left .tip-arrow { - left: 85%; -} - - -.tip-top-right .tip-arrow, -.tip-bottom-right .tip-arrow { - left: 15px; -} \ No newline at end of file diff --git a/fixture/components/component/aurora-tip/1.0.0/component.json b/fixture/components/component/aurora-tip/1.0.0/component.json deleted file mode 100644 index 0271a44..0000000 --- a/fixture/components/component/aurora-tip/1.0.0/component.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "aurora-tip", - "description": "Aurora theme for tool tips", - "version": "1.0.0", - "keywords": [ - "aurora", - "theme", - "tip", - "tooltip", - "tooltips" - ], - "dependencies": {}, - "development": {}, - "styles": [ - "aurora-tip.css" - ], - "repository": "component/aurora-tip", - "resolved": "39951990a134916a9d1ef41c38c83a64b1c177cd" -} \ No newline at end of file diff --git a/fixture/components/component/aurora/master/component.json b/fixture/components/component/aurora/master/component.json deleted file mode 100644 index f70256f..0000000 --- a/fixture/components/component/aurora/master/component.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "aurora", - "description": "Aurora theme for Calendar, Popover, and Tip", - "version": "0.0.1", - "keywords": [ - "aurora", - "theme", - "bundle" - ], - "dependencies": { - "component/aurora-popover": "*", - "component/aurora-calendar": "*" - }, - "development": {}, - "repository": "component/aurora", - "resolved": "e69b69706cd75d82452437ba54a427e4e042a291" -} \ No newline at end of file diff --git a/fixture/components/component/bind/1.0.0/component.json b/fixture/components/component/bind/1.0.0/component.json deleted file mode 100644 index 19ab32d..0000000 --- a/fixture/components/component/bind/1.0.0/component.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "bind", - "version": "1.0.0", - "description": "function binding utility", - "keywords": [ - "bind", - "utility" - ], - "dependencies": {}, - "scripts": [ - "index.js" - ], - "repository": "component/bind", - "resolved": "0a0b368653bd53bd162646806e184d384134f402" -} \ No newline at end of file diff --git a/fixture/components/component/bind/1.0.0/index.js b/fixture/components/component/bind/1.0.0/index.js deleted file mode 100644 index 4eeb2c0..0000000 --- a/fixture/components/component/bind/1.0.0/index.js +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Slice reference. - */ - -var slice = [].slice; - -/** - * Bind `obj` to `fn`. - * - * @param {Object} obj - * @param {Function|String} fn or string - * @return {Function} - * @api public - */ - -module.exports = function(obj, fn){ - if ('string' == typeof fn) fn = obj[fn]; - if ('function' != typeof fn) throw new Error('bind() requires a function'); - var args = slice.call(arguments, 2); - return function(){ - return fn.apply(obj, args.concat(slice.call(arguments))); - } -}; diff --git a/fixture/components/component/calendar/0.2.0/component.json b/fixture/components/component/calendar/0.2.0/component.json deleted file mode 100644 index 861e55d..0000000 --- a/fixture/components/component/calendar/0.2.0/component.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "name": "calendar", - "description": "Calendar component", - "version": "0.2.0", - "keywords": [ - "calendar", - "date", - "ui" - ], - "dependencies": { - "code42day/bounds": "*", - "component/bind": "*", - "component/domify": "*", - "component/classes": "*", - "component/event": "*", - "component/map": "*", - "component/range": "1.0.0", - "component/emitter": "1.0.0", - "component/in-groups-of": "1.0.0", - "component/type": "*", - "yields/empty": "*", - "stephenmathieson/normalize": "*" - }, - "development": { - "dependencies": { - "component/aurora-calendar": "*" - } - }, - "styles": [ - "lib/calendar.css" - ], - "scripts": [ - "index.js", - "lib/utils.js", - "lib/calendar.js", - "lib/dayrange.js", - "lib/days.js" - ], - "templates": [ - "lib/template.html" - ], - "demo": "http://component.github.io/calendar/", - "license": "MIT", - "repository": "component/calendar", - "resolved": "88c0ca134161ca3819cb8318a4f63e12ffdffaec" -} \ No newline at end of file diff --git a/fixture/components/component/calendar/0.2.0/index.js b/fixture/components/component/calendar/0.2.0/index.js deleted file mode 100644 index ee1abc8..0000000 --- a/fixture/components/component/calendar/0.2.0/index.js +++ /dev/null @@ -1,2 +0,0 @@ - -module.exports = require('./lib/calendar'); \ No newline at end of file diff --git a/fixture/components/component/calendar/0.2.0/lib/calendar.css b/fixture/components/component/calendar/0.2.0/lib/calendar.css deleted file mode 100644 index 643ff41..0000000 --- a/fixture/components/component/calendar/0.2.0/lib/calendar.css +++ /dev/null @@ -1,23 +0,0 @@ - -.calendar-table { - border: 1px solid #eee; - padding: 5px; - margin: 5px; -} - -.calendar-table .prev-day, -.calendar-table .next-day { - color: #999; -} - -.calendar-table td { - text-align: center; -} - -.calendar-table td { - user-select: none; -} - -.calendar-table td a { - cursor: pointer; -} diff --git a/fixture/components/component/calendar/0.2.0/lib/calendar.js b/fixture/components/component/calendar/0.2.0/lib/calendar.js deleted file mode 100644 index 0376288..0000000 --- a/fixture/components/component/calendar/0.2.0/lib/calendar.js +++ /dev/null @@ -1,240 +0,0 @@ - -/** - * Module dependencies. - */ - -var bind = require('bind') - , domify = require('domify') - , Emitter = require('emitter') - , classes = require('classes') - , Days = require('./days'); - -/** - * Expose `Calendar`. - */ - -module.exports = Calendar; - -/** - * Initialize a new `Calendar` - * with the given `date` defaulting - * to now. - * - * Events: - * - * - `prev` when the prev link is clicked - * - `next` when the next link is clicked - * - `change` (date) when the selected date is modified - * - * @params {Date} date - * @api public - */ - -function Calendar(date) { - if (!(this instanceof Calendar)) { - return new Calendar(date); - } - - Emitter.call(this); - var self = this; - this.el = domify('
'); - this.days = new Days; - this.el.appendChild(this.days.el); - this.on('change', bind(this, this.show)); - this.days.on('prev', bind(this, this.prev)); - this.days.on('next', bind(this, this.next)); - this.days.on('year', bind(this, this.menuChange, 'year')); - this.days.on('month', bind(this, this.menuChange, 'month')); - this.show(date || new Date); - this.days.on('change', function(date){ - self.emit('change', date); - }); -} - -/** - * Mixin emitter. - */ - -Emitter(Calendar.prototype); - -/** - * Add class `name` to differentiate this - * specific calendar for styling purposes, - * for example `calendar.addClass('date-picker')`. - * - * @param {String} name - * @return {Calendar} - * @api public - */ - -Calendar.prototype.addClass = function(name){ - classes(this.el).add(name); - return this; -}; - -/** - * Select `date`. - * - * @param {Date} date - * @return {Calendar} - * @api public - */ - -Calendar.prototype.select = function(date){ - if (this.days.validRange.valid(date)) { - this.selected = date; - this.days.select(date); - } - this.show(date); - return this; -}; - -/** - * Show `date`. - * - * @param {Date} date - * @return {Calendar} - * @api public - */ - -Calendar.prototype.show = function(date){ - this._date = date; - this.days.show(date); - return this; -}; - -/** - * Set minimum valid date (inclusive) - * - * @param {Date} date - * @api public - */ - -Calendar.prototype.min = function(date) { - this.days.validRange.min(date); - return this; -}; - - -/** - * Set maximum valid date (inclusive) - * - * @param {Date} date - * @api public - */ - -Calendar.prototype.max = function(date) { - this.days.validRange.max(date); - return this; -}; - -/** - * Enable a year dropdown. - * - * @param {Number} from - * @param {Number} to - * @return {Calendar} - * @api public - */ - -Calendar.prototype.showYearSelect = function(from, to){ - from = from || this._date.getFullYear() - 10; - to = to || this._date.getFullYear() + 10; - this.days.yearMenu(from, to); - this.show(this._date); - return this; -}; - -/** - * Enable a month dropdown. - * - * @return {Calendar} - * @api public - */ - -Calendar.prototype.showMonthSelect = function(){ - this.days.monthMenu(); - this.show(this._date); - return this; -}; - -/** - * Return the previous month. - * - * @return {Date} - * @api private - */ - -Calendar.prototype.prevMonth = function(){ - var date = new Date(this._date); - date.setDate(1); - date.setMonth(date.getMonth() - 1); - return date; -}; - -/** - * Return the next month. - * - * @return {Date} - * @api private - */ - -Calendar.prototype.nextMonth = function(){ - var date = new Date(this._date); - date.setDate(1); - date.setMonth(date.getMonth() + 1); - return date; -}; - -/** - * Show the prev view. - * - * @return {Calendar} - * @api public - */ - -Calendar.prototype.prev = function(){ - this.show(this.prevMonth()); - this.emit('view change', this.days.selectedMonth(), 'prev'); - return this; -}; - -/** - * Show the next view. - * - * @return {Calendar} - * @api public - */ - -Calendar.prototype.next = function(){ - this.show(this.nextMonth()); - this.emit('view change', this.days.selectedMonth(), 'next'); - return this; -}; - -/** - * Switch to the year or month selected by dropdown menu. - * - * @return {Calendar} - * @api public - */ - -Calendar.prototype.menuChange = function(action){ - var date = this.days.selectedMonth(); - this.show(date); - this.emit('view change', date, action); - return this; -}; - -/** - * Select locale - * - * @param {months, weekdaysMin} - array of months labels and array of weekdays shortcuts - * @api public - */ - - Calendar.prototype.locale = function(locale) { - this.days.setLocale(locale); - this.days.show(this._date); - return this; - }; diff --git a/fixture/components/component/calendar/0.2.0/lib/dayrange.js b/fixture/components/component/calendar/0.2.0/lib/dayrange.js deleted file mode 100644 index 7bf18ec..0000000 --- a/fixture/components/component/calendar/0.2.0/lib/dayrange.js +++ /dev/null @@ -1,29 +0,0 @@ -var Bounds = require('bounds'); - -var type; - -if (typeof window !== 'undefined') { - type = require('type'); -} else { - type = require('type-component'); -} - -module.exports = DayRange; - -function date(d) { - return type(d) === 'date' ? d : new Date(d[0], d[1], d[2]); -} - -function DayRange(min, max) { - return this.min(min).max(max); -} - -Bounds(DayRange.prototype); - -DayRange.prototype._compare = function(a, b) { - return date(a).getTime() - date(b).getTime(); -} - -DayRange.prototype._distance = function(a, b) { - return Math.abs(this.compare(a, b)); -} diff --git a/fixture/components/component/calendar/0.2.0/lib/days.js b/fixture/components/component/calendar/0.2.0/lib/days.js deleted file mode 100644 index 59aa911..0000000 --- a/fixture/components/component/calendar/0.2.0/lib/days.js +++ /dev/null @@ -1,459 +0,0 @@ - -/** - * Module dependencies. - */ - -var domify = require('domify') - , Emitter = require('emitter') - , classes = require('classes') - , events = require('event') - , map = require('map') - , template = require('./template.html') - , inGroupsOf = require('in-groups-of') - , clamp = require('./utils').clamp - , range = require('range') - , empty = require('empty') - , normalize = require('normalize') - , DayRange = require('./dayrange'); - -/** - * Default locale - en - */ - -var LOCALE = { - months: 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'), - weekdaysMin: 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_') -}; - - -/** - * Get days in `month` for `year`. - * - * @param {Number} month - * @param {Number} year - * @return {Number} - * @api private - */ - -function daysInMonth(month, year) { - return [31, (isLeapYear(year) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month]; -} - -/** - * Check if `year` is a leap year. - * - * @param {Number} year - * @return {Boolean} - * @api private - */ - -function isLeapYear(year) { - return (0 === year % 400) - || ((0 === year % 4) && (0 !== year % 100)) - || (0 === year); -} - - -/** - * Expose `Days`. - */ - -module.exports = Days; - -/** - * Initialize a new `Days` view. - * - * Emits: - * - * - `prev` when prev link is clicked - * - `next` when next link is clicked - * - `change` (date) when a date is selected - * - * @api public - */ - -function Days() { - Emitter.call(this); - var self = this; - this.el = domify(template); - classes(this.el).add('calendar-days'); - this.head = this.el.tHead; - this.body = this.el.tBodies[0]; - this.title = this.head.querySelector('.title'); - this.select(new Date); - this.validRange = new DayRange; - this.locale = LOCALE; - - // emit "day" - events.bind(this.body, 'click', normalize(function(e){ - if (e.target.tagName !== 'A') { - return true; - } - - e.preventDefault(); - - var el = e.target; - var data = el.getAttribute('data-date').split('-'); - if (!self.validRange.valid(data)) { - return false; - } - var year = data[0]; - var month = data[1]; - var day = data[2]; - var date = new Date(year, month, day); - self.select(date); - self.emit('change', date); - return false; - })); - - // emit "prev" - events.bind(this.el.querySelector('.prev'), 'click', normalize(function(ev){ - ev.preventDefault(); - - self.emit('prev'); - return false; - })); - - // emit "next" - events.bind(this.el.querySelector('.next'), 'click', normalize(function(ev){ - ev.preventDefault(); - - self.emit('next'); - return false; - })); -} - -/** - * Mixin emitter. - */ - -Emitter(Days.prototype); - -/** - * Select the given `date`. - * - * @param {Date} date - * @return {Days} - * @api public - */ - -Days.prototype.select = function(date){ - this.selected = date; - return this; -}; - - -/** - * Select locale - * - * @param {months, weekdaysMin} - array of months labels and array of weekdays shortcuts - * @api public - */ - - Days.prototype.setLocale = function(locale) { - this.locale = locale; - return this; - }; - -/** - * Show date selection. - * - * @param {Date} date - * @api public - */ - -Days.prototype.show = function(date){ - var year = date.getFullYear(); - var month = date.getMonth(); - this.showSelectedYear(year); - this.showSelectedMonth(month); - var subhead = this.head.querySelector('.subheading'); - if (subhead) { - subhead.parentElement.removeChild(subhead); - } - - this.head.appendChild(this.renderHeading(this.locale.weekdaysMin)); - empty(this.body); - this.body.appendChild(this.renderDays(date)); -}; - -/** - * Enable a year dropdown. - * - * @param {Number} from - * @param {Number} to - * @api public - */ - -Days.prototype.yearMenu = function(from, to){ - this.selectYear = true; - this.title.querySelector('.year').innerHTML = yearDropdown(from, to); - var self = this; - events.bind(this.title.querySelector('.year .calendar-select'), 'change', function(){ - self.emit('year'); - return false; - }); -}; - -/** - * Enable a month dropdown. - * - * @api public - */ - -Days.prototype.monthMenu = function(){ - this.selectMonth = true; - this.title.querySelector('.month').innerHTML = monthDropdown(this.locale.months); - var self = this; - events.bind(this.title.querySelector('.month .calendar-select'), 'change', function(){ - self.emit('month'); - return false; - }); -}; - -/** - * Return current year of view from title. - * - * @api private - */ - -Days.prototype.titleYear = function(){ - if (this.selectYear) { - return this.title.querySelector('.year .calendar-select').value; - } else { - return this.title.querySelector('.year').innerHTML; - } -}; - -/** - * Return current month of view from title. - * - * @api private - */ - -Days.prototype.titleMonth = function(){ - if (this.selectMonth) { - return this.title.querySelector('.month .calendar-select').value; - } else { - return this.title.querySelector('.month').innerHTML; - } -}; - -/** - * Return a date based on the field-selected month. - * - * @api public - */ - -Days.prototype.selectedMonth = function(){ - return new Date(this.titleYear(), this.titleMonth(), 1); -}; - -/** - * Render days of the week heading with - * the given `length`, for example 2 for "Tu", - * 3 for "Tue" etc. - * - * @param {String} len - * @return {Element} - * @api private - */ - -Days.prototype.renderHeading = function(days){ - var rows = '' + map(days, function(day){ - return '' + day + ''; - }).join('') + ''; - return domify(rows); -}; - -/** - * Render days for `date`. - * - * @param {Date} date - * @return {Element} - * @api private - */ - -Days.prototype.renderDays = function(date){ - var rows = this.rowsFor(date); - var html = map(rows, function(row){ - return '' + row.join('') + ''; - }).join('\n'); - return domify(html); -}; - -/** - * Return rows array for `date`. - * - * This method calculates the "overflow" - * from the previous month and into - * the next in order to display an - * even 5 rows. - * - * @param {Date} date - * @return {Array} - * @api private - */ - -Days.prototype.rowsFor = function(date){ - var selected = this.selected; - var selectedDay = selected.getDate(); - var selectedMonth = selected.getMonth(); - var selectedYear = selected.getFullYear(); - var month = date.getMonth(); - var year = date.getFullYear(); - - // calculate overflow - var start = new Date(date); - start.setDate(1); - var before = start.getDay(); - var total = daysInMonth(month, year); - var perRow = 7; - var totalShown = perRow * Math.ceil((total + before) / perRow); - var after = totalShown - (total + before); - var cells = []; - - // cells before - cells = cells.concat(cellsBefore(before, month, year, this.validRange)); - - // current cells - for (var i = 0; i < total; ++i) { - var day = i + 1 - , select = (day == selectedDay && month == selectedMonth && year == selectedYear); - cells.push(renderDay([year, month, day], this.validRange, select)); - } - - // after cells - cells = cells.concat(cellsAfter(after, month, year, this.validRange)); - - return inGroupsOf(cells, 7); -}; - -/** - * Update view title or select input for `year`. - * - * @param {Number} year - * @api private - */ - -Days.prototype.showSelectedYear = function(year){ - if (this.selectYear) { - this.title.querySelector('.year .calendar-select').value = year; - } else { - this.title.querySelector('.year').innerHTML = year; - } -}; - -/** - * Update view title or select input for `month`. - * - * @param {Number} month - * @api private - */ - -Days.prototype.showSelectedMonth = function(month) { - if (this.selectMonth) { - this.title.querySelector('.month .calendar-select').value = month; - } else { - this.title.querySelector('.month').innerHTML = this.locale.months[month]; - } -}; - -/** - * Return `n` days before `month`. - * - * @param {Number} n - * @param {Number} month - * @return {Array} - * @api private - */ - -function cellsBefore(n, month, year, validRange){ - var cells = []; - if (month === 0) --year; - var prev = clamp(month - 1); - var before = daysInMonth(prev, year); - while (n--) cells.push(renderDay([year, prev, before--], validRange, false, 'prev-day')); - return cells.reverse(); -} - -/** - * Return `n` days after `month`. - * - * @param {Number} n - * @param {Number} month - * @return {Array} - * @api private - */ - -function cellsAfter(n, month, year, validRange){ - var cells = []; - var day = 0; - if (month == 11) ++year; - var next = clamp(month + 1); - while (n--) cells.push(renderDay([year, next, ++day], validRange, false, 'next-day')); - return cells; -} - - -/** - * Day template. - */ - -function renderDay(ymd, validRange, selected, style) { - var date = 'data-date=' + ymd.join('-') - , styles = [] - , tdClass = '' - , aClass = ''; - - if (selected) { - tdClass = ' class="selected"'; - } - if (style) { - styles.push(style); - } - if (!validRange.valid(ymd)) { - styles.push('invalid'); - } - if (styles.length) { - aClass = ' class="' + styles.join(' ') + '"'; - } - - - return '' + ymd[2] + ''; -} - -/** - * Year dropdown template. - */ - -function yearDropdown(from, to) { - var years = range(from, to, 'inclusive'); - var options = map(years, yearOption).join(''); - return ''; -} - -/** - * Month dropdown template. - */ - -function monthDropdown(months) { - var options = map(months, monthOption).join(''); - return ''; -} - -/** - * Year dropdown option template. - */ - -function yearOption(year) { - return ''; -} - -/** - * Month dropdown option template. - */ - -function monthOption(month, i) { - return ''; -} diff --git a/fixture/components/component/calendar/0.2.0/lib/template.html b/fixture/components/component/calendar/0.2.0/lib/template.html deleted file mode 100644 index 01c7970..0000000 --- a/fixture/components/component/calendar/0.2.0/lib/template.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - -
\ No newline at end of file diff --git a/fixture/components/component/calendar/0.2.0/lib/utils.js b/fixture/components/component/calendar/0.2.0/lib/utils.js deleted file mode 100644 index d777f63..0000000 --- a/fixture/components/component/calendar/0.2.0/lib/utils.js +++ /dev/null @@ -1,14 +0,0 @@ - -/** - * Clamp `month`. - * - * @param {Number} month - * @return {Number} - * @api public - */ - -exports.clamp = function(month){ - if (month > 11) return 0; - if (month < 0) return 11; - return month; -}; diff --git a/fixture/components/component/classes/1.2.1/component.json b/fixture/components/component/classes/1.2.1/component.json deleted file mode 100644 index e585952..0000000 --- a/fixture/components/component/classes/1.2.1/component.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "classes", - "version": "1.2.1", - "description": "Cross-browser element class list", - "keywords": [ - "dom", - "html", - "classList", - "class", - "ui" - ], - "scripts": [ - "index.js" - ], - "dependencies": { - "component/indexof": "*" - }, - "repository": "component/classes", - "resolved": "8c6a364b96ba2b1729e91bf76aeb66a8b7a7b5ed" -} \ No newline at end of file diff --git a/fixture/components/component/classes/1.2.1/index.js b/fixture/components/component/classes/1.2.1/index.js deleted file mode 100644 index 335c68d..0000000 --- a/fixture/components/component/classes/1.2.1/index.js +++ /dev/null @@ -1,184 +0,0 @@ -/** - * Module dependencies. - */ - -var index = require('indexof'); - -/** - * Whitespace regexp. - */ - -var re = /\s+/; - -/** - * toString reference. - */ - -var toString = Object.prototype.toString; - -/** - * Wrap `el` in a `ClassList`. - * - * @param {Element} el - * @return {ClassList} - * @api public - */ - -module.exports = function(el){ - return new ClassList(el); -}; - -/** - * Initialize a new ClassList for `el`. - * - * @param {Element} el - * @api private - */ - -function ClassList(el) { - if (!el) throw new Error('A DOM element reference is required'); - this.el = el; - this.list = el.classList; -} - -/** - * Add class `name` if not already present. - * - * @param {String} name - * @return {ClassList} - * @api public - */ - -ClassList.prototype.add = function(name){ - // classList - if (this.list) { - this.list.add(name); - return this; - } - - // fallback - var arr = this.array(); - var i = index(arr, name); - if (!~i) arr.push(name); - this.el.className = arr.join(' '); - return this; -}; - -/** - * Remove class `name` when present, or - * pass a regular expression to remove - * any which match. - * - * @param {String|RegExp} name - * @return {ClassList} - * @api public - */ - -ClassList.prototype.remove = function(name){ - if ('[object RegExp]' == toString.call(name)) { - return this.removeMatching(name); - } - - // classList - if (this.list) { - this.list.remove(name); - return this; - } - - // fallback - var arr = this.array(); - var i = index(arr, name); - if (~i) arr.splice(i, 1); - this.el.className = arr.join(' '); - return this; -}; - -/** - * Remove all classes matching `re`. - * - * @param {RegExp} re - * @return {ClassList} - * @api private - */ - -ClassList.prototype.removeMatching = function(re){ - var arr = this.array(); - for (var i = 0; i < arr.length; i++) { - if (re.test(arr[i])) { - this.remove(arr[i]); - } - } - return this; -}; - -/** - * Toggle class `name`, can force state via `force`. - * - * For browsers that support classList, but do not support `force` yet, - * the mistake will be detected and corrected. - * - * @param {String} name - * @param {Boolean} force - * @return {ClassList} - * @api public - */ - -ClassList.prototype.toggle = function(name, force){ - // classList - if (this.list) { - if ("undefined" !== typeof force) { - if (force !== this.list.toggle(name, force)) { - this.list.toggle(name); // toggle again to correct - } - } else { - this.list.toggle(name); - } - return this; - } - - // fallback - if ("undefined" !== typeof force) { - if (!force) { - this.remove(name); - } else { - this.add(name); - } - } else { - if (this.has(name)) { - this.remove(name); - } else { - this.add(name); - } - } - - return this; -}; - -/** - * Return an array of classes. - * - * @return {Array} - * @api public - */ - -ClassList.prototype.array = function(){ - var str = this.el.className.replace(/^\s+|\s+$/g, ''); - var arr = str.split(re); - if ('' === arr[0]) arr.shift(); - return arr; -}; - -/** - * Check if class `name` is present. - * - * @param {String} name - * @return {ClassList} - * @api public - */ - -ClassList.prototype.has = -ClassList.prototype.contains = function(name){ - return this.list - ? this.list.contains(name) - : !! ~index(this.array(), name); -}; diff --git a/fixture/components/component/classes/1.2.4/component.json b/fixture/components/component/classes/1.2.4/component.json deleted file mode 100644 index fd4f3a6..0000000 --- a/fixture/components/component/classes/1.2.4/component.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name": "classes", - "version": "1.2.4", - "description": "Cross-browser element class list", - "keywords": [ - "dom", - "html", - "classList", - "class", - "ui" - ], - "scripts": [ - "index.js" - ], - "dependencies": { - "component/indexof": "*" - }, - "development": { - "dependencies": { - "component/assert": "*" - } - }, - "repository": "component/classes", - "resolved": "7e8440cdfed498c410b43d4318be63e9a9d32cf1" -} \ No newline at end of file diff --git a/fixture/components/component/classes/1.2.4/index.js b/fixture/components/component/classes/1.2.4/index.js deleted file mode 100644 index d60b1db..0000000 --- a/fixture/components/component/classes/1.2.4/index.js +++ /dev/null @@ -1,187 +0,0 @@ -/** - * Module dependencies. - */ - -var index = require('indexof'); - -/** - * Whitespace regexp. - */ - -var re = /\s+/; - -/** - * toString reference. - */ - -var toString = Object.prototype.toString; - -/** - * Wrap `el` in a `ClassList`. - * - * @param {Element} el - * @return {ClassList} - * @api public - */ - -module.exports = function(el){ - return new ClassList(el); -}; - -/** - * Initialize a new ClassList for `el`. - * - * @param {Element} el - * @api private - */ - -function ClassList(el) { - if (!el || !el.nodeType) { - throw new Error('A DOM element reference is required'); - } - this.el = el; - this.list = el.classList; -} - -/** - * Add class `name` if not already present. - * - * @param {String} name - * @return {ClassList} - * @api public - */ - -ClassList.prototype.add = function(name){ - // classList - if (this.list) { - this.list.add(name); - return this; - } - - // fallback - var arr = this.array(); - var i = index(arr, name); - if (!~i) arr.push(name); - this.el.className = arr.join(' '); - return this; -}; - -/** - * Remove class `name` when present, or - * pass a regular expression to remove - * any which match. - * - * @param {String|RegExp} name - * @return {ClassList} - * @api public - */ - -ClassList.prototype.remove = function(name){ - if ('[object RegExp]' == toString.call(name)) { - return this.removeMatching(name); - } - - // classList - if (this.list) { - this.list.remove(name); - return this; - } - - // fallback - var arr = this.array(); - var i = index(arr, name); - if (~i) arr.splice(i, 1); - this.el.className = arr.join(' '); - return this; -}; - -/** - * Remove all classes matching `re`. - * - * @param {RegExp} re - * @return {ClassList} - * @api private - */ - -ClassList.prototype.removeMatching = function(re){ - var arr = this.array(); - for (var i = 0; i < arr.length; i++) { - if (re.test(arr[i])) { - this.remove(arr[i]); - } - } - return this; -}; - -/** - * Toggle class `name`, can force state via `force`. - * - * For browsers that support classList, but do not support `force` yet, - * the mistake will be detected and corrected. - * - * @param {String} name - * @param {Boolean} force - * @return {ClassList} - * @api public - */ - -ClassList.prototype.toggle = function(name, force){ - // classList - if (this.list) { - if ("undefined" !== typeof force) { - if (force !== this.list.toggle(name, force)) { - this.list.toggle(name); // toggle again to correct - } - } else { - this.list.toggle(name); - } - return this; - } - - // fallback - if ("undefined" !== typeof force) { - if (!force) { - this.remove(name); - } else { - this.add(name); - } - } else { - if (this.has(name)) { - this.remove(name); - } else { - this.add(name); - } - } - - return this; -}; - -/** - * Return an array of classes. - * - * @return {Array} - * @api public - */ - -ClassList.prototype.array = function(){ - var className = this.el.getAttribute('class') || ''; - var str = className.replace(/^\s+|\s+$/g, ''); - var arr = str.split(re); - if ('' === arr[0]) arr.shift(); - return arr; -}; - -/** - * Check if class `name` is present. - * - * @param {String} name - * @return {ClassList} - * @api public - */ - -ClassList.prototype.has = -ClassList.prototype.contains = function(name){ - return this.list - ? this.list.contains(name) - : !! ~index(this.array(), name); -}; diff --git a/fixture/components/component/clone/0.2.2/component.json b/fixture/components/component/clone/0.2.2/component.json deleted file mode 100644 index a7757cd..0000000 --- a/fixture/components/component/clone/0.2.2/component.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "clone", - "version": "0.2.2", - "dependencies": { - "component/type": "*" - }, - "devDependencies": { - "visionmedia/mocha": "*", - "guille/expect.js": "*" - }, - "scripts": [ - "index.js" - ], - "repository": "component/clone", - "resolved": "a0158687a5a141275949ca8149494bdb06383cbf" -} \ No newline at end of file diff --git a/fixture/components/component/clone/0.2.2/index.js b/fixture/components/component/clone/0.2.2/index.js deleted file mode 100644 index a74bc22..0000000 --- a/fixture/components/component/clone/0.2.2/index.js +++ /dev/null @@ -1,57 +0,0 @@ -/** - * Module dependencies. - */ - -var type; -try { - type = require('component-type'); -} catch (_) { - type = require('type'); -} - -/** - * Module exports. - */ - -module.exports = clone; - -/** - * Clones objects. - * - * @param {Mixed} any object - * @api public - */ - -function clone(obj){ - switch (type(obj)) { - case 'object': - var copy = {}; - for (var key in obj) { - if (obj.hasOwnProperty(key)) { - copy[key] = clone(obj[key]); - } - } - return copy; - - case 'array': - var copy = new Array(obj.length); - for (var i = 0, l = obj.length; i < l; i++) { - copy[i] = clone(obj[i]); - } - return copy; - - case 'regexp': - // from millermedeiros/amd-utils - MIT - var flags = ''; - flags += obj.multiline ? 'm' : ''; - flags += obj.global ? 'g' : ''; - flags += obj.ignoreCase ? 'i' : ''; - return new RegExp(obj.source, flags); - - case 'date': - return new Date(obj.getTime()); - - default: // string, number, boolean, … - return obj; - } -} diff --git a/fixture/components/component/closest/1.0.0/component.json b/fixture/components/component/closest/1.0.0/component.json deleted file mode 100644 index d9d4c23..0000000 --- a/fixture/components/component/closest/1.0.0/component.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "closest", - "description": "Find the closest ancestor matching a selector string", - "version": "1.0.0", - "dependencies": { - "component/matches-selector": "0.1.5" - }, - "main": "index.js", - "scripts": [ - "index.js" - ], - "license": "MIT", - "repository": "component/closest", - "resolved": "ea5e19ca0766b40b86eb4997ca21e5fe2d000475" -} \ No newline at end of file diff --git a/fixture/components/component/closest/1.0.0/index.js b/fixture/components/component/closest/1.0.0/index.js deleted file mode 100644 index bab079d..0000000 --- a/fixture/components/component/closest/1.0.0/index.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Module Dependencies - */ - -var matches = require('matches-selector') - -/** - * Export `closest` - */ - -module.exports = closest - -/** - * Closest - * - * @param {Element} el - * @param {String} selector - * @param {Element} scope (optional) - */ - -function closest (el, selector, scope) { - scope = scope || document.documentElement; - - // walk up the dom - while (el && el !== scope) { - if (matches(el, selector)) return el; - el = el.parentNode; - } - - // check scope for match - return matches(el, selector) ? el : null; -} diff --git a/fixture/components/component/css/0.0.6/component.json b/fixture/components/component/css/0.0.6/component.json deleted file mode 100644 index eeeccc4..0000000 --- a/fixture/components/component/css/0.0.6/component.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "css", - "description": "jquery's css()", - "version": "0.0.6", - "keywords": [], - "dependencies": { - "component/each": "*", - "visionmedia/debug": "*", - "ianstormtaylor/to-camel-case": "0.2.1", - "component/within-document": "0.0.1" - }, - "development": { - "dependencies": { - "component/domify": "*", - "component/assert": "*", - "component/load-styles": "*" - } - }, - "license": "MIT", - "main": "index.js", - "scripts": [ - "index.js", - "lib/css.js", - "lib/prop.js", - "lib/swap.js", - "lib/style.js", - "lib/hooks.js", - "lib/styles.js", - "lib/vendor.js", - "lib/support.js", - "lib/computed.js" - ], - "repository": "component/css", - "resolved": "a4f39ee46b185c6545bc0855be276a192720a7e4" -} \ No newline at end of file diff --git a/fixture/components/component/css/0.0.6/index.js b/fixture/components/component/css/0.0.6/index.js deleted file mode 100644 index f5fb335..0000000 --- a/fixture/components/component/css/0.0.6/index.js +++ /dev/null @@ -1,58 +0,0 @@ -/** - * Module Dependencies - */ - -var debug = require('debug')('css'); -var set = require('./lib/style'); -var get = require('./lib/css'); - -/** - * Expose `css` - */ - -module.exports = css; - -/** - * Get and set css values - * - * @param {Element} el - * @param {String|Object} prop - * @param {Mixed} val - * @return {Element} el - * @api public - */ - -function css(el, prop, val) { - if (!el) return; - - if (undefined !== val) { - var obj = {}; - obj[prop] = val; - debug('setting styles %j', obj); - return setStyles(el, obj); - } - - if ('object' == typeof prop) { - debug('setting styles %j', prop); - return setStyles(el, prop); - } - - debug('getting %s', prop); - return get(el, prop); -} - -/** - * Set the styles on an element - * - * @param {Element} el - * @param {Object} props - * @return {Element} el - */ - -function setStyles(el, props) { - for (var prop in props) { - set(el, prop, props[prop]); - } - - return el; -} diff --git a/fixture/components/component/css/0.0.6/lib/computed.js b/fixture/components/component/css/0.0.6/lib/computed.js deleted file mode 100644 index 921ad62..0000000 --- a/fixture/components/component/css/0.0.6/lib/computed.js +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Module Dependencies - */ - -var debug = require('debug')('css:computed'); -var withinDocument = require('within-document'); -var styles = require('./styles'); - -/** - * Expose `computed` - */ - -module.exports = computed; - -/** - * Get the computed style - * - * @param {Element} el - * @param {String} prop - * @param {Array} precomputed (optional) - * @return {Array} - * @api private - */ - -function computed(el, prop, precomputed) { - var computed = precomputed || styles(el); - var ret; - - if (!computed) return; - - if (computed.getPropertyValue) { - ret = computed.getPropertyValue(prop) || computed[prop]; - } else { - ret = computed[prop]; - } - - if ('' === ret && !withinDocument(el)) { - debug('element not within document, try finding from style attribute'); - var style = require('./style'); - ret = style(el, prop); - } - - debug('computed value of %s: %s', prop, ret); - - // Support: IE - // IE returns zIndex value as an integer. - return undefined === ret ? ret : ret + ''; -} diff --git a/fixture/components/component/css/0.0.6/lib/css.js b/fixture/components/component/css/0.0.6/lib/css.js deleted file mode 100644 index 7137d8f..0000000 --- a/fixture/components/component/css/0.0.6/lib/css.js +++ /dev/null @@ -1,80 +0,0 @@ -/** - * Module Dependencies - */ - -var debug = require('debug')('css:css'); -var camelcase = require('to-camel-case'); -var computed = require('./computed'); -var property = require('./prop'); - -/** - * Expose `css` - */ - -module.exports = css; - -/** - * CSS Normal Transforms - */ - -var cssNormalTransform = { - letterSpacing: 0, - fontWeight: 400 -}; - -/** - * Get a CSS value - * - * @param {Element} el - * @param {String} prop - * @param {Mixed} extra - * @param {Array} styles - * @return {String} - */ - -function css(el, prop, extra, styles) { - var hooks = require('./hooks'); - var orig = camelcase(prop); - var style = el.style; - var val; - - prop = property(prop, style); - var hook = hooks[prop] || hooks[orig]; - - // If a hook was provided get the computed value from there - if (hook && hook.get) { - debug('get hook provided. use that'); - val = hook.get(el, true, extra); - } - - // Otherwise, if a way to get the computed value exists, use that - if (undefined == val) { - debug('fetch the computed value of %s', prop); - val = computed(el, prop); - } - - if ('normal' == val && cssNormalTransform[prop]) { - val = cssNormalTransform[prop]; - debug('normal => %s', val); - } - - // Return, converting to number if forced or a qualifier was provided and val looks numeric - if ('' == extra || extra) { - debug('converting value: %s into a number', val); - var num = parseFloat(val); - return true === extra || isNumeric(num) ? num || 0 : val; - } - - return val; -} - -/** - * Is Numeric - * - * @param {Mixed} obj - * @return {Boolean} - */ - -function isNumeric(obj) { - return !isNan(parseFloat(obj)) && isFinite(obj); -} diff --git a/fixture/components/component/css/0.0.6/lib/hooks.js b/fixture/components/component/css/0.0.6/lib/hooks.js deleted file mode 100644 index 7468ab2..0000000 --- a/fixture/components/component/css/0.0.6/lib/hooks.js +++ /dev/null @@ -1,162 +0,0 @@ -/** - * Module Dependencies - */ - -var each = require('each'); -var css = require('./css'); -var cssShow = { position: 'absolute', visibility: 'hidden', display: 'block' }; -var pnum = (/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/).source; -var rnumnonpx = new RegExp( '^(' + pnum + ')(?!px)[a-z%]+$', 'i'); -var rnumsplit = new RegExp( '^(' + pnum + ')(.*)$', 'i'); -var rdisplayswap = /^(none|table(?!-c[ea]).+)/; -var styles = require('./styles'); -var support = require('./support'); -var swap = require('./swap'); -var computed = require('./computed'); -var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; - -/** - * Height & Width - */ - -each(['width', 'height'], function(name) { - exports[name] = {}; - - exports[name].get = function(el, compute, extra) { - if (!compute) return; - // certain elements can have dimension info if we invisibly show them - // however, it must have a current display style that would benefit from this - return 0 == el.offsetWidth && rdisplayswap.test(css(el, 'display')) - ? swap(el, cssShow, function() { return getWidthOrHeight(el, name, extra); }) - : getWidthOrHeight(el, name, extra); - } - - exports[name].set = function(el, val, extra) { - var styles = extra && styles(el); - return setPositiveNumber(el, val, extra - ? augmentWidthOrHeight(el, name, extra, 'border-box' == css(el, 'boxSizing', false, styles), styles) - : 0 - ); - }; - -}); - -/** - * Opacity - */ - -exports.opacity = {}; -exports.opacity.get = function(el, compute) { - if (!compute) return; - var ret = computed(el, 'opacity'); - return '' == ret ? '1' : ret; -} - -/** - * Utility: Set Positive Number - * - * @param {Element} el - * @param {Mixed} val - * @param {Number} subtract - * @return {Number} - */ - -function setPositiveNumber(el, val, subtract) { - var matches = rnumsplit.exec(val); - return matches ? - // Guard against undefined 'subtract', e.g., when used as in cssHooks - Math.max(0, matches[1]) + (matches[2] || 'px') : - val; -} - -/** - * Utility: Get the width or height - * - * @param {Element} el - * @param {String} prop - * @param {Mixed} extra - * @return {String} - */ - -function getWidthOrHeight(el, prop, extra) { - // Start with offset property, which is equivalent to the border-box value - var valueIsBorderBox = true; - var val = prop === 'width' ? el.offsetWidth : el.offsetHeight; - var styles = computed(el); - var isBorderBox = support.boxSizing && css(el, 'boxSizing') === 'border-box'; - - // some non-html elements return undefined for offsetWidth, so check for null/undefined - // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 - // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668 - if (val <= 0 || val == null) { - // Fall back to computed then uncomputed css if necessary - val = computed(el, prop, styles); - - if (val < 0 || val == null) { - val = el.style[prop]; - } - - // Computed unit is not pixels. Stop here and return. - if (rnumnonpx.test(val)) { - return val; - } - - // we need the check for style in case a browser which returns unreliable values - // for getComputedStyle silently falls back to the reliable el.style - valueIsBorderBox = isBorderBox && (support.boxSizingReliable() || val === el.style[prop]); - - // Normalize ', auto, and prepare for extra - val = parseFloat(val) || 0; - } - - // use the active box-sizing model to add/subtract irrelevant styles - extra = extra || (isBorderBox ? 'border' : 'content'); - val += augmentWidthOrHeight(el, prop, extra, valueIsBorderBox, styles); - return val + 'px'; -} - -/** - * Utility: Augment the width or the height - * - * @param {Element} el - * @param {String} prop - * @param {Mixed} extra - * @param {Boolean} isBorderBox - * @param {Array} styles - */ - -function augmentWidthOrHeight(el, prop, extra, isBorderBox, styles) { - // If we already have the right measurement, avoid augmentation, - // Otherwise initialize for horizontal or vertical properties - var i = extra === (isBorderBox ? 'border' : 'content') ? 4 : 'width' == prop ? 1 : 0; - var val = 0; - - for (; i < 4; i += 2) { - // both box models exclude margin, so add it if we want it - if (extra === 'margin') { - val += css(el, extra + cssExpand[i], true, styles); - } - - if (isBorderBox) { - // border-box includes padding, so remove it if we want content - if (extra === 'content') { - val -= css(el, 'padding' + cssExpand[i], true, styles); - } - - // at this point, extra isn't border nor margin, so remove border - if (extra !== 'margin') { - val -= css(el, 'border' + cssExpand[i] + 'Width', true, styles); - } - } else { - // at this point, extra isn't content, so add padding - val += css(el, 'padding' + cssExpand[i], true, styles); - - // at this point, extra isn't content nor padding, so add border - if (extra !== 'padding') { - val += css(el, 'border' + cssExpand[i] + 'Width', true, styles); - } - } - } - - return val; -} diff --git a/fixture/components/component/css/0.0.6/lib/prop.js b/fixture/components/component/css/0.0.6/lib/prop.js deleted file mode 100644 index 6abd9a0..0000000 --- a/fixture/components/component/css/0.0.6/lib/prop.js +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Module dependencies - */ - -var debug = require('debug')('css:prop'); -var camelcase = require('to-camel-case'); -var vendor = require('./vendor'); - -/** - * Export `prop` - */ - -module.exports = prop; - -/** - * Normalize Properties - */ - -var cssProps = { - 'float': 'cssFloat' in document.documentElement.style ? 'cssFloat' : 'styleFloat' -}; - -/** - * Get the vendor prefixed property - * - * @param {String} prop - * @param {String} style - * @return {String} prop - * @api private - */ - -function prop(prop, style) { - prop = cssProps[prop] || (cssProps[prop] = vendor(prop, style)); - debug('transform property: %s => %s', prop, style); - return prop; -} diff --git a/fixture/components/component/css/0.0.6/lib/style.js b/fixture/components/component/css/0.0.6/lib/style.js deleted file mode 100644 index 8e87c5e..0000000 --- a/fixture/components/component/css/0.0.6/lib/style.js +++ /dev/null @@ -1,106 +0,0 @@ -/** - * Module Dependencies - */ - -var debug = require('debug')('css:style'); -var camelcase = require('to-camel-case'); -var support = require('./support'); -var property = require('./prop'); -var hooks = require('./hooks'); - -/** - * Expose `style` - */ - -module.exports = style; - -/** - * Possibly-unitless properties - * - * Don't automatically add 'px' to these properties - */ - -var cssNumber = { - "columnCount": true, - "fillOpacity": true, - "fontWeight": true, - "lineHeight": true, - "opacity": true, - "order": true, - "orphans": true, - "widows": true, - "zIndex": true, - "zoom": true -}; - -/** - * Set a css value - * - * @param {Element} el - * @param {String} prop - * @param {Mixed} val - * @param {Mixed} extra - */ - -function style(el, prop, val, extra) { - // Don't set styles on text and comment nodes - if (!el || el.nodeType === 3 || el.nodeType === 8 || !el.style ) return; - - var orig = camelcase(prop); - var style = el.style; - var type = typeof val; - - if (!val) return get(el, prop, orig, extra); - - prop = property(prop, style); - - var hook = hooks[prop] || hooks[orig]; - - // If a number was passed in, add 'px' to the (except for certain CSS properties) - if ('number' == type && !cssNumber[orig]) { - debug('adding "px" to end of number'); - val += 'px'; - } - - // Fixes jQuery #8908, it can be done more correctly by specifying setters in cssHooks, - // but it would mean to define eight (for every problematic property) identical functions - if (!support.clearCloneStyle && '' === val && 0 === prop.indexOf('background')) { - debug('set property (%s) value to "inherit"', prop); - style[prop] = 'inherit'; - } - - // If a hook was provided, use that value, otherwise just set the specified value - if (!hook || !hook.set || undefined !== (val = hook.set(el, val, extra))) { - // Support: Chrome, Safari - // Setting style to blank string required to delete "style: x !important;" - debug('set hook defined. setting property (%s) to %s', prop, val); - style[prop] = ''; - style[prop] = val; - } - -} - -/** - * Get the style - * - * @param {Element} el - * @param {String} prop - * @param {String} orig - * @param {Mixed} extra - * @return {String} - */ - -function get(el, prop, orig, extra) { - var style = el.style; - var hook = hooks[prop] || hooks[orig]; - var ret; - - if (hook && hook.get && undefined !== (ret = hook.get(el, false, extra))) { - debug('get hook defined, returning: %s', ret); - return ret; - } - - ret = style[prop]; - debug('getting %s', ret); - return ret; -} diff --git a/fixture/components/component/css/0.0.6/lib/styles.js b/fixture/components/component/css/0.0.6/lib/styles.js deleted file mode 100644 index 5a93b01..0000000 --- a/fixture/components/component/css/0.0.6/lib/styles.js +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Expose `styles` - */ - -module.exports = styles; - -/** - * Get all the styles - * - * @param {Element} el - * @return {Array} - */ - -function styles(el) { - if (window.getComputedStyle) { - return el.ownerDocument.defaultView.getComputedStyle(el, null); - } else { - return el.currentStyle; - } -} diff --git a/fixture/components/component/css/0.0.6/lib/support.js b/fixture/components/component/css/0.0.6/lib/support.js deleted file mode 100644 index e6c8620..0000000 --- a/fixture/components/component/css/0.0.6/lib/support.js +++ /dev/null @@ -1,101 +0,0 @@ -/** - * Support values - */ - -var reliableMarginRight; -var boxSizingReliableVal; -var pixelPositionVal; -var clearCloneStyle; - -/** - * Container setup - */ - -var docElem = document.documentElement; -var container = document.createElement('div'); -var div = document.createElement('div'); - -/** - * Clear clone style - */ - -div.style.backgroundClip = 'content-box'; -div.cloneNode(true).style.backgroundClip = ''; -exports.clearCloneStyle = div.style.backgroundClip === 'content-box'; - -container.style.cssText = 'border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px'; -container.appendChild(div); - -/** - * Pixel position - * - * Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 - * getComputedStyle returns percent when specified for top/left/bottom/right - * rather than make the css module depend on the offset module, we just check for it here - */ - -exports.pixelPosition = function() { - if (undefined == pixelPositionVal) computePixelPositionAndBoxSizingReliable(); - return pixelPositionVal; -} - -/** - * Reliable box sizing - */ - -exports.boxSizingReliable = function() { - if (undefined == boxSizingReliableVal) computePixelPositionAndBoxSizingReliable(); - return boxSizingReliableVal; -} - -/** - * Reliable margin right - * - * Support: Android 2.3 - * Check if div with explicit width and no margin-right incorrectly - * gets computed margin-right based on width of container. (#3333) - * WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right - * This support function is only executed once so no memoizing is needed. - * - * @return {Boolean} - */ - -exports.reliableMarginRight = function() { - var ret; - var marginDiv = div.appendChild(document.createElement("div" )); - - marginDiv.style.cssText = div.style.cssText = divReset; - marginDiv.style.marginRight = marginDiv.style.width = "0"; - div.style.width = "1px"; - docElem.appendChild(container); - - ret = !parseFloat(window.getComputedStyle(marginDiv, null).marginRight); - - docElem.removeChild(container); - - // Clean up the div for other support tests. - div.innerHTML = ""; - - return ret; -} - -/** - * Executing both pixelPosition & boxSizingReliable tests require only one layout - * so they're executed at the same time to save the second computation. - */ - -function computePixelPositionAndBoxSizingReliable() { - // Support: Firefox, Android 2.3 (Prefixed box-sizing versions). - div.style.cssText = "-webkit-box-sizing:border-box;-moz-box-sizing:border-box;" + - "box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;" + - "position:absolute;top:1%"; - docElem.appendChild(container); - - var divStyle = window.getComputedStyle(div, null); - pixelPositionVal = divStyle.top !== "1%"; - boxSizingReliableVal = divStyle.width === "4px"; - - docElem.removeChild(container); -} - - diff --git a/fixture/components/component/css/0.0.6/lib/swap.js b/fixture/components/component/css/0.0.6/lib/swap.js deleted file mode 100644 index b9b9942..0000000 --- a/fixture/components/component/css/0.0.6/lib/swap.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Export `swap` - */ - -module.exports = swap; - -/** - * Initialize `swap` - * - * @param {Element} el - * @param {Object} options - * @param {Function} fn - * @param {Array} args - * @return {Mixed} - */ - -function swap(el, options, fn, args) { - // Remember the old values, and insert the new ones - for (var key in options) { - old[key] = el.style[key]; - el.style[key] = options[key]; - } - - ret = fn.apply(el, args || []); - - // Revert the old values - for (key in options) { - el.style[key] = old[key]; - } - - return ret; -} diff --git a/fixture/components/component/css/0.0.6/lib/vendor.js b/fixture/components/component/css/0.0.6/lib/vendor.js deleted file mode 100644 index 7612576..0000000 --- a/fixture/components/component/css/0.0.6/lib/vendor.js +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Module Dependencies - */ - -var prefixes = ['Webkit', 'O', 'Moz', 'ms']; - -/** - * Expose `vendor` - */ - -module.exports = vendor; - -/** - * Get the vendor prefix for a given property - * - * @param {String} prop - * @param {Object} style - * @return {String} - */ - -function vendor(prop, style) { - // shortcut for names that are not vendor prefixed - if (style[prop]) return prop; - - // check for vendor prefixed names - var capName = prop[0].toUpperCase() + prop.slice(1); - var original = prop; - var i = prefixes.length; - - while (i--) { - prop = prefixes[i] + capName; - if (prop in style) return prop; - } - - return original; -} diff --git a/fixture/components/component/datepicker/1.0.1/component.json b/fixture/components/component/datepicker/1.0.1/component.json deleted file mode 100644 index fae85fa..0000000 --- a/fixture/components/component/datepicker/1.0.1/component.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "name": "datepicker", - "description": "Datepicker ui component built on component/calendar", - "version": "1.0.1", - "keywords": [ - "date", - "picker", - "calendar" - ], - "dependencies": { - "component/bind": "*", - "component/calendar": "*", - "component/popover": "*", - "component/aurora": "*", - "component/event": "*" - }, - "development": {}, - "license": "MIT", - "scripts": [ - "index.js" - ], - "styles": [ - "datepicker.css" - ], - "repository": "component/datepicker", - "resolved": "f6e4836163a436ef5755bbafee0f12d9e281c414" -} \ No newline at end of file diff --git a/fixture/components/component/datepicker/1.0.1/datepicker.css b/fixture/components/component/datepicker/1.0.1/datepicker.css deleted file mode 100644 index 9eb1690..0000000 --- a/fixture/components/component/datepicker/1.0.1/datepicker.css +++ /dev/null @@ -1,12 +0,0 @@ - -.datepicker-calendar { - font: 10px "Helvetica Neue", Helvetica, Arial, sans-serif; -} - -.datepicker-popover .tip-arrow { - top: auto; -} - -.datepicker-popover .tip-inner { - border: none; -} \ No newline at end of file diff --git a/fixture/components/component/datepicker/1.0.1/index.js b/fixture/components/component/datepicker/1.0.1/index.js deleted file mode 100644 index 223c81c..0000000 --- a/fixture/components/component/datepicker/1.0.1/index.js +++ /dev/null @@ -1,56 +0,0 @@ -/** - * Module dependencies. - */ - -var bind = require('bind') - , Calendar = require('calendar') - , Popover = require('popover') - , event = require('event') - -/** - * Expose `Datepicker`. - */ - -module.exports = Datepicker; - -/** - * Initialize a new date picker with the given input `el`. - * - * @param {Element} el - * @api public - */ - -function Datepicker(el) { - if (!(this instanceof Datepicker)) return new Datepicker(el); - this.el = el; - this.cal = new Calendar; - this.cal.addClass('datepicker-calendar'); - event.bind(el, 'click', bind(this, this.onclick)); -} - -/** - * Handle input clicks. - */ - -Datepicker.prototype.onclick = function(e){ - if (this.popover) return; - this.cal.once('change', bind(this, this.onchange)); - this.popover = new Popover(this.cal.el); - this.popover.classname = 'datepicker-popover popover'; - this.popover.show(this.el); -}; - -/** - * Handle date changes. - */ - -Datepicker.prototype.onchange = function(date){ - this.el.value = date.getFullYear() - + '/' - + (date.getMonth() + 1) - + '/' - + date.getDate(); - - this.popover.remove(); - this.popover = null; -}; diff --git a/fixture/components/component/delegate/0.2.3/component.json b/fixture/components/component/delegate/0.2.3/component.json deleted file mode 100644 index 7a45229..0000000 --- a/fixture/components/component/delegate/0.2.3/component.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "delegate", - "description": "Event delegation component", - "version": "0.2.3", - "keywords": [ - "event", - "events", - "delegate", - "delegation" - ], - "dependencies": { - "component/closest": "*", - "component/event": "*" - }, - "scripts": [ - "index.js" - ], - "repository": "component/delegate", - "resolved": "7fff6b7dddced675248c2e24d6da179d83bc52b2" -} \ No newline at end of file diff --git a/fixture/components/component/delegate/0.2.3/index.js b/fixture/components/component/delegate/0.2.3/index.js deleted file mode 100644 index 0500bf9..0000000 --- a/fixture/components/component/delegate/0.2.3/index.js +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Module dependencies. - */ - -var closest = require('closest') - , event = require('event'); - -/** - * Delegate event `type` to `selector` - * and invoke `fn(e)`. A callback function - * is returned which may be passed to `.unbind()`. - * - * @param {Element} el - * @param {String} selector - * @param {String} type - * @param {Function} fn - * @param {Boolean} capture - * @return {Function} - * @api public - */ - -exports.bind = function(el, selector, type, fn, capture){ - return event.bind(el, type, function(e){ - var target = e.target || e.srcElement; - e.delegateTarget = closest(target, selector, true, el); - if (e.delegateTarget) fn.call(el, e); - }, capture); -}; - -/** - * Unbind event `type`'s callback `fn`. - * - * @param {Element} el - * @param {String} type - * @param {Function} fn - * @param {Boolean} capture - * @api public - */ - -exports.unbind = function(el, type, fn, capture){ - event.unbind(el, type, fn, capture); -}; diff --git a/fixture/components/component/domify/1.3.0/component.json b/fixture/components/component/domify/1.3.0/component.json deleted file mode 100644 index c389465..0000000 --- a/fixture/components/component/domify/1.3.0/component.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "domify", - "version": "1.3.0", - "description": "turn HTML into DOM elements", - "development": { - "dependencies": { - "component/assert": "*" - } - }, - "keywords": [ - "dom", - "html", - "client", - "browser", - "component" - ], - "scripts": [ - "index.js" - ], - "license": "MIT", - "repository": "component/domify", - "resolved": "55b02fd3e3401292a9d15f1ed6d16cd061b8ea80" -} \ No newline at end of file diff --git a/fixture/components/component/domify/1.3.0/index.js b/fixture/components/component/domify/1.3.0/index.js deleted file mode 100644 index 361f3ea..0000000 --- a/fixture/components/component/domify/1.3.0/index.js +++ /dev/null @@ -1,93 +0,0 @@ - -/** - * Expose `parse`. - */ - -module.exports = parse; - -/** - * Wrap map from jquery. - */ - -var map = { - legend: [1, '
', '
'], - tr: [2, '', '
'], - col: [2, '', '
'], - _default: [0, '', ''] -}; - -map.td = -map.th = [3, '', '
']; - -map.option = -map.optgroup = [1, '']; - -map.thead = -map.tbody = -map.colgroup = -map.caption = -map.tfoot = [1, '', '
']; - -map.text = -map.circle = -map.ellipse = -map.line = -map.path = -map.polygon = -map.polyline = -map.rect = [1, '','']; - -/** - * Parse `html` and return a DOM Node instance, which could be a TextNode, - * HTML DOM Node of some kind (
for example), or a DocumentFragment - * instance, depending on the contents of the `html` string. - * - * @param {String} html - HTML string to "domify" - * @param {Document} doc - The `document` instance to create the Node for - * @return {DOMNode} the TextNode, DOM Node, or DocumentFragment instance - * @api private - */ - -function parse(html, doc) { - if ('string' != typeof html) throw new TypeError('String expected'); - - // default to the global `document` object - if (!doc) doc = document; - - // tag name - var m = /<([\w:]+)/.exec(html); - if (!m) return doc.createTextNode(html); - - html = html.replace(/^\s+|\s+$/g, ''); // Remove leading/trailing whitespace - - var tag = m[1]; - - // body support - if (tag == 'body') { - var el = doc.createElement('html'); - el.innerHTML = html; - return el.removeChild(el.lastChild); - } - - // wrap map - var wrap = map[tag] || map._default; - var depth = wrap[0]; - var prefix = wrap[1]; - var suffix = wrap[2]; - var el = doc.createElement('div'); - el.innerHTML = prefix + html + suffix; - while (depth--) el = el.lastChild; - - // one element - if (el.firstChild == el.lastChild) { - return el.removeChild(el.firstChild); - } - - // several elements - var fragment = doc.createDocumentFragment(); - while (el.firstChild) { - fragment.appendChild(el.removeChild(el.firstChild)); - } - - return fragment; -} diff --git a/fixture/components/component/domify/1.4.0/component.json b/fixture/components/component/domify/1.4.0/component.json deleted file mode 100644 index 9b77cf8..0000000 --- a/fixture/components/component/domify/1.4.0/component.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "domify", - "version": "1.4.0", - "description": "turn HTML into DOM elements", - "development": { - "dependencies": { - "component/assert": "*" - } - }, - "keywords": [ - "dom", - "html", - "client", - "browser", - "component" - ], - "scripts": [ - "index.js" - ], - "license": "MIT", - "repository": "component/domify", - "resolved": "ac5066bf08ffec3dad4c64d6852f27f014021059" -} \ No newline at end of file diff --git a/fixture/components/component/domify/1.4.0/index.js b/fixture/components/component/domify/1.4.0/index.js deleted file mode 100644 index 78d3547..0000000 --- a/fixture/components/component/domify/1.4.0/index.js +++ /dev/null @@ -1,112 +0,0 @@ - -/** - * Expose `parse`. - */ - -module.exports = parse; - -/** - * Tests for browser support. - */ - -var innerHTMLBug = false; -var bugTestDiv; -if (typeof document !== 'undefined') { - bugTestDiv = document.createElement('div'); - // Setup - bugTestDiv.innerHTML = '
a'; - // Make sure that link elements get serialized correctly by innerHTML - // This requires a wrapper element in IE - innerHTMLBug = !bugTestDiv.getElementsByTagName('link').length; - bugTestDiv = undefined; -} - -/** - * Wrap map from jquery. - */ - -var map = { - legend: [1, '
', '
'], - tr: [2, '', '
'], - col: [2, '', '
'], - // for script/link/style tags to work in IE6-8, you have to wrap - // in a div with a non-whitespace character in front, ha! - _default: innerHTMLBug ? [1, 'X
', '
'] : [0, '', ''] -}; - -map.td = -map.th = [3, '', '
']; - -map.option = -map.optgroup = [1, '']; - -map.thead = -map.tbody = -map.colgroup = -map.caption = -map.tfoot = [1, '', '
']; - -map.polyline = -map.ellipse = -map.polygon = -map.circle = -map.text = -map.line = -map.path = -map.rect = -map.g = [1, '','']; - -/** - * Parse `html` and return a DOM Node instance, which could be a TextNode, - * HTML DOM Node of some kind (
for example), or a DocumentFragment - * instance, depending on the contents of the `html` string. - * - * @param {String} html - HTML string to "domify" - * @param {Document} doc - The `document` instance to create the Node for - * @return {DOMNode} the TextNode, DOM Node, or DocumentFragment instance - * @api private - */ - -function parse(html, doc) { - if ('string' != typeof html) throw new TypeError('String expected'); - - // default to the global `document` object - if (!doc) doc = document; - - // tag name - var m = /<([\w:]+)/.exec(html); - if (!m) return doc.createTextNode(html); - - html = html.replace(/^\s+|\s+$/g, ''); // Remove leading/trailing whitespace - - var tag = m[1]; - - // body support - if (tag == 'body') { - var el = doc.createElement('html'); - el.innerHTML = html; - return el.removeChild(el.lastChild); - } - - // wrap map - var wrap = map[tag] || map._default; - var depth = wrap[0]; - var prefix = wrap[1]; - var suffix = wrap[2]; - var el = doc.createElement('div'); - el.innerHTML = prefix + html + suffix; - while (depth--) el = el.lastChild; - - // one element - if (el.firstChild == el.lastChild) { - return el.removeChild(el.firstChild); - } - - // several elements - var fragment = doc.createDocumentFragment(); - while (el.firstChild) { - fragment.appendChild(el.removeChild(el.firstChild)); - } - - return fragment; -} diff --git a/fixture/components/component/each/0.2.6/component.json b/fixture/components/component/each/0.2.6/component.json deleted file mode 100644 index 4fc934b..0000000 --- a/fixture/components/component/each/0.2.6/component.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "each", - "description": "Array / object / string iteration utility", - "version": "0.2.6", - "keywords": [ - "object", - "string", - "array", - "each", - "utility" - ], - "dependencies": { - "component/type": "1.0.0", - "component/to-function": "2.0.6" - }, - "development": {}, - "scripts": [ - "index.js" - ], - "repository": "component/each", - "resolved": "3cf32b22bf235eb922019d660b7cabc85d33ff7f" -} \ No newline at end of file diff --git a/fixture/components/component/each/0.2.6/index.js b/fixture/components/component/each/0.2.6/index.js deleted file mode 100644 index d663bf6..0000000 --- a/fixture/components/component/each/0.2.6/index.js +++ /dev/null @@ -1,89 +0,0 @@ - -/** - * Module dependencies. - */ - -try { - var type = require('type'); -} catch (err) { - var type = require('component-type'); -} - -var toFunction = require('to-function'); - -/** - * HOP reference. - */ - -var has = Object.prototype.hasOwnProperty; - -/** - * Iterate the given `obj` and invoke `fn(val, i)` - * in optional context `ctx`. - * - * @param {String|Array|Object} obj - * @param {Function} fn - * @param {Object} [ctx] - * @api public - */ - -module.exports = function(obj, fn, ctx){ - fn = toFunction(fn); - ctx = ctx || this; - switch (type(obj)) { - case 'array': - return array(obj, fn, ctx); - case 'object': - if ('number' == typeof obj.length) return array(obj, fn, ctx); - return object(obj, fn, ctx); - case 'string': - return string(obj, fn, ctx); - } -}; - -/** - * Iterate string chars. - * - * @param {String} obj - * @param {Function} fn - * @param {Object} ctx - * @api private - */ - -function string(obj, fn, ctx) { - for (var i = 0; i < obj.length; ++i) { - fn.call(ctx, obj.charAt(i), i); - } -} - -/** - * Iterate object keys. - * - * @param {Object} obj - * @param {Function} fn - * @param {Object} ctx - * @api private - */ - -function object(obj, fn, ctx) { - for (var key in obj) { - if (has.call(obj, key)) { - fn.call(ctx, key, obj[key]); - } - } -} - -/** - * Iterate array-ish. - * - * @param {Array|Object} obj - * @param {Function} fn - * @param {Object} ctx - * @api private - */ - -function array(obj, fn, ctx) { - for (var i = 0; i < obj.length; ++i) { - fn.call(ctx, obj[i], i); - } -} diff --git a/fixture/components/component/emitter/1.0.0/component.json b/fixture/components/component/emitter/1.0.0/component.json deleted file mode 100644 index 795818f..0000000 --- a/fixture/components/component/emitter/1.0.0/component.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "emitter", - "description": "Event emitter", - "keywords": [ - "emitter", - "events" - ], - "version": "1.0.0", - "scripts": [ - "index.js" - ], - "repository": "component/emitter", - "resolved": "9c5379b4d1985a9a16745abe7bbc31524b8a090e" -} \ No newline at end of file diff --git a/fixture/components/component/emitter/1.0.0/index.js b/fixture/components/component/emitter/1.0.0/index.js deleted file mode 100644 index fa50d5f..0000000 --- a/fixture/components/component/emitter/1.0.0/index.js +++ /dev/null @@ -1,156 +0,0 @@ - -/** - * Expose `Emitter`. - */ - -module.exports = Emitter; - -/** - * Initialize a new `Emitter`. - * - * @api public - */ - -function Emitter(obj) { - if (obj) return mixin(obj); -}; - -/** - * Mixin the emitter properties. - * - * @param {Object} obj - * @return {Object} - * @api private - */ - -function mixin(obj) { - for (var key in Emitter.prototype) { - obj[key] = Emitter.prototype[key]; - } - return obj; -} - -/** - * Listen on the given `event` with `fn`. - * - * @param {String} event - * @param {Function} fn - * @return {Emitter} - * @api public - */ - -Emitter.prototype.on = function(event, fn){ - this._callbacks = this._callbacks || {}; - (this._callbacks[event] = this._callbacks[event] || []) - .push(fn); - return this; -}; - -/** - * Adds an `event` listener that will be invoked a single - * time then automatically removed. - * - * @param {String} event - * @param {Function} fn - * @return {Emitter} - * @api public - */ - -Emitter.prototype.once = function(event, fn){ - var self = this; - this._callbacks = this._callbacks || {}; - - function on() { - self.off(event, on); - fn.apply(this, arguments); - } - - fn._off = on; - this.on(event, on); - return this; -}; - -/** - * Remove the given callback for `event` or all - * registered callbacks. - * - * @param {String} event - * @param {Function} fn - * @return {Emitter} - * @api public - */ - -Emitter.prototype.off = -Emitter.prototype.removeListener = -Emitter.prototype.removeAllListeners = function(event, fn){ - this._callbacks = this._callbacks || {}; - - // all - if (0 == arguments.length) { - this._callbacks = {}; - return this; - } - - // specific event - var callbacks = this._callbacks[event]; - if (!callbacks) return this; - - // remove all handlers - if (1 == arguments.length) { - delete this._callbacks[event]; - return this; - } - - // remove specific handler - var i = callbacks.indexOf(fn._off || fn); - if (~i) callbacks.splice(i, 1); - return this; -}; - -/** - * Emit `event` with the given args. - * - * @param {String} event - * @param {Mixed} ... - * @return {Emitter} - */ - -Emitter.prototype.emit = function(event){ - this._callbacks = this._callbacks || {}; - var args = [].slice.call(arguments, 1) - , callbacks = this._callbacks[event]; - - if (callbacks) { - callbacks = callbacks.slice(0); - for (var i = 0, len = callbacks.length; i < len; ++i) { - callbacks[i].apply(this, args); - } - } - - return this; -}; - -/** - * Return array of callbacks for `event`. - * - * @param {String} event - * @return {Array} - * @api public - */ - -Emitter.prototype.listeners = function(event){ - this._callbacks = this._callbacks || {}; - return this._callbacks[event] || []; -}; - -/** - * Check if this emitter has `event` handlers. - * - * @param {String} event - * @return {Boolean} - * @api public - */ - -Emitter.prototype.hasListeners = function(event){ - return !! this.listeners(event).length; -}; diff --git a/fixture/components/component/emitter/1.1.3/component.json b/fixture/components/component/emitter/1.1.3/component.json deleted file mode 100644 index 8d35543..0000000 --- a/fixture/components/component/emitter/1.1.3/component.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "emitter", - "description": "Event emitter", - "keywords": [ - "emitter", - "events" - ], - "version": "1.1.3", - "scripts": [ - "index.js" - ], - "license": "MIT", - "repository": "component/emitter", - "resolved": "1bd7d81f841323a29ced2f18532af21cada1c3b9" -} \ No newline at end of file diff --git a/fixture/components/component/emitter/1.1.3/index.js b/fixture/components/component/emitter/1.1.3/index.js deleted file mode 100644 index ad71163..0000000 --- a/fixture/components/component/emitter/1.1.3/index.js +++ /dev/null @@ -1,164 +0,0 @@ - -/** - * Expose `Emitter`. - */ - -module.exports = Emitter; - -/** - * Initialize a new `Emitter`. - * - * @api public - */ - -function Emitter(obj) { - if (obj) return mixin(obj); -}; - -/** - * Mixin the emitter properties. - * - * @param {Object} obj - * @return {Object} - * @api private - */ - -function mixin(obj) { - for (var key in Emitter.prototype) { - obj[key] = Emitter.prototype[key]; - } - return obj; -} - -/** - * Listen on the given `event` with `fn`. - * - * @param {String} event - * @param {Function} fn - * @return {Emitter} - * @api public - */ - -Emitter.prototype.on = -Emitter.prototype.addEventListener = function(event, fn){ - this._callbacks = this._callbacks || {}; - (this._callbacks[event] = this._callbacks[event] || []) - .push(fn); - return this; -}; - -/** - * Adds an `event` listener that will be invoked a single - * time then automatically removed. - * - * @param {String} event - * @param {Function} fn - * @return {Emitter} - * @api public - */ - -Emitter.prototype.once = function(event, fn){ - var self = this; - this._callbacks = this._callbacks || {}; - - function on() { - self.off(event, on); - fn.apply(this, arguments); - } - - on.fn = fn; - this.on(event, on); - return this; -}; - -/** - * Remove the given callback for `event` or all - * registered callbacks. - * - * @param {String} event - * @param {Function} fn - * @return {Emitter} - * @api public - */ - -Emitter.prototype.off = -Emitter.prototype.removeListener = -Emitter.prototype.removeAllListeners = -Emitter.prototype.removeEventListener = function(event, fn){ - this._callbacks = this._callbacks || {}; - - // all - if (0 == arguments.length) { - this._callbacks = {}; - return this; - } - - // specific event - var callbacks = this._callbacks[event]; - if (!callbacks) return this; - - // remove all handlers - if (1 == arguments.length) { - delete this._callbacks[event]; - return this; - } - - // remove specific handler - var cb; - for (var i = 0; i < callbacks.length; i++) { - cb = callbacks[i]; - if (cb === fn || cb.fn === fn) { - callbacks.splice(i, 1); - break; - } - } - return this; -}; - -/** - * Emit `event` with the given args. - * - * @param {String} event - * @param {Mixed} ... - * @return {Emitter} - */ - -Emitter.prototype.emit = function(event){ - this._callbacks = this._callbacks || {}; - var args = [].slice.call(arguments, 1) - , callbacks = this._callbacks[event]; - - if (callbacks) { - callbacks = callbacks.slice(0); - for (var i = 0, len = callbacks.length; i < len; ++i) { - callbacks[i].apply(this, args); - } - } - - return this; -}; - -/** - * Return array of callbacks for `event`. - * - * @param {String} event - * @return {Array} - * @api public - */ - -Emitter.prototype.listeners = function(event){ - this._callbacks = this._callbacks || {}; - return this._callbacks[event] || []; -}; - -/** - * Check if this emitter has `event` handlers. - * - * @param {String} event - * @return {Boolean} - * @api public - */ - -Emitter.prototype.hasListeners = function(event){ - return !! this.listeners(event).length; -}; diff --git a/fixture/components/component/event/0.1.4/component.json b/fixture/components/component/event/0.1.4/component.json deleted file mode 100644 index 6bd6ccf..0000000 --- a/fixture/components/component/event/0.1.4/component.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "event", - "description": "Event binding component", - "version": "0.1.4", - "keywords": [ - "browser", - "event", - "events" - ], - "scripts": [ - "index.js" - ], - "repository": "component/event", - "resolved": "fa60a092b3670ae2e62bfd3620dc2b7196098b3c" -} \ No newline at end of file diff --git a/fixture/components/component/event/0.1.4/index.js b/fixture/components/component/event/0.1.4/index.js deleted file mode 100644 index ef05d5c..0000000 --- a/fixture/components/component/event/0.1.4/index.js +++ /dev/null @@ -1,35 +0,0 @@ -var bind = window.addEventListener ? 'addEventListener' : 'attachEvent', - unbind = window.removeEventListener ? 'removeEventListener' : 'detachEvent', - prefix = bind !== 'addEventListener' ? 'on' : ''; - -/** - * Bind `el` event `type` to `fn`. - * - * @param {Element} el - * @param {String} type - * @param {Function} fn - * @param {Boolean} capture - * @return {Function} - * @api public - */ - -exports.bind = function(el, type, fn, capture){ - el[bind](prefix + type, fn, capture || false); - return fn; -}; - -/** - * Unbind `el` event `type`'s callback `fn`. - * - * @param {Element} el - * @param {String} type - * @param {Function} fn - * @param {Boolean} capture - * @return {Function} - * @api public - */ - -exports.unbind = function(el, type, fn, capture){ - el[unbind](prefix + type, fn, capture || false); - return fn; -}; \ No newline at end of file diff --git a/fixture/components/component/events/1.0.9/component.json b/fixture/components/component/events/1.0.9/component.json deleted file mode 100644 index 3e3b708..0000000 --- a/fixture/components/component/events/1.0.9/component.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "events", - "description": "Higher level dom event management", - "version": "1.0.9", - "keywords": [ - "event", - "events", - "subscriptions" - ], - "dependencies": { - "component/event": "0.1.4", - "component/delegate": "0.2.3" - }, - "development": {}, - "license": "MIT", - "scripts": [ - "index.js" - ], - "repository": "component/events", - "resolved": "e79bae32cc8861901520326859420783506f9bd1" -} \ No newline at end of file diff --git a/fixture/components/component/events/1.0.9/index.js b/fixture/components/component/events/1.0.9/index.js deleted file mode 100644 index d3ed75b..0000000 --- a/fixture/components/component/events/1.0.9/index.js +++ /dev/null @@ -1,176 +0,0 @@ - -/** - * Module dependencies. - */ - -var events = require('event'); -var delegate = require('delegate'); - -/** - * Expose `Events`. - */ - -module.exports = Events; - -/** - * Initialize an `Events` with the given - * `el` object which events will be bound to, - * and the `obj` which will receive method calls. - * - * @param {Object} el - * @param {Object} obj - * @api public - */ - -function Events(el, obj) { - if (!(this instanceof Events)) return new Events(el, obj); - if (!el) throw new Error('element required'); - if (!obj) throw new Error('object required'); - this.el = el; - this.obj = obj; - this._events = {}; -} - -/** - * Subscription helper. - */ - -Events.prototype.sub = function(event, method, cb){ - this._events[event] = this._events[event] || {}; - this._events[event][method] = cb; -}; - -/** - * Bind to `event` with optional `method` name. - * When `method` is undefined it becomes `event` - * with the "on" prefix. - * - * Examples: - * - * Direct event handling: - * - * events.bind('click') // implies "onclick" - * events.bind('click', 'remove') - * events.bind('click', 'sort', 'asc') - * - * Delegated event handling: - * - * events.bind('click li > a') - * events.bind('click li > a', 'remove') - * events.bind('click a.sort-ascending', 'sort', 'asc') - * events.bind('click a.sort-descending', 'sort', 'desc') - * - * @param {String} event - * @param {String|function} [method] - * @return {Function} callback - * @api public - */ - -Events.prototype.bind = function(event, method){ - var e = parse(event); - var el = this.el; - var obj = this.obj; - var name = e.name; - var method = method || 'on' + name; - var args = [].slice.call(arguments, 2); - - // callback - function cb(){ - var a = [].slice.call(arguments).concat(args); - obj[method].apply(obj, a); - } - - // bind - if (e.selector) { - cb = delegate.bind(el, e.selector, name, cb); - } else { - events.bind(el, name, cb); - } - - // subscription for unbinding - this.sub(name, method, cb); - - return cb; -}; - -/** - * Unbind a single binding, all bindings for `event`, - * or all bindings within the manager. - * - * Examples: - * - * Unbind direct handlers: - * - * events.unbind('click', 'remove') - * events.unbind('click') - * events.unbind() - * - * Unbind delegate handlers: - * - * events.unbind('click', 'remove') - * events.unbind('click') - * events.unbind() - * - * @param {String|Function} [event] - * @param {String|Function} [method] - * @api public - */ - -Events.prototype.unbind = function(event, method){ - if (0 == arguments.length) return this.unbindAll(); - if (1 == arguments.length) return this.unbindAllOf(event); - - // no bindings for this event - var bindings = this._events[event]; - if (!bindings) return; - - // no bindings for this method - var cb = bindings[method]; - if (!cb) return; - - events.unbind(this.el, event, cb); -}; - -/** - * Unbind all events. - * - * @api private - */ - -Events.prototype.unbindAll = function(){ - for (var event in this._events) { - this.unbindAllOf(event); - } -}; - -/** - * Unbind all events for `event`. - * - * @param {String} event - * @api private - */ - -Events.prototype.unbindAllOf = function(event){ - var bindings = this._events[event]; - if (!bindings) return; - - for (var method in bindings) { - this.unbind(event, method); - } -}; - -/** - * Parse `event`. - * - * @param {String} event - * @return {Object} - * @api private - */ - -function parse(event) { - var parts = event.split(/ +/); - return { - name: parts.shift(), - selector: parts.join(' ') - } -} diff --git a/fixture/components/component/in-groups-of/1.0.0/component.json b/fixture/components/component/in-groups-of/1.0.0/component.json deleted file mode 100644 index e910689..0000000 --- a/fixture/components/component/in-groups-of/1.0.0/component.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "in-groups-of", - "description": "Return an array of arrays in groups of N", - "version": "1.0.0", - "keywords": [], - "dependencies": {}, - "development": {}, - "scripts": [ - "index.js" - ], - "license": "MIT", - "repository": "component/in-groups-of", - "resolved": "09af9a093a4cb0c6c9b67b72ae6aa7dd8c3292e7" -} \ No newline at end of file diff --git a/fixture/components/component/in-groups-of/1.0.0/index.js b/fixture/components/component/in-groups-of/1.0.0/index.js deleted file mode 100644 index 5b61f76..0000000 --- a/fixture/components/component/in-groups-of/1.0.0/index.js +++ /dev/null @@ -1,19 +0,0 @@ - -module.exports = function(arr, n){ - var ret = []; - var group = []; - var len = arr.length; - var per = len * (n / len); - - for (var i = 0; i < len; ++i) { - group.push(arr[i]); - if ((i + 1) % n == 0) { - ret.push(group); - group = []; - } - } - - if (group.length) ret.push(group); - - return ret; -}; \ No newline at end of file diff --git a/fixture/components/component/indexof/0.0.3/component.json b/fixture/components/component/indexof/0.0.3/component.json deleted file mode 100644 index 57d46b7..0000000 --- a/fixture/components/component/indexof/0.0.3/component.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "indexof", - "description": "Microsoft sucks", - "version": "0.0.3", - "keywords": [ - "index", - "array", - "indexOf" - ], - "dependencies": {}, - "development": { - "dependencies": { - "component/assert": "*" - } - }, - "scripts": [ - "index.js" - ], - "repository": "component/indexof", - "resolved": "d65c1a37e5e3b976f35ed103bc6e199f75e97d2b" -} \ No newline at end of file diff --git a/fixture/components/component/indexof/0.0.3/index.js b/fixture/components/component/indexof/0.0.3/index.js deleted file mode 100644 index 7f6005c..0000000 --- a/fixture/components/component/indexof/0.0.3/index.js +++ /dev/null @@ -1,7 +0,0 @@ -module.exports = function(arr, obj){ - if (arr.indexOf) return arr.indexOf(obj); - for (var i = 0; i < arr.length; ++i) { - if (arr[i] === obj) return i; - } - return -1; -}; \ No newline at end of file diff --git a/fixture/components/component/inherit/0.0.3/component.json b/fixture/components/component/inherit/0.0.3/component.json deleted file mode 100644 index 80639c3..0000000 --- a/fixture/components/component/inherit/0.0.3/component.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "inherit", - "description": "Prototype inheritance utility", - "version": "0.0.3", - "keywords": [ - "inherit", - "utility" - ], - "dependencies": {}, - "scripts": [ - "index.js" - ], - "repository": "component/inherit", - "resolved": "c49c723aaa5b66d7a4e1dcfe96440ebd85b5bfe9" -} \ No newline at end of file diff --git a/fixture/components/component/inherit/0.0.3/index.js b/fixture/components/component/inherit/0.0.3/index.js deleted file mode 100644 index aaebc03..0000000 --- a/fixture/components/component/inherit/0.0.3/index.js +++ /dev/null @@ -1,7 +0,0 @@ - -module.exports = function(a, b){ - var fn = function(){}; - fn.prototype = b.prototype; - a.prototype = new fn; - a.prototype.constructor = a; -}; \ No newline at end of file diff --git a/fixture/components/component/map/0.0.1/component.json b/fixture/components/component/map/0.0.1/component.json deleted file mode 100644 index 61fd345..0000000 --- a/fixture/components/component/map/0.0.1/component.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "map", - "description": "Array map utility", - "version": "0.0.1", - "keywords": [ - "array", - "map", - "utility" - ], - "dependencies": { - "component/to-function": "*" - }, - "development": {}, - "scripts": [ - "index.js" - ], - "repository": "component/map", - "resolved": "a33e131c24495d1f363c12118e263e41353d1109" -} \ No newline at end of file diff --git a/fixture/components/component/map/0.0.1/index.js b/fixture/components/component/map/0.0.1/index.js deleted file mode 100644 index 875a6d1..0000000 --- a/fixture/components/component/map/0.0.1/index.js +++ /dev/null @@ -1,24 +0,0 @@ - -/** - * Module dependencies. - */ - -var toFunction = require('to-function'); - -/** - * Map the given `arr` with callback `fn(val, i)`. - * - * @param {Array} arr - * @param {Function} fn - * @return {Array} - * @api public - */ - -module.exports = function(arr, fn){ - var ret = []; - fn = toFunction(fn); - for (var i = 0; i < arr.length; ++i) { - ret.push(fn(arr[i], i)); - } - return ret; -}; \ No newline at end of file diff --git a/fixture/components/component/matches-selector/0.1.5/component.json b/fixture/components/component/matches-selector/0.1.5/component.json deleted file mode 100644 index 43edf72..0000000 --- a/fixture/components/component/matches-selector/0.1.5/component.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "matches-selector", - "description": "Check if an element matches a given selector", - "version": "0.1.5", - "keywords": [ - "match", - "element", - "selector" - ], - "dependencies": { - "component/query": "*" - }, - "development": { - "dependencies": { - "component/domify": "*" - } - }, - "scripts": [ - "index.js" - ], - "repository": "component/matches-selector", - "resolved": "b6a46650d8aa7a54f1ac431f83f50aa2c65f0153" -} \ No newline at end of file diff --git a/fixture/components/component/matches-selector/0.1.5/index.js b/fixture/components/component/matches-selector/0.1.5/index.js deleted file mode 100644 index 5d86755..0000000 --- a/fixture/components/component/matches-selector/0.1.5/index.js +++ /dev/null @@ -1,46 +0,0 @@ -/** - * Module dependencies. - */ - -var query = require('query'); - -/** - * Element prototype. - */ - -var proto = Element.prototype; - -/** - * Vendor function. - */ - -var vendor = proto.matches - || proto.webkitMatchesSelector - || proto.mozMatchesSelector - || proto.msMatchesSelector - || proto.oMatchesSelector; - -/** - * Expose `match()`. - */ - -module.exports = match; - -/** - * Match `el` to `selector`. - * - * @param {Element} el - * @param {String} selector - * @return {Boolean} - * @api public - */ - -function match(el, selector) { - if (!el || el.nodeType !== 1) return false; - if (vendor) return vendor.call(el, selector); - var nodes = query.all(selector, el.parentNode); - for (var i = 0; i < nodes.length; ++i) { - if (nodes[i] == el) return true; - } - return false; -} diff --git a/fixture/components/component/popover/1.1.1/component.json b/fixture/components/component/popover/1.1.1/component.json deleted file mode 100644 index 5f77b81..0000000 --- a/fixture/components/component/popover/1.1.1/component.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "popover", - "description": "Popover component", - "version": "1.1.1", - "keywords": [ - "toolpopover", - "popover", - "ui" - ], - "dependencies": { - "component/tip": "*", - "component/query": "*", - "component/inherit": "0.0.3" - }, - "development": { - "dependencies": { - "component/aurora-popover": "*" - } - }, - "scripts": [ - "index.js", - "template.js" - ], - "repository": "component/popover", - "resolved": "8fc4a9b058df4915b6c577561b0af0a278ff70eb" -} \ No newline at end of file diff --git a/fixture/components/component/popover/1.1.1/index.js b/fixture/components/component/popover/1.1.1/index.js deleted file mode 100644 index e284824..0000000 --- a/fixture/components/component/popover/1.1.1/index.js +++ /dev/null @@ -1,85 +0,0 @@ -/** - * Module dependencies. - */ - -var Tip = require('tip') - , q = require('query') - , inherit = require('inherit'); - -/** - * Expose `Popover`. - */ - -module.exports = Popover; - -/** - * Initialize a `Popover` with the given `content` - * and optional `title`. - * - * @param {Mixed} content - * @param {Mixed} title - * @api public - */ - -function Popover(content, title) { - Tip.call(this, require('./template')); - this.classname = 'popover'; - this.classes.add('popover'); - if (title) this.title(title); - else this.hideTitle(); - this.content(content); - if (Popover.effect) this.effect(Popover.effect); -} - -/** - * Inherits from `Tip.prototype`. - */ - -inherit(Popover, Tip); - -/** - * Replace `content`. - * - * @param {Mixed} content - * @return {Popover} - * @api public - */ - -Popover.prototype.content = function(content){ - var contentEl = q('.popover-content', this.el); - if (typeof content === 'string') - contentEl.innerHTML = content; - else - contentEl.appendChild(content); - return this; -}; - -/** - * Change `title`. - * - * @param {String} title - * @return {Popover} - * @api public - */ - -Popover.prototype.title = function(title){ - var titleEl = q('.popover-title', this.el); - if (typeof title === 'string') - titleEl.innerHTML = title; - else - titleEl.appendChild(title); - return this; -}; - -/** - * Hide the title. - * - * @return {Popover} - * @api private - */ - -Popover.prototype.hideTitle = function(){ - var titleEl = q('.popover-title', this.el); - titleEl.parentNode.removeChild(titleEl); - return this; -}; diff --git a/fixture/components/component/popover/1.1.1/template.js b/fixture/components/component/popover/1.1.1/template.js deleted file mode 100644 index 9acebb0..0000000 --- a/fixture/components/component/popover/1.1.1/template.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = '
\n \n
\n
'; \ No newline at end of file diff --git a/fixture/components/component/props/1.1.2/component.json b/fixture/components/component/props/1.1.2/component.json deleted file mode 100644 index e666a1b..0000000 --- a/fixture/components/component/props/1.1.2/component.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "props", - "description": "Parse immediate identifiers from a js expression", - "version": "1.1.2", - "keywords": [ - "template", - "engine", - "parse", - "parser" - ], - "dependencies": {}, - "development": {}, - "license": "MIT", - "scripts": [ - "index.js" - ], - "repository": "component/props", - "resolved": "e45d06d3b2827013035a992963e0e46000e96e45" -} \ No newline at end of file diff --git a/fixture/components/component/props/1.1.2/index.js b/fixture/components/component/props/1.1.2/index.js deleted file mode 100644 index 3bf657d..0000000 --- a/fixture/components/component/props/1.1.2/index.js +++ /dev/null @@ -1,85 +0,0 @@ -/** - * Global Names - */ - -var globals = /\b(this|Array|Date|Object|Math|JSON)\b/g; - -/** - * Return immediate identifiers parsed from `str`. - * - * @param {String} str - * @param {String|Function} map function or prefix - * @return {Array} - * @api public - */ - -module.exports = function(str, fn){ - var p = unique(props(str)); - if (fn && 'string' == typeof fn) fn = prefixed(fn); - if (fn) return map(str, p, fn); - return p; -}; - -/** - * Return immediate identifiers in `str`. - * - * @param {String} str - * @return {Array} - * @api private - */ - -function props(str) { - return str - .replace(/\.\w+|\w+ *\(|"[^"]*"|'[^']*'|\/([^/]+)\//g, '') - .replace(globals, '') - .match(/[$a-zA-Z_]\w*/g) - || []; -} - -/** - * Return `str` with `props` mapped with `fn`. - * - * @param {String} str - * @param {Array} props - * @param {Function} fn - * @return {String} - * @api private - */ - -function map(str, props, fn) { - var re = /\.\w+|\w+ *\(|"[^"]*"|'[^']*'|\/([^/]+)\/|[a-zA-Z_]\w*/g; - return str.replace(re, function(_){ - if ('(' == _[_.length - 1]) return fn(_); - if (!~props.indexOf(_)) return _; - return fn(_); - }); -} - -/** - * Return unique array. - * - * @param {Array} arr - * @return {Array} - * @api private - */ - -function unique(arr) { - var ret = []; - - for (var i = 0; i < arr.length; i++) { - if (~ret.indexOf(arr[i])) continue; - ret.push(arr[i]); - } - - return ret; -} - -/** - * Map with prefix `str`. - */ - -function prefixed(str) { - return function(_){ - return str + _; - }; -} diff --git a/fixture/components/component/query/0.0.3/component.json b/fixture/components/component/query/0.0.3/component.json deleted file mode 100644 index 8733285..0000000 --- a/fixture/components/component/query/0.0.3/component.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name": "query", - "description": "Query the DOM with selector engine fallback support", - "version": "0.0.3", - "keywords": [ - "query", - "selector", - "engine", - "dom", - "elements" - ], - "dependencies": {}, - "development": { - "dependencies": { - "component/assert": "*" - } - }, - "license": "MIT", - "scripts": [ - "index.js" - ], - "repository": "component/query", - "resolved": "cfa981c3be3df3603c3b1d42106490f7246059c4" -} \ No newline at end of file diff --git a/fixture/components/component/query/0.0.3/index.js b/fixture/components/component/query/0.0.3/index.js deleted file mode 100644 index cd2cf3a..0000000 --- a/fixture/components/component/query/0.0.3/index.js +++ /dev/null @@ -1,21 +0,0 @@ -function one(selector, el) { - return el.querySelector(selector); -} - -exports = module.exports = function(selector, el){ - el = el || document; - return one(selector, el); -}; - -exports.all = function(selector, el){ - el = el || document; - return el.querySelectorAll(selector); -}; - -exports.engine = function(obj){ - if (!obj.one) throw new Error('.one callback required'); - if (!obj.all) throw new Error('.all callback required'); - one = obj.one; - exports.all = obj.all; - return exports; -}; diff --git a/fixture/components/component/range/1.0.0/component.json b/fixture/components/component/range/1.0.0/component.json deleted file mode 100644 index 5f8509d..0000000 --- a/fixture/components/component/range/1.0.0/component.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "range", - "description": "Return a range of integers", - "version": "1.0.0", - "keywords": [ - "range", - "utility", - "array" - ], - "dependencies": {}, - "development": {}, - "scripts": [ - "index.js" - ], - "license": "MIT", - "repository": "component/range", - "resolved": "9517514aaf185c9650d3738005887c448af559f9" -} \ No newline at end of file diff --git a/fixture/components/component/range/1.0.0/index.js b/fixture/components/component/range/1.0.0/index.js deleted file mode 100644 index 5328119..0000000 --- a/fixture/components/component/range/1.0.0/index.js +++ /dev/null @@ -1,11 +0,0 @@ - -module.exports = function(from, to, inclusive){ - var ret = []; - if (inclusive) to++; - - for (var n = from; n < to; ++n) { - ret.push(n); - } - - return ret; -} \ No newline at end of file diff --git a/fixture/components/component/tip/2.5.0/component.json b/fixture/components/component/tip/2.5.0/component.json deleted file mode 100644 index bd88d9a..0000000 --- a/fixture/components/component/tip/2.5.0/component.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "name": "tip", - "description": "Tip component", - "version": "2.5.0", - "keywords": [ - "browser", - "component", - "tooltip", - "tip", - "ui" - ], - "dependencies": { - "component/bind": "*", - "component/emitter": "1.1.3", - "component/query": "0.0.3", - "component/events": "1.0.9", - "component/domify": "1.3.0", - "component/classes": "1.2.1", - "component/css": "0.0.6", - "webmodules/bounding-client-rect": "1.0.5" - }, - "development": { - "dependencies": { - "component/aurora-tip": "*", - "component/event": "*" - } - }, - "scripts": [ - "index.js" - ], - "styles": [ - "tip.css" - ], - "templates": [ - "template.html" - ], - "demo": [ - "http://component.github.io/tip/" - ], - "license": "MIT", - "repository": "component/tip", - "resolved": "14bb6349e988b6493f6df69b274790b905e3cbd6" -} \ No newline at end of file diff --git a/fixture/components/component/tip/2.5.0/index.js b/fixture/components/component/tip/2.5.0/index.js deleted file mode 100644 index f1ac5a0..0000000 --- a/fixture/components/component/tip/2.5.0/index.js +++ /dev/null @@ -1,485 +0,0 @@ -/** - * Module dependencies. - */ - -var css = require('css'); -var bind = require('bind'); -var query = require('query'); -var domify = require('domify'); -var events = require('events'); -var Emitter = require('emitter'); -var classes = require('classes'); -var getBoundingClientRect = require('bounding-client-rect'); - -var html = domify(require('./template.html')); - -/** - * Expose `Tip`. - */ - -module.exports = Tip; - -/** - * Apply the average use-case of simply - * showing a tool-tip on `el` hover. - * - * Options: - * - * - `delay` hide delay in milliseconds [0] - * - `value` defaulting to the element's title attribute - * - * @param {Mixed} elem - * @param {Object|String} options or value - * @api public - */ - -function tip(elem, options) { - if ('string' == typeof options) options = { value : options }; - var els = ('string' == typeof elem) ? query.all(elem) : [elem]; - for(var i = 0, el; el = els[i]; i++) { - var val = options.value || el.getAttribute('title'); - var tip = new Tip(val, options); - el.setAttribute('title', ''); - tip.cancelHideOnHover(); - tip.attach(el); - } -} - -/** - * Initialize a `Tip` with the given `content`. - * - * @param {Mixed} content - * @api public - */ - -function Tip(content, options) { - options = options || {}; - if (!(this instanceof Tip)) return tip(content, options); - Emitter.call(this); - this.classname = ''; - this.delay = options.delay || 300; - this.pad = null == options.pad ? 15 : options.pad; - this.el = html.cloneNode(true); - this.events = events(this.el, this); - this.classes = classes(this.el); - this.inner = query('.tip-inner', this.el); - this.message(content); - this.position('top'); - this.static = !!options.static; - if (Tip.effect) this.effect(Tip.effect); -} - -/** - * Mixin emitter. - */ - -Emitter(Tip.prototype); - -/** - * Set tip `content`. - * - * @param {String|Element} content - * @return {Tip} self - * @api public - */ - -Tip.prototype.message = function(content){ - if ('string' == typeof content) content = domify(content); - this.inner.appendChild(content); - return this; -}; - -/** - * Attach to the given `el` with optional hide `delay`. - * - * @param {Element} el - * @param {Number} delay - * @return {Tip} - * @api public - */ - -Tip.prototype.attach = function(el){ - this.target = el; - this.handleEvents = events(el, this); - this.handleEvents.bind('mouseover'); - this.handleEvents.bind('mouseout'); - return this; -}; - -/** - * On mouse over - * - * @param {Event} e - * @return {Tip} - * @api private - */ - -Tip.prototype.onmouseover = function() { - this.show(this.target); - this.cancelHide(); -}; - -/** - * On mouse out - * - * @param {Event} e - * @return {Tip} - * @api private - */ - -Tip.prototype.onmouseout = function() { - this.hide(this.delay); -}; - -/** - * Cancel hide on hover, hide with the given `delay`. - * - * @param {Number} delay - * @return {Tip} - * @api public - */ - -Tip.prototype.cancelHideOnHover = function(){ - this.events.bind('mouseover', 'cancelHide'); - this.events.bind('mouseout', 'hide'); - return this; -}; - -/** - * Set the effect to `type`. - * - * @param {String} type - * @return {Tip} - * @api public - */ - -Tip.prototype.effect = function(type){ - this._effect = type; - this.classes.add(type); - return this; -}; - -/** - * Set position: - * - * - `top` - * - `top left` - * - `top right` - * - `bottom` - * - `bottom left` - * - `bottom right` - * - `left` - * - `right` - * - * @param {String} pos - * @param {Object} options - * @return {Tip} - * @api public - */ - -Tip.prototype.position = function(pos, options){ - options = options || {}; - this._position = pos; - this._auto = false != options.auto; - this.replaceClass(pos); - this.emit('reposition'); - return this; -}; - -/** - * Show the tip attached to `el`. - * - * Emits "show" (el) event. - * - * @param {String|Element|Number} el or x - * @param {Number} [y] - * @return {Tip} - * @api public - */ - -Tip.prototype.show = function(el){ - if ('string' == typeof el) el = query(el); - - // show it - document.body.appendChild(this.el); - this.classes.add('tip-' + this._position.replace(/\s+/g, '-')); - this.classes.remove('tip-hide'); - - // x,y - if ('number' == typeof el) { - var x = arguments[0]; - var y = arguments[1]; - this.emit('show'); - css(this.el, { - top: y, - left: x - }); - return this; - } - - // el - this.target = el; - this.reposition(); - this.emit('show', this.target); - - if (!this.winEvents && !this.static) { - this.winEvents = events(window, this); - this.winEvents.bind('resize', 'reposition'); - this.winEvents.bind('scroll', 'reposition'); - } - - return this; -}; - -/** - * Reposition the tip if necessary. - * - * @api private - */ - -Tip.prototype.reposition = function(){ - var pos = this._position; - var off = this.offset(pos); - var newpos = this._auto && this.suggested(pos, off); - if (newpos && newpos !== pos) { - pos = newpos; - off = this.offset(pos); - } - this.replaceClass(pos); - this.emit('reposition'); - css(this.el, off); -}; - -/** - * Compute the "suggested" position favouring `pos`. - * - * Returns `pos` if no suggestion can be determined. - * - * @param {String} pos - * @param {Object} offset - * @return {String} - * @api private - */ - -Tip.prototype.suggested = function(pos, off){ - var el = this.el; - - var ew = el.clientWidth; - var eh = el.clientHeight; - var top = window.scrollY; - var left = window.scrollX; - var w = window.innerWidth; - var h = window.innerHeight; - - var good = { - top: true, - bottom: true, - left: true, - right: true - }; - - // too low - if (off.top + eh > top + h) good.bottom = false; - - // too high - if (off.top < top) good.top = false; - - // too far to the right - if (off.left + ew > left + w) good.right = false; - - // too far to the left - if (off.left < left) good.left = false; - - var i; - var positions = pos.split(/\s+/); - - // attempt to give the preferred position first, consider "bottom right" - for (i = 0; i < positions.length; i++) { - if (!good[positions[i]]) break; - if (i === positions.length - 1) { - // last one! - return pos; - } - } - - // attempt to get close to preferred position, i.e. "bottom" or "right" - for (i = 0; i < positions.length; i++) { - if (good[positions[i]]) return positions[i]; - } - - if (good[pos]) return pos; - if (good.top) return 'top'; - if (good.bottom) return 'bottom'; - if (good.left) return 'left'; - if (good.right) return 'right'; -}; - -/** - * Replace position class `name`. - * - * @param {String} name - * @api private - */ - -Tip.prototype.replaceClass = function(name){ - name = name.split(' ').join('-'); - var classname = this.classname + ' tip tip-' + name; - if (this._effect) classname += ' ' + this._effect; - this.el.setAttribute('class', classname); -}; - -/** - * Compute the offset for `.target` - * based on the given `pos`. - * - * @param {String} pos - * @return {Object} - * @api private - */ - -Tip.prototype.offset = function(pos){ - var pad = this.pad; - - var tipRect = getBoundingClientRect(this.el); - if (!tipRect) throw new Error('could not get bounding client rect of Tip element'); - var ew = tipRect.width; - var eh = tipRect.height; - - var targetRect = getBoundingClientRect(this.target); - if (!targetRect) throw new Error('could not get bounding client rect of `target`'); - var tw = targetRect.width; - var th = targetRect.height; - - var to = offset(targetRect, document); - if (!to) throw new Error('could not determine page offset of `target`'); - - switch (pos) { - case 'top': - return { - top: to.top - eh, - left: to.left + tw / 2 - ew / 2 - } - case 'bottom': - return { - top: to.top + th, - left: to.left + tw / 2 - ew / 2 - } - case 'right': - return { - top: to.top + th / 2 - eh / 2, - left: to.left + tw - } - case 'left': - return { - top: to.top + th / 2 - eh / 2, - left: to.left - ew - } - case 'top left': - return { - top: to.top - eh, - left: to.left + tw / 2 - ew + pad - } - case 'top right': - return { - top: to.top - eh, - left: to.left + tw / 2 - pad - } - case 'bottom left': - return { - top: to.top + th, - left: to.left + tw / 2 - ew + pad - } - case 'bottom right': - return { - top: to.top + th, - left: to.left + tw / 2 - pad - } - default: - throw new Error('invalid position "' + pos + '"'); - } -}; - -/** - * Cancel the `.hide()` timeout. - * - * @api private - */ - -Tip.prototype.cancelHide = function(){ - clearTimeout(this._hide); -}; - -/** - * Hide the tip with optional `ms` delay. - * - * Emits "hide" event. - * - * @param {Number} ms - * @return {Tip} - * @api public - */ - -Tip.prototype.hide = function(ms){ - var self = this; - - this.emit('hiding'); - - // duration - if (ms) { - this._hide = setTimeout(bind(this, this.hide), ms); - return this; - } - - // hide - this.classes.add('tip-hide'); - if (this._effect) { - setTimeout(bind(this, this.remove), 300); - } else { - self.remove(); - } - - return this; -}; - -/** - * Hide the tip without potential animation. - * - * @return {Tip} - * @api public - */ - -Tip.prototype.remove = function(){ - if (this.winEvents) { - this.winEvents.unbind(); - this.winEvents = null; - } - this.emit('hide'); - - var parent = this.el.parentNode; - if (parent) parent.removeChild(this.el); - return this; -}; - -/** - * Extracted from `timoxley/offset`, but directly using a - * TextRectangle instead of getting another version. - * - * @param {TextRectangle} box - result from a `getBoundingClientRect()` call - * @param {Document} doc - Document instance to use - * @return {Object} an object with `top` and `left` Number properties - * @api private - */ - -function offset (box, doc) { - var body = doc.body || doc.getElementsByTagName('body')[0]; - var docEl = doc.documentElement || body.parentNode; - var clientTop = docEl.clientTop || body.clientTop || 0; - var clientLeft = docEl.clientLeft || body.clientLeft || 0; - var scrollTop = window.pageYOffset || docEl.scrollTop; - var scrollLeft = window.pageXOffset || docEl.scrollLeft; - - return { - top: box.top + scrollTop - clientTop, - left: box.left + scrollLeft - clientLeft - }; -} diff --git a/fixture/components/component/tip/2.5.0/template.html b/fixture/components/component/tip/2.5.0/template.html deleted file mode 100644 index b79d0b0..0000000 --- a/fixture/components/component/tip/2.5.0/template.html +++ /dev/null @@ -1,4 +0,0 @@ -
-
-
-
\ No newline at end of file diff --git a/fixture/components/component/tip/2.5.0/tip.css b/fixture/components/component/tip/2.5.0/tip.css deleted file mode 100644 index 3a7ba8d..0000000 --- a/fixture/components/component/tip/2.5.0/tip.css +++ /dev/null @@ -1,20 +0,0 @@ -.tip { - position: absolute; - padding: 5px; - z-index: 1000; - /* default offset for edge-cases: https://github.com/component/tip/pull/12 */ - top: 0; - left: 0; -} - -/* effects */ - -.tip.fade { - transition: opacity 100ms; - -moz-transition: opacity 100ms; - -webkit-transition: opacity 100ms; -} - -.tip-hide { - opacity: 0; -} diff --git a/fixture/components/component/to-function/2.0.6/component.json b/fixture/components/component/to-function/2.0.6/component.json deleted file mode 100644 index 33a8114..0000000 --- a/fixture/components/component/to-function/2.0.6/component.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "to-function", - "description": "Convert property access strings into functions", - "version": "2.0.6", - "keywords": [ - "utility", - "function" - ], - "dependencies": { - "component/props": "*" - }, - "development": {}, - "scripts": [ - "index.js" - ], - "repository": "component/to-function", - "resolved": "8ea555132a66c0d951e5917580f91fa0b1b4441a" -} \ No newline at end of file diff --git a/fixture/components/component/to-function/2.0.6/index.js b/fixture/components/component/to-function/2.0.6/index.js deleted file mode 100644 index 3416091..0000000 --- a/fixture/components/component/to-function/2.0.6/index.js +++ /dev/null @@ -1,152 +0,0 @@ - -/** - * Module Dependencies - */ - -var expr; -try { - expr = require('props'); -} catch(e) { - expr = require('component-props'); -} - -/** - * Expose `toFunction()`. - */ - -module.exports = toFunction; - -/** - * Convert `obj` to a `Function`. - * - * @param {Mixed} obj - * @return {Function} - * @api private - */ - -function toFunction(obj) { - switch ({}.toString.call(obj)) { - case '[object Object]': - return objectToFunction(obj); - case '[object Function]': - return obj; - case '[object String]': - return stringToFunction(obj); - case '[object RegExp]': - return regexpToFunction(obj); - default: - return defaultToFunction(obj); - } -} - -/** - * Default to strict equality. - * - * @param {Mixed} val - * @return {Function} - * @api private - */ - -function defaultToFunction(val) { - return function(obj){ - return val === obj; - }; -} - -/** - * Convert `re` to a function. - * - * @param {RegExp} re - * @return {Function} - * @api private - */ - -function regexpToFunction(re) { - return function(obj){ - return re.test(obj); - }; -} - -/** - * Convert property `str` to a function. - * - * @param {String} str - * @return {Function} - * @api private - */ - -function stringToFunction(str) { - // immediate such as "> 20" - if (/^ *\W+/.test(str)) return new Function('_', 'return _ ' + str); - - // properties such as "name.first" or "age > 18" or "age > 18 && age < 36" - return new Function('_', 'return ' + get(str)); -} - -/** - * Convert `object` to a function. - * - * @param {Object} object - * @return {Function} - * @api private - */ - -function objectToFunction(obj) { - var match = {}; - for (var key in obj) { - match[key] = typeof obj[key] === 'string' - ? defaultToFunction(obj[key]) - : toFunction(obj[key]); - } - return function(val){ - if (typeof val !== 'object') return false; - for (var key in match) { - if (!(key in val)) return false; - if (!match[key](val[key])) return false; - } - return true; - }; -} - -/** - * Built the getter function. Supports getter style functions - * - * @param {String} str - * @return {String} - * @api private - */ - -function get(str) { - var props = expr(str); - if (!props.length) return '_.' + str; - - var val, i, prop; - for (i = 0; i < props.length; i++) { - prop = props[i]; - val = '_.' + prop; - val = "('function' == typeof " + val + " ? " + val + "() : " + val + ")"; - - // mimic negative lookbehind to avoid problems with nested properties - str = stripNested(prop, str, val); - } - - return str; -} - -/** - * Mimic negative lookbehind to avoid problems with nested properties. - * - * See: http://blog.stevenlevithan.com/archives/mimic-lookbehind-javascript - * - * @param {String} prop - * @param {String} str - * @param {String} val - * @return {String} - * @api private - */ - -function stripNested (prop, str, val) { - return str.replace(new RegExp('(\\.)?' + prop, 'g'), function($0, $1) { - return $1 ? $0 : val; - }); -} diff --git a/fixture/components/component/type/1.0.0/component.json b/fixture/components/component/type/1.0.0/component.json deleted file mode 100644 index f4463c2..0000000 --- a/fixture/components/component/type/1.0.0/component.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "type", - "description": "Cross-browser type assertions (less broken typeof)", - "version": "1.0.0", - "keywords": [ - "typeof", - "type", - "utility" - ], - "dependencies": {}, - "development": { - "dependencies": { - "component/assert": "*" - } - }, - "scripts": [ - "index.js" - ], - "repository": "component/type", - "resolved": "bcc541832ef44fedfcd0dfc2d0dc5dfd613e3069" -} \ No newline at end of file diff --git a/fixture/components/component/type/1.0.0/index.js b/fixture/components/component/type/1.0.0/index.js deleted file mode 100644 index 0e0e3aa..0000000 --- a/fixture/components/component/type/1.0.0/index.js +++ /dev/null @@ -1,32 +0,0 @@ - -/** - * toString ref. - */ - -var toString = Object.prototype.toString; - -/** - * Return the type of `val`. - * - * @param {Mixed} val - * @return {String} - * @api public - */ - -module.exports = function(val){ - switch (toString.call(val)) { - case '[object Function]': return 'function'; - case '[object Date]': return 'date'; - case '[object RegExp]': return 'regexp'; - case '[object Arguments]': return 'arguments'; - case '[object Array]': return 'array'; - case '[object String]': return 'string'; - } - - if (val === null) return 'null'; - if (val === undefined) return 'undefined'; - if (val && val.nodeType === 1) return 'element'; - if (val === Object(val)) return 'object'; - - return typeof val; -}; diff --git a/fixture/components/component/type/v1.2.0/component.json b/fixture/components/component/type/v1.2.0/component.json deleted file mode 100644 index 9b6e3fa..0000000 --- a/fixture/components/component/type/v1.2.0/component.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "type", - "description": "Cross-browser type assertions (less broken typeof)", - "version": "1.2.0", - "keywords": [ - "typeof", - "type", - "utility" - ], - "dependencies": {}, - "development": { - "dependencies": { - "component/assert": "*" - } - }, - "scripts": [ - "index.js" - ], - "repository": "component/type", - "resolved": "168462c30c13a5f777974e336c2e18d6ead64ef5" -} \ No newline at end of file diff --git a/fixture/components/component/type/v1.2.0/index.js b/fixture/components/component/type/v1.2.0/index.js deleted file mode 100644 index 906a34b..0000000 --- a/fixture/components/component/type/v1.2.0/index.js +++ /dev/null @@ -1,36 +0,0 @@ -/** - * toString ref. - */ - -var toString = Object.prototype.toString; - -/** - * Return the type of `val`. - * - * @param {Mixed} val - * @return {String} - * @api public - */ - -module.exports = function(val){ - switch (toString.call(val)) { - case '[object Date]': return 'date'; - case '[object RegExp]': return 'regexp'; - case '[object Arguments]': return 'arguments'; - case '[object Array]': return 'array'; - case '[object Error]': return 'error'; - } - - if (val === null) return 'null'; - if (val === undefined) return 'undefined'; - if (val !== val) return 'nan'; - if (val && val.nodeType === 1) return 'element'; - - if (typeof Buffer != 'undefined' && Buffer.isBuffer(val)) return 'buffer'; - - val = val.valueOf - ? val.valueOf() - : Object.prototype.valueOf.apply(val) - - return typeof val; -}; diff --git a/fixture/components/component/within-document/0.0.1/component.json b/fixture/components/component/within-document/0.0.1/component.json deleted file mode 100644 index b1f3f64..0000000 --- a/fixture/components/component/within-document/0.0.1/component.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "within-document", - "description": "check if an element is within the document", - "version": "0.0.1", - "keywords": [ - "dom" - ], - "dependencies": {}, - "development": {}, - "scripts": [ - "index.js" - ], - "repository": "component/within-document", - "resolved": "4a8208425915c7302291f835c242b38e4d690703" -} \ No newline at end of file diff --git a/fixture/components/component/within-document/0.0.1/index.js b/fixture/components/component/within-document/0.0.1/index.js deleted file mode 100644 index 89c584c..0000000 --- a/fixture/components/component/within-document/0.0.1/index.js +++ /dev/null @@ -1,16 +0,0 @@ - -/** - * Check if `el` is within the document. - * - * @param {Element} el - * @return {Boolean} - * @api private - */ - -module.exports = function(el) { - var node = el; - while (node = node.parentNode) { - if (node == document) return true; - } - return false; -}; \ No newline at end of file diff --git a/fixture/components/ianstormtaylor/to-camel-case/0.2.1/component.json b/fixture/components/ianstormtaylor/to-camel-case/0.2.1/component.json deleted file mode 100644 index d5bb546..0000000 --- a/fixture/components/ianstormtaylor/to-camel-case/0.2.1/component.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name": "to-camel-case", - "license": "MIT", - "version": "0.2.1", - "description": "Convert a string to a camel case.", - "keywords": [ - "camel", - "case", - "camelcase", - "string" - ], - "dependencies": { - "ianstormtaylor/to-space-case": "0.1.2" - }, - "development": { - "dependencies": { - "component/assert": "*" - } - }, - "scripts": [ - "index.js" - ], - "repository": "ianstormtaylor/to-camel-case", - "resolved": "02759f7dcf1b3a9c05568183dc14c738d2a0e229" -} \ No newline at end of file diff --git a/fixture/components/ianstormtaylor/to-camel-case/0.2.1/index.js b/fixture/components/ianstormtaylor/to-camel-case/0.2.1/index.js deleted file mode 100644 index e788778..0000000 --- a/fixture/components/ianstormtaylor/to-camel-case/0.2.1/index.js +++ /dev/null @@ -1,24 +0,0 @@ - -var toSpace = require('to-space-case'); - - -/** - * Expose `toCamelCase`. - */ - -module.exports = toCamelCase; - - -/** - * Convert a `string` to camel case. - * - * @param {String} string - * @return {String} - */ - - -function toCamelCase (string) { - return toSpace(string).replace(/\s(\w)/g, function (matches, letter) { - return letter.toUpperCase(); - }); -} \ No newline at end of file diff --git a/fixture/components/ianstormtaylor/to-no-case/0.1.0/component.json b/fixture/components/ianstormtaylor/to-no-case/0.1.0/component.json deleted file mode 100644 index 02950b5..0000000 --- a/fixture/components/ianstormtaylor/to-no-case/0.1.0/component.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "name": "to-no-case", - "license": "MIT", - "version": "0.1.0", - "description": "Remove an existing case from a string.", - "keywords": [ - "case", - "remove", - "camel", - "camelcase", - "snake", - "snakecase", - "slug", - "slugcase", - "string" - ], - "development": { - "dependencies": { - "component/assert": "*" - } - }, - "scripts": [ - "index.js" - ], - "repository": "ianstormtaylor/to-no-case", - "resolved": "297a62d594f71efcdd75ed44a27b3e6c751faa2b" -} \ No newline at end of file diff --git a/fixture/components/ianstormtaylor/to-no-case/0.1.0/index.js b/fixture/components/ianstormtaylor/to-no-case/0.1.0/index.js deleted file mode 100644 index 36a2094..0000000 --- a/fixture/components/ianstormtaylor/to-no-case/0.1.0/index.js +++ /dev/null @@ -1,74 +0,0 @@ - -/** - * Expose `toNoCase`. - */ - -module.exports = toNoCase; - - -/** - * Test whether a string is camel-case. - */ - -var hasSpace = /\s/; -var hasCamel = /[a-z][A-Z]/; -var hasSeparator = /[\W_]/; - - -/** - * Remove any starting case from a `string`, like camel or snake, but keep - * spaces and punctuation that may be important otherwise. - * - * @param {String} string - * @return {String} - */ - -function toNoCase (string) { - if (hasSpace.test(string)) return string.toLowerCase(); - - if (hasSeparator.test(string)) string = unseparate(string); - if (hasCamel.test(string)) string = uncamelize(string); - return string.toLowerCase(); -} - - -/** - * Separator splitter. - */ - -var separatorSplitter = /[\W_]+(.|$)/g; - - -/** - * Un-separate a `string`. - * - * @param {String} string - * @return {String} - */ - -function unseparate (string) { - return string.replace(separatorSplitter, function (m, next) { - return next ? ' ' + next : ''; - }); -} - - -/** - * Camelcase splitter. - */ - -var camelSplitter = /(.)([A-Z]+)/g; - - -/** - * Un-camelcase a `string`. - * - * @param {String} string - * @return {String} - */ - -function uncamelize (string) { - return string.replace(camelSplitter, function (m, previous, uppers) { - return previous + ' ' + uppers.toLowerCase().split('').join(' '); - }); -} \ No newline at end of file diff --git a/fixture/components/ianstormtaylor/to-space-case/0.1.2/component.json b/fixture/components/ianstormtaylor/to-space-case/0.1.2/component.json deleted file mode 100644 index 5f59ff2..0000000 --- a/fixture/components/ianstormtaylor/to-space-case/0.1.2/component.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name": "to-space-case", - "license": "MIT", - "version": "0.1.2", - "description": "Convert a string to a space case.", - "keywords": [ - "space", - "case", - "spacecase", - "string" - ], - "dependencies": { - "ianstormtaylor/to-no-case": "0.1.0" - }, - "development": { - "dependencies": { - "component/assert": "*" - } - }, - "scripts": [ - "index.js" - ], - "repository": "ianstormtaylor/to-space-case", - "resolved": "b083e4329693941d57304707b7375d7fc2f1a4d5" -} \ No newline at end of file diff --git a/fixture/components/ianstormtaylor/to-space-case/0.1.2/index.js b/fixture/components/ianstormtaylor/to-space-case/0.1.2/index.js deleted file mode 100644 index ef2b8b2..0000000 --- a/fixture/components/ianstormtaylor/to-space-case/0.1.2/index.js +++ /dev/null @@ -1,24 +0,0 @@ - -var clean = require('to-no-case'); - - -/** - * Expose `toSpaceCase`. - */ - -module.exports = toSpaceCase; - - -/** - * Convert a `string` to space case. - * - * @param {String} string - * @return {String} - */ - - -function toSpaceCase (string) { - return clean(string).replace(/[\W_]+(.|$)/g, function (matches, match) { - return match ? ' ' + match : ''; - }); -} \ No newline at end of file diff --git a/fixture/components/rauchg/ms.js/0.7.1/component.json b/fixture/components/rauchg/ms.js/0.7.1/component.json deleted file mode 100644 index 34ffbd4..0000000 --- a/fixture/components/rauchg/ms.js/0.7.1/component.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "ms", - "version": "0.7.1", - "description": "ms parsing / formatting", - "keywords": [ - "ms", - "parse", - "format" - ], - "scripts": [ - "index.js" - ], - "license": "MIT", - "repository": "guille/ms.js", - "resolved": "713dcf26d9e6fd9dbc95affe7eff9783b7f1b909" -} \ No newline at end of file diff --git a/fixture/components/rauchg/ms.js/0.7.1/index.js b/fixture/components/rauchg/ms.js/0.7.1/index.js deleted file mode 100644 index 4f92771..0000000 --- a/fixture/components/rauchg/ms.js/0.7.1/index.js +++ /dev/null @@ -1,125 +0,0 @@ -/** - * Helpers. - */ - -var s = 1000; -var m = s * 60; -var h = m * 60; -var d = h * 24; -var y = d * 365.25; - -/** - * Parse or format the given `val`. - * - * Options: - * - * - `long` verbose formatting [false] - * - * @param {String|Number} val - * @param {Object} options - * @return {String|Number} - * @api public - */ - -module.exports = function(val, options){ - options = options || {}; - if ('string' == typeof val) return parse(val); - return options.long - ? long(val) - : short(val); -}; - -/** - * Parse the given `str` and return milliseconds. - * - * @param {String} str - * @return {Number} - * @api private - */ - -function parse(str) { - str = '' + str; - if (str.length > 10000) return; - var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(str); - if (!match) return; - var n = parseFloat(match[1]); - var type = (match[2] || 'ms').toLowerCase(); - switch (type) { - case 'years': - case 'year': - case 'yrs': - case 'yr': - case 'y': - return n * y; - case 'days': - case 'day': - case 'd': - return n * d; - case 'hours': - case 'hour': - case 'hrs': - case 'hr': - case 'h': - return n * h; - case 'minutes': - case 'minute': - case 'mins': - case 'min': - case 'm': - return n * m; - case 'seconds': - case 'second': - case 'secs': - case 'sec': - case 's': - return n * s; - case 'milliseconds': - case 'millisecond': - case 'msecs': - case 'msec': - case 'ms': - return n; - } -} - -/** - * Short format for `ms`. - * - * @param {Number} ms - * @return {String} - * @api private - */ - -function short(ms) { - if (ms >= d) return Math.round(ms / d) + 'd'; - if (ms >= h) return Math.round(ms / h) + 'h'; - if (ms >= m) return Math.round(ms / m) + 'm'; - if (ms >= s) return Math.round(ms / s) + 's'; - return ms + 'ms'; -} - -/** - * Long format for `ms`. - * - * @param {Number} ms - * @return {String} - * @api private - */ - -function long(ms) { - return plural(ms, d, 'day') - || plural(ms, h, 'hour') - || plural(ms, m, 'minute') - || plural(ms, s, 'second') - || ms + ' ms'; -} - -/** - * Pluralization helper. - */ - -function plural(ms, n, name) { - if (ms < n) return; - if (ms < n * 1.5) return Math.floor(ms / n) + ' ' + name; - return Math.ceil(ms / n) + ' ' + name + 's'; -} diff --git a/fixture/components/stephenmathieson/normalize/0.0.1/component.json b/fixture/components/stephenmathieson/normalize/0.0.1/component.json deleted file mode 100644 index 0726ac7..0000000 --- a/fixture/components/stephenmathieson/normalize/0.0.1/component.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "normalize", - "description": "Normalize events", - "version": "0.0.1", - "keywords": [], - "dependencies": {}, - "development": { - "dependencies": { - "component/event": "*" - } - }, - "license": "MIT", - "main": "index.js", - "scripts": [ - "index.js" - ], - "repository": "stephenmathieson/normalize", - "resolved": "37e14f03f454526f2425731cded883d55ee0b1ff" -} \ No newline at end of file diff --git a/fixture/components/stephenmathieson/normalize/0.0.1/index.js b/fixture/components/stephenmathieson/normalize/0.0.1/index.js deleted file mode 100644 index ec2aa28..0000000 --- a/fixture/components/stephenmathieson/normalize/0.0.1/index.js +++ /dev/null @@ -1,47 +0,0 @@ - -/** - * Normalize the events provided to `fn` - * - * @api public - * @param {Function|Event} fn - * @return {Function|Event} - */ - -exports = module.exports = function (fn) { - // handle functions which are passed an event - if (typeof fn === 'function') { - return function (event) { - event = exports.normalize(event); - fn.call(this, event); - }; - } - - // just normalize the event - return exports.normalize(fn); -}; - -/** - * Normalize the given `event` - * - * @api private - * @param {Event} event - * @return {Event} - */ - -exports.normalize = function (event) { - event = event || window.event; - - event.target = event.target || event.srcElement; - - event.which = event.which || event.keyCode || event.charCode; - - event.preventDefault = event.preventDefault || function () { - this.returnValue = false; - }; - - event.stopPropagation = event.stopPropagation || function () { - this.cancelBubble = true; - }; - - return event; -}; diff --git a/fixture/components/visionmedia/debug/2.2.0/browser.js b/fixture/components/visionmedia/debug/2.2.0/browser.js deleted file mode 100644 index 7c76452..0000000 --- a/fixture/components/visionmedia/debug/2.2.0/browser.js +++ /dev/null @@ -1,168 +0,0 @@ - -/** - * This is the web browser implementation of `debug()`. - * - * Expose `debug()` as the module. - */ - -exports = module.exports = require('./debug'); -exports.log = log; -exports.formatArgs = formatArgs; -exports.save = save; -exports.load = load; -exports.useColors = useColors; -exports.storage = 'undefined' != typeof chrome - && 'undefined' != typeof chrome.storage - ? chrome.storage.local - : localstorage(); - -/** - * Colors. - */ - -exports.colors = [ - 'lightseagreen', - 'forestgreen', - 'goldenrod', - 'dodgerblue', - 'darkorchid', - 'crimson' -]; - -/** - * Currently only WebKit-based Web Inspectors, Firefox >= v31, - * and the Firebug extension (any Firefox version) are known - * to support "%c" CSS customizations. - * - * TODO: add a `localStorage` variable to explicitly enable/disable colors - */ - -function useColors() { - // is webkit? http://stackoverflow.com/a/16459606/376773 - return ('WebkitAppearance' in document.documentElement.style) || - // is firebug? http://stackoverflow.com/a/398120/376773 - (window.console && (console.firebug || (console.exception && console.table))) || - // is firefox >= v31? - // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages - (navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31); -} - -/** - * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. - */ - -exports.formatters.j = function(v) { - return JSON.stringify(v); -}; - - -/** - * Colorize log arguments if enabled. - * - * @api public - */ - -function formatArgs() { - var args = arguments; - var useColors = this.useColors; - - args[0] = (useColors ? '%c' : '') - + this.namespace - + (useColors ? ' %c' : ' ') - + args[0] - + (useColors ? '%c ' : ' ') - + '+' + exports.humanize(this.diff); - - if (!useColors) return args; - - var c = 'color: ' + this.color; - args = [args[0], c, 'color: inherit'].concat(Array.prototype.slice.call(args, 1)); - - // the final "%c" is somewhat tricky, because there could be other - // arguments passed either before or after the %c, so we need to - // figure out the correct index to insert the CSS into - var index = 0; - var lastC = 0; - args[0].replace(/%[a-z%]/g, function(match) { - if ('%%' === match) return; - index++; - if ('%c' === match) { - // we only are interested in the *last* %c - // (the user may have provided their own) - lastC = index; - } - }); - - args.splice(lastC, 0, c); - return args; -} - -/** - * Invokes `console.log()` when available. - * No-op when `console.log` is not a "function". - * - * @api public - */ - -function log() { - // this hackery is required for IE8/9, where - // the `console.log` function doesn't have 'apply' - return 'object' === typeof console - && console.log - && Function.prototype.apply.call(console.log, console, arguments); -} - -/** - * Save `namespaces`. - * - * @param {String} namespaces - * @api private - */ - -function save(namespaces) { - try { - if (null == namespaces) { - exports.storage.removeItem('debug'); - } else { - exports.storage.debug = namespaces; - } - } catch(e) {} -} - -/** - * Load `namespaces`. - * - * @return {String} returns the previously persisted debug modes - * @api private - */ - -function load() { - var r; - try { - r = exports.storage.debug; - } catch(e) {} - return r; -} - -/** - * Enable namespaces listed in `localStorage.debug` initially. - */ - -exports.enable(load()); - -/** - * Localstorage attempts to return the localstorage. - * - * This is necessary because safari throws - * when a user disables cookies/localstorage - * and you attempt to access it. - * - * @return {LocalStorage} - * @api private - */ - -function localstorage(){ - try { - return window.localStorage; - } catch (e) {} -} diff --git a/fixture/components/visionmedia/debug/2.2.0/component.json b/fixture/components/visionmedia/debug/2.2.0/component.json deleted file mode 100644 index e957e5c..0000000 --- a/fixture/components/visionmedia/debug/2.2.0/component.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "debug", - "description": "small debugging utility", - "version": "2.2.0", - "keywords": [ - "debug", - "log", - "debugger" - ], - "main": "browser.js", - "scripts": [ - "browser.js", - "debug.js" - ], - "dependencies": { - "rauchg/ms.js": "0.7.1" - }, - "repository": "visionmedia/debug", - "resolved": "b38458422b5aa8aa6d286b10dfe427e8a67e2b35" -} \ No newline at end of file diff --git a/fixture/components/visionmedia/debug/2.2.0/debug.js b/fixture/components/visionmedia/debug/2.2.0/debug.js deleted file mode 100644 index 7571a86..0000000 --- a/fixture/components/visionmedia/debug/2.2.0/debug.js +++ /dev/null @@ -1,197 +0,0 @@ - -/** - * This is the common logic for both the Node.js and web browser - * implementations of `debug()`. - * - * Expose `debug()` as the module. - */ - -exports = module.exports = debug; -exports.coerce = coerce; -exports.disable = disable; -exports.enable = enable; -exports.enabled = enabled; -exports.humanize = require('ms'); - -/** - * The currently active debug mode names, and names to skip. - */ - -exports.names = []; -exports.skips = []; - -/** - * Map of special "%n" handling functions, for the debug "format" argument. - * - * Valid key names are a single, lowercased letter, i.e. "n". - */ - -exports.formatters = {}; - -/** - * Previously assigned color. - */ - -var prevColor = 0; - -/** - * Previous log timestamp. - */ - -var prevTime; - -/** - * Select a color. - * - * @return {Number} - * @api private - */ - -function selectColor() { - return exports.colors[prevColor++ % exports.colors.length]; -} - -/** - * Create a debugger with the given `namespace`. - * - * @param {String} namespace - * @return {Function} - * @api public - */ - -function debug(namespace) { - - // define the `disabled` version - function disabled() { - } - disabled.enabled = false; - - // define the `enabled` version - function enabled() { - - var self = enabled; - - // set `diff` timestamp - var curr = +new Date(); - var ms = curr - (prevTime || curr); - self.diff = ms; - self.prev = prevTime; - self.curr = curr; - prevTime = curr; - - // add the `color` if not set - if (null == self.useColors) self.useColors = exports.useColors(); - if (null == self.color && self.useColors) self.color = selectColor(); - - var args = Array.prototype.slice.call(arguments); - - args[0] = exports.coerce(args[0]); - - if ('string' !== typeof args[0]) { - // anything else let's inspect with %o - args = ['%o'].concat(args); - } - - // apply any `formatters` transformations - var index = 0; - args[0] = args[0].replace(/%([a-z%])/g, function(match, format) { - // if we encounter an escaped % then don't increase the array index - if (match === '%%') return match; - index++; - var formatter = exports.formatters[format]; - if ('function' === typeof formatter) { - var val = args[index]; - match = formatter.call(self, val); - - // now we need to remove `args[index]` since it's inlined in the `format` - args.splice(index, 1); - index--; - } - return match; - }); - - if ('function' === typeof exports.formatArgs) { - args = exports.formatArgs.apply(self, args); - } - var logFn = enabled.log || exports.log || console.log.bind(console); - logFn.apply(self, args); - } - enabled.enabled = true; - - var fn = exports.enabled(namespace) ? enabled : disabled; - - fn.namespace = namespace; - - return fn; -} - -/** - * Enables a debug mode by namespaces. This can include modes - * separated by a colon and wildcards. - * - * @param {String} namespaces - * @api public - */ - -function enable(namespaces) { - exports.save(namespaces); - - var split = (namespaces || '').split(/[\s,]+/); - var len = split.length; - - for (var i = 0; i < len; i++) { - if (!split[i]) continue; // ignore empty strings - namespaces = split[i].replace(/\*/g, '.*?'); - if (namespaces[0] === '-') { - exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); - } else { - exports.names.push(new RegExp('^' + namespaces + '$')); - } - } -} - -/** - * Disable debug output. - * - * @api public - */ - -function disable() { - exports.enable(''); -} - -/** - * Returns true if the given mode name is enabled, false otherwise. - * - * @param {String} name - * @return {Boolean} - * @api public - */ - -function enabled(name) { - var i, len; - for (i = 0, len = exports.skips.length; i < len; i++) { - if (exports.skips[i].test(name)) { - return false; - } - } - for (i = 0, len = exports.names.length; i < len; i++) { - if (exports.names[i].test(name)) { - return true; - } - } - return false; -} - -/** - * Coerce `val`. - * - * @param {Mixed} val - * @return {Mixed} - * @api private - */ - -function coerce(val) { - if (val instanceof Error) return val.stack || val.message; - return val; -} diff --git a/fixture/components/webmodules/bounding-client-rect/1.0.5/component.json b/fixture/components/webmodules/bounding-client-rect/1.0.5/component.json deleted file mode 100644 index ae4256a..0000000 --- a/fixture/components/webmodules/bounding-client-rect/1.0.5/component.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name": "bounding-client-rect", - "version": "1.0.5", - "description": "Cross-browser `getBoundingClientRect()` for all Node types", - "keywords": [ - "browser", - "bounding", - "client", - "rect", - "getBoundingClientRect", - "TextRectangle", - "TextNode", - "Node", - "Range", - "HTMLElement" - ], - "main": "index.js", - "author": "Nathan Rajlich ", - "license": "MIT", - "scripts": [ - "index.js" - ], - "dependencies": { - "webmodules/get-document": "1.0.0" - }, - "repository": "webmodules/bounding-client-rect", - "resolved": "b0f8a679ac05b3a7b9942dfc0be19473110197f8" -} \ No newline at end of file diff --git a/fixture/components/webmodules/bounding-client-rect/1.0.5/index.js b/fixture/components/webmodules/bounding-client-rect/1.0.5/index.js deleted file mode 100644 index acc971f..0000000 --- a/fixture/components/webmodules/bounding-client-rect/1.0.5/index.js +++ /dev/null @@ -1,57 +0,0 @@ - -/** - * Module dependencies. - */ - -var getDocument = require('get-document'); - -/** - * Module exports. - */ - -module.exports = getBoundingClientRect; - -/** - * Returns the "bounding client rectangle" of the given `TextNode`, - * `HTMLElement`, or `Range`. - * - * @param {Node} node - * @return {TextRectangle} - * @public - */ - -function getBoundingClientRect (node) { - var rect = null; - var doc = getDocument(node); - - if (node.nodeType === 3 /* TEXT_NODE */) { - // see: http://stackoverflow.com/a/6966613/376773 - var range = doc.createRange(); - range.selectNodeContents(node); - node = range; - } - - if ('function' === typeof node.getBoundingClientRect) { - rect = node.getBoundingClientRect(); - - if (node.startContainer && rect.left === 0 && rect.top === 0) { - // Range instances sometimes report all `0`s - // see: http://stackoverflow.com/a/6847328/376773 - var span = doc.createElement('span'); - - // Ensure span has dimensions and position by - // adding a zero-width space character - span.appendChild(doc.createTextNode('\u200b')); - node.insertNode(span); - rect = span.getBoundingClientRect(); - - // Remove temp SPAN and glue any broken text nodes back together - var spanParent = span.parentNode; - spanParent.removeChild(span); - spanParent.normalize(); - } - - } - - return rect; -} diff --git a/fixture/components/webmodules/get-document/1.0.0/component.json b/fixture/components/webmodules/get-document/1.0.0/component.json deleted file mode 100644 index 3bc7a04..0000000 --- a/fixture/components/webmodules/get-document/1.0.0/component.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "get-document", - "version": "1.0.0", - "description": "Returns the `document` object from a DOM object", - "keywords": [ - "dom", - "document", - "node", - "range", - "element", - "browser" - ], - "main": "index.js", - "scripts": [ - "index.js" - ], - "dependencies": {}, - "repository": "webmodules/get-document", - "resolved": "1ba68f43808a24a721307ce67f188c9eb38d1747" -} \ No newline at end of file diff --git a/fixture/components/webmodules/get-document/1.0.0/index.js b/fixture/components/webmodules/get-document/1.0.0/index.js deleted file mode 100644 index 028211d..0000000 --- a/fixture/components/webmodules/get-document/1.0.0/index.js +++ /dev/null @@ -1,57 +0,0 @@ - -/** - * Module exports. - */ - -module.exports = getDocument; - -// defined by w3c -var DOCUMENT_NODE = 9; - -/** - * Returns `true` if `w` is a Document object, or `false` otherwise. - * - * @param {?} d - Document object, maybe - * @return {Boolean} - * @private - */ - -function isDocument (d) { - return d && d.nodeType === DOCUMENT_NODE; -} - -/** - * Returns the `document` object associated with the given `node`, which may be - * a DOM element, the Window object, a Selection, a Range. Basically any DOM - * object that references the Document in some way, this function will find it. - * - * @param {Mixed} node - DOM node, selection, or range in which to find the `document` object - * @return {Document} the `document` object associated with `node` - * @public - */ - -function getDocument(node) { - if (isDocument(node)) { - return node; - - } else if (isDocument(node.ownerDocument)) { - return node.ownerDocument; - - } else if (isDocument(node.document)) { - return node.document; - - } else if (node.parentNode) { - return getDocument(node.parentNode); - - // Range support - } else if (node.commonAncestorContainer) { - return getDocument(node.commonAncestorContainer); - - } else if (node.startContainer) { - return getDocument(node.startContainer); - - // Selection support - } else if (node.anchorNode) { - return getDocument(node.anchorNode); - } -} diff --git a/fixture/components/yields/empty/0.0.1/component.json b/fixture/components/yields/empty/0.0.1/component.json deleted file mode 100644 index e0aa4b0..0000000 --- a/fixture/components/yields/empty/0.0.1/component.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "empty", - "description": "empty an element.", - "version": "0.0.1", - "keywords": [ - "empty" - ], - "dependencies": {}, - "development": { - "dependencies": { - "visionmedia/mocha": "*" - } - }, - "license": "MIT", - "main": "index.js", - "scripts": [ - "index.js" - ], - "repository": "yields/empty", - "resolved": "2859e4348e7b3a7268655397b959b850f7376dd5" -} \ No newline at end of file diff --git a/fixture/components/yields/empty/0.0.1/index.js b/fixture/components/yields/empty/0.0.1/index.js deleted file mode 100644 index 24ebeb8..0000000 --- a/fixture/components/yields/empty/0.0.1/index.js +++ /dev/null @@ -1,12 +0,0 @@ - -/** - * Empty the given `el`. - * - * @param {Element} el - * @return {Element} - */ - -module.exports = function(el, node){ - while (node = el.firstChild) el.removeChild(node); - return el; -};