mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-08 08:52:12 +00:00
Project & files - Project view modes (Project Files / Open Files / All Changed Files / Scratches); External Libraries for Python, JDK (src.zip), Node, Cargo, Go, Maven/Gradle jars; read-only jar/zip browsing - ⌘N New popup with type search and more file kinds; New Project, Rename Project, Reload All from Disk, Export/Import Settings, Power Save Mode - File type associations, extra content roots and exclude patterns (indexed and watched without reopening the project) Editor & navigation - Find bar: search scope (comments/strings), Preserve Case, Exclude, multiline, history; Find in Files: Module scope, custom pattern scopes, multiline - Search Everywhere filters, Assign Shortcut, settings results; named bookmark lists, file/folder bookmarks; Structure filters and Show Inherited; Recent Locations timestamps and breadcrumbs; Code Vision author - Completion options, editor tab placement/layout, inline completion (LSP 3.18) - Spell checking (Typo inspection, ide-spell) and Inspections settings with custom profiles; Code Style schemes, formatter markers, Do not format Run, VCS, services, database - Typed run configurations (Shell, Program, npm, Gradle, Maven, Docker, Compound), Modify options, Before launch, env dialog, Current File, Emulate terminal (PTY) - Git log graph/view options, Go to Hash/Branch/Tag, date filter keeps the graph; Pull/Merge/Rebase dialogs, Manage Remotes, Worktrees - Generic Services host (Docker connections/registries, run sessions); TODO scope/changes tabs with changelists; Coverage report import - Data sources: wire-compatible vendors, URL import, SSL certs, Options, Schemas and Advanced tabs, color and comment Workbench - Run Anything, Customize Main Toolbar, named tool window layouts, menu completeness, Code Cleanup, macros, "Don't Show Again", editor banners - Chinese translations for the new UI Claude-Session: https://claude.ai/code/session_01SaPPsVPuk6ZTNsoUCNCbMv
96 lines
2.9 KiB
TypeScript
96 lines
2.9 KiB
TypeScript
import { forwardRef, type ButtonHTMLAttributes, type ReactNode } from "react";
|
|
import clsx from "clsx";
|
|
import { getAction, executeAction } from "@/platform/actions";
|
|
import { shortcutLabel } from "@/platform/keymap";
|
|
import { Icon, type IconName } from "./icons";
|
|
import { tooltipAttrs } from "./Tooltip";
|
|
import styles from "./Button.module.css";
|
|
import { useTx } from "@/platform/i18n";
|
|
|
|
export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
variant?: "primary" | "secondary" | "ghost";
|
|
size?: "normal" | "small";
|
|
icon?: IconName | (string & {});
|
|
children?: ReactNode;
|
|
}
|
|
|
|
export const Button = forwardRef<HTMLButtonElement, ButtonProps>(function Button(
|
|
{ variant = "secondary", size = "normal", icon, className, children, type = "button", title, ...rest },
|
|
ref,
|
|
) {
|
|
const tx = useTx();
|
|
return (
|
|
<button
|
|
ref={ref}
|
|
type={type}
|
|
className={clsx(styles.button, styles[variant], size === "small" && styles.small, className)}
|
|
title={tx(title)}
|
|
{...rest}
|
|
>
|
|
{icon && <Icon name={icon} size={14} />}
|
|
{typeof children === "string" ? tx(children) : children}
|
|
</button>
|
|
);
|
|
});
|
|
|
|
export interface IconButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "title"> {
|
|
icon: IconName | (string & {});
|
|
/** Accessible label and tooltip text. Defaults to the action's title. */
|
|
title?: string;
|
|
/** Run this action on click; supplies title + shortcut. */
|
|
action?: string;
|
|
actionArg?: unknown;
|
|
/** Explicit shortcut label shown in the tooltip (defaults to the action's binding). */
|
|
shortcut?: string;
|
|
/** Toggle state (renders `aria-pressed`). */
|
|
pressed?: boolean;
|
|
size?: "small" | "normal" | "large";
|
|
iconSize?: number;
|
|
tone?: "default" | "danger" | "accent";
|
|
}
|
|
|
|
export const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(function IconButton(
|
|
{
|
|
icon,
|
|
title,
|
|
action,
|
|
actionArg,
|
|
shortcut,
|
|
pressed,
|
|
size = "normal",
|
|
iconSize,
|
|
tone = "default",
|
|
className,
|
|
onClick,
|
|
disabled,
|
|
type = "button",
|
|
"aria-label": ariaLabel,
|
|
...rest
|
|
},
|
|
ref,
|
|
) {
|
|
const tx = useTx();
|
|
const a = action ? getAction(action) : undefined;
|
|
const label = tx(title) ?? a?.title ?? action ?? icon;
|
|
const keys = shortcut ?? (action ? shortcutLabel(action) : undefined);
|
|
return (
|
|
<button
|
|
ref={ref}
|
|
type={type}
|
|
aria-label={tx(ariaLabel) ?? label}
|
|
aria-pressed={pressed}
|
|
aria-keyshortcuts={keys}
|
|
disabled={disabled}
|
|
className={clsx(styles.iconButton, styles[`is-${size}`], tone !== "default" && styles[`tone-${tone}`], className)}
|
|
onClick={(e) => {
|
|
onClick?.(e);
|
|
if (!e.defaultPrevented && action) void executeAction(action, actionArg);
|
|
}}
|
|
{...tooltipAttrs(label, keys)}
|
|
{...rest}
|
|
>
|
|
<Icon name={icon} size={iconSize ?? (size === "small" ? 14 : 16)} />
|
|
</button>
|
|
);
|
|
});
|