@valbuild/shared 0.118.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
CHANGED
|
@@ -1,5 +1,51 @@
|
|
|
1
1
|
# @valbuild/shared
|
|
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
|
+
|
|
3
49
|
## 0.118.0
|
|
4
50
|
|
|
5
51
|
### Minor Changes
|
|
@@ -1123,25 +1123,24 @@ var SerializedImageSchema = zod.z.object({
|
|
|
1123
1123
|
});
|
|
1124
1124
|
var RichTextOptions = zod.z.lazy(function () {
|
|
1125
1125
|
return zod.z.object({
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
}).optional()
|
|
1126
|
+
// Set by `.maxLength()` / `.minLength()`, not by the options argument.
|
|
1127
|
+
// These z.objects strip unknown keys, so leaving them out drops the
|
|
1128
|
+
// length constraints in transit.
|
|
1129
|
+
maxLength: zod.z.number().optional(),
|
|
1130
|
+
minLength: zod.z.number().optional(),
|
|
1131
|
+
bold: zod.z["boolean"]().optional(),
|
|
1132
|
+
italic: zod.z["boolean"]().optional(),
|
|
1133
|
+
lineThrough: zod.z["boolean"]().optional(),
|
|
1134
|
+
h1: zod.z["boolean"]().optional(),
|
|
1135
|
+
h2: zod.z["boolean"]().optional(),
|
|
1136
|
+
h3: zod.z["boolean"]().optional(),
|
|
1137
|
+
h4: zod.z["boolean"]().optional(),
|
|
1138
|
+
h5: zod.z["boolean"]().optional(),
|
|
1139
|
+
h6: zod.z["boolean"]().optional(),
|
|
1140
|
+
ul: zod.z["boolean"]().optional(),
|
|
1141
|
+
ol: zod.z["boolean"]().optional(),
|
|
1142
|
+
a: zod.z.union([zod.z["boolean"](), SerializedRouteSchema, SerializedStringSchema]).optional(),
|
|
1143
|
+
img: zod.z.union([zod.z["boolean"](), SerializedImageSchema]).optional()
|
|
1145
1144
|
});
|
|
1146
1145
|
});
|
|
1147
1146
|
var SerializedRichTextSchema = zod.z.object({
|
|
@@ -3667,7 +3666,7 @@ function getInlineImgInfo(richtextSchema) {
|
|
|
3667
3666
|
if (richtextSchema.type !== "richtext") return {
|
|
3668
3667
|
kind: "not-allowed"
|
|
3669
3668
|
};
|
|
3670
|
-
var img = (_richtextSchema$optio = richtextSchema.options) === null || _richtextSchema$optio === void 0
|
|
3669
|
+
var img = (_richtextSchema$optio = richtextSchema.options) === null || _richtextSchema$optio === void 0 ? void 0 : _richtextSchema$optio.img;
|
|
3671
3670
|
if (!img) return {
|
|
3672
3671
|
kind: "not-allowed"
|
|
3673
3672
|
};
|
|
@@ -1123,25 +1123,24 @@ var SerializedImageSchema = zod.z.object({
|
|
|
1123
1123
|
});
|
|
1124
1124
|
var RichTextOptions = zod.z.lazy(function () {
|
|
1125
1125
|
return zod.z.object({
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
}).optional()
|
|
1126
|
+
// Set by `.maxLength()` / `.minLength()`, not by the options argument.
|
|
1127
|
+
// These z.objects strip unknown keys, so leaving them out drops the
|
|
1128
|
+
// length constraints in transit.
|
|
1129
|
+
maxLength: zod.z.number().optional(),
|
|
1130
|
+
minLength: zod.z.number().optional(),
|
|
1131
|
+
bold: zod.z["boolean"]().optional(),
|
|
1132
|
+
italic: zod.z["boolean"]().optional(),
|
|
1133
|
+
lineThrough: zod.z["boolean"]().optional(),
|
|
1134
|
+
h1: zod.z["boolean"]().optional(),
|
|
1135
|
+
h2: zod.z["boolean"]().optional(),
|
|
1136
|
+
h3: zod.z["boolean"]().optional(),
|
|
1137
|
+
h4: zod.z["boolean"]().optional(),
|
|
1138
|
+
h5: zod.z["boolean"]().optional(),
|
|
1139
|
+
h6: zod.z["boolean"]().optional(),
|
|
1140
|
+
ul: zod.z["boolean"]().optional(),
|
|
1141
|
+
ol: zod.z["boolean"]().optional(),
|
|
1142
|
+
a: zod.z.union([zod.z["boolean"](), SerializedRouteSchema, SerializedStringSchema]).optional(),
|
|
1143
|
+
img: zod.z.union([zod.z["boolean"](), SerializedImageSchema]).optional()
|
|
1145
1144
|
});
|
|
1146
1145
|
});
|
|
1147
1146
|
var SerializedRichTextSchema = zod.z.object({
|
|
@@ -3667,7 +3666,7 @@ function getInlineImgInfo(richtextSchema) {
|
|
|
3667
3666
|
if (richtextSchema.type !== "richtext") return {
|
|
3668
3667
|
kind: "not-allowed"
|
|
3669
3668
|
};
|
|
3670
|
-
var img = (_richtextSchema$optio = richtextSchema.options) === null || _richtextSchema$optio === void 0
|
|
3669
|
+
var img = (_richtextSchema$optio = richtextSchema.options) === null || _richtextSchema$optio === void 0 ? void 0 : _richtextSchema$optio.img;
|
|
3671
3670
|
if (!img) return {
|
|
3672
3671
|
kind: "not-allowed"
|
|
3673
3672
|
};
|
|
@@ -1119,25 +1119,24 @@ var SerializedImageSchema = z.object({
|
|
|
1119
1119
|
});
|
|
1120
1120
|
var RichTextOptions = z.lazy(function () {
|
|
1121
1121
|
return z.object({
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
}).optional()
|
|
1122
|
+
// Set by `.maxLength()` / `.minLength()`, not by the options argument.
|
|
1123
|
+
// These z.objects strip unknown keys, so leaving them out drops the
|
|
1124
|
+
// length constraints in transit.
|
|
1125
|
+
maxLength: z.number().optional(),
|
|
1126
|
+
minLength: z.number().optional(),
|
|
1127
|
+
bold: z["boolean"]().optional(),
|
|
1128
|
+
italic: z["boolean"]().optional(),
|
|
1129
|
+
lineThrough: z["boolean"]().optional(),
|
|
1130
|
+
h1: z["boolean"]().optional(),
|
|
1131
|
+
h2: z["boolean"]().optional(),
|
|
1132
|
+
h3: z["boolean"]().optional(),
|
|
1133
|
+
h4: z["boolean"]().optional(),
|
|
1134
|
+
h5: z["boolean"]().optional(),
|
|
1135
|
+
h6: z["boolean"]().optional(),
|
|
1136
|
+
ul: z["boolean"]().optional(),
|
|
1137
|
+
ol: z["boolean"]().optional(),
|
|
1138
|
+
a: z.union([z["boolean"](), SerializedRouteSchema, SerializedStringSchema]).optional(),
|
|
1139
|
+
img: z.union([z["boolean"](), SerializedImageSchema]).optional()
|
|
1141
1140
|
});
|
|
1142
1141
|
});
|
|
1143
1142
|
var SerializedRichTextSchema = z.object({
|
|
@@ -3663,7 +3662,7 @@ function getInlineImgInfo(richtextSchema) {
|
|
|
3663
3662
|
if (richtextSchema.type !== "richtext") return {
|
|
3664
3663
|
kind: "not-allowed"
|
|
3665
3664
|
};
|
|
3666
|
-
var img = (_richtextSchema$optio = richtextSchema.options) === null || _richtextSchema$optio === void 0
|
|
3665
|
+
var img = (_richtextSchema$optio = richtextSchema.options) === null || _richtextSchema$optio === void 0 ? void 0 : _richtextSchema$optio.img;
|
|
3667
3666
|
if (!img) return {
|
|
3668
3667
|
kind: "not-allowed"
|
|
3669
3668
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@valbuild/shared",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.120.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Val shared types and utilities",
|
|
6
6
|
"repository": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"zod": "^4.4.3",
|
|
33
33
|
"zod-validation-error": "^5.0.0",
|
|
34
|
-
"@valbuild/core": "0.
|
|
34
|
+
"@valbuild/core": "0.120.0"
|
|
35
35
|
},
|
|
36
36
|
"files": [
|
|
37
37
|
"CHANGELOG.md",
|