Skip to content

Commit

Permalink
v0.8.4
Browse files Browse the repository at this point in the history
  • Loading branch information
wilsonpage committed Jun 12, 2015
1 parent 8d48012 commit bab53e9
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 102 deletions.
2 changes: 1 addition & 1 deletion bower.json
@@ -1,6 +1,6 @@
{
"name": "gaia-header",
"version": "0.8.3",
"version": "0.8.4",
"homepage": "https://github.com/gaia-components/gaia-header",
"authors": [
"Wilson Page <wilsonpage@me.com>"
Expand Down
58 changes: 11 additions & 47 deletions dist/gaia-header-es5.js
Expand Up @@ -169,12 +169,14 @@
};
})("font-fit", this));
}, {}], 2: [function (require, module, exports) {
/* globals define */
;(function (define) {
"use strict";define(function (require, exports, module) {
define(function (require, exports, module) {
"use strict";

/**
* Locals
*/

var textContent = Object.getOwnPropertyDescriptor(Node.prototype, "textContent");
var innerHTML = Object.getOwnPropertyDescriptor(Element.prototype, "innerHTML");
var removeAttribute = Element.prototype.removeAttribute;
Expand All @@ -191,25 +193,13 @@
*/
exports.register = function (name, props) {
var baseProto = getBaseProto(props["extends"]);
var template = props.template || baseProto.templateString;

// Components are extensible by default but can be declared
// as non extensible as an optimization to avoid
// storing the template strings
var extensible = props.extensible = props.hasOwnProperty("extensible") ? props.extensible : true;

// Clean up
delete props["extends"];

// Pull out CSS that needs to be in the light-dom
if (template) {
// Stores the string to be reprocessed when
// a new component extends this one
if (extensible && props.template) {
props.templateString = props.template;
}

var output = processCss(template, name);
if (props.template) {
var output = processCss(props.template, name);

props.template = document.createElement("template");
props.template.innerHTML = output.template;
Expand All @@ -226,7 +216,7 @@

// Merge base getter/setter attributes with the user's,
// then define the property descriptors on the prototype.
var descriptors = mixin(props.attrs || {}, base.descriptors);
var descriptors = Object.assign(props.attrs || {}, base.descriptors);

// Store the orginal descriptors somewhere
// a little more private and delete the original
Expand Down Expand Up @@ -353,9 +343,7 @@
}
},

get: function get() {
return textContent.get();
}
get: textContent.get
},

innerHTML: {
Expand Down Expand Up @@ -383,9 +371,9 @@
* Returns a suitable prototype based
* on the object passed.
*
* @private
* @param {HTMLElementPrototype|undefined} proto
* @return {HTMLElementPrototype}
* @private
*/
function getBaseProto(proto) {
if (!proto) {
Expand All @@ -399,20 +387,18 @@
* Extends the given proto and mixes
* in the given properties.
*
* @private
* @param {Object} proto
* @param {Object} props
* @return {Object}
*/
function createProto(proto, props) {
return mixin(Object.create(proto), props);
return Object.assign(Object.create(proto), props);
}

/**
* Detects presence of shadow-dom
* CSS selectors.
*
* @private
* @return {Boolean}
*/
var hasShadowCSS = (function () {
Expand Down Expand Up @@ -443,7 +429,6 @@
* them to work from the <style scoped>
* injected at the root of the component.
*
* @private
* @return {String}
*/
function processCss(template, name) {
Expand Down Expand Up @@ -479,13 +464,10 @@
* <style> in the head of the
* document.
*
* @private
* @param {String} css
*/
function injectGlobalCss(css) {
if (!css) {
return;
}
if (!css) return;
var style = document.createElement("style");
style.innerHTML = css.trim();
headReady().then(function () {
Expand Down Expand Up @@ -542,7 +524,6 @@
*
* toCamelCase('foo-bar'); //=> 'fooBar'
*
* @private
* @param {Sring} string
* @return {String}
*/
Expand Down Expand Up @@ -584,23 +565,6 @@
document.dispatchEvent(new Event("dirchanged"));
}
}

/**
* Copy the values of all properties from
* source object `target` to a target object `source`.
* It will return the target object.
*
* @private
* @param {Object} target
* @param {Object} source
* @returns {Object}
*/
function mixin(target, source) {
for (var key in source) {
target[key] = source[key];
}
return target;
}
});
})(typeof define == "function" && define.amd ? define : (function (n, w) {
"use strict";return typeof module == "object" ? function (c) {
Expand Down
71 changes: 18 additions & 53 deletions dist/gaia-header.js
Expand Up @@ -133,13 +133,14 @@ c(require,exports,module);}:function(c){var m={exports:{}};c(function(n){
return w[n];},m.exports,m);w[n]=m.exports;};})('font-fit',this));

},{}],2:[function(require,module,exports){
/* globals define */
;(function(define){'use strict';define(function(require,exports,module){
;(function(define){define(function(require,exports,module){
'use strict';

/**
* Locals
*/
var textContent = Object.getOwnPropertyDescriptor(Node.prototype,
'textContent');

var textContent = Object.getOwnPropertyDescriptor(Node.prototype, 'textContent');
var innerHTML = Object.getOwnPropertyDescriptor(Element.prototype, 'innerHTML');
var removeAttribute = Element.prototype.removeAttribute;
var setAttribute = Element.prototype.setAttribute;
Expand All @@ -155,26 +156,13 @@ var noop = function() {};
*/
exports.register = function(name, props) {
var baseProto = getBaseProto(props.extends);
var template = props.template || baseProto.templateString;

// Components are extensible by default but can be declared
// as non extensible as an optimization to avoid
// storing the template strings
var extensible = props.extensible = props.hasOwnProperty('extensible')?
props.extensible : true;

// Clean up
delete props.extends;

// Pull out CSS that needs to be in the light-dom
if (template) {
// Stores the string to be reprocessed when
// a new component extends this one
if (extensible && props.template) {
props.templateString = props.template;
}

var output = processCss(template, name);
if (props.template) {
var output = processCss(props.template, name);

props.template = document.createElement('template');
props.template.innerHTML = output.template;
Expand All @@ -191,7 +179,7 @@ exports.register = function(name, props) {

// Merge base getter/setter attributes with the user's,
// then define the property descriptors on the prototype.
var descriptors = mixin(props.attrs || {}, base.descriptors);
var descriptors = Object.assign(props.attrs || {}, base.descriptors);

// Store the orginal descriptors somewhere
// a little more private and delete the original
Expand Down Expand Up @@ -306,9 +294,7 @@ var base = {
if (this.lightStyle) { this.appendChild(this.lightStyle); }
},

get: function() {
return textContent.get();
}
get: textContent.get
},

innerHTML: {
Expand All @@ -334,35 +320,34 @@ var defaultPrototype = createProto(HTMLElement.prototype, base.properties);
* Returns a suitable prototype based
* on the object passed.
*
* @private
* @param {HTMLElementPrototype|undefined} proto
* @return {HTMLElementPrototype}
* @private
*/
function getBaseProto(proto) {
if (!proto) { return defaultPrototype; }
proto = proto.prototype || proto;
return !proto.GaiaComponent ?
createProto(proto, base.properties) : proto;
return !proto.GaiaComponent
? createProto(proto, base.properties)
: proto;
}

/**
* Extends the given proto and mixes
* in the given properties.
*
* @private
* @param {Object} proto
* @param {Object} props
* @return {Object}
*/
function createProto(proto, props) {
return mixin(Object.create(proto), props);
return Object.assign(Object.create(proto), props);
}

/**
* Detects presence of shadow-dom
* CSS selectors.
*
* @private
* @return {Boolean}
*/
var hasShadowCSS = (function() {
Expand Down Expand Up @@ -390,7 +375,6 @@ var regex = {
* them to work from the <style scoped>
* injected at the root of the component.
*
* @private
* @return {String}
*/
function processCss(template, name) {
Expand Down Expand Up @@ -432,15 +416,14 @@ function processCss(template, name) {
* <style> in the head of the
* document.
*
* @private
* @param {String} css
*/
function injectGlobalCss(css) {
if (!css) {return;}
if (!css) return;
var style = document.createElement('style');
style.innerHTML = css.trim();
headReady().then(function() {
document.head.appendChild(style);
headReady().then(() => {
document.head.appendChild(style)
});
}

Expand All @@ -451,7 +434,7 @@ function injectGlobalCss(css) {
* @private
*/
function headReady() {
return new Promise(function(resolve) {
return new Promise(resolve => {
if (document.head) { return resolve(); }
window.addEventListener('load', function fn() {
window.removeEventListener('load', fn);
Expand Down Expand Up @@ -491,7 +474,6 @@ function injectLightCss(el) {
*
* toCamelCase('foo-bar'); //=> 'fooBar'
*
* @private
* @param {Sring} string
* @return {String}
*/
Expand Down Expand Up @@ -532,23 +514,6 @@ function addDirObserver() {
}
}

/**
* Copy the values of all properties from
* source object `target` to a target object `source`.
* It will return the target object.
*
* @private
* @param {Object} target
* @param {Object} source
* @returns {Object}
*/
function mixin(target, source) {
for (var key in source) {
target[key] = source[key];
}
return target;
}

});})(typeof define=='function'&&define.amd?define
:(function(n,w){'use strict';return typeof module=='object'?function(c){
c(require,exports,module);}:function(c){var m={exports:{}};c(function(n){
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "gaia-header",
"version": "0.8.3",
"version": "0.8.4",
"homepage": "https://github.com/gaia-components/gaia-header",
"license": "MIT",
"main": "gaia-header.js",
Expand Down

0 comments on commit bab53e9

Please sign in to comment.