Every contribution `icon` now takes a Lucide name, `{ svg }`, or a
component. Attachment sources take only the first two because composer
drafts persist the source icon.
The daemon's provider-icon check and the app's inline-SVG check are the
same function in the shared SDK root, so a plugin sees the same reasons
in both places. The app parses each icon once at registration and fails
the plugin with that reason. Rendering goes through one module that
turns any form into a component, so surfaces never branch on the form.
82 lines
2.5 KiB
TypeScript
82 lines
2.5 KiB
TypeScript
import type {
|
|
ComponentType,
|
|
FunctionComponent,
|
|
ReactNode,
|
|
ForwardRefExoticComponent,
|
|
RefAttributes,
|
|
ReactElement,
|
|
Ref,
|
|
} from "react";
|
|
import type {
|
|
StyleProp,
|
|
ViewStyle,
|
|
ScrollView as NativeScrollView,
|
|
ScrollViewProps,
|
|
FlatList as NativeFlatList,
|
|
FlatListProps,
|
|
TextInput as NativeTextInput,
|
|
TextInputProps,
|
|
} from "react-native";
|
|
import type { PluginIconProps } from "../icons.js";
|
|
import type { PluginIcon } from "./contracts.js";
|
|
|
|
export interface ModalProps {
|
|
title: string;
|
|
icon?: ReactNode;
|
|
open: boolean;
|
|
onOpenChange(open: boolean): void;
|
|
children: ReactNode;
|
|
}
|
|
|
|
export interface ModalContentProps {
|
|
children: ReactNode;
|
|
/** Paint the full body below the header. */
|
|
style?: StyleProp<ViewStyle>;
|
|
/** Overrides the default 24px padding and 16px gap. Safe-area clearance stays host-owned. */
|
|
contentContainerStyle?: StyleProp<ViewStyle>;
|
|
/** Default true. Set false for a bounded body with your own ScrollView or FlatList. */
|
|
scrollable?: boolean;
|
|
}
|
|
|
|
export interface ModalComponent extends FunctionComponent<ModalProps> {
|
|
Content: ComponentType<ModalContentProps>;
|
|
}
|
|
|
|
export type ToastVariant = "default" | "info" | "success" | "warning" | "error";
|
|
|
|
export interface ToastOptions {
|
|
variant?: ToastVariant;
|
|
durationMs?: number;
|
|
}
|
|
|
|
export interface ToastApi {
|
|
show(message: string, options?: ToastOptions): void;
|
|
error(message: string): void;
|
|
}
|
|
|
|
/** Renders a Lucide icon by `name`, or any plugin icon by `icon`. An unusable icon renders nothing. */
|
|
export type IconProps = Partial<PluginIconProps> &
|
|
({ name: string; icon?: never } | { icon: PluginIcon; name?: never });
|
|
|
|
export declare const Icon: ComponentType<IconProps>;
|
|
export declare const Modal: ModalComponent;
|
|
export declare function useToast(): ToastApi;
|
|
export declare function useRevealedText(text: string, phase: "streaming" | "complete"): string;
|
|
|
|
export type { PluginIconProps } from "../icons.js";
|
|
|
|
/** React Native scrolling with the host's sheet gestures when rendered inside a sheet. */
|
|
export declare const ScrollView: ForwardRefExoticComponent<
|
|
ScrollViewProps & RefAttributes<NativeScrollView>
|
|
>;
|
|
export declare function FlatList<Item>(
|
|
props: FlatListProps<Item> & { ref?: Ref<NativeFlatList<Item>> },
|
|
): ReactElement;
|
|
/** Copies text to this client's clipboard. Rejects when copying is unavailable or denied. */
|
|
export declare function copyText(text: string): Promise<void>;
|
|
|
|
/** Native input focus integrated with modal keyboard positioning. */
|
|
export declare const TextInput: ForwardRefExoticComponent<
|
|
TextInputProps & RefAttributes<NativeTextInput>
|
|
>;
|