From bfafe34d5c79f30f274c66709775ed8b13a016c5 Mon Sep 17 00:00:00 2001 From: Hsieh Chin Fan Date: Thu, 10 Oct 2024 11:51:57 +0800 Subject: docs(jsdoc): update jsdoc --- src/MenuItem.mjs | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) (limited to 'src/MenuItem.mjs') diff --git a/src/MenuItem.mjs b/src/MenuItem.mjs index 0fea539..8b54539 100644 --- a/src/MenuItem.mjs +++ b/src/MenuItem.mjs @@ -1,15 +1,28 @@ import { shiftByWindow } from './utils.mjs' /** - * Item. Basic Element for menu item + * @typedef {Object} RefLink + * @property {string} ref -- name of link + * @property {string} link -- content of link + * @property {string|null} title -- title of link + */ + +/** + * Basic Element for menu item * * @extends {window.HTMLDivElement} */ export class Item extends window.HTMLDivElement { /** - * constructor. + * Creates a new Item instance * - * @param {Object} + * @param {Object} options - The options for the item + * @param {string} [options.text] - The text content of the item + * @param {string} [options.innerHTML] - The HTML content of the item + * @param {string} [options.title] - The title attribute for the item + * @param {Function} [options.onclick] - The click event handler + * @param {string} [options.style] - The CSS style string + * @param {string[]} [options.className] - Additional CSS classes */ constructor ({ text, innerHTML, title, onclick, style, className }) { super() @@ -30,15 +43,18 @@ export class Item extends window.HTMLDivElement { window.customElements.define('menu-item', Item, { extends: 'div' }) /** - * Folder. Basic Element for menu item, it generate submenu on hover + * Basic Element for menu item that generates a submenu on hover * * @extends {window.HTMLDivElement} */ export class Folder extends window.HTMLDivElement { /** - * constructor. + * Creates a new Folder instance * - * @param {} + * @param {Object} options - The options for the folder + * @param {string} [options.text] - The text content of the folder + * @param {string} [options.innerHTML] - The HTML content of the folder + * @param {Item[]} options.items - The submenu items */ constructor ({ text, innerHTML, items }) { super() @@ -67,9 +83,11 @@ export class Folder extends window.HTMLDivElement { window.customElements.define('menu-folder', Folder, { extends: 'div' }) /** - * pickMapItem. + * Creates a menu item for picking a map * - * @param {Function[]} options.utils + * @param {Object} options - The options object + * @param {Object} options.utils - Utility functions + * @returns {Folder} A Folder instance for picking a map */ export const pickMapItem = ({ utils }) => new Folder({ @@ -372,7 +390,7 @@ export const restoreCamera = map => * addRefLink. replace selected text into markdown link by reference style links * * @param {CodeMirror} cm - * @param {Object[]} refLinks -- object for { ref, link } + * @param {RefLink[]} refLinks */ export const addRefLink = (cm, refLinks) => new Folder({ -- cgit v1.2.3-70-g09d2