Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
This commit is contained in:
parent
93e3a48004
commit
b38dea0597
25901 changed files with 9982925 additions and 369 deletions
36
gaia/apps/music/components/gaia-toolbar/.bower.json
Executable file
36
gaia/apps/music/components/gaia-toolbar/.bower.json
Executable file
|
|
@ -0,0 +1,36 @@
|
|||
{
|
||||
"name": "gaia-toolbar",
|
||||
"authors": [
|
||||
"Wilson Page <wilsonpage@me.com>"
|
||||
],
|
||||
"main": "script.js",
|
||||
"license": "MIT",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"examples",
|
||||
"test",
|
||||
"tests",
|
||||
"README.md"
|
||||
],
|
||||
"devDependencies": {
|
||||
"gaia-icons": "gaia-components/gaia-icons#~0.10.0",
|
||||
"gaia-theme": "gaia-components/gaia-theme#~0.5.0",
|
||||
"base": "gaia-components/base"
|
||||
},
|
||||
"dependencies": {
|
||||
"gaia-dialog": "gaia-components/gaia-dialog",
|
||||
"gaia-component": "gaia-components/gaia-component#~0.2.0"
|
||||
},
|
||||
"homepage": "https://github.com/gaia-components/gaia-toolbar",
|
||||
"_release": "474aab785d",
|
||||
"_resolution": {
|
||||
"type": "branch",
|
||||
"branch": "master",
|
||||
"commit": "474aab785d3899ae27eb08d165c7ab7799cb0c8f"
|
||||
},
|
||||
"_source": "git://github.com/gaia-components/gaia-toolbar.git",
|
||||
"_target": "master",
|
||||
"_originalSource": "gaia-components/gaia-toolbar"
|
||||
}
|
||||
27
gaia/apps/music/components/gaia-toolbar/bower.json
Executable file
27
gaia/apps/music/components/gaia-toolbar/bower.json
Executable file
|
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"name": "gaia-toolbar",
|
||||
"version": "0.0.0",
|
||||
"authors": [
|
||||
"Wilson Page <wilsonpage@me.com>"
|
||||
],
|
||||
"main": "script.js",
|
||||
"license": "MIT",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"examples",
|
||||
"test",
|
||||
"tests",
|
||||
"README.md"
|
||||
],
|
||||
"devDependencies": {
|
||||
"gaia-icons": "gaia-components/gaia-icons#~0.10.0",
|
||||
"gaia-theme": "gaia-components/gaia-theme#~0.5.0",
|
||||
"base": "gaia-components/base"
|
||||
},
|
||||
"dependencies": {
|
||||
"gaia-dialog": "gaia-components/gaia-dialog",
|
||||
"gaia-component": "gaia-components/gaia-component#~0.2.0"
|
||||
}
|
||||
}
|
||||
307
gaia/apps/music/components/gaia-toolbar/gaia-toolbar.js
Executable file
307
gaia/apps/music/components/gaia-toolbar/gaia-toolbar.js
Executable file
|
|
@ -0,0 +1,307 @@
|
|||
;(function(define){define(function(require,exports,module){
|
||||
/*jshint esnext:true*/
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Dependencies
|
||||
*/
|
||||
|
||||
var GaiaDialogMenu = require('gaia-dialog-menu');
|
||||
|
||||
/**
|
||||
* Locals
|
||||
*/
|
||||
|
||||
var forEach = [].forEach;
|
||||
var slice = [].slice;
|
||||
|
||||
/**
|
||||
* Extend from the `HTMLElement` prototype
|
||||
*
|
||||
* @type {Object}
|
||||
*/
|
||||
var proto = Object.create(HTMLElement.prototype);
|
||||
|
||||
proto.createdCallback = function() {
|
||||
this.createShadowRoot().innerHTML = template;
|
||||
|
||||
this.els = {
|
||||
inner: this.shadowRoot.querySelector('.inner'),
|
||||
moreButton: this.shadowRoot.querySelector('.more-button')
|
||||
};
|
||||
|
||||
this.els.moreButton.addEventListener('click', this.openOverflow.bind(this));
|
||||
|
||||
var self = this;
|
||||
this.reflow_raf = rafWrap(this.reflow, this);
|
||||
addEventListener('resize', this.reflow_raf);
|
||||
this.shadowStyleHack();
|
||||
|
||||
if (document.readyState === 'loading') {
|
||||
addEventListener('load', this.reflow.bind(this));
|
||||
return;
|
||||
}
|
||||
|
||||
this.style.visibility = 'hidden';
|
||||
self.reflow_raf();
|
||||
};
|
||||
|
||||
proto.attachedCallback = function() {
|
||||
this.style.visibility = 'hidden';
|
||||
this.reflow_raf();
|
||||
};
|
||||
|
||||
proto.reflow = function() {
|
||||
this.release();
|
||||
var overflow = this.getOverflowData();
|
||||
if (overflow.overflowed) { this.onOverflowed(overflow); }
|
||||
this.style.visibility = '';
|
||||
};
|
||||
|
||||
proto.getOverflowData = function() {
|
||||
var space = this.els.inner.clientWidth;
|
||||
var child = this.children[0];
|
||||
var overflowed = false;
|
||||
var willFit = 0;
|
||||
var total = 0;
|
||||
var overflow;
|
||||
var width;
|
||||
|
||||
while (child) {
|
||||
width = child.clientWidth;
|
||||
overflow = width + total - space;
|
||||
|
||||
if (overflow > 3) {
|
||||
overflowed = true;
|
||||
break;
|
||||
}
|
||||
|
||||
willFit++;
|
||||
total += width;
|
||||
child = child.nextElementSibling;
|
||||
}
|
||||
|
||||
return {
|
||||
willFit: willFit,
|
||||
remaining: space - total,
|
||||
overflowed: overflowed
|
||||
};
|
||||
};
|
||||
|
||||
proto.onOverflowed = function(overflow) {
|
||||
var items = slice.call(this.children, 0, -1);
|
||||
var minMoreButtonWidth = 70;
|
||||
var extra = overflow.remaining < minMoreButtonWidth ? 1 : 0;
|
||||
var numToHide = items.length - overflow.willFit + extra;
|
||||
|
||||
this.hiddenChildren = slice.call(items, 0 - numToHide);
|
||||
this.hiddenChildren.forEach(function(el) { el.classList.add('overflowing'); });
|
||||
this.els.inner.classList.add('overflowed');
|
||||
};
|
||||
|
||||
proto.release = function() {
|
||||
if (!this.hiddenChildren) { return; }
|
||||
this.els.inner.classList.remove('overflowed');
|
||||
forEach.call(this.hiddenChildren, function(el) {
|
||||
el.classList.remove('overflowing');
|
||||
});
|
||||
};
|
||||
|
||||
proto.getTotalItemLength = function() {
|
||||
return [].reduce.call(this.children, function(total, el) {
|
||||
return total + el.clientWidth;
|
||||
}, 0);
|
||||
};
|
||||
|
||||
proto.shadowStyleHack = function() {
|
||||
var style = this.shadowRoot.querySelector('style').cloneNode(true);
|
||||
this.classList.add('-content', '-host');
|
||||
style.setAttribute('scoped', '');
|
||||
this.appendChild(style);
|
||||
};
|
||||
|
||||
proto.openOverflow = function(e) {
|
||||
this.dialog = new GaiaDialogMenu();
|
||||
|
||||
this.hiddenChildren.forEach(function(el) {
|
||||
this.dialog.appendChild(el);
|
||||
el.classList.remove('overflowing');
|
||||
}, this);
|
||||
|
||||
this.appendChild(this.dialog);
|
||||
this.dialog.addEventListener('click', this.dialog.close.bind(this.dialog));
|
||||
this.dialog.addEventListener('closed', this.onDialogClosed.bind(this));
|
||||
this.dialog.open(e);
|
||||
};
|
||||
|
||||
proto.onDialogClosed = function() {
|
||||
this.dialog.remove();
|
||||
this.dialog = null;
|
||||
|
||||
this.hiddenChildren.forEach(function(el) {
|
||||
el.classList.add('overflowing');
|
||||
this.insertBefore(el, this.lastChild);
|
||||
}, this);
|
||||
|
||||
};
|
||||
|
||||
var template = `
|
||||
<style>
|
||||
|
||||
/** Reset
|
||||
---------------------------------------------------------*/
|
||||
|
||||
::-moz-focus-inner { border: 0; }
|
||||
|
||||
/** Host
|
||||
---------------------------------------------------------*/
|
||||
|
||||
.-host {
|
||||
display: block;
|
||||
}
|
||||
|
||||
/** Inner
|
||||
---------------------------------------------------------*/
|
||||
|
||||
.inner {
|
||||
display: flex;
|
||||
height: 45px;
|
||||
overflow: hidden;
|
||||
|
||||
border-top: 1px solid;
|
||||
border-color:
|
||||
var(--border-color,
|
||||
var(--background-plus));
|
||||
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
/** Direct Children
|
||||
---------------------------------------------------------*/
|
||||
|
||||
.-content > *,
|
||||
.more-button {
|
||||
box-sizing: border-box;
|
||||
flex: 1 0 0;
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
padding: 0 6px;
|
||||
border: 0;
|
||||
font-size: 17px;
|
||||
line-height: 45px;
|
||||
font-style: italic;
|
||||
font-weight: lighter;
|
||||
background: none;
|
||||
cursor: pointer;
|
||||
white-space: nowrap;
|
||||
transition: color 200ms 300ms;
|
||||
|
||||
color:
|
||||
var(--text-color, inherit);
|
||||
}
|
||||
|
||||
/**
|
||||
* :active
|
||||
*/
|
||||
|
||||
.more-button :active,
|
||||
.-content > :active {
|
||||
transition: none;
|
||||
color: var(--highlight-color);
|
||||
}
|
||||
|
||||
/**
|
||||
* .overflowing
|
||||
*/
|
||||
|
||||
.-content > .overflowing {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/**
|
||||
* [disabled]
|
||||
*/
|
||||
|
||||
.-content > [disabled] {
|
||||
pointer-events: none;
|
||||
opacity: 0.3;
|
||||
}
|
||||
|
||||
.-content > [data-icon] {
|
||||
font-size: 0;
|
||||
}
|
||||
|
||||
/** Style
|
||||
---------------------------------------------------------*/
|
||||
|
||||
style {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/** More Button
|
||||
---------------------------------------------------------*/
|
||||
|
||||
.more-button {
|
||||
display: none;
|
||||
flex: 0.7;
|
||||
}
|
||||
|
||||
/** More Button Icon
|
||||
---------------------------------------------------------*/
|
||||
|
||||
.more-button:before {
|
||||
font-family: 'gaia-icons';
|
||||
font-weight: 500;
|
||||
content: 'more';
|
||||
text-rendering: optimizeLegibility;
|
||||
font-style: normal;
|
||||
font-size: 32px;
|
||||
}
|
||||
|
||||
/**
|
||||
* .overflowed
|
||||
*/
|
||||
|
||||
.overflowed .more-button {
|
||||
display: block;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<div class="inner">
|
||||
<content></content>
|
||||
<button class="more-button"></button>
|
||||
</div>`;
|
||||
|
||||
|
||||
function rafWrap(fn, ctx) {
|
||||
var raf = requestAnimationFrame;
|
||||
var frame;
|
||||
|
||||
return function() {
|
||||
if (frame) { return; }
|
||||
var args = arguments;
|
||||
|
||||
frame = raf(function() {
|
||||
raf(function() {
|
||||
frame = null;
|
||||
fn.apply(ctx, arguments);
|
||||
});
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
// Register and expose the constructor
|
||||
try {
|
||||
module.exports = document.registerElement('gaia-toolbar', { prototype: proto });
|
||||
module.exports.proto = proto;
|
||||
} catch (e) {
|
||||
if (e.name !== 'NotSupportedError') {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
});})(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){
|
||||
return w[n];},m.exports,m);w[n]=m.exports;};})('gaia-toolbar',this));
|
||||
74
gaia/apps/music/components/gaia-toolbar/index.html
Executable file
74
gaia/apps/music/components/gaia-toolbar/index.html
Executable file
|
|
@ -0,0 +1,74 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title><gaia-toolbar></title>
|
||||
<meta name="description" content="gaia-toolbar example" />
|
||||
<link rel="stylesheet" type="text/css" href="bower_components/base/base.css">
|
||||
<link rel="stylesheet" type="text/css" href="bower_components/gaia-theme/gaia-theme.css">
|
||||
<link rel="stylesheet" type="text/css" href="bower_components/gaia-icons/gaia-icons.css">
|
||||
<link rel="stylesheet" type="text/css" href="bower_components/gaia-fonts/style.css">
|
||||
<script src="bower_components/gaia-theme/lib/gaia-theme-selector.js"></script>
|
||||
<script src="bower_components/gaia-component/gaia-component.js"></script>
|
||||
<script src="bower_components/gaia-dialog/gaia-dialog.js"></script>
|
||||
<script src="bower_components/gaia-icons/gaia-icons.js"></script>
|
||||
<script src="gaia-toolbar.js"></script>
|
||||
<style type="text/css">
|
||||
|
||||
body {
|
||||
padding: 16px;
|
||||
padding-top: 48px;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body role="application">
|
||||
<gaia-theme-selector></gaia-theme-selector>
|
||||
<h1 class="large l-align-center l-mb-mega"><gaia-toolbar></h1>
|
||||
<button id="append">Add one</button>
|
||||
<section id="section">
|
||||
<gaia-toolbar class="l-mb-mega" selected="2">
|
||||
<button data-icon="recent-calls" aria-hidden="true"></button>
|
||||
<button data-icon="user" aria-hidden="true"></button>
|
||||
<button data-icon="dialpad" aria-hidden="true"></button>
|
||||
<button data-icon="sync" aria-hidden="true">sync</button>
|
||||
<button data-icon="camera" aria-hidden="true">camera</button>
|
||||
</gaia-toolbar>
|
||||
|
||||
<gaia-toolbar class="l-mb-mega" selected="2">
|
||||
<button data-icon="recent-calls" aria-hidden="true"></button>
|
||||
<button data-icon="user" aria-hidden="true"></button>
|
||||
</gaia-toolbar>
|
||||
|
||||
<gaia-toolbar selected="2">
|
||||
<button>Phone</button>
|
||||
<button>Contact</button>
|
||||
<button>Dialer</button>
|
||||
<button>Refresh</button>
|
||||
<button>Add to homescreen</button>
|
||||
</gaia-toolbar>
|
||||
</section>
|
||||
|
||||
<script>
|
||||
/*jshint esnext:true*/
|
||||
|
||||
append.onclick = add;
|
||||
|
||||
function add() {
|
||||
var div = document.createElement('div');
|
||||
|
||||
div.innerHTML = `
|
||||
<gaia-toolbar selected="2">
|
||||
<div>Phone</div>
|
||||
<div>Contact</div>
|
||||
<div>Dialer</div>
|
||||
<div>Refresh</div>
|
||||
<div>Add to homescreen</div>
|
||||
</gaia-toolbar>`;
|
||||
|
||||
section.appendChild(div.firstElementChild);
|
||||
}
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Reference in a new issue