chore: clean up

This commit is contained in:
hypercross 2026-02-28 17:44:38 +08:00
parent 80471e8dd2
commit 1f5ee24a0f
6 changed files with 60 additions and 89 deletions

View File

@ -18,11 +18,3 @@ export { FileTreeNode, HeadingNode } from './FileTree';
export type { DiceProps } from './md-dice'; export type { DiceProps } from './md-dice';
export type { TableProps } from './md-table'; export type { TableProps } from './md-table';
export type { BgProps } from './md-bg'; export type { BgProps } from './md-bg';
export type {
MdCommanderProps,
MdCommanderCommand,
MdCommanderOption,
MdCommanderOptionType,
CommanderEntry,
CompletionItem,
} from './md-commander';

View File

@ -1,4 +1,4 @@
export { useCommander, defaultCommands, parseInput, getCompletions, getResultClass } from './useCommander'; export { useCommander, defaultCommands, parseInput, getCompletions, getResultClass } from './useCommander';
export type { UseCommanderReturn } from './useCommander'; export type { UseCommanderReturn } from './useCommander';
export { useDiceRoller } from './useDiceRoller'; export { rollFormula, rollSimple } from './useDiceRoller';
export * from './dice-engine'; export * from './dice-engine';

View File

@ -4,7 +4,7 @@ import {
CommanderEntry, CommanderEntry,
CompletionItem, CompletionItem,
} from "../types"; } from "../types";
import { useDiceRoller } from "./useDiceRoller"; import { rollSimple } from "./useDiceRoller";
// ==================== 默认命令 ==================== // ==================== 默认命令 ====================
@ -57,7 +57,6 @@ export const defaultCommands: Record<string, MdCommanderCommand> = {
], ],
handler: (args) => { handler: (args) => {
const formula = args.params.formula || "1d6"; const formula = args.params.formula || "1d6";
const { rollSimple } = useDiceRoller();
const result = rollSimple(formula); const result = rollSimple(formula);
return { return {
message: result.text, message: result.text,

View File

@ -19,7 +19,6 @@ export interface DiceRollerResult {
* Hook * Hook
* *
*/ */
export function useDiceRoller() {
/** /**
* *
* @param formula * @param formula
@ -30,7 +29,7 @@ export function useDiceRoller() {
* - -: * - -:
* - 5: 固定数字 * - 5: 固定数字
*/ */
function roll(formula: string): DiceRollerResult { export function rollFormula(formula: string): DiceRollerResult {
try { try {
const result = rollDice(formula); const result = rollDice(formula);
@ -65,7 +64,7 @@ export function useDiceRoller() {
* HTML * HTML
* [1] [2] [3] = <strong>6</strong> * [1] [2] [3] = <strong>6</strong>
*/ */
function rollSimple(formula: string): { text: string; isHtml?: boolean } { export function rollSimple(formula: string): { text: string; isHtml?: boolean } {
try { try {
const result = rollDice(formula); const result = rollDice(formula);
return { return {
@ -79,9 +78,3 @@ export function useDiceRoller() {
}; };
} }
} }
return {
roll,
rollSimple,
};
}

View File

@ -1,13 +0,0 @@
export { CommanderInput } from './CommanderInput';
export type { CommanderInputProps } from './CommanderInput';
export { CommanderEntries } from './CommanderEntries';
export type { CommanderEntriesProps } from './CommanderEntries';
export type {
MdCommanderProps,
MdCommanderCommand,
MdCommanderOption,
MdCommanderParameter,
MdCommanderOptionType,
CommanderEntry,
CompletionItem,
} from './types';

View File

@ -1,6 +1,6 @@
import { customElement, noShadowDOM } from "solid-element"; import { customElement, noShadowDOM } from "solid-element";
import { onMount, onCleanup } from "solid-js"; import { onMount, onCleanup } from "solid-js";
import { useCommander } from "./hooks/useCommander"; import { useCommander } from "./hooks";
import { CommanderInput } from "./CommanderInput"; import { CommanderInput } from "./CommanderInput";
import { CommanderEntries } from "./CommanderEntries"; import { CommanderEntries } from "./CommanderEntries";
import type { MdCommanderProps } from "./types"; import type { MdCommanderProps } from "./types";