Split dailyShare.js and document the shared exported functions with JSDoc
dailyShare.js held fillTemplate and formatCountdown, used across the whole TCG, under a Daily Card name. They now live in textFormat.js at the root, and the Daily Card helpers in daily/dailyFormat.js. 173 exported functions that other files call now explain what they return and how they treat missing values: the server game rules, the toolbox storage chain, the shared hooks and utilities, and the TCG display helpers. website/AGENTS.md asks the same of new shared functions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
166790245f
commit
aa8bb1ebaa
71 changed files with 339 additions and 57 deletions
|
|
@ -122,18 +122,24 @@ const TEXT_EXCHANGE_HANDLERS = {
|
|||
}
|
||||
};
|
||||
|
||||
/** Vrai si ce type d'outil sait s'exporter et s'importer en texte. */
|
||||
export function supportsTextExchange(type) {
|
||||
return Boolean(TEXT_EXCHANGE_HANDLERS[type]);
|
||||
}
|
||||
|
||||
/** Vrai si les données de l'outil ont quelque chose à exporter en texte. */
|
||||
export function hasTextExchangeContent(type, data) {
|
||||
return Boolean(TEXT_EXCHANGE_HANDLERS[type]?.hasContent(data));
|
||||
}
|
||||
|
||||
/** Texte d'export de l'outil, ou chaîne vide si le type ne le gère pas. */
|
||||
export function exportModuleText(type, data) {
|
||||
return TEXT_EXCHANGE_HANDLERS[type]?.exportText(data) || "";
|
||||
}
|
||||
|
||||
/**
|
||||
* Lit un texte collé pour un outil : `{ ok: true, data }`, ou `{ ok: false, error }` avec un message pour l'utilisateur. Ne lève jamais.
|
||||
*/
|
||||
export function importModuleText(type, text, context) {
|
||||
try {
|
||||
const value = String(text || "");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue