forked from Ittai/ittai
More docs
This commit is contained in:
parent
32d802d24b
commit
393a94c8af
|
@ -1,20 +0,0 @@
|
|||
import { getByProps } from "../webpack/modules";
|
||||
const React = getByProps("useState");
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {object} props - React properties.
|
||||
* @param {string} props.type - The FontAwesome icon type. `solid`, `regular`, `light`, `duotone`, `brand`.
|
||||
* @param {string} props.className - For extra class features that aren't directly supported. Example: https://fontawesome.com/how-to-use/on-the-web/styling/duotone-icons
|
||||
* @param {number} props.size - The size of the icon in pixels. Don't include `px`.
|
||||
*/
|
||||
export function FontAwesome(props) {
|
||||
return (
|
||||
<i
|
||||
className={`fa${props.type?.[0] ? props.type[0].toLowerCase() : "s"} fa-${
|
||||
props.name ? props.name : "debug"
|
||||
}${props.className ? " " + props.className : ""}`}
|
||||
style={{ fontSize: props.size ? props.size + "px" : "48px" }}
|
||||
/>
|
||||
);
|
||||
}
|
|
@ -1,2 +0,0 @@
|
|||
import { FontAwesome } from "./FontAwesome";
|
||||
export const FontAwesome = FontAwesome;
|
|
@ -1,8 +1,15 @@
|
|||
/**
|
||||
* @module entities
|
||||
*/
|
||||
|
||||
import { getClientMod } from "../utils";
|
||||
|
||||
const faURL =
|
||||
"https://kit-pro.fontawesome.com/releases/v5.15.1/css/pro.min.css";
|
||||
|
||||
/**
|
||||
* The plugin class for the running client mod.
|
||||
*/
|
||||
export const Plugin = (() => {
|
||||
if (!document.querySelector(`[href="${faURL}"]`)) {
|
||||
document.head.appendChild(
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
export * as components from "./components";
|
||||
export * as reactComponents from "./reactComponents";
|
||||
export * as entities from "./entities";
|
||||
export * as libraries from "./libraries";
|
||||
export * as settings from "./settings";
|
||||
|
|
|
@ -1,6 +1,16 @@
|
|||
import { getByProps } from "../webpack/modules";
|
||||
/** @module libraries */
|
||||
|
||||
import { getByProps } from "../webpack/modules";
|
||||
|
||||
/**
|
||||
* Discord's {@link https://reactjs.org/|React} instance.
|
||||
*/
|
||||
export const React = getByProps("useState");
|
||||
/**
|
||||
* Discord's {@link https://reactjs.org/docs/react-dom.html|ReactDOM} instance.
|
||||
*/
|
||||
export const ReactDOM = getByProps("render", "unmountComponentAtNode");
|
||||
export const lodash = globalThis._;
|
||||
/**
|
||||
* Discord's {@link https://lodash.com/|Lodash} instance.
|
||||
*/
|
||||
export const Lodash = globalThis._;
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
import { React } from "../webpack/libraries";
|
||||
|
||||
/**
|
||||
* Render any {@link https://fontawesome.com/|FontAwesome} icon.
|
||||
* @component
|
||||
* @example
|
||||
* <FontAwesome type="brand" name="discord" size="22" />
|
||||
* @param {object} props React properties.
|
||||
* @param {string} [props.type="solid"] The FontAwesome icon type. `solid`, `regular`, `light`, `duotone`, `brand`.
|
||||
* @param {number} props.size The size of the icon in pixels. Don't include `px`.
|
||||
* @param {string} props.className {@link https://fontawesome.com/how-to-use/on-the-web/styling/duotone-icons|For extra class features that aren't directly supported.}
|
||||
* @category reactComponents
|
||||
*/
|
||||
export function FontAwesome(props) {
|
||||
return (
|
||||
<i
|
||||
className={`fa${props.type?.[0] ? props.type[0].toLowerCase() : "s"} fa-${
|
||||
props.name ? props.name : "debug"
|
||||
}${props.className ? " " + props.className : ""}`}
|
||||
style={{ fontSize: props.size ? props.size + "px" : "48px" }}
|
||||
/>
|
||||
);
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
/**
|
||||
* @module reactComponents
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see FontAwesome
|
||||
*/
|
||||
export const FontAwesome = import("./FontAwesome");
|
|
@ -1,13 +1,23 @@
|
|||
import getClientMod from "./getClientMod";
|
||||
import * as logger from "./logger";
|
||||
|
||||
export * as patcher from "./patcher";
|
||||
export * as logger from "./logger";
|
||||
/**
|
||||
* @module utils
|
||||
*/
|
||||
|
||||
// Know it will work on this client mod or it's detecting the wrong one?
|
||||
// Set this variable.
|
||||
let clientMod;
|
||||
|
||||
/**
|
||||
* @see module:patcher
|
||||
*/
|
||||
export const patcher = import("./patcher");
|
||||
/**
|
||||
* @see module:logger
|
||||
*/
|
||||
export const logger = import("./logger");
|
||||
|
||||
/**
|
||||
* @returns {string} The name of the running client mod.
|
||||
*/
|
||||
export function getClientMod() {
|
||||
if (clientMod) return clientMod;
|
||||
if (globalThis.BdApi && !window.powercord?.pluginManager.get("bdCompat")) {
|
||||
|
@ -24,11 +34,19 @@ export function getClientMod() {
|
|||
throw Error("Unknown client mod.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {number} The current time in nanoseconds.
|
||||
*/
|
||||
export function nanoseconds() {
|
||||
const hrTime = process.hrtime();
|
||||
return hrTime[0] * 1000000000 + hrTime[1];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {function} codeblock The code to benchmark.
|
||||
* @param {number} times The amount of times to run the benchmark.
|
||||
* @returns {Promise} A Promise that resolves when the benchmark is completed.
|
||||
*/
|
||||
export function benchmark(codeblock, times) {
|
||||
return new Promise((resolve) => {
|
||||
const pre = codeblock.pre ?? (() => {});
|
||||
|
@ -73,6 +91,11 @@ export function benchmark(codeblock, times) {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints out the benchmark results for each code block.
|
||||
* @param {function} codeblock The code to benchmark.
|
||||
* @param {number} times The amount of times to run the benchmark.
|
||||
*/
|
||||
export function multiBenchmark(codeblocks, times) {
|
||||
return new Promise((resolve) => {
|
||||
const start = nanoseconds();
|
||||
|
@ -118,6 +141,10 @@ export function multiBenchmark(codeblocks, times) {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {number[]} array An array of numbers.
|
||||
* @returns {number} The average of the numbers in the array.
|
||||
*/
|
||||
export function average(array) {
|
||||
if (array.length === 0) return 0;
|
||||
let total = 0;
|
||||
|
@ -127,6 +154,10 @@ export function average(array) {
|
|||
return total / array.length;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {number[]} array An array of numbers.
|
||||
* @returns {number} The median of the numbers in the array.
|
||||
*/
|
||||
export function median(array) {
|
||||
if (array.length === 0) return 0;
|
||||
array.sort(function (a, b) {
|
||||
|
@ -137,6 +168,10 @@ export function median(array) {
|
|||
return (array[half - 1] + array[half]) / 2.0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {number} length The length of the string.
|
||||
* @returns {string} A string of random characters.
|
||||
*/
|
||||
export function randomString(length) {
|
||||
let string = "";
|
||||
while (string.length < length) {
|
||||
|
@ -144,27 +179,3 @@ export function randomString(length) {
|
|||
}
|
||||
return string.slice(0, length);
|
||||
}
|
||||
|
||||
export function* searchTree(tree, value, key, reverse = false) {
|
||||
const stack = [tree[0]];
|
||||
while (stack.length) {
|
||||
const node = stack[reverse ? "pop" : "shift"]();
|
||||
if (node[key] === value) yield node;
|
||||
node.children && stack.push(...node.children);
|
||||
}
|
||||
}
|
||||
export function* searchTreeKey(tree, key, reverse = false) {
|
||||
const stack = Object.keys(tree).map((t) => ({ key: t, value: tree[t] }));
|
||||
while (stack.length) {
|
||||
const node = stack[reverse ? "pop" : "shift"]();
|
||||
if (node.key === key) yield node.value;
|
||||
if (node.value ?? false) {
|
||||
stack.push(
|
||||
...Object.keys(node.value).map((t) => ({
|
||||
key: t,
|
||||
value: node.value[t],
|
||||
}))
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
/**
|
||||
* @module logger
|
||||
* @category utils
|
||||
*/
|
||||
|
||||
const cc = { ...console };
|
||||
|
||||
export function createArguments(...args) {
|
||||
function createArguments(...args) {
|
||||
return [
|
||||
"%cIttai",
|
||||
"color: #000; background-color: #42ffa7; font-family: default; padding-left: 3px; padding-right: 3px; border-radius: 2px; font-weight: bold;",
|
||||
|
@ -8,21 +13,39 @@ export function createArguments(...args) {
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {...any} args
|
||||
*/
|
||||
export function log(...args) {
|
||||
cc.log(...createArguments(...args));
|
||||
}
|
||||
/**
|
||||
* @param {...any} args
|
||||
*/
|
||||
export function debug(...args) {
|
||||
cc.debug(...createArguments(...args));
|
||||
}
|
||||
/**
|
||||
* @param {...any} args
|
||||
*/
|
||||
export function warn(...args) {
|
||||
cc.warn(...createArguments(...args));
|
||||
}
|
||||
/**
|
||||
* @param {...any} args
|
||||
*/
|
||||
export function error(...args) {
|
||||
cc.error(...createArguments(...args));
|
||||
}
|
||||
/**
|
||||
* @param {...any} args
|
||||
*/
|
||||
export function group(...args) {
|
||||
cc.group(...createArguments(...args));
|
||||
}
|
||||
/**
|
||||
* @param {...any} args
|
||||
*/
|
||||
export function groupEnd(...args) {
|
||||
cc.groupEnd(...createArguments(...args));
|
||||
}
|
||||
|
|
|
@ -1,28 +1,79 @@
|
|||
/**
|
||||
* @module patcher
|
||||
* @category utils
|
||||
*/
|
||||
|
||||
import logger from "./logger";
|
||||
|
||||
/**
|
||||
* A list of the currently patched components.
|
||||
*/
|
||||
export let patches = [];
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {string} name The name of the patch. For debugging.
|
||||
* @param {any} object The object that the function is in.
|
||||
* @param {string} functionName The name of the function to patch.
|
||||
* @param {function} patchFunction The code to patch into the function.
|
||||
* @returns {object} {@link module:patcher.patch~patchData}
|
||||
*/
|
||||
export function before(name, object, functionName, patchFunction) {
|
||||
return patch(name, object, functionName, "before", patchFunction);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param {string} name The name of the patch. For debugging.
|
||||
* @param {any} object The object that the function is in.
|
||||
* @param {string} functionName The name of the function to patch.
|
||||
* @param {function} patchFunction The code to patch into the function.
|
||||
* @returns {Object} {@link module:patcher.patch~patchData}
|
||||
*/
|
||||
export function instead(name, object, functionName, patchFunction) {
|
||||
return patch(name, object, functionName, "instead", patchFunction);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param {string} name The name of the patch. For debugging.
|
||||
* @param {any} object The object that the function is in.
|
||||
* @param {string} functionName The name of the function to patch.
|
||||
* @param {function} patchFunction The code to patch into the function.
|
||||
* @returns {object} {@link module:patcher.patch~patchData}
|
||||
*/
|
||||
export function after(name, object, functionName, patchFunction) {
|
||||
return patch(name, object, functionName, "after", patchFunction);
|
||||
}
|
||||
|
||||
export function unpatchAll(ps) {
|
||||
if (!ps) ps = patches;
|
||||
else if (!Array.isArray(ps)) throw "`patches` is not an array.";
|
||||
|
||||
for (const patch of ps) {
|
||||
/**
|
||||
* Unpatches all of the patches specified, or all of them if none are specified.
|
||||
* @param {string[]} [unpatches={@link module:patcher.patches}] An array patch names.
|
||||
*/
|
||||
export function unpatchAll(unpatches = patches) {
|
||||
if (!Array.isArray(unpatches)) throw "`patches` is not an array.";
|
||||
for (const patch of unpatches) {
|
||||
patch.unpatch();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {string} name The name of the patch. For debugging.
|
||||
* @param {any} object The object that the function is in.
|
||||
* @param {string} functionName The name of the function to patch.
|
||||
* @param {string} type The type of patch to apply. `before`, `instead`, `after`.
|
||||
* @param {function} patchFunction The code to patch into the function.
|
||||
* @returns {object} {@link module:patcher.patch~patchData}
|
||||
*/
|
||||
export function patch(name, object, functionName, type, patchFunction) {
|
||||
if (!object.__ittai__) object.__ittai__ = {};
|
||||
/**
|
||||
* @namespace
|
||||
* @prop {string} name The name of the function being patched.
|
||||
* @prop {string} type The type of the patch.
|
||||
* @prop {function} patchFunction The original function.
|
||||
* @prop {function} unpatch The function to call to unpatch.
|
||||
* @category utils.patcher.patch
|
||||
*/
|
||||
const patchData = {
|
||||
name,
|
||||
type,
|
||||
|
|
|
@ -1,8 +1,17 @@
|
|||
/**
|
||||
* @module classes
|
||||
* @category webpack
|
||||
*/
|
||||
|
||||
import { updateModules } from "./modules";
|
||||
|
||||
let _classes = [];
|
||||
updateClasses();
|
||||
|
||||
/**
|
||||
* Extracts all of the classes from a Webpack module.
|
||||
* @param {Object} module The module to search.
|
||||
*/
|
||||
export function getAllClassesFromModule(module) {
|
||||
let classes = {};
|
||||
for (const prop of Object.keys(module).map((key) => ({
|
||||
|
@ -21,6 +30,11 @@ export function getAllClassesFromModule(module) {
|
|||
return classes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a Webpack module from Discord by the class names.
|
||||
* @param {...string} names
|
||||
* @returns {Object}
|
||||
*/
|
||||
export function getByNames(...names) {
|
||||
for (const mod of all()) {
|
||||
if (names.every((name) => mod[name] !== undefined)) {
|
||||
|
@ -31,6 +45,10 @@ export function getByNames(...names) {
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the class cache.
|
||||
* @returns {Object} The class cache.
|
||||
*/
|
||||
export function updateClasses() {
|
||||
let classes = [];
|
||||
|
||||
|
@ -42,6 +60,10 @@ export function updateClasses() {
|
|||
return (_classes = classes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all classes in Discord's Webpack modules.
|
||||
* @returns {Object} The class cache.
|
||||
*/
|
||||
export function all() {
|
||||
if (_classes) return _classes;
|
||||
return updateClasses();
|
||||
|
|
|
@ -1,8 +1,17 @@
|
|||
/**
|
||||
* @module components
|
||||
* @category webpack
|
||||
*/
|
||||
|
||||
import { updateModules } from "./modules";
|
||||
|
||||
let _components = {};
|
||||
updateComponents();
|
||||
|
||||
/**
|
||||
* Extracts all of the React components from a Webpack module.
|
||||
* @param {Object} module The module to search.
|
||||
*/
|
||||
export function getAllComponentsFromModule(module) {
|
||||
let components = {};
|
||||
if (typeof module === "function" && module.displayName != undefined)
|
||||
|
@ -32,6 +41,10 @@ const componentsHandler = {
|
|||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Updates the React component cache.
|
||||
* @returns {Object} The React component cache.
|
||||
*/
|
||||
export function updateComponents() {
|
||||
let components = {};
|
||||
|
||||
|
@ -51,4 +64,10 @@ export function updateComponents() {
|
|||
return (_components = components);
|
||||
}
|
||||
|
||||
/**
|
||||
* A {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy/|Proxy} of all React components in Discord's Webpack modules.
|
||||
* @type {Proxy}
|
||||
* @example
|
||||
* const {MiniPopover, Text} = ittai.webpack.components.all;
|
||||
*/
|
||||
export const all = new Proxy(_components, componentsHandler);
|
||||
|
|
|
@ -1,3 +1,16 @@
|
|||
export * as modules from "./modules";
|
||||
export * as components from "./components";
|
||||
export * as classes from "./classes";
|
||||
/**
|
||||
* @module webpack
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see module:modules
|
||||
*/
|
||||
export const modules = import("./modules");
|
||||
/**
|
||||
* @see module:components
|
||||
*/
|
||||
export const components = import("./components");
|
||||
/**
|
||||
* @see module:classes
|
||||
*/
|
||||
export const classes = import("./classes");
|
||||
|
|
|
@ -1,8 +1,18 @@
|
|||
/**
|
||||
* @module modules
|
||||
* @category webpack
|
||||
*/
|
||||
|
||||
const webpackID = "_ittai";
|
||||
let _modules;
|
||||
let webpackCache;
|
||||
updateModules();
|
||||
|
||||
/**
|
||||
* Gets a Webpack module from Discord by its property names.
|
||||
* @param {...string} names
|
||||
* @returns {Object}
|
||||
*/
|
||||
export function getByProps(...props) {
|
||||
for (const mod of all()) {
|
||||
if (props.every((prop) => mod[prop] !== undefined)) {
|
||||
|
@ -17,11 +27,19 @@ export function getByProps(...props) {
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all modules in Discord's Webpack modules.
|
||||
* @returns {Object} The module cache.
|
||||
*/
|
||||
export function all() {
|
||||
if (_modules) return _modules;
|
||||
return updateModules();
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the module cache.
|
||||
* @returns {Object} The module cache.
|
||||
*/
|
||||
export function updateModules() {
|
||||
if (!webpackCache) {
|
||||
let __webpack_require__ = globalThis.webpackJsonp.push([
|
||||
|
@ -45,6 +63,9 @@ export function updateModules() {
|
|||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes Ittai from `webpackJsonp`.
|
||||
*/
|
||||
export function cleanWebpackJsonp() {
|
||||
for (let i = globalThis.webpackJsonp.length - 1; i >= 0; i--) {
|
||||
if (!globalThis.webpackJsonp.hasOwnProperty(i)) continue;
|
||||
|
|
|
@ -0,0 +1,463 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Ittai FontAwesome</title>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/gh/google/code-prettify@master/loader/run_prettify.js"></script>
|
||||
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
|
||||
<script src="./build/entry.js"></script>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<link href="https://fonts.googleapis.com/css?family=Roboto:100,400,700|Inconsolata,700" rel="stylesheet">
|
||||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">
|
||||
<link type="text/css" rel="stylesheet" href="https://jmblog.github.io/color-themes-for-google-code-prettify/themes/tomorrow-night.min.css">
|
||||
<link type="text/css" rel="stylesheet" href="styles/app.min.css">
|
||||
<link type="text/css" rel="stylesheet" href="styles/iframe.css">
|
||||
<link type="text/css" rel="stylesheet" href="jsdoc.css">
|
||||
<script async defer src="https://buttons.github.io/buttons.js"></script>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
|
||||
|
||||
<body class="layout small-header">
|
||||
<div id="stickyNavbarOverlay"></div>
|
||||
|
||||
|
||||
<div class="top-nav">
|
||||
<div class="inner">
|
||||
<a id="hamburger" role="button" class="navbar-burger" aria-label="menu" aria-expanded="false">
|
||||
<span aria-hidden="true"></span>
|
||||
<span aria-hidden="true"></span>
|
||||
<span aria-hidden="true"></span>
|
||||
</a>
|
||||
<div class="logo">
|
||||
|
||||
|
||||
<a href="index.html">
|
||||
<h1 class="navbar-item">Ittai Documentation</h1>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
<div class="menu">
|
||||
|
||||
<div class="navigation">
|
||||
<a
|
||||
href="index.html"
|
||||
class="link"
|
||||
>
|
||||
API Documentation
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<a
|
||||
class="link user-link "
|
||||
href="https://github.com/Kyza/ittai"
|
||||
>
|
||||
GitHub
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="main">
|
||||
<div
|
||||
class="sidebar "
|
||||
id="sidebarNav"
|
||||
>
|
||||
|
||||
<div class="search-wrapper">
|
||||
<input id="search" type="text" placeholder="Search docs..." class="input">
|
||||
</div>
|
||||
|
||||
<nav>
|
||||
|
||||
<h2><a href="index.html">Documentation</a></h2><div class="category"><h3>Modules</h3><ul><li><a href="module-entities.html">entities</a></li><li><a href="module-libraries.html">libraries</a></li><li><a href="module-reactComponents.html">reactComponents</a></li><li><a href="module-utils.html">utils</a></li><li><a href="module-webpack.html">webpack</a></li></ul></div><div class="category"><h2>reactComponents</h2><h3>Components</h3><ul><li><a href="FontAwesome.html">FontAwesome</a></li></ul></div><div class="category"><h2>utils</h2><h3>Modules</h3><ul><li><a href="module-logger.html">logger</a></li><li><a href="module-patcher.html">patcher</a></li></ul></div><div class="category"><h2>utils.patcher.patch</h2><h3>Namespaces</h3><ul><li><a href="module-patcher.patch-patchData.html">patchData</a></li></ul></div><div class="category"><h2>webpack</h2><h3>Modules</h3><ul><li><a href="module-classes.html">classes</a></li><li><a href="module-components.html">components</a></li><li><a href="module-modules.html">modules</a></li></ul></div>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
<div class="core" id="main-content-wrapper">
|
||||
<div class="content">
|
||||
<header class="page-title">
|
||||
<p>Components</p>
|
||||
<h1>FontAwesome</h1>
|
||||
</header>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<section>
|
||||
|
||||
<header>
|
||||
|
||||
<h2>
|
||||
<FontAwesome />
|
||||
</h2>
|
||||
|
||||
|
||||
</header>
|
||||
|
||||
<article>
|
||||
<div class="container-overview">
|
||||
|
||||
|
||||
<div class='vertical-section'>
|
||||
<div class="members">
|
||||
<div class="member">
|
||||
<div class=name>
|
||||
<span class="tag">Constructor</span>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<h4 class="name" id="FontAwesome">
|
||||
<a class="href-link" href="#FontAwesome">#</a>
|
||||
|
||||
<span class="code-name">
|
||||
|
||||
<FontAwesome />
|
||||
|
||||
</span>
|
||||
</h4>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="description">
|
||||
<p>Render any <a href="https://fontawesome.com/">FontAwesome</a> icon.</p>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h5>Parameters:</h5>
|
||||
|
||||
<div class="table-container">
|
||||
<table class="params table">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
<th>Name</th>
|
||||
|
||||
|
||||
<th>Type</th>
|
||||
|
||||
|
||||
<th>Attributes</th>
|
||||
|
||||
|
||||
|
||||
<th>Default</th>
|
||||
|
||||
|
||||
<th class="last">Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
|
||||
|
||||
|
||||
<tr class="deep-level-0">
|
||||
|
||||
<td class="name"><code>props</code></td>
|
||||
|
||||
|
||||
<td class="type">
|
||||
|
||||
|
||||
<span class="param-type">object</span>
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
<td class="attributes">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
<td class="default">
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
<td class="description last"><p>React properties.</p></td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
|
||||
<tr class="deep-level-1">
|
||||
|
||||
<td class="name"><code>type</code></td>
|
||||
|
||||
|
||||
<td class="type">
|
||||
|
||||
|
||||
<span class="param-type">string</span>
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
<td class="attributes">
|
||||
|
||||
<optional><br>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
<td class="default">
|
||||
|
||||
"solid"
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
<td class="description last"><p>The FontAwesome icon type. <code>solid</code>, <code>regular</code>, <code>light</code>, <code>duotone</code>, <code>brand</code>.</p></td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr class="deep-level-1">
|
||||
|
||||
<td class="name"><code>size</code></td>
|
||||
|
||||
|
||||
<td class="type">
|
||||
|
||||
|
||||
<span class="param-type">number</span>
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
<td class="attributes">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
<td class="default">
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
<td class="description last"><p>The size of the icon in pixels. Don't include <code>px</code>.</p></td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr class="deep-level-1">
|
||||
|
||||
<td class="name"><code>className</code></td>
|
||||
|
||||
|
||||
<td class="type">
|
||||
|
||||
|
||||
<span class="param-type">string</span>
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
<td class="attributes">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
<td class="default">
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
<td class="description last"><p><a href="https://fontawesome.com/how-to-use/on-the-web/styling/duotone-icons">For extra class features that aren't directly supported.</a></p></td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<dl class="details">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<p class="tag-source">
|
||||
<a href="reactComponents_FontAwesome.js.html" class="button">View Source</a>
|
||||
<span>
|
||||
<a href="reactComponents_FontAwesome.js.html">reactComponents/FontAwesome.js</a>, <a href="reactComponents_FontAwesome.js.html#line14">line 14</a>
|
||||
</span>
|
||||
</p>
|
||||
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h5>Example</h5>
|
||||
|
||||
|
||||
|
||||
|
||||
<div id='component0'></div>
|
||||
|
||||
<script>
|
||||
ReactDOM.render(ReactWrapper({
|
||||
example: "<FontAwesome type=\"brand\" name=\"discord\" size=\"22\" />",
|
||||
uniqId: "component0",
|
||||
}), document.getElementById('component0'));
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</article>
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div id="side-nav" class="side-nav">
|
||||
</div>
|
||||
</div>
|
||||
<script src="scripts/app.min.js"></script>
|
||||
<script>PR.prettyPrint();</script>
|
||||
<script src="scripts/linenumber.js"> </script>
|
||||
|
||||
<script src="scripts/search.js"> </script>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,136 @@
|
|||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title> FontAwesome.js</title>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/gh/google/code-prettify@master/loader/run_prettify.js"></script>
|
||||
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
|
||||
<script src="./build/entry.js"></script>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<link href="https://fonts.googleapis.com/css?family=Roboto:100,400,700|Inconsolata,700" rel="stylesheet">
|
||||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">
|
||||
<link type="text/css" rel="stylesheet" href="https://jmblog.github.io/color-themes-for-google-code-prettify/themes/tomorrow-night.min.css">
|
||||
<link type="text/css" rel="stylesheet" href="styles/app.min.css">
|
||||
<link type="text/css" rel="stylesheet" href="styles/iframe.css">
|
||||
<link type="text/css" rel="stylesheet" href="">
|
||||
<script async defer src="https://buttons.github.io/buttons.js"></script>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
|
||||
|
||||
<body class="layout small-header">
|
||||
<div id="stickyNavbarOverlay"></div>
|
||||
|
||||
|
||||
<div class="top-nav">
|
||||
<div class="inner">
|
||||
<a id="hamburger" role="button" class="navbar-burger" aria-label="menu" aria-expanded="false">
|
||||
<span aria-hidden="true"></span>
|
||||
<span aria-hidden="true"></span>
|
||||
<span aria-hidden="true"></span>
|
||||
</a>
|
||||
<div class="logo">
|
||||
|
||||
|
||||
</div>
|
||||
<div class="menu">
|
||||
|
||||
<div class="navigation">
|
||||
<a
|
||||
href="index.html"
|
||||
class="link"
|
||||
>
|
||||
API Documentation
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="main">
|
||||
<div
|
||||
class="sidebar "
|
||||
id="sidebarNav"
|
||||
>
|
||||
|
||||
<nav>
|
||||
|
||||
<h2><a href="index.html">Documentation</a></h2><div class="category"><h3>Global</h3><ul><li><a href="global.html#FontAwesome">FontAwesome</a></li></ul></div>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
<div class="core" id="main-content-wrapper">
|
||||
<div class="content">
|
||||
<header class="page-title">
|
||||
<p>Source</p>
|
||||
<h1>FontAwesome.js</h1>
|
||||
</header>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<section>
|
||||
<article>
|
||||
<pre class="prettyprint source linenums"><code>import { getByProps } from "../webpack/modules";
|
||||
const React = getByProps("useState");
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {object} props - React properties.
|
||||
* @param {string} props.type - The FontAwesome icon type. `solid`, `regular`, `light`, `duotone`, `brand`.
|
||||
* @param {string} props.className - For extra class features that aren't directly supported. Example: https://fontawesome.com/how-to-use/on-the-web/styling/duotone-icons
|
||||
* @param {number} props.size - The size of the icon in pixels. Don't include `px`.
|
||||
*/
|
||||
export function FontAwesome(props) {
|
||||
return (
|
||||
<i
|
||||
className={`fa${props.type?.[0] ? props.type[0].toLowerCase() : "s"} fa-${
|
||||
props.name ? props.name : "debug"
|
||||
}${props.className ? " " + props.className : ""}`}
|
||||
style={{ fontSize: props.size ? props.size + "px" : "48px" }}
|
||||
/>
|
||||
);
|
||||
}
|
||||
</code></pre>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<footer class="footer">
|
||||
<div class="content has-text-centered">
|
||||
<p>Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a></p>
|
||||
<p class="sidebar-created-by">
|
||||
<a href="https://github.com/SoftwareBrothers/better-docs" target="_blank">BetterDocs theme</a> provided with <i class="fas fa-heart"></i> by
|
||||
<a href="http://softwarebrothers.co" target="_blank">SoftwareBrothers - JavaScript Development Agency</a>
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
</div>
|
||||
<div id="side-nav" class="side-nav">
|
||||
</div>
|
||||
</div>
|
||||
<script src="scripts/app.min.js"></script>
|
||||
<script>PR.prettyPrint();</script>
|
||||
<script src="scripts/linenumber.js"> </script>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,251 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title> components</title>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/gh/google/code-prettify@master/loader/run_prettify.js"></script>
|
||||
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
|
||||
<script src="./build/entry.js"></script>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<link href="https://fonts.googleapis.com/css?family=Roboto:100,400,700|Inconsolata,700" rel="stylesheet">
|
||||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">
|
||||
<link type="text/css" rel="stylesheet" href="https://jmblog.github.io/color-themes-for-google-code-prettify/themes/tomorrow-night.min.css">
|
||||
<link type="text/css" rel="stylesheet" href="styles/app.min.css">
|
||||
<link type="text/css" rel="stylesheet" href="styles/iframe.css">
|
||||
<link type="text/css" rel="stylesheet" href="">
|
||||
<script async defer src="https://buttons.github.io/buttons.js"></script>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
|
||||
|
||||
<body class="layout small-header">
|
||||
<div id="stickyNavbarOverlay"></div>
|
||||
|
||||
|
||||
<div class="top-nav">
|
||||
<div class="inner">
|
||||
<a id="hamburger" role="button" class="navbar-burger" aria-label="menu" aria-expanded="false">
|
||||
<span aria-hidden="true"></span>
|
||||
<span aria-hidden="true"></span>
|
||||
<span aria-hidden="true"></span>
|
||||
</a>
|
||||
<div class="logo">
|
||||
|
||||
|
||||
</div>
|
||||
<div class="menu">
|
||||
|
||||
<div class="navigation">
|
||||
<a
|
||||
href="index.html"
|
||||
class="link"
|
||||
>
|
||||
API Documentation
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="main">
|
||||
<div
|
||||
class="sidebar "
|
||||
id="sidebarNav"
|
||||
>
|
||||
|
||||
<nav>
|
||||
|
||||
<h2><a href="index.html">Documentation</a></h2><div class="category"><h3>Classes</h3><ul><li><a href="components.html">components</a></li></ul><h3>Global</h3><ul><li><a href="global.html#FontAwesome">FontAwesome</a></li><li><a href="global.html#getClientMod">getClientMod</a></li><li><a href="global.html#Plugin">Plugin</a></li></ul></div>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
<div class="core" id="main-content-wrapper">
|
||||
<div class="content">
|
||||
<header class="page-title">
|
||||
<p>Class</p>
|
||||
<h1>components</h1>
|
||||
</header>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<section>
|
||||
|
||||
<header>
|
||||
|
||||
<h2><span class="attribs"><span class="type-signature"></span></span>components<span class="signature">()</span><span class="type-signature"></span></h2>
|
||||
|
||||
<div class="class-description">Useful React components.</div>
|
||||
|
||||
|
||||
</header>
|
||||
|
||||
<article>
|
||||
<div class="container-overview">
|
||||
|
||||
|
||||
<div class='vertical-section'>
|
||||
<div class="members">
|
||||
<div class="member">
|
||||
<div class=name>
|
||||
<span class="tag">Constructor</span>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<h4 class="name" id="components">
|
||||
<a class="href-link" href="#components">#</a>
|
||||
|
||||
<span class="code-name">
|
||||
|
||||
new components<span class="signature">()</span><span class="type-signature"></span>
|
||||
|
||||
</span>
|
||||
</h4>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<dl class="details">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<p class="tag-source">
|
||||
<a href="components_index.js.html" class="button">View Source</a>
|
||||
<span>
|
||||
<a href="components_index.js.html">components/index.js</a>, <a href="components_index.js.html#line6">line 6</a>
|
||||
</span>
|
||||
</p>
|
||||
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</article>
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<footer class="footer">
|
||||
<div class="content has-text-centered">
|
||||
<p>Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a></p>
|
||||
<p class="sidebar-created-by">
|
||||
<a href="https://github.com/SoftwareBrothers/better-docs" target="_blank">BetterDocs theme</a> provided with <i class="fas fa-heart"></i> by
|
||||
<a href="http://softwarebrothers.co" target="_blank">SoftwareBrothers - JavaScript Development Agency</a>
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
</div>
|
||||
<div id="side-nav" class="side-nav">
|
||||
</div>
|
||||
</div>
|
||||
<script src="scripts/app.min.js"></script>
|
||||
<script>PR.prettyPrint();</script>
|
||||
<script src="scripts/linenumber.js"> </script>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,136 @@
|
|||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title> components/FontAwesome.js</title>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/gh/google/code-prettify@master/loader/run_prettify.js"></script>
|
||||
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
|
||||
<script src="./build/entry.js"></script>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<link href="https://fonts.googleapis.com/css?family=Roboto:100,400,700|Inconsolata,700" rel="stylesheet">
|
||||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">
|
||||
<link type="text/css" rel="stylesheet" href="https://jmblog.github.io/color-themes-for-google-code-prettify/themes/tomorrow-night.min.css">
|
||||
<link type="text/css" rel="stylesheet" href="styles/app.min.css">
|
||||
<link type="text/css" rel="stylesheet" href="styles/iframe.css">
|
||||
<link type="text/css" rel="stylesheet" href="">
|
||||
<script async defer src="https://buttons.github.io/buttons.js"></script>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
|
||||
|
||||
<body class="layout small-header">
|
||||
<div id="stickyNavbarOverlay"></div>
|
||||
|
||||
|
||||
<div class="top-nav">
|
||||
<div class="inner">
|
||||
<a id="hamburger" role="button" class="navbar-burger" aria-label="menu" aria-expanded="false">
|
||||
<span aria-hidden="true"></span>
|
||||
<span aria-hidden="true"></span>
|
||||
<span aria-hidden="true"></span>
|
||||
</a>
|
||||
<div class="logo">
|
||||
|
||||
|
||||
</div>
|
||||
<div class="menu">
|
||||
|
||||
<div class="navigation">
|
||||
<a
|
||||
href="index.html"
|
||||
class="link"
|
||||
>
|
||||
API Documentation
|
||||
</a>
|
||||
|
||||