Skip to content

Commit

Permalink
Initial structure and dev setup
Browse files Browse the repository at this point in the history
  • Loading branch information
abpetkov committed Jan 20, 2014
0 parents commit e6fe361
Show file tree
Hide file tree
Showing 563 changed files with 65,680 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
components
build
Empty file added History.md
Empty file.
89 changes: 89 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
#
# Variables
#

NAME = Powerange

#
# Paths
#

COMPONENT_BUILD = node_modules/.bin/component-build
COMPONENT_INSTALL = node_modules/.bin/component-install
UGLIFYJS = node_modules/uglify-js/bin/uglifyjs
UGLIFYCSS = node_modules/uglifycss/uglifycss
JS_DEST = dist/powerange.js
JS_MIN_DEST = dist/powerange.min.js
CSS_DEST = dist/powerange.css
CSS_MIN_DEST = dist/powerange.min.css

#
# All
#

all: install

#
# Install
#

install: node_modules components build

#
# Make a new development build
#

build: components powerange.js powerange.css
@$(COMPONENT_BUILD) --dev

#
# Install components (+ dev)
#

components: component.json
@$(COMPONENT_INSTALL) --dev

#
# Make a standalone version that doesn't depend on component etc.
#

standalone: build components
@$(COMPONENT_BUILD) -s $(NAME) -o .
@mv build.js $(JS_DEST)
@mv build.css $(CSS_DEST)
@$(UGLIFYJS) $(JS_DEST) --output $(JS_MIN_DEST)
@$(UGLIFYCSS) $(CSS_DEST) > $(CSS_MIN_DEST)

#
# Install Node.js modules
#

node_modules:
@npm install

#
# Clean all
#

clean: clean-components clean-node

#
# Clean components & build
#

clean-components:
@rm -rf build
@rm -rf components

#
# Clean the installed Node.js modules
#

clean-node:
@rm -rf node_modules

#
# Instructions
#

.PHONY: clean build components
4 changes: 4 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Powerange WIP

Module to create iOS 7 like range sliders

17 changes: 17 additions & 0 deletions component.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "powerange"
, "repo": "abpetkov/powerange"
, "description": "Module to create iOS 7 like range sliders"
, "version": "0.0.1"
, "keywords": []
, "dependencies": {}
, "development": {}
, "license": "MIT"
, "main": "powerange.js"
, "scripts": [
"powerange.js"
]
, "styles": [
"powerange.css"
]
}
3 changes: 3 additions & 0 deletions dist/powerange.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
body {
font-size: 14px;
}
212 changes: 212 additions & 0 deletions dist/powerange.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,212 @@
;(function(){

/**
* Require the given path.
*
* @param {String} path
* @return {Object} exports
* @api public
*/

function require(path, parent, orig) {
var resolved = require.resolve(path);

// lookup failed
if (null == resolved) {
orig = orig || path;
parent = parent || 'root';
var err = new Error('Failed to require "' + orig + '" from "' + parent + '"');
err.path = orig;
err.parent = parent;
err.require = true;
throw err;
}

var module = require.modules[resolved];

// perform real require()
// by invoking the module's
// registered function
if (!module._resolving && !module.exports) {
var mod = {};
mod.exports = {};
mod.client = mod.component = true;
module._resolving = true;
module.call(this, mod.exports, require.relative(resolved), mod);
delete module._resolving;
module.exports = mod.exports;
}

return module.exports;
}

/**
* Registered modules.
*/

require.modules = {};

/**
* Registered aliases.
*/

require.aliases = {};

/**
* Resolve `path`.
*
* Lookup:
*
* - PATH/index.js
* - PATH.js
* - PATH
*
* @param {String} path
* @return {String} path or null
* @api private
*/

require.resolve = function(path) {
if (path.charAt(0) === '/') path = path.slice(1);

var paths = [
path,
path + '.js',
path + '.json',
path + '/index.js',
path + '/index.json'
];

for (var i = 0; i < paths.length; i++) {
var path = paths[i];
if (require.modules.hasOwnProperty(path)) return path;
if (require.aliases.hasOwnProperty(path)) return require.aliases[path];
}
};

/**
* Normalize `path` relative to the current path.
*
* @param {String} curr
* @param {String} path
* @return {String}
* @api private
*/

require.normalize = function(curr, path) {
var segs = [];

if ('.' != path.charAt(0)) return path;

curr = curr.split('/');
path = path.split('/');

for (var i = 0; i < path.length; ++i) {
if ('..' == path[i]) {
curr.pop();
} else if ('.' != path[i] && '' != path[i]) {
segs.push(path[i]);
}
}

return curr.concat(segs).join('/');
};

/**
* Register module at `path` with callback `definition`.
*
* @param {String} path
* @param {Function} definition
* @api private
*/

require.register = function(path, definition) {
require.modules[path] = definition;
};

/**
* Alias a module definition.
*
* @param {String} from
* @param {String} to
* @api private
*/

require.alias = function(from, to) {
if (!require.modules.hasOwnProperty(from)) {
throw new Error('Failed to alias "' + from + '", it does not exist');
}
require.aliases[to] = from;
};

/**
* Return a require function relative to the `parent` path.
*
* @param {String} parent
* @return {Function}
* @api private
*/

require.relative = function(parent) {
var p = require.normalize(parent, '..');

/**
* lastIndexOf helper.
*/

function lastIndexOf(arr, obj) {
var i = arr.length;
while (i--) {
if (arr[i] === obj) return i;
}
return -1;
}

/**
* The relative require() itself.
*/

function localRequire(path) {
var resolved = localRequire.resolve(path);
return require(resolved, parent, path);
}

/**
* Resolve relative to the parent.
*/

localRequire.resolve = function(path) {
var c = path.charAt(0);
if ('/' == c) return path.slice(1);
if ('.' == c) return require.normalize(p, path);

// resolve deps by returning
// the dep in the nearest "deps"
// directory
var segs = parent.split('/');
var i = lastIndexOf(segs, 'deps') + 1;
if (!i) i = 0;
path = segs.slice(0, i + 1).join('/') + '/deps/' + path;
return path;
};

/**
* Check if module is defined at `path`.
*/

localRequire.exists = function(path) {
return require.modules.hasOwnProperty(localRequire.resolve(path));
};

return localRequire;
};
require.register("powerange/powerange.js", function(exports, require, module){

});
require.alias("powerange/powerange.js", "powerange/index.js");if (typeof exports == "object") {
module.exports = require("powerange");
} else if (typeof define == "function" && define.amd) {
define(function(){ return require("powerange"); });
} else {
this["Powerange"] = require("powerange");
}})();
1 change: 1 addition & 0 deletions dist/powerange.min.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
body{font-size:14px}
1 change: 1 addition & 0 deletions dist/powerange.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions examples/browserify.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
* Powerange example.
*
* In order for this to work, with Browserify (http://browserify.org/) already installed, execute the following command:
*
* browserify examples/browserify.js -o examples/bundle.js
*
*/

var powerange = require('../powerange');

window.onload = function() {
console.log(powerange);
};
Loading

0 comments on commit e6fe361

Please sign in to comment.