some docs

This commit is contained in:
MapleLeaf
2021-12-26 15:05:58 -06:00
parent 7efc7d53c9
commit 51bbdea73e
30 changed files with 2623 additions and 48 deletions

3
README.md Normal file
View File

@@ -0,0 +1,3 @@
# reacord
coming soon™

1
docs/.nojekyll Normal file
View File

@@ -0,0 +1 @@
TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false.

22
docs/assets/highlight.css Normal file
View File

@@ -0,0 +1,22 @@
:root {
--light-code-background: #FFFFFF;
--dark-code-background: #1E1E1E;
}
@media (prefers-color-scheme: light) { :root {
--code-background: var(--light-code-background);
} }
@media (prefers-color-scheme: dark) { :root {
--code-background: var(--dark-code-background);
} }
body.light {
--code-background: var(--light-code-background);
}
body.dark {
--code-background: var(--dark-code-background);
}
pre, code { background: var(--code-background); }

1043
docs/assets/icons.css Normal file

File diff suppressed because it is too large Load Diff

BIN
docs/assets/icons.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

BIN
docs/assets/icons@2x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

52
docs/assets/main.js Normal file

File diff suppressed because one or more lines are too long

1
docs/assets/search.js Normal file

File diff suppressed because one or more lines are too long

1388
docs/assets/style.css Normal file

File diff suppressed because it is too large Load Diff

BIN
docs/assets/widgets.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 480 B

BIN
docs/assets/widgets@2x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 855 B

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

6
docs/index.html Normal file
View File

@@ -0,0 +1,6 @@
<!DOCTYPE html><html class="default"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>reacord</title><meta name="description" content="Documentation for reacord"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="assets/style.css"/><link rel="stylesheet" href="assets/highlight.css"/><script async src="assets/search.js" id="search-script"></script></head><body><script>document.body.classList.add(localStorage.getItem("tsd-theme") || "os")</script><header><div class="tsd-page-toolbar"><div class="container"><div class="table-wrap"><div class="table-cell" id="tsd-search" data-base="."><div class="field"><label for="tsd-search-field" class="tsd-widget search no-caption">Search</label><input type="text" id="tsd-search-field"/></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="index.html" class="title">reacord</a></div><div class="table-cell" id="tsd-widgets"><div id="tsd-filter"><a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a><div class="tsd-filter-group"><div class="tsd-select" id="tsd-filter-visibility"><span class="tsd-select-label">All</span><ul class="tsd-select-list"><li data-value="public">Public</li><li data-value="protected">Public/Protected</li><li data-value="private" class="selected">All</li></ul></div> <input type="checkbox" id="tsd-filter-inherited" checked/><label class="tsd-widget" for="tsd-filter-inherited">Inherited</label><input type="checkbox" id="tsd-filter-externals" checked/><label class="tsd-widget" for="tsd-filter-externals">Externals</label></div></div><a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a></div></div></div></div><div class="tsd-page-title"><div class="container"><h1>reacord</h1></div></div></header><div class="container container-main"><div class="row"><div class="col-8 col-content"><div class="tsd-panel tsd-typography">
<a href="#reacord" id="reacord" style="color: inherit; text-decoration: none;">
<h1>reacord</h1>
</a>
<p>coming soon™</p>
</div></div><div class="col-4 col-menu menu-sticky-wrap menu-highlight"><nav class="tsd-navigation primary"><ul><li class="current"><a href="modules.html">Exports</a></li></ul></nav><nav class="tsd-navigation secondary menu-sticky"><ul><li class="tsd-kind-class"><a href="classes/DiscordJsAdapter.html" class="tsd-kind-icon">Discord<wbr/>Js<wbr/>Adapter</a></li><li class="tsd-kind-class tsd-has-type-parameter"><a href="classes/Reacord.html" class="tsd-kind-icon">Reacord</a></li><li class="tsd-kind-type-alias tsd-has-type-parameter"><a href="modules.html#Adapter" class="tsd-kind-icon">Adapter</a></li><li class="tsd-kind-type-alias"><a href="modules.html#ButtonClickEvent" class="tsd-kind-icon">Button<wbr/>Click<wbr/>Event</a></li><li class="tsd-kind-type-alias"><a href="modules.html#ButtonProps" class="tsd-kind-icon">Button<wbr/>Props</a></li><li class="tsd-kind-type-alias"><a href="modules.html#EmbedAuthorProps" class="tsd-kind-icon">Embed<wbr/>Author<wbr/>Props</a></li><li class="tsd-kind-type-alias"><a href="modules.html#EmbedFieldProps" class="tsd-kind-icon">Embed<wbr/>Field<wbr/>Props</a></li><li class="tsd-kind-type-alias"><a href="modules.html#EmbedFooterProps" class="tsd-kind-icon">Embed<wbr/>Footer<wbr/>Props</a></li><li class="tsd-kind-type-alias"><a href="modules.html#EmbedImageProps" class="tsd-kind-icon">Embed<wbr/>Image<wbr/>Props</a></li><li class="tsd-kind-type-alias"><a href="modules.html#EmbedProps" class="tsd-kind-icon">Embed<wbr/>Props</a></li><li class="tsd-kind-type-alias"><a href="modules.html#EmbedThumbnailProps" class="tsd-kind-icon">Embed<wbr/>Thumbnail<wbr/>Props</a></li><li class="tsd-kind-type-alias"><a href="modules.html#EmbedTitleProps" class="tsd-kind-icon">Embed<wbr/>Title<wbr/>Props</a></li><li class="tsd-kind-type-alias"><a href="modules.html#LinkProps" class="tsd-kind-icon">Link<wbr/>Props</a></li><li class="tsd-kind-type-alias tsd-has-type-parameter"><a href="modules.html#ReacordConfig" class="tsd-kind-icon">Reacord<wbr/>Config</a></li><li class="tsd-kind-type-alias"><a href="modules.html#ReacordInstance" class="tsd-kind-icon">Reacord<wbr/>Instance</a></li><li class="tsd-kind-function"><a href="modules.html#Button" class="tsd-kind-icon">Button</a></li><li class="tsd-kind-function"><a href="modules.html#Embed" class="tsd-kind-icon">Embed</a></li><li class="tsd-kind-function"><a href="modules.html#EmbedAuthor" class="tsd-kind-icon">Embed<wbr/>Author</a></li><li class="tsd-kind-function"><a href="modules.html#EmbedField" class="tsd-kind-icon">Embed<wbr/>Field</a></li><li class="tsd-kind-function"><a href="modules.html#EmbedFooter" class="tsd-kind-icon">Embed<wbr/>Footer</a></li><li class="tsd-kind-function"><a href="modules.html#EmbedImage" class="tsd-kind-icon">Embed<wbr/>Image</a></li><li class="tsd-kind-function"><a href="modules.html#EmbedThumbnail" class="tsd-kind-icon">Embed<wbr/>Thumbnail</a></li><li class="tsd-kind-function"><a href="modules.html#EmbedTitle" class="tsd-kind-icon">Embed<wbr/>Title</a></li><li class="tsd-kind-function"><a href="modules.html#Link" class="tsd-kind-icon">Link</a></li></ul></nav></div></div></div><footer class="with-border-bottom"><div class="container"><h2>Legend</h2><div class="tsd-legend-group"><ul class="tsd-legend"><li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li><li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li></ul></div><h2>Settings</h2><p>Theme <select id="theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></p></div></footer><div class="container tsd-generator"><p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></div><div class="overlay"></div><script src="assets/main.js"></script></body></html>

4
docs/modules.html Normal file

File diff suppressed because one or more lines are too long

View File

@@ -1,9 +1,15 @@
import type { CommandInteraction, ComponentInteraction } from "../interaction"
export type Adapter<InteractionInit> = {
/**
* @internal
*/
addComponentInteractionListener(
listener: (interaction: ComponentInteraction) => void,
): void
/**
* @internal
*/
createCommandInteraction(interactionInfo: InteractionInit): CommandInteraction
}

View File

@@ -8,6 +8,9 @@ import type { Adapter } from "./adapter"
export class DiscordJsAdapter implements Adapter<Discord.CommandInteraction> {
constructor(private client: Discord.Client) {}
/**
* @internal
*/
addComponentInteractionListener(
listener: (interaction: ComponentInteraction) => void,
) {
@@ -18,6 +21,9 @@ export class DiscordJsAdapter implements Adapter<Discord.CommandInteraction> {
})
}
/**
* @internal
*/
// eslint-disable-next-line class-methods-use-this
createCommandInteraction(
interaction: Discord.CommandInteraction,

View File

@@ -2,7 +2,7 @@ import { nanoid } from "nanoid"
import React from "react"
import { last } from "../helpers/last.js"
import { ReacordElement } from "./element.js"
import type { ButtonInteraction, ComponentInteraction } from "./interaction"
import type { ComponentInteraction } from "./interaction"
import type { MessageOptions } from "./message"
import { Node } from "./node.js"
@@ -11,9 +11,11 @@ export type ButtonProps = {
style?: "primary" | "secondary" | "success" | "danger"
disabled?: boolean
emoji?: string
onClick: (interaction: ButtonInteraction) => void
onClick: (event: ButtonClickEvent) => void
}
export type ButtonClickEvent = {}
export function Button(props: ButtonProps) {
return (
<ReacordElement props={props} createNode={() => new ButtonNode(props)} />

View File

@@ -1,19 +1,8 @@
export type EmbedOptions = {
title?: string
description?: string
url?: string
timestamp?: string
color?: number
fields?: EmbedFieldOptions[]
author?: { name: string; url?: string; icon_url?: string }
thumbnail?: { url: string }
image?: { url: string }
video?: { url: string }
footer?: { text: string; icon_url?: string }
}
import type { Except, SnakeCasedPropertiesDeep } from "type-fest"
import type { EmbedProps } from "./embed"
export type EmbedFieldOptions = {
name: string
value: string
inline?: boolean
}
export type EmbedOptions = SnakeCasedPropertiesDeep<
Except<EmbedProps, "timestamp" | "children"> & {
timestamp?: string
}
>

View File

@@ -1,5 +1,4 @@
import React from "react"
import type { CamelCasedPropertiesDeep } from "type-fest"
import { snakeCaseDeep } from "../../helpers/convert-object-property-case"
import { omit } from "../../helpers/omit"
import { ReacordElement } from "../element.js"
@@ -8,10 +7,17 @@ import { Node } from "../node.js"
import { EmbedChildNode } from "./embed-child.js"
import type { EmbedOptions } from "./embed-options"
export type EmbedProps = Omit<
CamelCasedPropertiesDeep<EmbedOptions>,
"timestamp"
> & {
export type EmbedProps = {
title?: string
description?: string
url?: string
color?: number
fields?: Array<{ name: string; value: string; inline?: boolean }>
author?: { name: string; url?: string; iconUrl?: string }
thumbnail?: { url: string }
image?: { url: string }
video?: { url: string }
footer?: { text: string; iconUrl?: string }
timestamp?: string | number | Date
children?: React.ReactNode
}

View File

@@ -1,6 +1,5 @@
export * from "./adapter/adapter"
export * from "./adapter/discord-js-adapter"
export * from "./adapter/test-adapter"
export * from "./button"
export * from "./embed/embed"
export * from "./embed/embed-author"
@@ -9,7 +8,5 @@ export * from "./embed/embed-footer"
export * from "./embed/embed-image"
export * from "./embed/embed-thumbnail"
export * from "./embed/embed-title"
export * from "./interaction"
export * from "./link"
export * from "./message"
export * from "./reacord"

1
library/testing.ts Normal file
View File

@@ -0,0 +1 @@
export * from "./adapter/test-adapter"

View File

@@ -21,7 +21,8 @@
"test-watch": "pnpm test -- --watch",
"coverage": "pnpm test -- --coverage",
"typecheck": "tsc --noEmit",
"playground": "nodemon --exec esmo --ext ts,tsx ./playground/main.tsx"
"playground": "nodemon --exec esmo --ext ts,tsx ./playground/main.tsx",
"docs": "typedoc library/main.ts --out docs --excludePrivate --excludeProtected --excludeInternal"
},
"dependencies": {
"@types/node": "*",
@@ -67,6 +68,7 @@
"react": "^17.0.2",
"tsup": "^5.11.9",
"type-fest": "^2.8.0",
"typedoc": "^0.22.10",
"typescript": "^4.5.4"
},
"resolutions": {

43
pnpm-lock.yaml generated
View File

@@ -39,6 +39,7 @@ importers:
rxjs: ^7.4.0
tsup: ^5.11.9
type-fest: ^2.8.0
typedoc: ^0.22.10
typescript: ^4.5.4
dependencies:
'@types/node': 17.0.4
@@ -74,6 +75,7 @@ importers:
react: 17.0.2
tsup: 5.11.9_typescript@4.5.4
type-fest: 2.8.0
typedoc: 0.22.10_typescript@4.5.4
typescript: 4.5.4
packages/helpers:
@@ -4959,6 +4961,10 @@ packages:
yallist: 4.0.0
dev: true
/lunr/2.3.9:
resolution: {integrity: sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==}
dev: true
/make-dir/3.1.0:
resolution: {integrity: sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==}
engines: {node: '>=8'}
@@ -4984,6 +4990,12 @@ packages:
object-visit: 1.0.1
dev: true
/marked/3.0.8:
resolution: {integrity: sha512-0gVrAjo5m0VZSJb4rpL59K1unJAMb/hm8HRXqasD8VeC8m91ytDPMritgFSlKonfdt+rRYYpP/JfLxgIX8yoSw==}
engines: {node: '>= 12'}
hasBin: true
dev: true
/merge-stream/2.0.0:
resolution: {integrity: sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==}
dev: true
@@ -6103,6 +6115,14 @@ packages:
engines: {node: '>=8'}
dev: true
/shiki/0.9.15:
resolution: {integrity: sha512-/Y0z9IzhJ8nD9nbceORCqu6NgT9X6I8Fk8c3SICHI5NbZRLdZYFaB233gwct9sU0vvSypyaL/qaKvzyQGJBZSw==}
dependencies:
jsonc-parser: 3.0.0
vscode-oniguruma: 1.6.1
vscode-textmate: 5.2.0
dev: true
/side-channel/1.0.4:
resolution: {integrity: sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==}
dependencies:
@@ -6669,6 +6689,21 @@ packages:
is-typedarray: 1.0.0
dev: true
/typedoc/0.22.10_typescript@4.5.4:
resolution: {integrity: sha512-hQYZ4WtoMZ61wDC6w10kxA42+jclWngdmztNZsDvIz7BMJg7F2xnT+uYsUa7OluyKossdFj9E9Ye4QOZKTy8SA==}
engines: {node: '>= 12.10.0'}
hasBin: true
peerDependencies:
typescript: 4.0.x || 4.1.x || 4.2.x || 4.3.x || 4.4.x || 4.5.x
dependencies:
glob: 7.2.0
lunr: 2.3.9
marked: 3.0.8
minimatch: 3.0.4
shiki: 0.9.15
typescript: 4.5.4
dev: true
/typescript/4.5.4:
resolution: {integrity: sha512-VgYs2A2QIRuGphtzFV7aQJduJ2gyfTljngLzjpfW9FoYZF6xuw1W0vW9ghCKLfcWrCFxK81CSGRAvS1pn4fIUg==}
engines: {node: '>=4.2.0'}
@@ -6789,6 +6824,14 @@ packages:
spdx-expression-parse: 3.0.1
dev: true
/vscode-oniguruma/1.6.1:
resolution: {integrity: sha512-vc4WhSIaVpgJ0jJIejjYxPvURJavX6QG41vu0mGhqywMkQqulezEqEQ3cO3gc8GvcOpX6ycmKGqRoROEMBNXTQ==}
dev: true
/vscode-textmate/5.2.0:
resolution: {integrity: sha512-Uw5ooOQxRASHgu6C7GVvUxisKXfSgW4oFlO+aa+PAkgmH89O3CXxEEzNRNtHSqtXFTl0nAC1uYj0GMSH27uwtQ==}
dev: true
/w3c-hr-time/1.0.2:
resolution: {integrity: sha512-z8P5DvDNjKDoFIHK7q8r8lackT6l+jo/Ye3HOle7l9nICP9lf1Ci25fy9vHd0JOWewkIFzXIEig3TdKT7JQ5fQ==}
dependencies:

View File

@@ -1,7 +1,7 @@
import { nextTick } from "node:process"
import { promisify } from "node:util"
import { omit } from "../helpers/omit"
import type { TestAdapter } from "../library/main"
import type { TestAdapter } from "../library/testing"
const nextTickPromise = promisify(nextTick)

View File

@@ -8,9 +8,8 @@ import {
EmbedThumbnail,
EmbedTitle,
Reacord,
TestAdapter,
TestCommandInteraction,
} from "../library/main"
import { TestAdapter, TestCommandInteraction } from "../library/testing"
import { assertMessages } from "./assert-messages"
const adapter = new TestAdapter()

View File

@@ -1,10 +1,6 @@
import React from "react"
import {
Link,
Reacord,
TestAdapter,
TestCommandInteraction,
} from "../library/main"
import { Link, Reacord } from "../library/main"
import { TestAdapter, TestCommandInteraction } from "../library/testing"
import { assertMessages } from "./assert-messages"
const adapter = new TestAdapter()

View File

@@ -1,13 +1,6 @@
import * as React from "react"
import {
Button,
Embed,
EmbedField,
EmbedTitle,
Reacord,
TestAdapter,
TestCommandInteraction,
} from "../library/main"
import { Button, Embed, EmbedField, EmbedTitle, Reacord } from "../library/main"
import { TestAdapter, TestCommandInteraction } from "../library/testing"
import { assertMessages } from "./assert-messages"
test("rendering behavior", async () => {

View File

@@ -3,5 +3,10 @@
"compilerOptions": {
"noImplicitOverride": true
},
"exclude": ["**/node_modules/**", "**/coverage/**", "**/dist/**"]
"exclude": [
"**/node_modules/**",
"**/coverage/**",
"**/dist/**",
"**/docs/**"
]
}

8
typedoc.json Normal file
View File

@@ -0,0 +1,8 @@
{
"entryPoints": ["library/main.ts"],
"excludeInternal": true,
"excludePrivate": true,
"excludeProtected": true,
"categoryOrder": ["Classes", "Functions", "*"],
"categorizeByGroup": false
}