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:
OverSu 2026-09-30 23:13:03 +02:00
commit b38dea0597
25901 changed files with 9982925 additions and 369 deletions

View file

@ -0,0 +1,13 @@
'use strict';
var result = document.getElementById('result');
var elements = document.querySelectorAll('gaia-checkbox');
[].forEach.call(elements, function(element, index) {
element.addEventListener('click', function(e) {
result.textContent = 'Click event for: ' + (index + 1) + ' value: ' +
e.target.checked;
});
});

View file

@ -0,0 +1,64 @@
<!DOCTYPE html>
<html dir="ltr">
<head>
<meta charset="utf-8" />
<title>GaiaCheckbox Demo</title>
<meta name="description" content="Demo app for gaia-checkbox" />
<style type="text/css">
html,
body {
margin: 0;
padding: 0;
font-size: 10px;
background-color: #fff;
width: 100%;
}
section {
margin: 2rem;
border-bottom: 1px solid #000;
}
</style>
<script>
window.onload = function() {
var dirInput = document.getElementById('dir');
dirInput.checked = false;
dirInput.onchange= function() {
document.documentElement.dir = this.checked ? 'rtl' : 'ltr';
}
};
</script>
<script src="../../../js/component_utils.js"></script>
<script>window.GaiaCheckboxBaseurl = '../';</script>
<script src="../script.js"></script>
<script defer src="example.js"></script>
</head>
<body role="application">
<p dir="ltr">
<label class="bb-docs">
<input id="dir" type="checkbox"> RTL mode
</label>
</p>
<section>
<gaia-checkbox></gaia-checkbox>
</section>
<section>
<gaia-checkbox checked style="width: 100%;">
<label>With a label</label>
</gaia-checkbox>
</section>
<section>
<gaia-checkbox class="danger"></gaia-checkbox>
</section>
<section>
<gaia-checkbox class="danger" checked>
<label>Class = danger</label>
</gaia-checkbox>
</section>
<section>
<gaia-checkbox class="inline" checked>
<label>Class = inline</label>
</gaia-checkbox>
</section>
<div id="result"></div>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 583 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 946 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 583 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 946 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -0,0 +1,129 @@
'use strict';
/* global ComponentUtils */
window.GaiaCheckbox = (function(win) {
// Extend from the HTMLElement prototype
var proto = Object.create(HTMLElement.prototype);
// Allow baseurl to be overridden (used for demo page)
var baseurl = window.GaiaCheckboxBaseurl ||
'/shared/elements/gaia_checkbox/';
proto.createdCallback = function() {
// A timestamp of the last click on the checkbox.
// We use this to throttle click events to the control.
// This is a temporary workaround for bug 1221886.
this.lastClick = 0;
this.throttleTime = 250;
var shadow = this.createShadowRoot();
this._template = template.content.cloneNode(true);
this._wrapper = this._template.getElementById('checkbox');
this._wrapper.addEventListener('click', this.handleClick.bind(this));
this.configureClass();
this.checked = this.hasAttribute('checked');
this._wrapper.setAttribute('aria-checked', this.checked);
this.setAttribute('role', 'presentation');
shadow.appendChild(this._template);
ComponentUtils.style.call(this, baseurl);
};
/**
* Handles a click event on the shadow dom.
* We handle checking/unchecking of the checkbox and proxy the click
* event to any click listeners on the gaia-radio. This is a nice transition
* that preserves backwards behavior and should make it easier to port apps.
*/
proto.handleClick = function(e) {
// We add this event listener twice (see above) on both the content and
// custom element nodes. We need to stop the event propagation to prevent
// this event from firing against both nodes.
e.preventDefault();
e.stopImmediatePropagation();
// Workaround for bug 1221886 - throttle clicks if needed.
if (this.lastClick + this.throttleTime > Date.now()) {
return;
}
this.lastClick = Date.now();
// Dispatch a click event to any listeners to the app.
// We should be able to remove this when bug 887541 lands.
var event = new MouseEvent('click', {
view: window,
bubbles: true,
cancelable: true
});
this.dispatchEvent(event);
if (!event.defaultPrevented) {
this.checked = !this.checked;
this._wrapper.setAttribute('aria-checked', this.checked);
}
// Dispatch a change event for the gaia-switch.
this.dispatchEvent(new CustomEvent('change', {
bubbles: true,
cancelable: false
}));
};
/**
* Configures the class for the element.
*/
proto.configureClass = function() {
this._wrapper.className = this.className;
};
/**
* Proxy className property to the wrapper.
*/
proto.attributeChangedCallback = function(name, from, to) {
if (name === 'class') {
this._wrapper.className = to;
}
};
/**
* Proxy the checked property to the input element.
*/
Object.defineProperty(proto, 'checked', {
get: function() {
return this._checked || false;
},
set: function(value) {
this._wrapper.classList.toggle('checked', value);
this._checked = value;
}
});
/**
* Proxy the name property to the input element.
*/
Object.defineProperty(proto, 'name', {
get: function() {
return this.getAttribute('name');
},
set: function(value) {
this.setAttribute('name', value);
}
});
var template = document.createElement('template');
template.innerHTML =
`<span id="checkbox" role="checkbox">
<span role="presentation"><content select="label"></content></span>
</span>`;
// Register and return the constructor
return document.registerElement('gaia-checkbox', { prototype: proto });
})(window);

View file

@ -0,0 +1,71 @@
gaia-checkbox {
display: inline-block;
width: 100%;
}
#checkbox {
display: block;
width: 100%;
/* Normal gaia-checkboxes are the heights of their parents. */
height: 100%;
position: relative;
background: none;
}
#checkbox span {
font-size: 1.9rem;
font-weight: normal;
color: var(--label-color);
line-height: 3rem;
box-sizing: border-box;
display: block;
min-width: 2.2rem;
min-height: 2.2rem;
width: 100%;
padding-inline-end: 2.2rem;
/* Override inheriting nowrap from legacy lists building blocks. */
white-space: normal;
}
/* Inline gaia-checkboxes are the heights of their parents. */
#checkbox.inline {
display: inline-block;
vertical-align: middle;
}
#checkbox:not(.invisible) span:after {
content: '';
position: absolute;
offset-inline-end: 0;
top: 50%;
margin: -1.2rem 0 0;
margin-inline-start: -1.2rem;
width: 2.2rem;
height: 2.2rem;
}
#checkbox.inline span {
padding-inline-start: 3rem;
padding-inline-end: 0;
height: auto;
}
#checkbox.inline span:after {
offset-inline-start: 1.2rem;
offset-inline-end: unset;
margin: -1.2rem 0 0;
margin-inline-start: -1.2rem;
}
#checkbox:not(.invisible) span:after {
background: url(images/default.png) no-repeat center top / 2.2rem auto;
}
#checkbox.checked span:after {
background-position: center bottom;
}
/* 'Dangerous' checkboxes */
#checkbox.danger span:after {
background-image: url(images/danger.png);
}