Releases: theisel/astro-portabletext
astro-portabletext@0.7.0-next.0
Minor Changes
-
Feat:
usePortableText(node)
utility function returns new properties and some have been deprecated.Refer to the
utils docs
for usage.Added
Property Type Description getDefaultComponent function
Returns the default
component related to the passed innode
. Use this when you need to fall back to thedefault
component.getUnknownComponent function
Returns the counterpart unknown(Block|List|ListItem|Mark|Type)
component related to the passed innode
.notifyMissingComponentHandler function
Calls onMissingComponent
handler. Pass in astring
to overridedefault
message.Deprecated
Property Type Description next function
Use getDefaultComponent
onMissingComponent function
Use notifyMissingComponentHandler
astro-portabletext@0.6.1
astro-portabletext@0.6.0
Minor Changes
-
1c205e7: Feat:
usePortableText
to get context for the current Portable Text node.--- import { Props as ComponentProps } from "astro-portabletext/types"; import { usePortableText } from "astro-portabletext/utils"; export type Props = ComponentProps; const props = Astro.props; const { node } = props; const { next } = usePortableText(node); const FallbackComponent = next(); --- <FallbackComponent {...props}> <slot /> </FallbackComponent>
Patch Changes
astro-portabletext@0.5.0
Minor Changes
-
cfaaf38: BREAKING
- Removed deprecated
BlockStyle
type; useBlock
type instead - Removed deprecated
isBlockStyle
; a utility type guard function which is tied toBlockStyle
and has no purpose
- Removed deprecated
Patch Changes
astro-portabletext@0.4.1
Patch Changes
-
29815b8: Fixes PortableText
onMissingComponent
prop to accept boolean- onMissingComponent?: MissingComponentHandler | false; + onMissingComponent?: MissingComponentHandler | boolean;
astro-portabletext@0.4.0
Minor Changes
-
1c102cf: Feat: Made
mergeComponents
andtoPlainText
functions available to be used. -
f8b9a06: Removed deprecated types
-
c6cbd3b: Redefined
Block
type with propertystyle
set tonormal
.style
is set tonormal
whenundefined
during render phase.- Depreacted
BlockStyle
in favour forBlock
.
-
a6bfa8e: Feat: Made
Block
,List
,ListItem
andMark
components available to be used to help extend custom components. -
11ffafc: BREAKING Changed
NodeType
type fromenum
tostring
- This effects
PortableText
proponMissingComponent
handler
- This effects
-
d1b38ea: BREAKING
Props<N>
typeN
parameter should extendTypedObject
.- import type { Props as $ } from "astro-portabletext/types"; + import type { Props as $, TypedObject } from "astro-portabletext/types"; - interface Greet { + interface Greet extends TypedObject { greeting: string; }; export type Props = $<Greet>;
-
9753535: BREAKING Brings in consistent naming, which reflects Portable Text node types.
T NodeType
- type NodeType = "block" | "blockStyle" | "listStyle" | "listItemStyle" | "mark"; + type NodeType = "type" | "block" | "list" | "listItem" | "mark";
T PortableTextComponents
Property Counterpart type unknownType block unknownBlockStyleunknownBlocklist unknownList listItem unknownListItem mark unknownMark hardBreak PortableText
<PortableText components={{ - unknownBlockStyle: /* custom component */; + unknownBlock: /* custom component */; }} >
Patch Changes
- 8644be2: Fixes [object Generator] output error
astro-portabletext@0.4.0-next.5
Patch Changes
- 8644be2: Fixes [object Generator] output error
astro-portabletext@0.4.0-next.4
Minor Changes
-
c6cbd3b: Redefined
Block
type with propertystyle
set tonormal
.style
is set tonormal
whenundefined
during render phase.- Depreacted
BlockStyle
in favour forBlock
.
astro-portabletext@0.4.0-next.3
Minor Changes
-
11ffafc: BREAKING Changed
NodeType
type fromenum
tostring
- This effects
PortableText
proponMissingComponent
handler
- This effects
-
9753535: Brings in consistent naming, which reflects Portable Text node types.
T NodeType
- type NodeType = "block" | "blockStyle" | "listStyle" | "listItemStyle" | "mark"; + type NodeType = "type" | "block" | "list" | "listItem" | "mark";
T PortableTextComponents
Property Counterpart type unknownType block unknownBlockStyleunknownBlocklist unknownList listItem unknownListItem mark unknownMark hardBreak PortableText
<PortableText components={{ - unknownBlockStyle: /* custom component */; + unknownBlock: /* custom component */; }} >
astro-portabletext@0.4.0-next.2
Minor Changes
-
d1b38ea: BREAKING
Props<N>
typeN
parameter should extendTypedObject
.- import type { Props as $ } from "astro-portabletext/types"; + import type { Props as $, TypedObject } from "astro-portabletext/types"; - interface Greet { + interface Greet extends TypedObject { greeting: string; }; export type Props = $<Greet>;