astro-portabletext
Advanced tools
Comparing version 0.6.0 to 0.6.1
@@ -7,6 +7,6 @@ import type { Component } from "./internal"; | ||
} | ||
export declare const context: Map<unknown, Context>; | ||
export declare const setContext: (key: unknown, value: Context) => void; | ||
export declare const setContext: (key: unknown, value: Context) => Map<unknown, Context>; | ||
export declare const hasContext: (key: unknown) => boolean; | ||
export declare const getContext: (node: unknown) => Context; | ||
export declare const flushContext: () => void; | ||
export {}; |
@@ -1,8 +0,5 @@ | ||
export const context = new Map(); | ||
export const setContext = (key, value) => { | ||
context.set(key, value); | ||
}; | ||
const context = new Map(); | ||
export const setContext = context.set.bind(context); | ||
export const hasContext = context.has.bind(context); | ||
export const getContext = (node) => { | ||
return context.get(node) ?? {}; | ||
}; | ||
export const getContext = (node) => context.get(node) ?? {}; | ||
export const flushContext = context.clear.bind(context); |
@@ -1,2 +0,1 @@ | ||
import type { ArbitraryTypedObject, TypedObject } from "@portabletext/types"; | ||
import type { Props, SomePortableTextComponents } from "./types"; | ||
@@ -21,5 +20,4 @@ /** | ||
* @internal | ||
* @template N Portable Text node type | ||
*/ | ||
export declare type Component<N extends TypedObject = ArbitraryTypedObject> = (props: Props<N>) => any; | ||
export declare type Component<P extends Props = Props> = (props: P) => any; | ||
/** | ||
@@ -29,3 +27,3 @@ * For internal use | ||
*/ | ||
export declare type ComponentOrRecord<N extends TypedObject = ArbitraryTypedObject> = Component<N> | Record<string, Component<N>>; | ||
export declare type ComponentOrRecord<P extends Props = Props> = Component<P> | Record<string, Component<P>>; | ||
/** | ||
@@ -32,0 +30,0 @@ * @internal |
@@ -46,35 +46,35 @@ import type { ToolkitListNestMode, ToolkitNestedPortableTextSpan, ToolkitPortableTextList, ToolkitPortableTextListItem, ToolkitTextNode } from "@portabletext/toolkit"; | ||
*/ | ||
block: ComponentOrRecord<Block>; | ||
block: ComponentOrRecord<Props<Block>>; | ||
/** | ||
* Used when a `block` handler isn't found | ||
*/ | ||
unknownBlock: Component<Block>; | ||
unknownBlock: Component<Props<Block>>; | ||
/** | ||
* How lists should be rendered | ||
*/ | ||
list: ComponentOrRecord<List>; | ||
list: ComponentOrRecord<Props<List>>; | ||
/** | ||
* Used when a `list` handler isn't found | ||
*/ | ||
unknownList: Component<List>; | ||
unknownList: Component<Props<List>>; | ||
/** | ||
* How list items should be rendered | ||
*/ | ||
listItem: ComponentOrRecord<ListItem>; | ||
listItem: ComponentOrRecord<Props<ListItem>>; | ||
/** | ||
* Used when a `listItem` handler isn't found | ||
*/ | ||
unknownListItem: Component<ListItem>; | ||
unknownListItem: Component<Props<ListItem>>; | ||
/** | ||
* How marked text should be rendered | ||
*/ | ||
mark: ComponentOrRecord<Mark>; | ||
mark: ComponentOrRecord<Props<Mark>>; | ||
/** | ||
* Used when a `mark` handler isn't found | ||
*/ | ||
unknownMark: Component<Mark>; | ||
unknownMark: Component<Props<Mark>>; | ||
/** | ||
* How line breaks should be rendered | ||
*/ | ||
hardBreak: Component<TextNode>; | ||
hardBreak: Component<Props<TextNode>>; | ||
} | ||
@@ -81,0 +81,0 @@ /** |
{ | ||
"name": "astro-portabletext", | ||
"version": "0.6.0", | ||
"version": "0.6.1", | ||
"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
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
27738
31
289