@valbuild/next 0.119.0 → 0.120.0
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.
- package/CHANGELOG.md +51 -0
- package/README.md +16 -24
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,56 @@
|
|
|
1
1
|
# @valbuild/next
|
|
2
2
|
|
|
3
|
+
## 0.120.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#589](https://github.com/valbuild/val/pull/589) [`c2d3c0e`](https://github.com/valbuild/val/commit/c2d3c0e6c2010c0a94c725d9dbaa618998773e8a) Thanks [@freekh](https://github.com/freekh)! - **Breaking:** `s.richtext()` options are flat.
|
|
8
|
+
|
|
9
|
+
The `style`, `block` and `inline` groups are gone — every option is a key of its
|
|
10
|
+
own. The names are unchanged, so updating a schema is only a matter of removing
|
|
11
|
+
the wrappers:
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
// before
|
|
15
|
+
s.richtext({
|
|
16
|
+
style: { bold: true, italic: true },
|
|
17
|
+
block: { h1: true, ul: true },
|
|
18
|
+
inline: { a: true, img: s.image() },
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
// after
|
|
22
|
+
s.richtext({
|
|
23
|
+
bold: true,
|
|
24
|
+
italic: true,
|
|
25
|
+
h1: true,
|
|
26
|
+
ul: true,
|
|
27
|
+
a: true,
|
|
28
|
+
img: s.image(),
|
|
29
|
+
});
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
The groups never carried any meaning the option names did not already have, and
|
|
33
|
+
they cost something real: an option name and its `ValRichText` theme key were
|
|
34
|
+
spelled differently (`block.h1` vs `theme.h1`), so the type that keeps a theme
|
|
35
|
+
exhaustive had to restate all thirteen options by hand. It is now a mapped type
|
|
36
|
+
over the options themselves — which also fixes an inconsistency in it: enabling
|
|
37
|
+
links with a schema (`a: s.route()`) rather than `a: true` now requires an `a`
|
|
38
|
+
key in the theme, the way `img` always has.
|
|
39
|
+
|
|
40
|
+
`ValRichText` themes were already flat and are unchanged. The serialized schema
|
|
41
|
+
that the server sends the Studio is flat too, so a project must not mix
|
|
42
|
+
`@valbuild/*` versions across this release.
|
|
43
|
+
|
|
44
|
+
### Patch Changes
|
|
45
|
+
|
|
46
|
+
- Updated dependencies [[`c2d3c0e`](https://github.com/valbuild/val/commit/c2d3c0e6c2010c0a94c725d9dbaa618998773e8a)]:
|
|
47
|
+
- @valbuild/core@0.120.0
|
|
48
|
+
- @valbuild/react@0.120.0
|
|
49
|
+
- @valbuild/shared@0.120.0
|
|
50
|
+
- @valbuild/ui@0.120.0
|
|
51
|
+
- @valbuild/language-server@0.120.0
|
|
52
|
+
- @valbuild/server@0.120.0
|
|
53
|
+
|
|
3
54
|
## 0.119.0
|
|
4
55
|
|
|
5
56
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -662,27 +662,21 @@ import { s, c } from "./val.config";
|
|
|
662
662
|
|
|
663
663
|
export const schema = s.richtext({
|
|
664
664
|
// styling
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
lineThrough: true, // enables line/strike-through
|
|
669
|
-
},
|
|
665
|
+
bold: true, // enables bold
|
|
666
|
+
italic: true, // enables italic text
|
|
667
|
+
lineThrough: true, // enables line/strike-through
|
|
670
668
|
// tags:
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
inline: {
|
|
683
|
-
//a: true, // enables links
|
|
684
|
-
//img: true, // enables images
|
|
685
|
-
},
|
|
669
|
+
//ul: true, // enables unordered lists
|
|
670
|
+
//ol: true, // enables ordered lists
|
|
671
|
+
// headings:
|
|
672
|
+
h1: true,
|
|
673
|
+
h2: true,
|
|
674
|
+
// h3: true,
|
|
675
|
+
// h4: true,
|
|
676
|
+
// h5: true,
|
|
677
|
+
// h6: true,
|
|
678
|
+
//a: true, // enables links
|
|
679
|
+
//img: true, // enables images
|
|
686
680
|
});
|
|
687
681
|
|
|
688
682
|
export default c.define("/src/app/content", schema, [
|
|
@@ -713,9 +707,7 @@ export default function Page() {
|
|
|
713
707
|
<main>
|
|
714
708
|
<ValRichText
|
|
715
709
|
theme={{
|
|
716
|
-
|
|
717
|
-
bold: "font-bold", // <- maps bold to a class. NOTE: tailwind classes are supported
|
|
718
|
-
},
|
|
710
|
+
bold: "font-bold", // <- maps bold to a class. NOTE: tailwind classes are supported
|
|
719
711
|
//
|
|
720
712
|
}}
|
|
721
713
|
content={content}
|
|
@@ -739,7 +731,7 @@ To add classes to `ValRichText` you can use the theme property:
|
|
|
739
731
|
/>
|
|
740
732
|
```
|
|
741
733
|
|
|
742
|
-
**NOTE**: if a theme is defined, you must define a mapping for every tag
|
|
734
|
+
**NOTE**: if a theme is defined, you must define a mapping for every tag you can get. What tags you have is decided based on the `options` defined on the `s.richtext()` schema. For example: `s.richtext({ bold: true })` requires that you add a `bold` theme.
|
|
743
735
|
|
|
744
736
|
```tsx
|
|
745
737
|
<ValRichText
|
package/package.json
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"next",
|
|
13
13
|
"react"
|
|
14
14
|
],
|
|
15
|
-
"version": "0.
|
|
15
|
+
"version": "0.120.0",
|
|
16
16
|
"main": "dist/valbuild-next.cjs.js",
|
|
17
17
|
"module": "dist/valbuild-next.esm.js",
|
|
18
18
|
"exports": {
|
|
@@ -47,12 +47,12 @@
|
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"client-only": "^0.0.1",
|
|
49
49
|
"server-only": "^0.0.1",
|
|
50
|
-
"@valbuild/core": "0.
|
|
51
|
-
"@valbuild/react": "0.
|
|
52
|
-
"@valbuild/server": "0.
|
|
53
|
-
"@valbuild/
|
|
54
|
-
"@valbuild/
|
|
55
|
-
"@valbuild/
|
|
50
|
+
"@valbuild/core": "0.120.0",
|
|
51
|
+
"@valbuild/react": "0.120.0",
|
|
52
|
+
"@valbuild/server": "0.120.0",
|
|
53
|
+
"@valbuild/shared": "0.120.0",
|
|
54
|
+
"@valbuild/language-server": "0.120.0",
|
|
55
|
+
"@valbuild/ui": "0.120.0"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@testing-library/react": "^16.3.3",
|