mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Fix unfixable lints
This commit is contained in:
@@ -3,10 +3,8 @@ import { debounce, escapeRegex } from '../utils.js';
|
||||
import { AutoCompleteOption } from './AutoCompleteOption.js';
|
||||
import { AutoCompleteFuzzyScore } from './AutoCompleteFuzzyScore.js';
|
||||
import { BlankAutoCompleteOption } from './BlankAutoCompleteOption.js';
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
import { AutoCompleteNameResult } from './AutoCompleteNameResult.js';
|
||||
import { AutoCompleteSecondaryNameResult } from './AutoCompleteSecondaryNameResult.js';
|
||||
import { Popup, getTopmostModalLayer } from '../popup.js';
|
||||
|
||||
/**@readonly*/
|
||||
/**@enum {Number}*/
|
||||
|
@@ -1,4 +1,3 @@
|
||||
import { SlashCommandNamedArgumentAutoCompleteOption } from '../slash-commands/SlashCommandNamedArgumentAutoCompleteOption.js';
|
||||
import { AutoCompleteOption } from './AutoCompleteOption.js';
|
||||
|
||||
|
||||
|
@@ -1,19 +1,18 @@
|
||||
import { SlashCommand } from '../slash-commands/SlashCommand.js';
|
||||
import { AutoCompleteFuzzyScore } from './AutoCompleteFuzzyScore.js';
|
||||
|
||||
|
||||
|
||||
export class AutoCompleteOption {
|
||||
/**@type {string}*/ name;
|
||||
/**@type {string}*/ typeIcon;
|
||||
/**@type {string}*/ type;
|
||||
/**@type {number}*/ nameOffset = 0;
|
||||
/**@type {AutoCompleteFuzzyScore}*/ score;
|
||||
/**@type {string}*/ replacer;
|
||||
/**@type {HTMLElement}*/ dom;
|
||||
/**@type {(input:string)=>boolean}*/ matchProvider;
|
||||
/**@type {(input:string)=>string}*/ valueProvider;
|
||||
/**@type {boolean}*/ makeSelectable = false;
|
||||
/** @type {string} */ name;
|
||||
/** @type {string} */ typeIcon;
|
||||
/** @type {string} */ type;
|
||||
/** @type {number} */ nameOffset = 0;
|
||||
/** @type {AutoCompleteFuzzyScore} */ score;
|
||||
/** @type {string} */ replacer;
|
||||
/** @type {HTMLElement} */ dom;
|
||||
/** @type {(input:string)=>boolean} */ matchProvider;
|
||||
/** @type {(input:string)=>string} */ valueProvider;
|
||||
/** @type {boolean} */ makeSelectable = false;
|
||||
|
||||
|
||||
/**
|
||||
|
@@ -1,21 +1,18 @@
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
import { QuickReply } from '../src/QuickReply.js';
|
||||
import { QuickReplyContextLink } from '../src/QuickReplyContextLink.js';
|
||||
import { QuickReplySet } from '../src/QuickReplySet.js';
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
import { QuickReplySettings } from '../src/QuickReplySettings.js';
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
import { SettingsUi } from '../src/ui/SettingsUi.js';
|
||||
import { onlyUnique } from '../../../utils.js';
|
||||
|
||||
export class QuickReplyApi {
|
||||
/**@type {QuickReplySettings}*/ settings;
|
||||
/**@type {SettingsUi}*/ settingsUi;
|
||||
/** @type {QuickReplySettings} */ settings;
|
||||
/** @type {SettingsUi} */ settingsUi;
|
||||
|
||||
|
||||
|
||||
|
||||
constructor(/**@type {QuickReplySettings}*/settings, /**@type {SettingsUi}*/settingsUi) {
|
||||
constructor(/** @type {QuickReplySettings} */settings, /** @type {SettingsUi} */settingsUi) {
|
||||
this.settings = settings;
|
||||
this.settingsUi = settingsUi;
|
||||
}
|
||||
|
@@ -1,18 +1,16 @@
|
||||
import { warn } from '../index.js';
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
import { QuickReply } from './QuickReply.js';
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
import { QuickReplySettings } from './QuickReplySettings.js';
|
||||
|
||||
export class AutoExecuteHandler {
|
||||
/**@type {QuickReplySettings}*/ settings;
|
||||
/** @type {QuickReplySettings} */ settings;
|
||||
|
||||
/**@type {Boolean[]}*/ preventAutoExecuteStack = [];
|
||||
/** @type {Boolean[]}*/ preventAutoExecuteStack = [];
|
||||
|
||||
|
||||
|
||||
|
||||
constructor(/**@type {QuickReplySettings}*/settings) {
|
||||
constructor(/** @type {QuickReplySettings} */settings) {
|
||||
this.settings = settings;
|
||||
}
|
||||
|
||||
@@ -24,7 +22,7 @@ export class AutoExecuteHandler {
|
||||
|
||||
|
||||
|
||||
async performAutoExecute(/**@type {QuickReply[]}*/qrList) {
|
||||
async performAutoExecute(/** @type {QuickReply[]} */qrList) {
|
||||
for (const qr of qrList) {
|
||||
this.preventAutoExecuteStack.push(qr.preventAutoExecute);
|
||||
try {
|
||||
|
@@ -49,7 +49,7 @@ export class QuickReply {
|
||||
/**@type {string}*/ automationId = '';
|
||||
|
||||
/**@type {function}*/ onExecute;
|
||||
/**@type {(qr:QuickReply)=>AsyncGenerator<SlashCommandClosureResult|{closure:SlashCommandClosure, executor:SlashCommandExecutor|SlashCommandClosureResult}, SlashCommandClosureResult, boolean>}*/ onDebug;
|
||||
/** @type {(qr:QuickReply)=>AsyncGenerator<SlashCommandClosureResult|{closure:SlashCommandClosure, executor:SlashCommandExecutor|SlashCommandClosureResult}, SlashCommandClosureResult, boolean>} */ onDebug;
|
||||
/**@type {function}*/ onDelete;
|
||||
/**@type {function}*/ onUpdate;
|
||||
/**@type {function}*/ onInsertBefore;
|
||||
@@ -635,7 +635,6 @@ export class QuickReply {
|
||||
}, { passive:true });
|
||||
const getLineStart = ()=>{
|
||||
const start = message.selectionStart;
|
||||
const end = message.selectionEnd;
|
||||
let lineStart;
|
||||
if (start == 0 || message.value[start - 1] == '\n') {
|
||||
// cursor is already at beginning of line
|
||||
@@ -701,7 +700,6 @@ export class QuickReply {
|
||||
} else if (evt.key == 'Enter' && !evt.ctrlKey && !evt.shiftKey && !evt.altKey && !(ac.isReplaceable && ac.isActive)) {
|
||||
// new line, keep indent
|
||||
const start = message.selectionStart;
|
||||
const end = message.selectionEnd;
|
||||
let lineStart = getLineStart();
|
||||
const indent = /^([^\S\n]*)/.exec(message.value.slice(lineStart))[1] ?? '';
|
||||
if (indent.length) {
|
||||
|
@@ -8,18 +8,17 @@ import { SlashCommandEnumValue, enumTypes } from '../../../slash-commands/SlashC
|
||||
import { SlashCommandParser } from '../../../slash-commands/SlashCommandParser.js';
|
||||
import { SlashCommandScope } from '../../../slash-commands/SlashCommandScope.js';
|
||||
import { isTrueBoolean } from '../../../utils.js';
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
import { QuickReplyApi } from '../api/QuickReplyApi.js';
|
||||
import { QuickReply } from './QuickReply.js';
|
||||
import { QuickReplySet } from './QuickReplySet.js';
|
||||
|
||||
export class SlashCommandHandler {
|
||||
/**@type {QuickReplyApi}*/ api;
|
||||
/** @type {QuickReplyApi} */ api;
|
||||
|
||||
|
||||
|
||||
|
||||
constructor(/**@type {QuickReplyApi}*/api) {
|
||||
constructor(/** @type {QuickReplyApi} */api) {
|
||||
this.api = api;
|
||||
}
|
||||
|
||||
@@ -27,7 +26,7 @@ export class SlashCommandHandler {
|
||||
|
||||
|
||||
init() {
|
||||
function getExecutionIcons(/**@type {QuickReply} */ qr) {
|
||||
function getExecutionIcons(/** @type {QuickReply} */ qr) {
|
||||
let icons = '';
|
||||
if (qr.preventAutoExecute) icons += '🚫';
|
||||
if (qr.isHidden) icons += '👁️';
|
||||
|
@@ -1,11 +1,10 @@
|
||||
import { animation_duration } from '../../../../../script.js';
|
||||
import { dragElement } from '../../../../RossAscends-mods.js';
|
||||
import { loadMovingUIState } from '../../../../power-user.js';
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
import { QuickReplySettings } from '../QuickReplySettings.js';
|
||||
|
||||
export class ButtonUi {
|
||||
/**@type {QuickReplySettings}*/ settings;
|
||||
/** @type {QuickReplySettings} */ settings;
|
||||
|
||||
/**@type {HTMLElement}*/ dom;
|
||||
/**@type {HTMLElement}*/ popoutDom;
|
||||
|
@@ -3,14 +3,13 @@ import { getSortableDelay } from '../../../../utils.js';
|
||||
import { log, warn } from '../../index.js';
|
||||
import { QuickReply } from '../QuickReply.js';
|
||||
import { QuickReplySet } from '../QuickReplySet.js';
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
import { QuickReplySettings } from '../QuickReplySettings.js';
|
||||
|
||||
export class SettingsUi {
|
||||
/**@type {QuickReplySettings}*/ settings;
|
||||
/** @type {QuickReplySettings} */ settings;
|
||||
|
||||
/**@type {HTMLElement}*/ template;
|
||||
/**@type {HTMLElement}*/ dom;
|
||||
/** @type {HTMLElement} */ template;
|
||||
/** @type {HTMLElement} */ dom;
|
||||
|
||||
/**@type {HTMLInputElement}*/ isEnabled;
|
||||
/**@type {HTMLInputElement}*/ isCombined;
|
||||
|
@@ -1,5 +1,4 @@
|
||||
import { QuickReply } from '../../QuickReply.js';
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
import { QuickReplySet } from '../../QuickReplySet.js';
|
||||
import { MenuHeader } from './MenuHeader.js';
|
||||
import { MenuItem } from './MenuItem.js';
|
||||
|
@@ -183,8 +183,6 @@ class GptSovitsV2Provider {
|
||||
|
||||
let prompt_text = replaceSpeaker(voiceId);
|
||||
|
||||
const streaming = this.settings.streaming;
|
||||
|
||||
const params = {
|
||||
text: inputText,
|
||||
prompt_text: prompt_text,
|
||||
|
@@ -795,6 +795,7 @@ export function parseNovelAILogprobs(data) {
|
||||
|
||||
// Add the chosen token to `merged` if it's not already there. This can
|
||||
// happen if the chosen token was not among the top 10 most likely ones.
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const [[chosenId], [_, chosenAfter]] = data.chosen[0];
|
||||
if (!merged.some(([id]) => id === chosenId)) {
|
||||
merged.push([chosenId, chosenAfter]);
|
||||
|
@@ -3,16 +3,16 @@ import { SlashCommandAbortController } from './SlashCommandAbortController.js';
|
||||
import { SlashCommandArgument, SlashCommandNamedArgument } from './SlashCommandArgument.js';
|
||||
import { SlashCommandClosure } from './SlashCommandClosure.js';
|
||||
import { SlashCommandDebugController } from './SlashCommandDebugController.js';
|
||||
import { PARSER_FLAG } from './SlashCommandParser.js';
|
||||
import { SlashCommandScope } from './SlashCommandScope.js';
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @typedef {import('./SlashCommandParser.js').ParserFlags} ParserFlags
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {{
|
||||
* _scope:SlashCommandScope,
|
||||
* _parserFlags:{[id:PARSER_FLAG]:boolean},
|
||||
* _parserFlags:{ParserFlags},
|
||||
* _abortController:SlashCommandAbortController,
|
||||
* _debugController:SlashCommandDebugController,
|
||||
* _hasUnnamedArgument:boolean,
|
||||
|
@@ -1,9 +1,6 @@
|
||||
import { AutoCompleteNameResult } from '../autocomplete/AutoCompleteNameResult.js';
|
||||
import { AutoCompleteOption } from '../autocomplete/AutoCompleteOption.js';
|
||||
import { AutoCompleteSecondaryNameResult } from '../autocomplete/AutoCompleteSecondaryNameResult.js';
|
||||
import { SlashCommand } from './SlashCommand.js';
|
||||
import { SlashCommandNamedArgument } from './SlashCommandArgument.js';
|
||||
import { SlashCommandClosure } from './SlashCommandClosure.js';
|
||||
import { SlashCommandCommandAutoCompleteOption } from './SlashCommandCommandAutoCompleteOption.js';
|
||||
import { SlashCommandEnumAutoCompleteOption } from './SlashCommandEnumAutoCompleteOption.js';
|
||||
import { SlashCommandExecutor } from './SlashCommandExecutor.js';
|
||||
|
@@ -2,7 +2,6 @@ import { substituteParams } from '../../script.js';
|
||||
import { delay, escapeRegex, uuidv4 } from '../utils.js';
|
||||
import { SlashCommand } from './SlashCommand.js';
|
||||
import { SlashCommandAbortController } from './SlashCommandAbortController.js';
|
||||
import { SlashCommandNamedArgument } from './SlashCommandArgument.js';
|
||||
import { SlashCommandBreak } from './SlashCommandBreak.js';
|
||||
import { SlashCommandBreakController } from './SlashCommandBreakController.js';
|
||||
import { SlashCommandBreakPoint } from './SlashCommandBreakPoint.js';
|
||||
@@ -14,21 +13,19 @@ import { SlashCommandNamedArgumentAssignment } from './SlashCommandNamedArgument
|
||||
import { SlashCommandScope } from './SlashCommandScope.js';
|
||||
|
||||
export class SlashCommandClosure {
|
||||
/**@type {SlashCommandScope}*/ scope;
|
||||
/**@type {boolean}*/ executeNow = false;
|
||||
// @ts-ignore
|
||||
/**@type {SlashCommandNamedArgumentAssignment[]}*/ argumentList = [];
|
||||
// @ts-ignore
|
||||
/**@type {SlashCommandNamedArgumentAssignment[]}*/ providedArgumentList = [];
|
||||
/**@type {SlashCommandExecutor[]}*/ executorList = [];
|
||||
/**@type {SlashCommandAbortController}*/ abortController;
|
||||
/**@type {SlashCommandBreakController}*/ breakController;
|
||||
/**@type {SlashCommandDebugController}*/ debugController;
|
||||
/**@type {(done:number, total:number)=>void}*/ onProgress;
|
||||
/**@type {string}*/ rawText;
|
||||
/**@type {string}*/ fullText;
|
||||
/**@type {string}*/ parserContext;
|
||||
/**@type {string}*/ #source = uuidv4();
|
||||
/** @type {SlashCommandScope} */ scope;
|
||||
/** @type {boolean} */ executeNow = false;
|
||||
/** @type {SlashCommandNamedArgumentAssignment[]} */ argumentList = [];
|
||||
/** @type {SlashCommandNamedArgumentAssignment[]} */ providedArgumentList = [];
|
||||
/** @type {SlashCommandExecutor[]} */ executorList = [];
|
||||
/** @type {SlashCommandAbortController} */ abortController;
|
||||
/** @type {SlashCommandBreakController} */ breakController;
|
||||
/** @type {SlashCommandDebugController} */ debugController;
|
||||
/** @type {(done:number, total:number)=>void} */ onProgress;
|
||||
/** @type {string} */ rawText;
|
||||
/** @type {string} */ fullText;
|
||||
/** @type {string} */ parserContext;
|
||||
/** @type {string} */ #source = uuidv4();
|
||||
get source() { return this.#source; }
|
||||
set source(value) {
|
||||
this.#source = value;
|
||||
|
@@ -2,20 +2,20 @@ import { SlashCommandClosure } from './SlashCommandClosure.js';
|
||||
import { SlashCommandExecutor } from './SlashCommandExecutor.js';
|
||||
|
||||
export class SlashCommandDebugController {
|
||||
/**@type {SlashCommandClosure[]} */ stack = [];
|
||||
/**@type {SlashCommandExecutor[]} */ cmdStack = [];
|
||||
/**@type {boolean[]} */ stepStack = [];
|
||||
/**@type {boolean} */ isStepping = false;
|
||||
/**@type {boolean} */ isSteppingInto = false;
|
||||
/**@type {boolean} */ isSteppingOut = false;
|
||||
/** @type {SlashCommandClosure[]} */ stack = [];
|
||||
/** @type {SlashCommandExecutor[]} */ cmdStack = [];
|
||||
/** @type {boolean[]} */ stepStack = [];
|
||||
/** @type {boolean} */ isStepping = false;
|
||||
/** @type {boolean} */ isSteppingInto = false;
|
||||
/** @type {boolean} */ isSteppingOut = false;
|
||||
|
||||
/**@type {object} */ namedArguments;
|
||||
/**@type {string|SlashCommandClosure|(string|SlashCommandClosure)[]} */ unnamedArguments;
|
||||
/** @type {object} */ namedArguments;
|
||||
/** @type {string|SlashCommandClosure|(string|SlashCommandClosure)[]} */ unnamedArguments;
|
||||
|
||||
/**@type {Promise<boolean>} */ continuePromise;
|
||||
/**@type {(boolean)=>void} */ continueResolver;
|
||||
/** @type {Promise<boolean>} */ continuePromise;
|
||||
/** @type {(boolean)=>void} */ continueResolver;
|
||||
|
||||
/**@type {(closure:SlashCommandClosure, executor:SlashCommandExecutor)=>Promise<boolean>} */ onBreakPoint;
|
||||
/** @type {(closure:SlashCommandClosure, executor:SlashCommandExecutor)=>Promise<boolean>} */ onBreakPoint;
|
||||
|
||||
|
||||
|
||||
|
@@ -1,7 +1,3 @@
|
||||
import { SlashCommandExecutor } from './SlashCommandExecutor.js';
|
||||
import { SlashCommandScope } from './SlashCommandScope.js';
|
||||
|
||||
|
||||
/**
|
||||
* @typedef {'enum' | 'command' | 'namedArgument' | 'variable' | 'qr' | 'macro' | 'number' | 'name'} EnumType
|
||||
*/
|
||||
|
@@ -1,11 +1,7 @@
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
import { uuidv4 } from '../utils.js';
|
||||
import { SlashCommand } from './SlashCommand.js';
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
import { SlashCommandClosure } from './SlashCommandClosure.js';
|
||||
import { SlashCommandNamedArgumentAssignment } from './SlashCommandNamedArgumentAssignment.js';
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
import { PARSER_FLAG } from './SlashCommandParser.js';
|
||||
import { SlashCommandUnnamedArgumentAssignment } from './SlashCommandUnnamedArgumentAssignment.js';
|
||||
|
||||
export class SlashCommandExecutor {
|
||||
@@ -28,11 +24,10 @@ export class SlashCommandExecutor {
|
||||
arg.value.source = value;
|
||||
}
|
||||
}
|
||||
/**@type {SlashCommand}*/ command;
|
||||
// @ts-ignore
|
||||
/**@type {SlashCommandNamedArgumentAssignment[]}*/ namedArgumentList = [];
|
||||
/**@type {SlashCommandUnnamedArgumentAssignment[]}*/ unnamedArgumentList = [];
|
||||
/**@type {{[id:PARSER_FLAG]:boolean}} */ parserFlags;
|
||||
/** @type {SlashCommand} */ command;
|
||||
/** @type {SlashCommandNamedArgumentAssignment[]} */ namedArgumentList = [];
|
||||
/** @type {SlashCommandUnnamedArgumentAssignment[]} */ unnamedArgumentList = [];
|
||||
/** @type {import('./SlashCommandParser.js').ParserFlags} */ parserFlags;
|
||||
|
||||
get commandCount() {
|
||||
return 1
|
||||
|
@@ -1,10 +1,10 @@
|
||||
import { SlashCommandClosure } from './SlashCommandClosure.js';
|
||||
|
||||
export class SlashCommandNamedArgumentAssignment {
|
||||
/**@type {number}*/ start;
|
||||
/**@type {number}*/ end;
|
||||
/**@type {string}*/ name;
|
||||
/**@type {string|SlashCommandClosure}*/ value;
|
||||
/** @type {number} */ start;
|
||||
/** @type {number} */ end;
|
||||
/** @type {string} */ name;
|
||||
/** @type {string|SlashCommandClosure} */ value;
|
||||
|
||||
|
||||
constructor() {
|
||||
|
@@ -1,11 +1,10 @@
|
||||
import { AutoCompleteOption } from '../autocomplete/AutoCompleteOption.js';
|
||||
import { SlashCommand } from './SlashCommand.js';
|
||||
import { SlashCommandNamedArgument } from './SlashCommandArgument.js';
|
||||
import { SlashCommandNamedArgumentAssignment } from './SlashCommandNamedArgumentAssignment.js';
|
||||
|
||||
export class SlashCommandNamedArgumentAutoCompleteOption extends AutoCompleteOption {
|
||||
/**@type {SlashCommandNamedArgument}*/ arg;
|
||||
/**@type {SlashCommand}*/ cmd;
|
||||
/** @type {SlashCommandNamedArgument} */ arg;
|
||||
/** @type {SlashCommand} */ cmd;
|
||||
|
||||
/**
|
||||
* @param {SlashCommandNamedArgument} arg
|
||||
|
@@ -8,11 +8,9 @@ import { SlashCommandExecutor } from './SlashCommandExecutor.js';
|
||||
import { SlashCommandParserError } from './SlashCommandParserError.js';
|
||||
import { AutoCompleteNameResult } from '../autocomplete/AutoCompleteNameResult.js';
|
||||
import { SlashCommandQuickReplyAutoCompleteOption } from './SlashCommandQuickReplyAutoCompleteOption.js';
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
import { SlashCommandScope } from './SlashCommandScope.js';
|
||||
import { SlashCommandVariableAutoCompleteOption } from './SlashCommandVariableAutoCompleteOption.js';
|
||||
import { SlashCommandNamedArgumentAssignment } from './SlashCommandNamedArgumentAssignment.js';
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
import { SlashCommandAbortController } from './SlashCommandAbortController.js';
|
||||
import { SlashCommandAutoCompleteNameResult } from './SlashCommandAutoCompleteNameResult.js';
|
||||
import { SlashCommandUnnamedArgumentAssignment } from './SlashCommandUnnamedArgumentAssignment.js';
|
||||
@@ -28,16 +26,18 @@ import { t } from '../i18n.js';
|
||||
/** @typedef {import('./SlashCommand.js').NamedArgumentsCapture} NamedArgumentsCapture */
|
||||
/** @typedef {import('./SlashCommand.js').NamedArguments} NamedArguments */
|
||||
|
||||
/**@readonly*/
|
||||
/**@enum {Number}*/
|
||||
/**
|
||||
* @enum {Number}
|
||||
* @readonly
|
||||
* @typedef {{[id:PARSER_FLAG]:boolean}} ParserFlags
|
||||
*/
|
||||
export const PARSER_FLAG = {
|
||||
'STRICT_ESCAPING': 1,
|
||||
'REPLACE_GETVAR': 2,
|
||||
};
|
||||
|
||||
export class SlashCommandParser {
|
||||
// @ts-ignore
|
||||
/**@type {Object.<string, SlashCommand>}*/ static commands = {};
|
||||
/** @type {Object.<string, SlashCommand>} */ static commands = {};
|
||||
|
||||
/**
|
||||
* @deprecated Use SlashCommandParser.addCommandObject() instead.
|
||||
@@ -101,26 +101,25 @@ export class SlashCommandParser {
|
||||
get commands() {
|
||||
return SlashCommandParser.commands;
|
||||
}
|
||||
// @ts-ignore
|
||||
/**@type {Object.<string, string>}*/ helpStrings = {};
|
||||
/**@type {boolean}*/ verifyCommandNames = true;
|
||||
/**@type {string}*/ text;
|
||||
/**@type {number}*/ index;
|
||||
/**@type {SlashCommandAbortController}*/ abortController;
|
||||
/**@type {SlashCommandDebugController}*/ debugController;
|
||||
/**@type {SlashCommandScope}*/ scope;
|
||||
/**@type {SlashCommandClosure}*/ closure;
|
||||
/** @type {Object.<string, string>} */ helpStrings = {};
|
||||
/** @type {boolean} */ verifyCommandNames = true;
|
||||
/** @type {string} */ text;
|
||||
/** @type {number} */ index;
|
||||
/** @type {SlashCommandAbortController} */ abortController;
|
||||
/** @type {SlashCommandDebugController} */ debugController;
|
||||
/** @type {SlashCommandScope} */ scope;
|
||||
/** @type {SlashCommandClosure} */ closure;
|
||||
|
||||
/**@type {Object.<PARSER_FLAG,boolean>}*/ flags = {};
|
||||
/** @type {Object.<PARSER_FLAG,boolean>} */ flags = {};
|
||||
|
||||
/**@type {boolean}*/ jumpedEscapeSequence = false;
|
||||
/** @type {boolean} */ jumpedEscapeSequence = false;
|
||||
|
||||
/**@type {{start:number, end:number}[]}*/ closureIndex;
|
||||
/**@type {{start:number, end:number, name:string}[]}*/ macroIndex;
|
||||
/**@type {SlashCommandExecutor[]}*/ commandIndex;
|
||||
/**@type {SlashCommandScope[]}*/ scopeIndex;
|
||||
/** @type {{start:number, end:number}[]} */ closureIndex;
|
||||
/** @type {{start:number, end:number, name:string}[]} */ macroIndex;
|
||||
/** @type {SlashCommandExecutor[]} */ commandIndex;
|
||||
/** @type {SlashCommandScope[]} */ scopeIndex;
|
||||
|
||||
/**@type {string}*/ parserContext;
|
||||
/** @type {string} */ parserContext;
|
||||
|
||||
get userIndex() { return this.index; }
|
||||
|
||||
|
@@ -2,21 +2,21 @@ import { SlashCommandClosure } from './SlashCommandClosure.js';
|
||||
import { convertValueType } from '../utils.js';
|
||||
|
||||
export class SlashCommandScope {
|
||||
/**@type {string[]}*/ variableNames = [];
|
||||
/** @type {string[]} */ variableNames = [];
|
||||
get allVariableNames() {
|
||||
const names = [...this.variableNames, ...(this.parent?.allVariableNames ?? [])];
|
||||
return names.filter((it,idx)=>idx == names.indexOf(it));
|
||||
}
|
||||
// @ts-ignore
|
||||
/**@type {object.<string, string|SlashCommandClosure>}*/ variables = {};
|
||||
/** @type {object.<string, string|SlashCommandClosure>} */ variables = {};
|
||||
// @ts-ignore
|
||||
/**@type {object.<string, string|SlashCommandClosure>}*/ macros = {};
|
||||
/**@type {{key:string, value:string|SlashCommandClosure}[]} */
|
||||
/** @type {object.<string, string|SlashCommandClosure>} */ macros = {};
|
||||
/** @type {{key:string, value:string|SlashCommandClosure}[]} */
|
||||
get macroList() {
|
||||
return [...Object.keys(this.macros).map(key=>({ key, value:this.macros[key] })), ...(this.parent?.macroList ?? [])];
|
||||
}
|
||||
/**@type {SlashCommandScope}*/ parent;
|
||||
/**@type {string}*/ #pipe;
|
||||
/** @type {SlashCommandScope} */ parent;
|
||||
/** @type {string} */ #pipe;
|
||||
get pipe() {
|
||||
return this.#pipe ?? this.parent?.pipe;
|
||||
}
|
||||
|
@@ -1,9 +1,9 @@
|
||||
import { SlashCommandClosure } from './SlashCommandClosure.js';
|
||||
|
||||
export class SlashCommandUnnamedArgumentAssignment {
|
||||
/**@type {number}*/ start;
|
||||
/**@type {number}*/ end;
|
||||
/**@type {string|SlashCommandClosure}*/ value;
|
||||
/** @type {number} */ start;
|
||||
/** @type {number} */ end;
|
||||
/** @type {string|SlashCommandClosure} */ value;
|
||||
|
||||
|
||||
constructor() {
|
||||
|
@@ -13,7 +13,6 @@ import {
|
||||
DEFAULT_PRINT_TIMEOUT,
|
||||
printCharacters,
|
||||
} from '../script.js';
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
import { FILTER_TYPES, FILTER_STATES, DEFAULT_FILTER_STATE, isFilterState, FilterHelper } from './filters.js';
|
||||
|
||||
import { groupCandidatesFilter, groups, selected_group } from './group-chats.js';
|
||||
|
@@ -9,7 +9,7 @@ import { SlashCommandClosure } from './slash-commands/SlashCommandClosure.js';
|
||||
import { SlashCommandClosureResult } from './slash-commands/SlashCommandClosureResult.js';
|
||||
import { commonEnumProviders, enumIcons } from './slash-commands/SlashCommandCommonEnumsProvider.js';
|
||||
import { SlashCommandEnumValue, enumTypes } from './slash-commands/SlashCommandEnumValue.js';
|
||||
import { PARSER_FLAG, SlashCommandParser } from './slash-commands/SlashCommandParser.js';
|
||||
import { SlashCommandParser } from './slash-commands/SlashCommandParser.js';
|
||||
import { slashCommandReturnHelper } from './slash-commands/SlashCommandReturnHelper.js';
|
||||
import { SlashCommandScope } from './slash-commands/SlashCommandScope.js';
|
||||
import { isFalseBoolean, convertValueType, isTrueBoolean } from './utils.js';
|
||||
@@ -583,7 +583,7 @@ export function evalBoolean(rule, a, b) {
|
||||
* Executes a slash command from a string (may be enclosed in quotes) and returns the result.
|
||||
* @param {string} command Command to execute. May contain escaped macro and batch separators.
|
||||
* @param {SlashCommandScope} [scope] The scope to use.
|
||||
* @param {{[id:PARSER_FLAG]:boolean}} [parserFlags] The parser flags to use.
|
||||
* @param {import('./slash-commands/SlashCommandParser.js').ParserFlags} [parserFlags] The parser flags to use.
|
||||
* @param {SlashCommandAbortController} [abortController] The abort controller to use.
|
||||
* @returns {Promise<SlashCommandClosureResult>} Closure execution result
|
||||
*/
|
||||
|
Reference in New Issue
Block a user