@valbuild/next 0.90.0 → 0.91.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +11 -15
  2. package/package.json +6 -6
package/README.md CHANGED
@@ -552,9 +552,8 @@ export default function Page() {
552
552
  },
553
553
  //
554
554
  }}
555
- >
556
- {content}
557
- </ValRichText>
555
+ content={content}
556
+ />
558
557
  </main>
559
558
  );
560
559
  }
@@ -570,9 +569,8 @@ To add classes to `ValRichText` you can use the theme property:
570
569
  p: "font-sans",
571
570
  // etc
572
571
  }}
573
- >
574
- {content}
575
- </ValRichText>
572
+ content={content}
573
+ />
576
574
  ```
577
575
 
578
576
  **NOTE**: if a theme is defined, you must define a mapping for every tag that the you get. What tags you have is decided based on the `options` defined on the `s.richtext()` schema. For example: `s.richtext({ style: { bold: true } })` requires that you add a `bold` theme.
@@ -584,9 +582,8 @@ To add classes to `ValRichText` you can use the theme property:
584
582
  bold: "font-bold",
585
583
  img: null, // either a string or null is required
586
584
  }}
587
- >
588
- {content}
589
- </ValRichText>
585
+ content={content}
586
+ />
590
587
  ```
591
588
 
592
589
  **NOTE**: the reason you must define themes for every tag that the RichText is that this will force you to revisit the themes that are used if the schema changes. The alternative would be to accept changes to the schema.
@@ -609,9 +606,8 @@ If you want to customize / override the type of elements which are rendered, you
609
606
  }
610
607
  // if transform returns undefined the default render will be used
611
608
  }}
612
- >
613
- {content}
614
- </ValRichText>
609
+ content={content}
610
+ />
615
611
  ```
616
612
 
617
613
  ### The RichText type
@@ -654,9 +650,9 @@ NOTE: before writing your own, make sure you check out the `theme` and `transfor
654
650
 
655
651
  ```tsx
656
652
  export function ValRichText({
657
- children: root,
653
+ content,
658
654
  }: {
659
- children: RichText<MyRichTextOptions>;
655
+ content: RichText<MyRichTextOptions>;
660
656
  }) {
661
657
  function build(
662
658
  node: RichTextNode<MyRichTextOptions>,
@@ -682,7 +678,7 @@ export function ValRichText({
682
678
  "children" in node ? node.children.map(build) : null,
683
679
  );
684
680
  }
685
- return <div {...val.attrs(root)}>{root.children.map(build)}</div>;
681
+ return <div {...val.attrs(content)}>{content.map(build)}</div>;
686
682
  }
687
683
  type MyRichTextOptions = AnyRichTextOptions; // you can reduce the surface of what you need to render, by restricting the `options` in `s.richtext(options)`
688
684
  ```
package/package.json CHANGED
@@ -12,7 +12,7 @@
12
12
  "next",
13
13
  "react"
14
14
  ],
15
- "version": "0.90.0",
15
+ "version": "0.91.1",
16
16
  "scripts": {
17
17
  "typecheck": "tsc --noEmit",
18
18
  "test": "jest"
@@ -49,11 +49,11 @@
49
49
  "exports": true
50
50
  },
51
51
  "dependencies": {
52
- "@valbuild/core": "~0.90.0",
53
- "@valbuild/react": "~0.90.0",
54
- "@valbuild/server": "~0.90.0",
55
- "@valbuild/shared": "~0.90.0",
56
- "@valbuild/ui": "~0.90.0",
52
+ "@valbuild/core": "~0.91.1",
53
+ "@valbuild/react": "~0.91.1",
54
+ "@valbuild/server": "~0.91.1",
55
+ "@valbuild/shared": "~0.91.1",
56
+ "@valbuild/ui": "~0.91.1",
57
57
  "client-only": "^0.0.1",
58
58
  "server-only": "^0.0.1"
59
59
  },