@sanity/code-input
7.3.37.3.4
dist/index.d.ts~
dist/index.d.tsModified+66−24
Index: package/dist/index.d.ts
===================================================================
--- package/dist/index.d.ts
+++ package/dist/index.d.ts
@@ -1,4 +1,5 @@
+import "@sanity/ui/styles.css";
import { ObjectDefinition, ObjectInputProps, ObjectSchemaType, Plugin, PreviewProps } from "sanity";
import { Extension } from "@codemirror/state";
interface CodeInputLanguage {
title: string;
@@ -39,8 +40,24 @@
}
/**
* @public
*/
+interface CodeInputProps extends ObjectInputProps<CodeInputValue, CodeSchemaType> {}
+/** @public */
+declare function CodeInput(props: CodeInputProps): React.JSX.Element;
+/**
+ * @public
+ */
+interface PreviewCodeProps extends PreviewProps {
+ selection?: CodeInputValue;
+}
+/**
+ * @public
+ */
+declare function PreviewCode(props: PreviewCodeProps): React.JSX.Element;
+/**
+ * @public
+ */
declare const codeTypeName = "code";
/**
* @public
*/
@@ -56,36 +73,61 @@
/**
* @public
*/
declare const codeSchema: {
- type: "object";
name: "code";
-} & Omit<ObjectDefinition, "preview"> & {
- preview?: import("sanity").PreviewConfig<{
- language: string;
- code: string;
- filename: string;
- highlightedLines: string;
- }, Record<"code" | "filename" | "highlightedLines" | "language", any>> | undefined;
+ type: "object";
+ title: string;
+ components: {
+ input: typeof CodeInput;
+ preview: typeof PreviewCode;
+ };
+ icon: import("react").ForwardRefExoticComponent<Omit<import("react").SVGProps<SVGSVGElement>, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
+ fields: ({
+ name: string;
+ title: string;
+ type: "string";
+ of?: undefined;
+ } | {
+ title: string;
+ name: string;
+ type: "text";
+ of?: undefined;
+ } | {
+ title: string;
+ name: string;
+ type: "array";
+ of: {
+ type: "number";
+ title: string;
+ }[];
+ })[];
+ preview: {
+ select: {
+ language: string;
+ code: string;
+ filename: string;
+ highlightedLines: string;
+ };
+ prepare: (value: {
+ language?: string;
+ code?: string;
+ filename?: string;
+ highlightedLines?: number[];
+ }) => {
+ title: string;
+ media: import("react").JSX.Element | undefined;
+ selection: {
+ language?: string;
+ code?: string;
+ filename?: string;
+ highlightedLines?: number[];
+ };
+ };
+ };
};
declare const SUPPORTED_LANGUAGES: CodeInputLanguage[];
declare const LANGUAGE_ALIASES: Record<string, string | undefined>;
-/**
- * @public
- */
-interface CodeInputProps extends ObjectInputProps<CodeInputValue, CodeSchemaType> {}
-/** @public */
-declare function CodeInput(props: CodeInputProps): React.JSX.Element;
-/**
- * @public
- */
-interface PreviewCodeProps extends PreviewProps {
- selection?: CodeInputValue;
-}
-/**
- * @public
- */
-declare function PreviewCode(props: PreviewCodeProps): React.JSX.Element;
interface CodeMode {
name: string;
loader: ModeLoader;
}