-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
Deploy to GitHub pages
0 parents
commit a8b95a1
Showing
33 changed files
with
16,377 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,188 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>JSDoc: Source: Binary.js</title> | ||
|
||
<script src="scripts/prettify/prettify.js"> </script> | ||
<script src="scripts/prettify/lang-css.js"> </script> | ||
<!--[if lt IE 9]> | ||
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> | ||
<![endif]--> | ||
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> | ||
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> | ||
</head> | ||
|
||
<body> | ||
|
||
<div id="main"> | ||
|
||
<h1 class="page-title">Source: Binary.js</h1> | ||
|
||
|
||
|
||
|
||
|
||
|
||
<section> | ||
<article> | ||
<pre class="prettyprint source linenums"><code>// Not efficient enough... | ||
// import { nonenumerable } from 'core-decorators'; | ||
|
||
import Types from './Types' | ||
|
||
/** Class allowing `@binary` members */ | ||
class Binary { | ||
// TODO: | ||
// - Handle Endianess | ||
// - Handle Clamped | ||
|
||
// Class props | ||
// Slowers down 4x times... | ||
// @nonenumerable | ||
static _size | ||
/** | ||
* Static getter for the class binary size | ||
* @return {number} - The class binary size | ||
*/ | ||
static get binarySize () { | ||
return this._size | ||
} | ||
|
||
// @nonenumerable | ||
static _binaryProps | ||
/** | ||
* Static getter for the class binary props | ||
* @return {array} - The list of binary props | ||
*/ | ||
static get binaryProps () { | ||
return this._binaryProps | ||
} | ||
|
||
/** | ||
* Fills an array with objects of this class using a unique buffer | ||
* @param {ArrayBuffer/SharedArrayBuffer/DataView} binOrDv - The buffer where the data lives | ||
* @param {number} length - The number of objects to add to the array | ||
* @param {number} initialOffset - Buffer offset before this object data start | ||
* @param {array} list - The array where new objects will be added | ||
* @return {array} - The array {@link list} where the objects have been added | ||
*/ | ||
// @nonenumerable | ||
static arrayFactory (binOrDV, length, initialOffset = 0, list = []) { | ||
// Optimize: Generate a single DataView for all elements | ||
const dv = binOrDV instanceof DataView ? binOrDV : new DataView(binOrDV) | ||
|
||
for (let i = 0; i < length; i++) { | ||
list.push(new this(dv, initialOffset + this._size * i)) | ||
} | ||
|
||
return list | ||
} | ||
|
||
// Prototype props | ||
// @nonenumerable | ||
_initialOffset | ||
// @nonenumerable | ||
_bin | ||
// @nonenumerable | ||
__dv | ||
/** | ||
* Getter of the DataView containing this object's data | ||
* @return {DataView} - The DataView | ||
*/ | ||
// @nonenumerable | ||
get _dv () { | ||
this.__dv = | ||
this?.__dv ?? | ||
new DataView(this._bin, this._initialOffset, this.constructor._size) | ||
return this.__dv | ||
} | ||
|
||
/** | ||
* Transform this object into a JSON string containing all the binary members | ||
* @return {string} - The JSON string | ||
* @method | ||
*/ | ||
// @nonenumerable | ||
toJSON = () => | ||
this.constructor._binaryProps.reduce( | ||
(acc, prop) => ({ | ||
...acc, | ||
[prop]: this[prop] | ||
}), | ||
{} | ||
) | ||
|
||
/** | ||
* Save own initial offset at binary data | ||
* @param {ArrayBuffer/SharedArrayBuffer/DataView} binOrDv - The buffer where the data lives | ||
* @param {number} initialOffset - Buffer offset before this object data start | ||
* @param {boolean} isLazy - If true and {@link binOrDv} is not a {DataView}, wait until first acces before Instantiating the __dv | ||
*/ | ||
constructor (binOrDV, initialOffset = 0, isLazy = true) { | ||
this._initialOffset = initialOffset | ||
if (binOrDV instanceof DataView) { | ||
this.__dv = binOrDV | ||
} else { | ||
this._bin = binOrDV | ||
if (!isLazy) { | ||
this._dv // Call getter | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* Get a single byte (as unsigned integer) from a position | ||
* @param {number} offset - The position of the byte to get | ||
* @return {number} - The unsigned numerical number at the specified position | ||
* @method | ||
*/ | ||
// @nonenumerable | ||
getByteAt = (offset) => | ||
Types.Uint8.get(this._dv, this._initialOffset + offset) | ||
} | ||
|
||
/* | ||
Object.defineProperty(Binary, "_size", { | ||
enumerable: false, | ||
writable: true, | ||
}); | ||
Object.defineProperty(Binary, "binarySize", { | ||
enumerable: false, | ||
get () { return this._size } | ||
}); | ||
|
||
Object.defineProperty(Binary, "_binaryProps", { | ||
enumerable: false, | ||
writable: true, | ||
}); | ||
Object.defineProperty(Binary, "binaryProps", { | ||
enumerable: false, | ||
get () { return this._binaryProps } | ||
}); | ||
*/ | ||
|
||
export default Binary | ||
</code></pre> | ||
</article> | ||
</section> | ||
|
||
|
||
|
||
|
||
</div> | ||
|
||
<nav> | ||
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Binary.html">Binary</a></li><li><a href="BinaryArrayBase.html">BinaryArrayBase</a></li></ul><h3>Global</h3><ul><li><a href="global.html#BinaryArray">BinaryArray</a></li><li><a href="global.html#BinaryArrayHandler">BinaryArrayHandler</a></li><li><a href="global.html#Types">Types</a></li><li><a href="global.html#binary">binary</a></li><li><a href="global.html">binarySize</a></li><li><a href="global.html#decorator">decorator</a></li><li><a href="global.html#iterator">iterator</a></li><li><a href="global.html#propertyDescriptor">propertyDescriptor</a></li><li><a href="global.html#propertyDescriptorGetter">propertyDescriptorGetter</a></li><li><a href="global.html#propertyDescriptorSetter">propertyDescriptorSetter</a></li><li><a href="global.html#withBinary">withBinary</a></li></ul> | ||
</nav> | ||
|
||
<br class="clear"> | ||
|
||
<footer> | ||
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.3</a> on Fri Oct 04 2024 07:14:57 GMT+0000 (Coordinated Universal Time) | ||
</footer> | ||
|
||
<script> prettyPrint(); </script> | ||
<script src="scripts/linenumber.js"> </script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,191 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>JSDoc: Source: BinaryArray.js</title> | ||
|
||
<script src="scripts/prettify/prettify.js"> </script> | ||
<script src="scripts/prettify/lang-css.js"> </script> | ||
<!--[if lt IE 9]> | ||
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> | ||
<![endif]--> | ||
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> | ||
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> | ||
</head> | ||
|
||
<body> | ||
|
||
<div id="main"> | ||
|
||
<h1 class="page-title">Source: BinaryArray.js</h1> | ||
|
||
|
||
|
||
|
||
|
||
|
||
<section> | ||
<article> | ||
<pre class="prettyprint source linenums"><code>/** Class for returning array members from {@link Binary} objects */ | ||
class BinaryArrayBase { | ||
// @member | ||
type | ||
// @member | ||
dv | ||
// @member | ||
offset | ||
// @member | ||
length | ||
// @member | ||
bytes | ||
|
||
/** | ||
* Creates a new customized array | ||
* @param {DataView} dv - The DataView handling the buffer where the data lives | ||
* @param {object} type - The type of the array members from {@link Types} | ||
* @param {number} offset - The offset of the first member of the array into the buffer | ||
* @param {number} length - The length of the array | ||
*/ | ||
constructor (dv, type, offset, length) { | ||
this.type = type | ||
this.dv = dv | ||
this.offset = offset | ||
this.length = length | ||
this.bytes = length * type.bytes | ||
} | ||
|
||
/** | ||
* Proxy array methods using this iterator | ||
* @param {function} fn - The function to apply on the array elements | ||
* @return {array} - The new generated array (not bound to original values) | ||
* @method | ||
*/ | ||
map = (fn) => Array.from(this, fn) | ||
// reduce = (...args) => Array.prototype.reduce.call([...this], ...args); | ||
|
||
/** | ||
* Transform this array into a JSON string | ||
* @return {string} - The JSON string representing this array | ||
* @method | ||
*/ | ||
toJSON = () => JSON.parse(JSON.stringify(this.map())); | ||
|
||
/** | ||
* Make a generator iterator | ||
* @method | ||
* @generator | ||
* @function iterator | ||
* @yield {any} - Each of this array elements of type {@link Types} | ||
* @name iterator | ||
*/ | ||
* [Symbol.iterator] () { | ||
// Deconstruct to optimize and ease reading | ||
const { | ||
length, | ||
dv, | ||
offset, | ||
type: { get, bytes } | ||
} = this | ||
|
||
// Use a new index for each iterator. This makes multiple | ||
// iterations over the iterable safe for non-trivial cases, | ||
// such as use of break or nested looping over the same iterable. | ||
for (let index = 0; index < length; index++) { | ||
yield get(dv, offset + bytes * index) | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* A Proxy handler for the {@link BinaryArray} class to allow accessing its elements | ||
* @enum | ||
*/ | ||
const BinaryArrayHandler = { | ||
/** | ||
* Getter for the elements of the handled {@link BinaryArray} | ||
* @param {BinaryArray} target - The handled {@link BinaryArray} instance | ||
* @param {string} prop - The property to return (only handled when prop is a string representing a number) | ||
* @return {any} - The element at {@link prop} position, or a reflected value from {@link target} | ||
*/ | ||
get (target, prop) { | ||
// Very inefficient way | ||
// Need to: | ||
// - Override Array internals, but are private | ||
// - Override `[]` operator, but it's not possible | ||
if (prop === '0' || (typeof prop === 'string' && Number(prop) > 0)) { | ||
// Destructure to optimize | ||
const { | ||
dv, | ||
offset, | ||
type: { get, bytes } | ||
} = target | ||
return get(dv, offset + bytes * Number(prop)) | ||
} | ||
|
||
// Return original value | ||
return Reflect.get(target, prop) | ||
}, | ||
|
||
/** | ||
* Setter for the elements of the handled {@link BinaryArray} | ||
* @param {BinaryArray} target - The handled {@link BinaryArray} instance | ||
* @param {string} prop - The property to set (only handled when prop is a string representing a number) | ||
* @param {any} value - The value to assign to the {@link prop}'th element | ||
* @return {boolean} - If {@link prop} is numericalish, true (as needed for JS setters), else the return value from the {@link target} reflected setter | ||
*/ | ||
set (target, prop, value) { | ||
if (prop === '0' || (typeof prop === 'string' && Number(prop) > 0)) { | ||
// Destructure to optimize | ||
const { | ||
dv, | ||
offset, | ||
type: { set, bytes } | ||
} = target | ||
set(dv, offset + bytes * Number(prop), value) | ||
return true | ||
} | ||
return Reflect.set(target, prop, value) | ||
} | ||
} | ||
|
||
// #TODO: BUG: Argument Spread Operator not working | ||
// well when packing with webpack | ||
/** | ||
* Proxy creator for {@link BinaryArrayBase} | ||
* @param {DataView} dv - The DataView handling the buffer where the data lives | ||
* @param {object} type - The type of the array members from {@link Types} | ||
* @param {number} offset - The offset before the first member of the array | ||
* @param {number} length - The length of the array | ||
* @return {Proxy} - The proxy to {@link BinaryArrayBase} with {@link BinaryArrayHandler} as proxy handler | ||
*/ | ||
const BinaryArray = (dv, type, offset, length) => { | ||
return new Proxy( | ||
new BinaryArrayBase(dv, type, offset, length), | ||
BinaryArrayHandler | ||
) | ||
} | ||
|
||
export default BinaryArray | ||
</code></pre> | ||
</article> | ||
</section> | ||
|
||
|
||
|
||
|
||
</div> | ||
|
||
<nav> | ||
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Binary.html">Binary</a></li><li><a href="BinaryArrayBase.html">BinaryArrayBase</a></li></ul><h3>Global</h3><ul><li><a href="global.html#BinaryArray">BinaryArray</a></li><li><a href="global.html#BinaryArrayHandler">BinaryArrayHandler</a></li><li><a href="global.html#Types">Types</a></li><li><a href="global.html#binary">binary</a></li><li><a href="global.html">binarySize</a></li><li><a href="global.html#decorator">decorator</a></li><li><a href="global.html#iterator">iterator</a></li><li><a href="global.html#propertyDescriptor">propertyDescriptor</a></li><li><a href="global.html#propertyDescriptorGetter">propertyDescriptorGetter</a></li><li><a href="global.html#propertyDescriptorSetter">propertyDescriptorSetter</a></li><li><a href="global.html#withBinary">withBinary</a></li></ul> | ||
</nav> | ||
|
||
<br class="clear"> | ||
|
||
<footer> | ||
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.3</a> on Fri Oct 04 2024 07:14:57 GMT+0000 (Coordinated Universal Time) | ||
</footer> | ||
|
||
<script> prettyPrint(); </script> | ||
<script src="scripts/linenumber.js"> </script> | ||
</body> | ||
</html> |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,237 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>JSDoc: Source: Types.js</title> | ||
|
||
<script src="scripts/prettify/prettify.js"> </script> | ||
<script src="scripts/prettify/lang-css.js"> </script> | ||
<!--[if lt IE 9]> | ||
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> | ||
<![endif]--> | ||
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> | ||
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> | ||
</head> | ||
|
||
<body> | ||
|
||
<div id="main"> | ||
|
||
<h1 class="page-title">Source: Types.js</h1> | ||
|
||
|
||
|
||
|
||
|
||
|
||
<section> | ||
<article> | ||
<pre class="prettyprint source linenums"><code>import BinaryArray from './BinaryArray' | ||
|
||
/** | ||
* Types used by the {@link binary} decorator | ||
* @enum | ||
*/ | ||
const Types = { | ||
Float32: { | ||
extractor: Float32Array, | ||
bytes: 4, | ||
get: (dv, offset) => dv.getFloat32(offset), | ||
set: (dv, offset, value) => dv.setFloat32(offset, value) | ||
}, | ||
Float64: { | ||
extractor: Float64Array, | ||
bytes: 8, | ||
get: (dv, offset) => dv.getFloat64(offset), | ||
set: (dv, offset, value) => dv.setFloat64(offset, value) | ||
}, | ||
Int8: { | ||
extractor: Int8Array, | ||
bytes: 1, | ||
get: (dv, offset) => dv.getInt8(offset), | ||
set: (dv, offset, value) => dv.setInt8(offset, value) | ||
}, | ||
Int16: { | ||
extractor: Int16Array, | ||
bytes: 2, | ||
get: (dv, offset) => dv.getInt16(offset), | ||
set: (dv, offset, value) => dv.setInt16(offset, value) | ||
}, | ||
Int32: { | ||
extractor: Int32Array, | ||
bytes: 4, | ||
get: (dv, offset) => dv.getInt32(offset), | ||
set: (dv, offset, value) => dv.setInt32(offset, value) | ||
}, | ||
BigInt64: { | ||
extractor: BigInt64Array, | ||
bytes: 8, | ||
get: (dv, offset) => dv.getBigInt64(offset), | ||
set: (dv, offset, value) => dv.setBigInt64(offset, value) | ||
}, | ||
Uint8: { | ||
extractor: Uint8Array, | ||
bytes: 1, | ||
get: (dv, offset) => dv.getUint8(offset), | ||
set: (dv, offset, value) => dv.setUint8(offset, value) | ||
}, | ||
/** Not implemented */ | ||
Uint8Clamped: { | ||
extractor: Uint8ClampedArray, | ||
bytes: 1 | ||
}, | ||
Uint16: { | ||
extractor: Uint16Array, | ||
bytes: 2, | ||
get: (dv, offset) => dv.getUint16(offset), | ||
set: (dv, offset, value) => dv.setUint16(offset, value) | ||
}, | ||
Uint32: { | ||
extractor: Uint32Array, | ||
bytes: 4, | ||
get: (dv, offset) => dv.getUint32(offset), | ||
set: (dv, offset, value) => dv.setUint32(offset, value) | ||
}, | ||
BigUint64: { | ||
extractor: BigUint64Array, | ||
bytes: 8, | ||
get: (dv, offset) => dv.getBigUint64(offset), | ||
set: (dv, offset, value) => dv.setBigUint64(offset, value) | ||
}, | ||
|
||
/** | ||
* Array type generator `(type, length, padding=false)` | ||
* @function | ||
* @param {@link Types} type - One of Types.* | ||
* @param {number} length - The number of elements of the array | ||
* @param {boolean} padding - If true, adds initial unused bytes so initialOffset is a multiple of the elements size. One byte size {@link Types} are always treated as padded for optimization. | ||
* @return {object} - The generated Types.* compliant | ||
*/ | ||
Array: (type, length, padding = false) => { | ||
return { | ||
bytes: length * type.bytes, | ||
padding: padding && type.bytes, | ||
// Change getter/setter depending on padding ensured | ||
// 1-byte sized native types always have padding ensured | ||
...(padding || ('extractor' in type && type.bytes === 1) | ||
? { | ||
get (dv, offset) { | ||
return new type.extractor(dv.buffer, offset, length) | ||
}, | ||
set (dv, offset, values) { | ||
const typed = new type.extractor(dv.buffer, offset, length) | ||
typed.set(values) | ||
return true | ||
} | ||
} | ||
: { | ||
get (dv, offset) { | ||
return BinaryArray(dv, type, offset, length) | ||
}, | ||
set (dv, offset, values) { | ||
values.forEach((value, index) => | ||
type.set(dv, offset + type.bytes * index, value) | ||
) | ||
return true | ||
} | ||
}) | ||
} | ||
}, | ||
|
||
/** | ||
* Nested/composited struct generator `(Class)` which extends {@link Binary} | ||
* @function | ||
* @param {class} Class - The class the wrapped member belongs to | ||
* @return {object} - The generated {@link Types} compliant | ||
*/ | ||
Struct: (Class) => { | ||
return { | ||
bytes: Class.binarySize, | ||
get (dv, offset) { | ||
return new Class(dv, offset) | ||
}, | ||
set (dv, offset, values) { | ||
// TODO: Test if values is a Binary Object and we can just copy binary data, or nothing, | ||
// because binary data, class and offset are the same. | ||
const obj = new Class(dv, offset) | ||
for (const prop of Object.keys(values)) { | ||
if (Class.binaryProps.includes(prop)) { | ||
obj[prop] = values[prop] | ||
} | ||
} | ||
return true | ||
} | ||
} | ||
}, | ||
|
||
/** | ||
* Text generator `(length, {encoding='utf8', zeroTerminated=true}={})` | ||
* @function | ||
* @param {number} length - The maximum length of the binary array (not necessarily equal to the string length) | ||
* @param {object} options - The options for the generated text field: | ||
* - @param {text} encoding - The encoding (defaults to utf8) | ||
* - @param {boolean} zeroTerminated - True if using the C zero terminated strings (default) | ||
* @return {object} - The generated Types.* compliant | ||
*/ | ||
Text: (length, { encoding = 'utf8', zeroTerminated = true } = {}) => { | ||
const decoder = new TextDecoder(encoding) | ||
const encoder = new TextEncoder() // Only UTF8 available | ||
return { | ||
bytes: length, | ||
get (dv, offset) { | ||
const arr = new Types.Uint8.extractor(dv.buffer, offset, length) | ||
|
||
if (zeroTerminated) { | ||
const firstZero = arr.indexOf(0x00) | ||
if (firstZero === 0) { | ||
return '' | ||
} else if (firstZero > 0) { | ||
const arrSmaller = new Types.Uint8.extractor( | ||
dv.buffer, | ||
offset, | ||
firstZero | ||
) | ||
return decoder.decode(arrSmaller) | ||
} | ||
} | ||
|
||
return decoder.decode(arr) | ||
}, | ||
set (dv, offset, value) { | ||
const arr = new Types.Uint8.extractor(dv.buffer, offset, length) | ||
const { read, written } = encoder.encodeInto(value, arr) | ||
|
||
if (zeroTerminated && written < arr.length) { | ||
arr[written] = 0 // append null if room | ||
} | ||
|
||
return true | ||
} | ||
} | ||
} | ||
} | ||
|
||
export default Types | ||
</code></pre> | ||
</article> | ||
</section> | ||
|
||
|
||
|
||
|
||
</div> | ||
|
||
<nav> | ||
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Binary.html">Binary</a></li><li><a href="BinaryArrayBase.html">BinaryArrayBase</a></li></ul><h3>Global</h3><ul><li><a href="global.html#BinaryArray">BinaryArray</a></li><li><a href="global.html#BinaryArrayHandler">BinaryArrayHandler</a></li><li><a href="global.html#Types">Types</a></li><li><a href="global.html#binary">binary</a></li><li><a href="global.html">binarySize</a></li><li><a href="global.html#decorator">decorator</a></li><li><a href="global.html#iterator">iterator</a></li><li><a href="global.html#propertyDescriptor">propertyDescriptor</a></li><li><a href="global.html#propertyDescriptorGetter">propertyDescriptorGetter</a></li><li><a href="global.html#propertyDescriptorSetter">propertyDescriptorSetter</a></li><li><a href="global.html#withBinary">withBinary</a></li></ul> | ||
</nav> | ||
|
||
<br class="clear"> | ||
|
||
<footer> | ||
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.3</a> on Fri Oct 04 2024 07:14:57 GMT+0000 (Coordinated Universal Time) | ||
</footer> | ||
|
||
<script> prettyPrint(); </script> | ||
<script src="scripts/linenumber.js"> </script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,245 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>JSDoc: Source: decorators.js</title> | ||
|
||
<script src="scripts/prettify/prettify.js"> </script> | ||
<script src="scripts/prettify/lang-css.js"> </script> | ||
<!--[if lt IE 9]> | ||
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> | ||
<![endif]--> | ||
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> | ||
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> | ||
</head> | ||
|
||
<body> | ||
|
||
<div id="main"> | ||
|
||
<h1 class="page-title">Source: decorators.js</h1> | ||
|
||
|
||
|
||
|
||
|
||
|
||
<section> | ||
<article> | ||
<pre class="prettyprint source linenums"><code>import Types from './Types' | ||
|
||
/** | ||
* Class member decorator generator for Binary class property | ||
* @param {object} type - Any element from the {@link Types} | ||
* @return {function} - The {@link decorator} which generates the {@link propertyDescriptor} to be used to transform a class member into binary backed member | ||
* @decorator | ||
* @method | ||
*/ | ||
const binary = ({ bytes, padding = false, get, set }) => { | ||
/** | ||
* The class member generated decorator | ||
* @param {object} target - object which will be `assign`ed to the Class.prototype (extending {@link Binary} or decorated with {@link withBinary}) | ||
* @param {string} name - property name | ||
* @param {object} descriptor - as in `Object.defineProperty(target, name, descriptor)`, like {@link propertyDescriptor} | ||
* @return {object} - The new or modified {@link propertyDescriptor} for this class member | ||
* @method | ||
* @name decorator | ||
*/ | ||
return function decorator (target, name, descriptor) { | ||
// const deleted = (() => { | ||
// const {value, initializer, writable} = descriptor; | ||
// return {value, initializer, writable}; | ||
// })(); | ||
|
||
// Add size as static property to Class | ||
target.constructor._size = target.constructor._size ?? 0 | ||
target.constructor._binaryProps = target.constructor._binaryProps ?? [] | ||
|
||
// Create an initial padding offset if needed | ||
const size = target.constructor._size | ||
const paddingOffset = padding ? padding - (size % padding) : 0 | ||
|
||
// Get this property offset | ||
const offset = target.constructor._size + paddingOffset | ||
|
||
// Add property size to Class size (at static Class property) | ||
target.constructor._size += bytes + paddingOffset | ||
target.constructor._binaryProps.push(name) | ||
|
||
/** | ||
* Property definition returned from {@link binary}'s returned {@link decorator} | ||
* @name propertyDescriptor | ||
*/ | ||
return { | ||
// TODO: Do something with initializer as default value | ||
configurable: false, | ||
enumerable: true, | ||
|
||
/** | ||
* Returns the value handled by this class member, defined at its {@link Types} | ||
* @return {any} - The value in memory, translated by the {@link Types} getter | ||
* @this Binary instance | ||
* @name propertyDescriptorGetter | ||
*/ | ||
get () { | ||
return get(this._dv, this._initialOffset + offset) | ||
}, | ||
|
||
/** | ||
* Modifies the value handled by this class member, defined at its {@link Types} | ||
* @param {any} value - The new value to be assigned, which will be translated by the {@link Types} setter | ||
* @return {boolean} - Always true, as needed by JS setters | ||
* @this Binary instance | ||
* @name propertyDescriptorSetter | ||
*/ | ||
set (value) { | ||
set(this._dv, this._initialOffset + offset, value) | ||
return true | ||
} | ||
} | ||
|
||
return descriptor | ||
} | ||
} | ||
|
||
// Using `withBinary` as class decorator is 4x times faster in | ||
// instantiation (if using @nonenumerable), at the cost of losing some | ||
// JS class syntax benefits. | ||
// If using withBinary, don't use `extend Binary` and don't use `new` either. | ||
/** | ||
* Decorator to add Binary behavior to a class containing `@binary` members, but | ||
* without extending Binary class | ||
* @param {class} Class - A class not extending Binary containing `@binary` members | ||
* @return {@link wrapper} A {@link Class} instantiator | ||
* */ | ||
const withBinary = (Class) => { | ||
/** | ||
* Class wrapper (object constructor) | ||
* @param {ArrayBuffer/SharedArrayBuffer/DataView} binOrDV - The buffer where the data lives | ||
* @param {number} initialOffset - Buffer offset before this object data start | ||
* @param {array} args - Any arguments passed to the class constructor | ||
* @return {@link Class} instance | ||
* @callback wrapper | ||
* */ | ||
const wrapper = (binOrDV, initialOffset = 0, ...args) => { | ||
const target = new Class(...args) | ||
target._dv = binOrDV instanceof DataView ? binOrDV : new DataView(binOrDV) | ||
target._initialOffset = initialOffset | ||
|
||
/** | ||
* Get a single byte (as unsigned integer) from a position | ||
* @param {number} offset - The position of the byte to get | ||
* @return {number} The unsigned numeric value at this byte | ||
* @this {@link Class} instance | ||
*/ | ||
target.getByteAt = (offset) => | ||
Types.Uint8.get(this._dv, this._initialOffset + offset) | ||
|
||
// This is desirable, but slowers down instantiation time by 4x times | ||
// Note: `defineProperties` is +0,25 slower | ||
/* | ||
Object.defineProperty(target, | ||
'_dv', { | ||
enumerable: false, | ||
configurable: false, | ||
writable: false, | ||
value: new DataView(bin, initialOffset, Class._size), | ||
}); | ||
Object.defineProperty(target, | ||
'_initialOffset', { | ||
enumerable: false, | ||
configurable: false, | ||
writable: false, | ||
value: initialOffset, | ||
}); | ||
*/ | ||
return target | ||
} | ||
|
||
/** | ||
* Allow getting the class size from outside | ||
* @this wrapper | ||
* @static | ||
* @method | ||
* @name binarySize | ||
*/ | ||
Object.defineProperty(wrapper, 'binarySize', { | ||
get () { | ||
return Class._size | ||
}, | ||
configurable: false, | ||
enumerable: false | ||
}) | ||
|
||
/** | ||
* Allow getting the class binary props from outside | ||
* @this wrapper | ||
* @static | ||
* @method | ||
* @name binarySize | ||
*/ | ||
Object.defineProperty(wrapper, 'binaryProps', { | ||
get () { | ||
return Class._binaryProps | ||
}, | ||
configurable: false, | ||
enumerable: false | ||
}) | ||
|
||
/** | ||
* Array creator helper | ||
* @param {ArrayBuffer/SharedArrayBuffer/DataView} binOrDv - The buffer where the data lives | ||
* @param {number} length - The length of elements to create | ||
* @param {number} initialOffset - The initial offset in the buffer before the first element of the array | ||
* @param {array} list - The array where new objects will be added | ||
* @return {array} - The array {@link list} where the objects have been added | ||
* @this wrapper | ||
* @static | ||
* @method | ||
*/ | ||
wrapper.arrayFactory = function ( | ||
binOrDV, | ||
length, | ||
initialOffset = 0, | ||
list = [] | ||
) { | ||
// Optimize: Generate a single DataView for all elements | ||
const dv = | ||
binOrDV instanceof DataView | ||
? binOrDV | ||
: new DataView(binOrDV, initialOffset, length * Class._size) | ||
|
||
for (let i = 0; i < length; i++) { | ||
list.push(wrapper(dv, initialOffset + Class._size * i)) | ||
} | ||
|
||
return list | ||
} | ||
|
||
return wrapper | ||
} | ||
|
||
export { withBinary, binary } | ||
</code></pre> | ||
</article> | ||
</section> | ||
|
||
|
||
|
||
|
||
</div> | ||
|
||
<nav> | ||
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Binary.html">Binary</a></li><li><a href="BinaryArrayBase.html">BinaryArrayBase</a></li></ul><h3>Global</h3><ul><li><a href="global.html#BinaryArray">BinaryArray</a></li><li><a href="global.html#BinaryArrayHandler">BinaryArrayHandler</a></li><li><a href="global.html#Types">Types</a></li><li><a href="global.html#binary">binary</a></li><li><a href="global.html">binarySize</a></li><li><a href="global.html#decorator">decorator</a></li><li><a href="global.html#iterator">iterator</a></li><li><a href="global.html#propertyDescriptor">propertyDescriptor</a></li><li><a href="global.html#propertyDescriptorGetter">propertyDescriptorGetter</a></li><li><a href="global.html#propertyDescriptorSetter">propertyDescriptorSetter</a></li><li><a href="global.html#withBinary">withBinary</a></li></ul> | ||
</nav> | ||
|
||
<br class="clear"> | ||
|
||
<footer> | ||
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.3</a> on Fri Oct 04 2024 07:14:57 GMT+0000 (Coordinated Universal Time) | ||
</footer> | ||
|
||
<script> prettyPrint(); </script> | ||
<script src="scripts/linenumber.js"> </script> | ||
</body> | ||
</html> |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>JSDoc: Home</title> | ||
|
||
<script src="scripts/prettify/prettify.js"> </script> | ||
<script src="scripts/prettify/lang-css.js"> </script> | ||
<!--[if lt IE 9]> | ||
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> | ||
<![endif]--> | ||
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> | ||
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> | ||
</head> | ||
|
||
<body> | ||
|
||
<div id="main"> | ||
|
||
<h1 class="page-title">Home</h1> | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<h3> </h3> | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
</div> | ||
|
||
<nav> | ||
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Binary.html">Binary</a></li><li><a href="BinaryArrayBase.html">BinaryArrayBase</a></li></ul><h3>Global</h3><ul><li><a href="global.html#BinaryArray">BinaryArray</a></li><li><a href="global.html#BinaryArrayHandler">BinaryArrayHandler</a></li><li><a href="global.html#Types">Types</a></li><li><a href="global.html#binary">binary</a></li><li><a href="global.html">binarySize</a></li><li><a href="global.html#decorator">decorator</a></li><li><a href="global.html#iterator">iterator</a></li><li><a href="global.html#propertyDescriptor">propertyDescriptor</a></li><li><a href="global.html#propertyDescriptorGetter">propertyDescriptorGetter</a></li><li><a href="global.html#propertyDescriptorSetter">propertyDescriptorSetter</a></li><li><a href="global.html#withBinary">withBinary</a></li></ul> | ||
</nav> | ||
|
||
<br class="clear"> | ||
|
||
<footer> | ||
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.3</a> on Fri Oct 04 2024 07:14:57 GMT+0000 (Coordinated Universal Time) | ||
</footer> | ||
|
||
<script> prettyPrint(); </script> | ||
<script src="scripts/linenumber.js"> </script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/*global document */ | ||
(() => { | ||
const source = document.getElementsByClassName('prettyprint source linenums'); | ||
let i = 0; | ||
let lineNumber = 0; | ||
let lineId; | ||
let lines; | ||
let totalLines; | ||
let anchorHash; | ||
|
||
if (source && source[0]) { | ||
anchorHash = document.location.hash.substring(1); | ||
lines = source[0].getElementsByTagName('li'); | ||
totalLines = lines.length; | ||
|
||
for (; i < totalLines; i++) { | ||
lineNumber++; | ||
lineId = `line${lineNumber}`; | ||
lines[i].id = lineId; | ||
if (lineId === anchorHash) { | ||
lines[i].className += ' selected'; | ||
} | ||
} | ||
} | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,202 @@ | ||
|
||
Apache License | ||
Version 2.0, January 2004 | ||
http://www.apache.org/licenses/ | ||
|
||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION | ||
|
||
1. Definitions. | ||
|
||
"License" shall mean the terms and conditions for use, reproduction, | ||
and distribution as defined by Sections 1 through 9 of this document. | ||
|
||
"Licensor" shall mean the copyright owner or entity authorized by | ||
the copyright owner that is granting the License. | ||
|
||
"Legal Entity" shall mean the union of the acting entity and all | ||
other entities that control, are controlled by, or are under common | ||
control with that entity. For the purposes of this definition, | ||
"control" means (i) the power, direct or indirect, to cause the | ||
direction or management of such entity, whether by contract or | ||
otherwise, or (ii) ownership of fifty percent (50%) or more of the | ||
outstanding shares, or (iii) beneficial ownership of such entity. | ||
|
||
"You" (or "Your") shall mean an individual or Legal Entity | ||
exercising permissions granted by this License. | ||
|
||
"Source" form shall mean the preferred form for making modifications, | ||
including but not limited to software source code, documentation | ||
source, and configuration files. | ||
|
||
"Object" form shall mean any form resulting from mechanical | ||
transformation or translation of a Source form, including but | ||
not limited to compiled object code, generated documentation, | ||
and conversions to other media types. | ||
|
||
"Work" shall mean the work of authorship, whether in Source or | ||
Object form, made available under the License, as indicated by a | ||
copyright notice that is included in or attached to the work | ||
(an example is provided in the Appendix below). | ||
|
||
"Derivative Works" shall mean any work, whether in Source or Object | ||
form, that is based on (or derived from) the Work and for which the | ||
editorial revisions, annotations, elaborations, or other modifications | ||
represent, as a whole, an original work of authorship. For the purposes | ||
of this License, Derivative Works shall not include works that remain | ||
separable from, or merely link (or bind by name) to the interfaces of, | ||
the Work and Derivative Works thereof. | ||
|
||
"Contribution" shall mean any work of authorship, including | ||
the original version of the Work and any modifications or additions | ||
to that Work or Derivative Works thereof, that is intentionally | ||
submitted to Licensor for inclusion in the Work by the copyright owner | ||
or by an individual or Legal Entity authorized to submit on behalf of | ||
the copyright owner. For the purposes of this definition, "submitted" | ||
means any form of electronic, verbal, or written communication sent | ||
to the Licensor or its representatives, including but not limited to | ||
communication on electronic mailing lists, source code control systems, | ||
and issue tracking systems that are managed by, or on behalf of, the | ||
Licensor for the purpose of discussing and improving the Work, but | ||
excluding communication that is conspicuously marked or otherwise | ||
designated in writing by the copyright owner as "Not a Contribution." | ||
|
||
"Contributor" shall mean Licensor and any individual or Legal Entity | ||
on behalf of whom a Contribution has been received by Licensor and | ||
subsequently incorporated within the Work. | ||
|
||
2. Grant of Copyright License. Subject to the terms and conditions of | ||
this License, each Contributor hereby grants to You a perpetual, | ||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable | ||
copyright license to reproduce, prepare Derivative Works of, | ||
publicly display, publicly perform, sublicense, and distribute the | ||
Work and such Derivative Works in Source or Object form. | ||
|
||
3. Grant of Patent License. Subject to the terms and conditions of | ||
this License, each Contributor hereby grants to You a perpetual, | ||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable | ||
(except as stated in this section) patent license to make, have made, | ||
use, offer to sell, sell, import, and otherwise transfer the Work, | ||
where such license applies only to those patent claims licensable | ||
by such Contributor that are necessarily infringed by their | ||
Contribution(s) alone or by combination of their Contribution(s) | ||
with the Work to which such Contribution(s) was submitted. If You | ||
institute patent litigation against any entity (including a | ||
cross-claim or counterclaim in a lawsuit) alleging that the Work | ||
or a Contribution incorporated within the Work constitutes direct | ||
or contributory patent infringement, then any patent licenses | ||
granted to You under this License for that Work shall terminate | ||
as of the date such litigation is filed. | ||
|
||
4. Redistribution. You may reproduce and distribute copies of the | ||
Work or Derivative Works thereof in any medium, with or without | ||
modifications, and in Source or Object form, provided that You | ||
meet the following conditions: | ||
|
||
(a) You must give any other recipients of the Work or | ||
Derivative Works a copy of this License; and | ||
|
||
(b) You must cause any modified files to carry prominent notices | ||
stating that You changed the files; and | ||
|
||
(c) You must retain, in the Source form of any Derivative Works | ||
that You distribute, all copyright, patent, trademark, and | ||
attribution notices from the Source form of the Work, | ||
excluding those notices that do not pertain to any part of | ||
the Derivative Works; and | ||
|
||
(d) If the Work includes a "NOTICE" text file as part of its | ||
distribution, then any Derivative Works that You distribute must | ||
include a readable copy of the attribution notices contained | ||
within such NOTICE file, excluding those notices that do not | ||
pertain to any part of the Derivative Works, in at least one | ||
of the following places: within a NOTICE text file distributed | ||
as part of the Derivative Works; within the Source form or | ||
documentation, if provided along with the Derivative Works; or, | ||
within a display generated by the Derivative Works, if and | ||
wherever such third-party notices normally appear. The contents | ||
of the NOTICE file are for informational purposes only and | ||
do not modify the License. You may add Your own attribution | ||
notices within Derivative Works that You distribute, alongside | ||
or as an addendum to the NOTICE text from the Work, provided | ||
that such additional attribution notices cannot be construed | ||
as modifying the License. | ||
|
||
You may add Your own copyright statement to Your modifications and | ||
may provide additional or different license terms and conditions | ||
for use, reproduction, or distribution of Your modifications, or | ||
for any such Derivative Works as a whole, provided Your use, | ||
reproduction, and distribution of the Work otherwise complies with | ||
the conditions stated in this License. | ||
|
||
5. Submission of Contributions. Unless You explicitly state otherwise, | ||
any Contribution intentionally submitted for inclusion in the Work | ||
by You to the Licensor shall be under the terms and conditions of | ||
this License, without any additional terms or conditions. | ||
Notwithstanding the above, nothing herein shall supersede or modify | ||
the terms of any separate license agreement you may have executed | ||
with Licensor regarding such Contributions. | ||
|
||
6. Trademarks. This License does not grant permission to use the trade | ||
names, trademarks, service marks, or product names of the Licensor, | ||
except as required for reasonable and customary use in describing the | ||
origin of the Work and reproducing the content of the NOTICE file. | ||
|
||
7. Disclaimer of Warranty. Unless required by applicable law or | ||
agreed to in writing, Licensor provides the Work (and each | ||
Contributor provides its Contributions) on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or | ||
implied, including, without limitation, any warranties or conditions | ||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A | ||
PARTICULAR PURPOSE. You are solely responsible for determining the | ||
appropriateness of using or redistributing the Work and assume any | ||
risks associated with Your exercise of permissions under this License. | ||
|
||
8. Limitation of Liability. In no event and under no legal theory, | ||
whether in tort (including negligence), contract, or otherwise, | ||
unless required by applicable law (such as deliberate and grossly | ||
negligent acts) or agreed to in writing, shall any Contributor be | ||
liable to You for damages, including any direct, indirect, special, | ||
incidental, or consequential damages of any character arising as a | ||
result of this License or out of the use or inability to use the | ||
Work (including but not limited to damages for loss of goodwill, | ||
work stoppage, computer failure or malfunction, or any and all | ||
other commercial damages or losses), even if such Contributor | ||
has been advised of the possibility of such damages. | ||
|
||
9. Accepting Warranty or Additional Liability. While redistributing | ||
the Work or Derivative Works thereof, You may choose to offer, | ||
and charge a fee for, acceptance of support, warranty, indemnity, | ||
or other liability obligations and/or rights consistent with this | ||
License. However, in accepting such obligations, You may act only | ||
on Your own behalf and on Your sole responsibility, not on behalf | ||
of any other Contributor, and only if You agree to indemnify, | ||
defend, and hold each Contributor harmless for any liability | ||
incurred by, or claims asserted against, such Contributor by reason | ||
of your accepting any such warranty or additional liability. | ||
|
||
END OF TERMS AND CONDITIONS | ||
|
||
APPENDIX: How to apply the Apache License to your work. | ||
|
||
To apply the Apache License to your work, attach the following | ||
boilerplate notice, with the fields enclosed by brackets "[]" | ||
replaced with your own identifying information. (Don't include | ||
the brackets!) The text should be enclosed in the appropriate | ||
comment syntax for the file format. We also recommend that a | ||
file or class name and description of purpose be included on the | ||
same "printed page" as the copyright notice for easier | ||
identification within third-party archives. | ||
|
||
Copyright [yyyy] [name of copyright owner] | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. |
Oops, something went wrong.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,358 @@ | ||
@font-face { | ||
font-family: 'Open Sans'; | ||
font-weight: normal; | ||
font-style: normal; | ||
src: url('../fonts/OpenSans-Regular-webfont.eot'); | ||
src: | ||
local('Open Sans'), | ||
local('OpenSans'), | ||
url('../fonts/OpenSans-Regular-webfont.eot?#iefix') format('embedded-opentype'), | ||
url('../fonts/OpenSans-Regular-webfont.woff') format('woff'), | ||
url('../fonts/OpenSans-Regular-webfont.svg#open_sansregular') format('svg'); | ||
} | ||
|
||
@font-face { | ||
font-family: 'Open Sans Light'; | ||
font-weight: normal; | ||
font-style: normal; | ||
src: url('../fonts/OpenSans-Light-webfont.eot'); | ||
src: | ||
local('Open Sans Light'), | ||
local('OpenSans Light'), | ||
url('../fonts/OpenSans-Light-webfont.eot?#iefix') format('embedded-opentype'), | ||
url('../fonts/OpenSans-Light-webfont.woff') format('woff'), | ||
url('../fonts/OpenSans-Light-webfont.svg#open_sanslight') format('svg'); | ||
} | ||
|
||
html | ||
{ | ||
overflow: auto; | ||
background-color: #fff; | ||
font-size: 14px; | ||
} | ||
|
||
body | ||
{ | ||
font-family: 'Open Sans', sans-serif; | ||
line-height: 1.5; | ||
color: #4d4e53; | ||
background-color: white; | ||
} | ||
|
||
a, a:visited, a:active { | ||
color: #0095dd; | ||
text-decoration: none; | ||
} | ||
|
||
a:hover { | ||
text-decoration: underline; | ||
} | ||
|
||
header | ||
{ | ||
display: block; | ||
padding: 0px 4px; | ||
} | ||
|
||
tt, code, kbd, samp { | ||
font-family: Consolas, Monaco, 'Andale Mono', monospace; | ||
} | ||
|
||
.class-description { | ||
font-size: 130%; | ||
line-height: 140%; | ||
margin-bottom: 1em; | ||
margin-top: 1em; | ||
} | ||
|
||
.class-description:empty { | ||
margin: 0; | ||
} | ||
|
||
#main { | ||
float: left; | ||
width: 70%; | ||
} | ||
|
||
article dl { | ||
margin-bottom: 40px; | ||
} | ||
|
||
article img { | ||
max-width: 100%; | ||
} | ||
|
||
section | ||
{ | ||
display: block; | ||
background-color: #fff; | ||
padding: 12px 24px; | ||
border-bottom: 1px solid #ccc; | ||
margin-right: 30px; | ||
} | ||
|
||
.variation { | ||
display: none; | ||
} | ||
|
||
.signature-attributes { | ||
font-size: 60%; | ||
color: #aaa; | ||
font-style: italic; | ||
font-weight: lighter; | ||
} | ||
|
||
nav | ||
{ | ||
display: block; | ||
float: right; | ||
margin-top: 28px; | ||
width: 30%; | ||
box-sizing: border-box; | ||
border-left: 1px solid #ccc; | ||
padding-left: 16px; | ||
} | ||
|
||
nav ul { | ||
font-family: 'Lucida Grande', 'Lucida Sans Unicode', arial, sans-serif; | ||
font-size: 100%; | ||
line-height: 17px; | ||
padding: 0; | ||
margin: 0; | ||
list-style-type: none; | ||
} | ||
|
||
nav ul a, nav ul a:visited, nav ul a:active { | ||
font-family: Consolas, Monaco, 'Andale Mono', monospace; | ||
line-height: 18px; | ||
color: #4D4E53; | ||
} | ||
|
||
nav h3 { | ||
margin-top: 12px; | ||
} | ||
|
||
nav li { | ||
margin-top: 6px; | ||
} | ||
|
||
footer { | ||
display: block; | ||
padding: 6px; | ||
margin-top: 12px; | ||
font-style: italic; | ||
font-size: 90%; | ||
} | ||
|
||
h1, h2, h3, h4 { | ||
font-weight: 200; | ||
margin: 0; | ||
} | ||
|
||
h1 | ||
{ | ||
font-family: 'Open Sans Light', sans-serif; | ||
font-size: 48px; | ||
letter-spacing: -2px; | ||
margin: 12px 24px 20px; | ||
} | ||
|
||
h2, h3.subsection-title | ||
{ | ||
font-size: 30px; | ||
font-weight: 700; | ||
letter-spacing: -1px; | ||
margin-bottom: 12px; | ||
} | ||
|
||
h3 | ||
{ | ||
font-size: 24px; | ||
letter-spacing: -0.5px; | ||
margin-bottom: 12px; | ||
} | ||
|
||
h4 | ||
{ | ||
font-size: 18px; | ||
letter-spacing: -0.33px; | ||
margin-bottom: 12px; | ||
color: #4d4e53; | ||
} | ||
|
||
h5, .container-overview .subsection-title | ||
{ | ||
font-size: 120%; | ||
font-weight: bold; | ||
letter-spacing: -0.01em; | ||
margin: 8px 0 3px 0; | ||
} | ||
|
||
h6 | ||
{ | ||
font-size: 100%; | ||
letter-spacing: -0.01em; | ||
margin: 6px 0 3px 0; | ||
font-style: italic; | ||
} | ||
|
||
table | ||
{ | ||
border-spacing: 0; | ||
border: 0; | ||
border-collapse: collapse; | ||
} | ||
|
||
td, th | ||
{ | ||
border: 1px solid #ddd; | ||
margin: 0px; | ||
text-align: left; | ||
vertical-align: top; | ||
padding: 4px 6px; | ||
display: table-cell; | ||
} | ||
|
||
thead tr | ||
{ | ||
background-color: #ddd; | ||
font-weight: bold; | ||
} | ||
|
||
th { border-right: 1px solid #aaa; } | ||
tr > th:last-child { border-right: 1px solid #ddd; } | ||
|
||
.ancestors, .attribs { color: #999; } | ||
.ancestors a, .attribs a | ||
{ | ||
color: #999 !important; | ||
text-decoration: none; | ||
} | ||
|
||
.clear | ||
{ | ||
clear: both; | ||
} | ||
|
||
.important | ||
{ | ||
font-weight: bold; | ||
color: #950B02; | ||
} | ||
|
||
.yes-def { | ||
text-indent: -1000px; | ||
} | ||
|
||
.type-signature { | ||
color: #aaa; | ||
} | ||
|
||
.name, .signature { | ||
font-family: Consolas, Monaco, 'Andale Mono', monospace; | ||
} | ||
|
||
.details { margin-top: 14px; border-left: 2px solid #DDD; } | ||
.details dt { width: 120px; float: left; padding-left: 10px; padding-top: 6px; } | ||
.details dd { margin-left: 70px; } | ||
.details ul { margin: 0; } | ||
.details ul { list-style-type: none; } | ||
.details li { margin-left: 30px; padding-top: 6px; } | ||
.details pre.prettyprint { margin: 0 } | ||
.details .object-value { padding-top: 0; } | ||
|
||
.description { | ||
margin-bottom: 1em; | ||
margin-top: 1em; | ||
} | ||
|
||
.code-caption | ||
{ | ||
font-style: italic; | ||
font-size: 107%; | ||
margin: 0; | ||
} | ||
|
||
.source | ||
{ | ||
border: 1px solid #ddd; | ||
width: 80%; | ||
overflow: auto; | ||
} | ||
|
||
.prettyprint.source { | ||
width: inherit; | ||
} | ||
|
||
.source code | ||
{ | ||
font-size: 100%; | ||
line-height: 18px; | ||
display: block; | ||
padding: 4px 12px; | ||
margin: 0; | ||
background-color: #fff; | ||
color: #4D4E53; | ||
} | ||
|
||
.prettyprint code span.line | ||
{ | ||
display: inline-block; | ||
} | ||
|
||
.prettyprint.linenums | ||
{ | ||
padding-left: 70px; | ||
-webkit-user-select: none; | ||
-moz-user-select: none; | ||
-ms-user-select: none; | ||
user-select: none; | ||
} | ||
|
||
.prettyprint.linenums ol | ||
{ | ||
padding-left: 0; | ||
} | ||
|
||
.prettyprint.linenums li | ||
{ | ||
border-left: 3px #ddd solid; | ||
} | ||
|
||
.prettyprint.linenums li.selected, | ||
.prettyprint.linenums li.selected * | ||
{ | ||
background-color: lightyellow; | ||
} | ||
|
||
.prettyprint.linenums li * | ||
{ | ||
-webkit-user-select: text; | ||
-moz-user-select: text; | ||
-ms-user-select: text; | ||
user-select: text; | ||
} | ||
|
||
.params .name, .props .name, .name code { | ||
color: #4D4E53; | ||
font-family: Consolas, Monaco, 'Andale Mono', monospace; | ||
font-size: 100%; | ||
} | ||
|
||
.params td.description > p:first-child, | ||
.props td.description > p:first-child | ||
{ | ||
margin-top: 0; | ||
padding-top: 0; | ||
} | ||
|
||
.params td.description > p:last-child, | ||
.props td.description > p:last-child | ||
{ | ||
margin-bottom: 0; | ||
padding-bottom: 0; | ||
} | ||
|
||
.disabled { | ||
color: #454545; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
/* JSDoc prettify.js theme */ | ||
|
||
/* plain text */ | ||
.pln { | ||
color: #000000; | ||
font-weight: normal; | ||
font-style: normal; | ||
} | ||
|
||
/* string content */ | ||
.str { | ||
color: #006400; | ||
font-weight: normal; | ||
font-style: normal; | ||
} | ||
|
||
/* a keyword */ | ||
.kwd { | ||
color: #000000; | ||
font-weight: bold; | ||
font-style: normal; | ||
} | ||
|
||
/* a comment */ | ||
.com { | ||
font-weight: normal; | ||
font-style: italic; | ||
} | ||
|
||
/* a type name */ | ||
.typ { | ||
color: #000000; | ||
font-weight: normal; | ||
font-style: normal; | ||
} | ||
|
||
/* a literal value */ | ||
.lit { | ||
color: #006400; | ||
font-weight: normal; | ||
font-style: normal; | ||
} | ||
|
||
/* punctuation */ | ||
.pun { | ||
color: #000000; | ||
font-weight: bold; | ||
font-style: normal; | ||
} | ||
|
||
/* lisp open bracket */ | ||
.opn { | ||
color: #000000; | ||
font-weight: bold; | ||
font-style: normal; | ||
} | ||
|
||
/* lisp close bracket */ | ||
.clo { | ||
color: #000000; | ||
font-weight: bold; | ||
font-style: normal; | ||
} | ||
|
||
/* a markup tag name */ | ||
.tag { | ||
color: #006400; | ||
font-weight: normal; | ||
font-style: normal; | ||
} | ||
|
||
/* a markup attribute name */ | ||
.atn { | ||
color: #006400; | ||
font-weight: normal; | ||
font-style: normal; | ||
} | ||
|
||
/* a markup attribute value */ | ||
.atv { | ||
color: #006400; | ||
font-weight: normal; | ||
font-style: normal; | ||
} | ||
|
||
/* a declaration */ | ||
.dec { | ||
color: #000000; | ||
font-weight: bold; | ||
font-style: normal; | ||
} | ||
|
||
/* a variable name */ | ||
.var { | ||
color: #000000; | ||
font-weight: normal; | ||
font-style: normal; | ||
} | ||
|
||
/* a function name */ | ||
.fun { | ||
color: #000000; | ||
font-weight: bold; | ||
font-style: normal; | ||
} | ||
|
||
/* Specify class=linenums on a pre to get line numbering */ | ||
ol.linenums { | ||
margin-top: 0; | ||
margin-bottom: 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
/* Tomorrow Theme */ | ||
/* Original theme - https://github.com/chriskempson/tomorrow-theme */ | ||
/* Pretty printing styles. Used with prettify.js. */ | ||
/* SPAN elements with the classes below are added by prettyprint. */ | ||
/* plain text */ | ||
.pln { | ||
color: #4d4d4c; } | ||
|
||
@media screen { | ||
/* string content */ | ||
.str { | ||
color: #718c00; } | ||
|
||
/* a keyword */ | ||
.kwd { | ||
color: #8959a8; } | ||
|
||
/* a comment */ | ||
.com { | ||
color: #8e908c; } | ||
|
||
/* a type name */ | ||
.typ { | ||
color: #4271ae; } | ||
|
||
/* a literal value */ | ||
.lit { | ||
color: #f5871f; } | ||
|
||
/* punctuation */ | ||
.pun { | ||
color: #4d4d4c; } | ||
|
||
/* lisp open bracket */ | ||
.opn { | ||
color: #4d4d4c; } | ||
|
||
/* lisp close bracket */ | ||
.clo { | ||
color: #4d4d4c; } | ||
|
||
/* a markup tag name */ | ||
.tag { | ||
color: #c82829; } | ||
|
||
/* a markup attribute name */ | ||
.atn { | ||
color: #f5871f; } | ||
|
||
/* a markup attribute value */ | ||
.atv { | ||
color: #3e999f; } | ||
|
||
/* a declaration */ | ||
.dec { | ||
color: #f5871f; } | ||
|
||
/* a variable name */ | ||
.var { | ||
color: #c82829; } | ||
|
||
/* a function name */ | ||
.fun { | ||
color: #4271ae; } } | ||
/* Use higher contrast and text-weight for printable form. */ | ||
@media print, projection { | ||
.str { | ||
color: #060; } | ||
|
||
.kwd { | ||
color: #006; | ||
font-weight: bold; } | ||
|
||
.com { | ||
color: #600; | ||
font-style: italic; } | ||
|
||
.typ { | ||
color: #404; | ||
font-weight: bold; } | ||
|
||
.lit { | ||
color: #044; } | ||
|
||
.pun, .opn, .clo { | ||
color: #440; } | ||
|
||
.tag { | ||
color: #006; | ||
font-weight: bold; } | ||
|
||
.atn { | ||
color: #404; } | ||
|
||
.atv { | ||
color: #060; } } | ||
/* Style */ | ||
/* | ||
pre.prettyprint { | ||
background: white; | ||
font-family: Consolas, Monaco, 'Andale Mono', monospace; | ||
font-size: 12px; | ||
line-height: 1.5; | ||
border: 1px solid #ccc; | ||
padding: 10px; } | ||
*/ | ||
|
||
/* Specify class=linenums on a pre to get line numbering */ | ||
ol.linenums { | ||
margin-top: 0; | ||
margin-bottom: 0; } | ||
|
||
/* IE indents via margin-left */ | ||
li.L0, | ||
li.L1, | ||
li.L2, | ||
li.L3, | ||
li.L4, | ||
li.L5, | ||
li.L6, | ||
li.L7, | ||
li.L8, | ||
li.L9 { | ||
/* */ } | ||
|
||
/* Alternate shading for lines */ | ||
li.L1, | ||
li.L3, | ||
li.L5, | ||
li.L7, | ||
li.L9 { | ||
/* */ } |