From 705e8b553f2a3505598f840be385a617a8af8ecf Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Sun, 27 Jul 2025 21:48:18 -0400 Subject: [PATCH] docs: Expose the rest of the core js to doxygen. --- Doxyfile | 4 +- core/client.js | 285 +++++++++++++++++++++++++------------------------ core/core.js | 125 +++++++++++----------- core/tfrpc.js | 61 +++++++---- 4 files changed, 248 insertions(+), 227 deletions(-) diff --git a/Doxyfile b/Doxyfile index 677d8b47..0fde917c 100644 --- a/Doxyfile +++ b/Doxyfile @@ -945,13 +945,13 @@ WARN_LOGFILE = INPUT = README.md \ core/app.js \ + core/client.js \ core/core.js \ core/http.js \ + core/tfrpc.js \ docs/ \ src/ -# Not yet: core/tfrpc.js core/client.js - # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses # libiconv (or the iconv built into libc) for the transcoding. See the libiconv diff --git a/core/client.js b/core/client.js index bef78e0b..61e103bf 100644 --- a/core/client.js +++ b/core/client.js @@ -1,3 +1,11 @@ +/** + * \file + * \defgroup tfclient Tilde Friends Client JS + * Tilde Friends client-side browser JavaScript. + * @{ + */ + +/** \cond */ import {LitElement, html, css, svg} from '/lit/lit-all.min.js'; let cm6; @@ -13,8 +21,9 @@ let gUnloading; let kErrorColor = '#dc322f'; let kDisconnectColor = '#f00'; let kStatusColor = '#fff'; +/** \endcond */ -// Functions that server-side app code can call through the app object. +/** Functions that server-side app code can call through the app object. */ const k_api = { setDocument: {args: ['content'], func: api_setDocument}, postMessage: {args: ['message'], func: api_postMessage}, @@ -26,29 +35,14 @@ const k_api = { setHash: {args: ['hash'], func: api_setHash}, }; -// TODO(tasiaiso): this is only used once, move it down ? -const k_global_style = css` - a:link { - color: #268bd2; - } - - a:visited { - color: #6c71c4; - } - - a:hover { - color: #859900; - } - - a:active { - color: #2aa198; - } -`; - /** * Class that represents the top bar */ class TfNavigationElement extends LitElement { + /** + * Get Lit Html properties. + * @return The properties. + */ static get properties() { return { credentials: {type: Object}, @@ -64,6 +58,9 @@ class TfNavigationElement extends LitElement { }; } + /** + * Create a TfNavigationElement instance. + */ constructor() { super(); this.permissions = {}; @@ -76,7 +73,7 @@ class TfNavigationElement extends LitElement { /** * TODOC - * @param {*} event + * @param event The HTML event. */ toggle_edit(event) { event.preventDefault(); @@ -89,7 +86,7 @@ class TfNavigationElement extends LitElement { /** * TODOC - * @param {*} key + * @param key The permission to reset. */ reset_permission(key) { send({action: 'resetPermission', permission: key}); @@ -97,9 +94,9 @@ class TfNavigationElement extends LitElement { /** * TODOC - * @param {*} key - * @param {*} options - * @returns + * @param key The spark line identifier. + * @param options Spark line options. + * @return A spark line HTML element. */ get_spark_line(key, options) { if (!this.spark_lines[key]) { @@ -118,29 +115,49 @@ class TfNavigationElement extends LitElement { return this.spark_lines[key]; } + /** + * Set the active SSB identity for the current application. + * @param id The identity. + */ set_active_identity(id) { send({action: 'setActiveIdentity', identity: id}); this.renderRoot.getElementById('id_dropdown').classList.remove('w3-show'); } - create_identity(event) { + /** + * Create a new SSB identity. + */ + create_identity() { if (confirm('Are you sure you want to create a new identity?')) { send({action: 'createIdentity'}); } } + /** + * Toggle visibility of the ID dropdown. + */ toggle_id_dropdown() { this.renderRoot.getElementById('id_dropdown').classList.toggle('w3-show'); } + /** + * Edit the current identity's SSB profile. + */ edit_profile() { window.location.href = '/~core/ssb/#' + this.identity; } + /** + * Sign out of the current Tilde Friends user. + */ logout() { window.location.href = `/login/logout?return=${encodeURIComponent(url() + hash())}`; } + /** + * Render the identity dropdown. + * @return Lit HTML. + */ render_identity() { let self = this; @@ -287,6 +304,9 @@ class TfNavigationElement extends LitElement { } } + /** + * Clear the current error. + */ clear_error() { this.status = {}; } @@ -297,6 +317,23 @@ class TfNavigationElement extends LitElement { */ render() { let self = this; + const k_global_style = css` + a:link { + color: #268bd2; + } + + a:visited { + color: #6c71c4; + } + + a:hover { + color: #859900; + } + + a:active { + color: #2aa198; + } + `; return html`