feat: dice roller improved

This commit is contained in:
2026-02-28 16:49:59 +08:00
parent 66aaaa96e1
commit cc10cea31d
12 changed files with 736 additions and 40 deletions
+8 -18
View File
@@ -1,23 +1,10 @@
import { customElement, noShadowDOM } from "solid-element";
import { onMount, onCleanup } from "solid-js";
import { useCommander } from "./hooks";
import { useCommander } from "./hooks/useCommander";
import { CommanderInput } from "./CommanderInput";
import { CommanderEntries } from "./CommanderEntries";
import type { MdCommanderProps } from "./types";
export { CommanderInput } from './CommanderInput';
export type { CommanderInputProps } from './CommanderInput';
export { CommanderEntries } from './CommanderEntries';
export type { CommanderEntriesProps } from './CommanderEntries';
export type {
MdCommanderProps,
MdCommanderCommand,
MdCommanderOption,
MdCommanderOptionType,
CommanderEntry,
CompletionItem,
} from './types';
customElement<MdCommanderProps>(
"md-commander",
{ placeholder: "", class: "", height: "" },
@@ -73,14 +60,17 @@ customElement<MdCommanderProps>(
return (
<div
class={`md-commander flex flex-col border border-gray-300 rounded-lg overflow-visible ${props.class || ""}`}
class={`md-commander flex flex-col border border-gray-300 rounded-lg overflow-hidden ${props.class || ""}`}
style={{ height: heightStyle() }}
>
{/* 命令执行结果 */}
<CommanderEntries entries={commander.entries} />
{/* 命令执行结果 */}
<CommanderEntries
entries={commander.entries}
onCommandClick={(cmd) => commander.setInputValue(cmd)}
/>
{/* 命令输入框 */}
<div class="relative">
<div class="relative border-t border-gray-300">
<CommanderInput
placeholder={props.placeholder}
inputValue={commander.inputValue}