astro-portabletext
Advanced tools
Comparing version 0.8.1 to 0.9.0-next.0
@@ -6,10 +6,4 @@ import type { TypedObject } from "@portabletext/types"; | ||
getUnknownComponent: () => Component; | ||
getWarningMessage: () => string; | ||
notifyMissingComponentHandler: (message?: string) => void; | ||
/** @deprecated Use `getDefaultComponent` */ | ||
next: () => Component; | ||
/** @deprecated Use `notifyMissingComponentHandler` */ | ||
onMissingComponent: (message?: string) => void; | ||
} | ||
export declare const key: unique symbol; | ||
export declare function useContext(node: TypedObject): Context; |
@@ -1,2 +0,2 @@ | ||
import type { Props, SomePortableTextComponents } from "./types"; | ||
import type { Props, SomePortableTextComponents, TypedObject } from "./types"; | ||
/** | ||
@@ -21,3 +21,3 @@ * Helper for component to throw an error | ||
*/ | ||
export type Component<P extends Props = Props> = (props: P) => any; | ||
export type Component<T extends TypedObject = any> = (props: Props<T>) => any; | ||
/** | ||
@@ -27,3 +27,3 @@ * For internal use | ||
*/ | ||
export type ComponentOrRecord<P extends Props = Props> = Component<P> | Record<string, Component<P>>; | ||
export type ComponentOrRecord<T extends TypedObject = any> = Component<T> | Record<string, Component<T>>; | ||
/** | ||
@@ -30,0 +30,0 @@ * @internal |
@@ -46,35 +46,35 @@ import type { ToolkitListNestMode, ToolkitNestedPortableTextSpan, ToolkitPortableTextList, ToolkitPortableTextListItem, ToolkitTextNode } from "@portabletext/toolkit"; | ||
*/ | ||
block: ComponentOrRecord<Props<Block>>; | ||
block: ComponentOrRecord<Block>; | ||
/** | ||
* Used when a `block` handler isn't found | ||
*/ | ||
unknownBlock: Component<Props<Block>>; | ||
unknownBlock: Component<Block>; | ||
/** | ||
* How lists should be rendered | ||
*/ | ||
list: ComponentOrRecord<Props<List>>; | ||
list: ComponentOrRecord<List>; | ||
/** | ||
* Used when a `list` handler isn't found | ||
*/ | ||
unknownList: Component<Props<List>>; | ||
unknownList: Component<List>; | ||
/** | ||
* How list items should be rendered | ||
*/ | ||
listItem: ComponentOrRecord<Props<ListItem>>; | ||
listItem: ComponentOrRecord<ListItem>; | ||
/** | ||
* Used when a `listItem` handler isn't found | ||
*/ | ||
unknownListItem: Component<Props<ListItem>>; | ||
unknownListItem: Component<ListItem>; | ||
/** | ||
* How marked text should be rendered | ||
*/ | ||
mark: ComponentOrRecord<Props<Mark>>; | ||
mark: ComponentOrRecord<Mark<any>>; | ||
/** | ||
* Used when a `mark` handler isn't found | ||
*/ | ||
unknownMark: Component<Props<Mark>>; | ||
unknownMark: Component<Mark<any>>; | ||
/** | ||
* How line breaks should be rendered | ||
*/ | ||
hardBreak: Component<Props<TextNode>>; | ||
hardBreak: Component<TextNode>; | ||
} | ||
@@ -145,8 +145,8 @@ /** | ||
* @example | ||
* import type { Mark, Props } from "astro-portabletext/types"; | ||
* type Greet = Mark<{ msg: string }>; | ||
* const props = Astro.props as Props<Greet>; | ||
* import type { Mark, Props as $ } from "astro-portabletext/types"; | ||
* | ||
* export type Props = $<Mark<{ msg: string }>>; | ||
*/ | ||
export interface Mark<MarkDef extends Record<string, any> | undefined = undefined> extends ToolkitNestedPortableTextSpan { | ||
markDef: MarkDef extends Record<string, any> ? MarkDef & PortableTextMarkDefinition : undefined; | ||
markDef: MarkDef & PortableTextMarkDefinition; | ||
markKey: string; | ||
@@ -153,0 +153,0 @@ } |
{ | ||
"name": "astro-portabletext", | ||
"version": "0.8.1", | ||
"version": "0.9.0-next.0", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "description": "Render Portable Text with Astro", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
29
26395
290