Skip to content

Releases: theisel/astro-portabletext

astro-portabletext@0.7.0-next.0

29 Oct 03:43
Compare
Choose a tag to compare
Pre-release

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 in node. Use this when you need to fall back to the default component.
    getUnknownComponent function Returns the counterpart unknown(Block|List|ListItem|Mark|Type) component related to the passed in node.
    notifyMissingComponentHandler function Calls onMissingComponent handler. Pass in a string to override default message.

    Deprecated

    Property Type Description
    next function Use getDefaultComponent
    onMissingComponent function Use notifyMissingComponentHandler

astro-portabletext@0.6.1

13 Oct 11:34
bea8c8f
Compare
Choose a tag to compare

Patch Changes

  • f10099f: Perf: Flushes context at end of PortableText render

  • ab96ddc: Fixes build failing.

    • Cannot redefine property: $key

astro-portabletext@0.6.0

11 Oct 20:04
f1c1965
Compare
Choose a tag to compare

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

  • fb3cdf5: Fixes: #14 Client-side components are no longer reactive

astro-portabletext@0.5.0

07 Oct 18:36
19fde71
Compare
Choose a tag to compare

Minor Changes

  • cfaaf38: BREAKING

    • Removed deprecated BlockStyle type; use Block type instead
    • Removed deprecated isBlockStyle; a utility type guard function which is tied to BlockStyle
      and has no purpose

Patch Changes

  • 46c62f6: Fixes #13 UnknownType.astro failed during build
  • 7809f2f: Fixes error thrown in block, list, listItem, mark and type
    components to fall back to their unknown counterpart.

astro-portabletext@0.4.1

26 Sep 09:14
7270685
Compare
Choose a tag to compare

Patch Changes

  • 29815b8: Fixes PortableText onMissingComponent prop to accept boolean

    - onMissingComponent?: MissingComponentHandler | false;
    + onMissingComponent?: MissingComponentHandler | boolean;

astro-portabletext@0.4.0

26 Sep 03:28
0b86d85
Compare
Choose a tag to compare

Minor Changes

  • 1c102cf: Feat: Made mergeComponents and toPlainText functions available to be used.

  • f8b9a06: Removed deprecated types

  • c6cbd3b: Redefined Block type with property style set to normal.

    • style is set to normal when undefined during render phase.
    • Depreacted BlockStyle in favour for Block.
  • a6bfa8e: Feat: Made Block, List, ListItem and Mark components available to be used to help extend custom components.

  • 11ffafc: BREAKING Changed NodeType type from enum to string

    • This effects PortableText prop onMissingComponent handler
  • d1b38ea: BREAKING Props<N> type N parameter should extend TypedObject.

    - 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 unknownBlockStyle unknownBlock
    list 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

25 Sep 08:41
4207219
Compare
Choose a tag to compare
Pre-release

Patch Changes

  • 8644be2: Fixes [object Generator] output error

astro-portabletext@0.4.0-next.4

24 Sep 17:24
ff790eb
Compare
Choose a tag to compare
Pre-release

Minor Changes

  • c6cbd3b: Redefined Block type with property style set to normal.

    • style is set to normal when undefined during render phase.
    • Depreacted BlockStyle in favour for Block.

astro-portabletext@0.4.0-next.3

24 Sep 07:21
59d1951
Compare
Choose a tag to compare
Pre-release

Minor Changes

  • 11ffafc: BREAKING Changed NodeType type from enum to string

    • This effects PortableText prop onMissingComponent handler
  • 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 unknownBlockStyle unknownBlock
    list unknownList
    listItem unknownListItem
    mark unknownMark
    hardBreak

    PortableText

    <PortableText
      components={{
    -   unknownBlockStyle: /* custom component */;
    +   unknownBlock: /* custom component */;
      }}
    >

astro-portabletext@0.4.0-next.2

22 Sep 17:03
352c5bf
Compare
Choose a tag to compare
Pre-release

Minor Changes

  • d1b38ea: BREAKING Props<N> type N parameter should extend TypedObject.

    - 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>;