@madebywild/sanity-richtext-field 1.0.0 → 2.0.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/README.md +25 -0
- package/dist/blocks/media-grid-block.d.cts +4 -4
- package/dist/blocks/media-grid-block.d.ts +4 -4
- package/dist/blocks/media-only-block.d.cts +4 -4
- package/dist/blocks/media-only-block.d.ts +4 -4
- package/dist/blocks/media-slider-block.d.cts +4 -4
- package/dist/blocks/media-slider-block.d.ts +4 -4
- package/dist/blocks/quote-block.d.cts +4 -4
- package/dist/blocks/quote-block.d.ts +4 -4
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/parts.cjs +85 -64
- package/dist/parts.cjs.map +1 -1
- package/dist/parts.d.cts +52 -33
- package/dist/parts.d.ts +52 -33
- package/dist/parts.js +85 -64
- package/dist/parts.js.map +1 -1
- package/dist/utils.d.cts +4 -4
- package/dist/utils.d.ts +4 -4
- package/package.json +2 -2
- package/src/parts/annotations/color.tsx +46 -30
- package/src/parts/annotations/index.tsx +3 -3
- package/src/parts/index.tsx +2 -1
- package/src/parts/spans/icon.tsx +42 -27
- package/src/parts/spans/index.tsx +3 -3
package/README.md
CHANGED
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
createAnnotations,
|
|
21
21
|
createDecorators,
|
|
22
22
|
createLists,
|
|
23
|
+
createSpans,
|
|
23
24
|
createStyles,
|
|
24
25
|
} from "@madebywild/sanity-richtext-field/parts";
|
|
25
26
|
import { createBlock as quoteBlock } from "@madebywild/sanity-richtext-field/blocks/quote-block";
|
|
@@ -41,6 +42,7 @@ export default defineConfig({
|
|
|
41
42
|
plugins: [
|
|
42
43
|
wildSanityRichtextFieldPlugin({
|
|
43
44
|
blocks: [createBlock(customBlock), quoteBlock()],
|
|
45
|
+
spans: [...createSpans() /* Add your own */],
|
|
44
46
|
styles: [...createStyles() /* Add your own */],
|
|
45
47
|
lists: [...createLists() /* Add your own */],
|
|
46
48
|
decorators: [...createDecorators() /* Add your own */],
|
|
@@ -50,6 +52,29 @@ export default defineConfig({
|
|
|
50
52
|
});
|
|
51
53
|
```
|
|
52
54
|
|
|
55
|
+
```ts
|
|
56
|
+
// Override built-in annotation rendering (color/highlight)
|
|
57
|
+
wildSanityRichtextFieldPlugin({
|
|
58
|
+
annotations: [
|
|
59
|
+
...createAnnotations({
|
|
60
|
+
textColor: {
|
|
61
|
+
renderValue: (value) => getColor(value)?.cssVar,
|
|
62
|
+
},
|
|
63
|
+
highlightColor: {
|
|
64
|
+
renderValue: (value) => getColor(value)?.cssVar,
|
|
65
|
+
},
|
|
66
|
+
}),
|
|
67
|
+
],
|
|
68
|
+
spans: [
|
|
69
|
+
...createSpans({
|
|
70
|
+
icon: {
|
|
71
|
+
renderValuePreview: (value) => <Icon name={value as IconName} />,
|
|
72
|
+
},
|
|
73
|
+
}),
|
|
74
|
+
],
|
|
75
|
+
});
|
|
76
|
+
```
|
|
77
|
+
|
|
53
78
|
## Use in Schema
|
|
54
79
|
|
|
55
80
|
```ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as sanity69 from "sanity";
|
|
2
2
|
import { ObjectDefinition } from "sanity";
|
|
3
3
|
import { FieldOptions } from "@madebywild/sanity-media-field";
|
|
4
4
|
type Options = Omit<Partial<ObjectDefinition>, "type"> & {
|
|
@@ -16,9 +16,9 @@ declare function createBlock({
|
|
|
16
16
|
}?: Options): {
|
|
17
17
|
type: "object";
|
|
18
18
|
name?: string | undefined;
|
|
19
|
-
} & Omit<
|
|
20
|
-
preview?:
|
|
19
|
+
} & Omit<sanity69.ArrayOfEntry<ObjectDefinition>, "preview"> & {
|
|
20
|
+
preview?: sanity69.PreviewConfig<{
|
|
21
21
|
[x: string]: string;
|
|
22
22
|
}, Record<string, string>> | undefined;
|
|
23
|
-
} &
|
|
23
|
+
} & sanity69.WidenValidation & sanity69.WidenInitialValue;
|
|
24
24
|
export { createBlock };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as sanity73 from "sanity";
|
|
2
2
|
import { ObjectDefinition } from "sanity";
|
|
3
3
|
import { FieldOptions } from "@madebywild/sanity-media-field";
|
|
4
4
|
type Options = Omit<Partial<ObjectDefinition>, "type"> & {
|
|
@@ -16,9 +16,9 @@ declare function createBlock({
|
|
|
16
16
|
}?: Options): {
|
|
17
17
|
type: "object";
|
|
18
18
|
name?: string | undefined;
|
|
19
|
-
} & Omit<
|
|
20
|
-
preview?:
|
|
19
|
+
} & Omit<sanity73.ArrayOfEntry<ObjectDefinition>, "preview"> & {
|
|
20
|
+
preview?: sanity73.PreviewConfig<{
|
|
21
21
|
[x: string]: string;
|
|
22
22
|
}, Record<string, string>> | undefined;
|
|
23
|
-
} &
|
|
23
|
+
} & sanity73.WidenValidation & sanity73.WidenInitialValue;
|
|
24
24
|
export { createBlock };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as sanity60 from "sanity";
|
|
2
2
|
import { ObjectDefinition } from "sanity";
|
|
3
3
|
import { FieldOptions } from "@madebywild/sanity-media-field";
|
|
4
4
|
type Options = Omit<Partial<ObjectDefinition>, "type"> & {
|
|
@@ -16,9 +16,9 @@ declare function createBlock({
|
|
|
16
16
|
}?: Options): {
|
|
17
17
|
type: "object";
|
|
18
18
|
name?: string | undefined;
|
|
19
|
-
} & Omit<
|
|
20
|
-
preview?:
|
|
19
|
+
} & Omit<sanity60.ArrayOfEntry<ObjectDefinition>, "preview"> & {
|
|
20
|
+
preview?: sanity60.PreviewConfig<{
|
|
21
21
|
[x: string]: string;
|
|
22
22
|
}, Record<string, string>> | undefined;
|
|
23
|
-
} &
|
|
23
|
+
} & sanity60.WidenValidation & sanity60.WidenInitialValue;
|
|
24
24
|
export { createBlock };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as sanity69 from "sanity";
|
|
2
2
|
import { ObjectDefinition } from "sanity";
|
|
3
3
|
import { FieldOptions } from "@madebywild/sanity-media-field";
|
|
4
4
|
type Options = Omit<Partial<ObjectDefinition>, "type"> & {
|
|
@@ -16,9 +16,9 @@ declare function createBlock({
|
|
|
16
16
|
}?: Options): {
|
|
17
17
|
type: "object";
|
|
18
18
|
name?: string | undefined;
|
|
19
|
-
} & Omit<
|
|
20
|
-
preview?:
|
|
19
|
+
} & Omit<sanity69.ArrayOfEntry<ObjectDefinition>, "preview"> & {
|
|
20
|
+
preview?: sanity69.PreviewConfig<{
|
|
21
21
|
[x: string]: string;
|
|
22
22
|
}, Record<string, string>> | undefined;
|
|
23
|
-
} &
|
|
23
|
+
} & sanity69.WidenValidation & sanity69.WidenInitialValue;
|
|
24
24
|
export { createBlock };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as sanity73 from "sanity";
|
|
2
2
|
import { ObjectDefinition } from "sanity";
|
|
3
3
|
import { FieldOptions } from "@madebywild/sanity-media-field";
|
|
4
4
|
type Options = Omit<Partial<ObjectDefinition>, "type"> & {
|
|
@@ -16,9 +16,9 @@ declare function createBlock({
|
|
|
16
16
|
}?: Options): {
|
|
17
17
|
type: "object";
|
|
18
18
|
name?: string | undefined;
|
|
19
|
-
} & Omit<
|
|
20
|
-
preview?:
|
|
19
|
+
} & Omit<sanity73.ArrayOfEntry<ObjectDefinition>, "preview"> & {
|
|
20
|
+
preview?: sanity73.PreviewConfig<{
|
|
21
21
|
[x: string]: string;
|
|
22
22
|
}, Record<string, string>> | undefined;
|
|
23
|
-
} &
|
|
23
|
+
} & sanity73.WidenValidation & sanity73.WidenInitialValue;
|
|
24
24
|
export { createBlock };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as sanity61 from "sanity";
|
|
2
2
|
import { ObjectDefinition } from "sanity";
|
|
3
3
|
import { FieldOptions } from "@madebywild/sanity-media-field";
|
|
4
4
|
type Options = Omit<Partial<ObjectDefinition>, "type"> & {
|
|
@@ -16,9 +16,9 @@ declare function createBlock({
|
|
|
16
16
|
}?: Options): {
|
|
17
17
|
type: "object";
|
|
18
18
|
name?: string | undefined;
|
|
19
|
-
} & Omit<
|
|
20
|
-
preview?:
|
|
19
|
+
} & Omit<sanity61.ArrayOfEntry<ObjectDefinition>, "preview"> & {
|
|
20
|
+
preview?: sanity61.PreviewConfig<{
|
|
21
21
|
[x: string]: string;
|
|
22
22
|
}, Record<string, string>> | undefined;
|
|
23
|
-
} &
|
|
23
|
+
} & sanity61.WidenValidation & sanity61.WidenInitialValue;
|
|
24
24
|
export { createBlock };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as sanity64 from "sanity";
|
|
2
2
|
import { ObjectDefinition } from "sanity";
|
|
3
3
|
type Options = Omit<Partial<ObjectDefinition>, "type">;
|
|
4
4
|
/** @public */
|
|
@@ -9,9 +9,9 @@ declare function createBlock({
|
|
|
9
9
|
}?: Options): {
|
|
10
10
|
type: "object";
|
|
11
11
|
name?: string | undefined;
|
|
12
|
-
} & Omit<
|
|
13
|
-
preview?:
|
|
12
|
+
} & Omit<sanity64.ArrayOfEntry<ObjectDefinition>, "preview"> & {
|
|
13
|
+
preview?: sanity64.PreviewConfig<{
|
|
14
14
|
[x: string]: string;
|
|
15
15
|
}, Record<string, string>> | undefined;
|
|
16
|
-
} &
|
|
16
|
+
} & sanity64.WidenValidation & sanity64.WidenInitialValue;
|
|
17
17
|
export { createBlock };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as sanity65 from "sanity";
|
|
2
2
|
import { ObjectDefinition } from "sanity";
|
|
3
3
|
type Options = Omit<Partial<ObjectDefinition>, "type">;
|
|
4
4
|
/** @public */
|
|
@@ -9,9 +9,9 @@ declare function createBlock({
|
|
|
9
9
|
}?: Options): {
|
|
10
10
|
type: "object";
|
|
11
11
|
name?: string | undefined;
|
|
12
|
-
} & Omit<
|
|
13
|
-
preview?:
|
|
12
|
+
} & Omit<sanity65.ArrayOfEntry<ObjectDefinition>, "preview"> & {
|
|
13
|
+
preview?: sanity65.PreviewConfig<{
|
|
14
14
|
[x: string]: string;
|
|
15
15
|
}, Record<string, string>> | undefined;
|
|
16
|
-
} &
|
|
16
|
+
} & sanity65.WidenValidation & sanity65.WidenInitialValue;
|
|
17
17
|
export { createBlock };
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as sanity68 from "sanity";
|
|
2
2
|
import { ArrayDefinition, ArrayOfType, ArrayOptions, BlockDecoratorDefinition, BlockListDefinition, BlockStyleDefinition } from "sanity";
|
|
3
3
|
/** @public */
|
|
4
4
|
declare const typeName: "wild.richtext";
|
|
@@ -86,5 +86,5 @@ declare module "sanity" {
|
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
/** @public */
|
|
89
|
-
declare const wildSanityRichtextFieldPlugin:
|
|
89
|
+
declare const wildSanityRichtextFieldPlugin: sanity68.Plugin<PluginConfig>;
|
|
90
90
|
export { type FieldOptions, type PluginConfig, typeName, wildSanityRichtextFieldPlugin };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as sanity60 from "sanity";
|
|
2
2
|
import { ArrayDefinition, ArrayOfType, ArrayOptions, BlockDecoratorDefinition, BlockListDefinition, BlockStyleDefinition } from "sanity";
|
|
3
3
|
/** @public */
|
|
4
4
|
declare const typeName: "wild.richtext";
|
|
@@ -86,5 +86,5 @@ declare module "sanity" {
|
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
/** @public */
|
|
89
|
-
declare const wildSanityRichtextFieldPlugin:
|
|
89
|
+
declare const wildSanityRichtextFieldPlugin: sanity60.Plugin<PluginConfig>;
|
|
90
90
|
export { type FieldOptions, type PluginConfig, typeName, wildSanityRichtextFieldPlugin };
|
package/dist/parts.cjs
CHANGED
|
@@ -22,48 +22,61 @@ const ColorText = styledComponents.styled.span`
|
|
|
22
22
|
background-color: inherit;
|
|
23
23
|
border-bottom: unset;
|
|
24
24
|
color: ${({
|
|
25
|
-
color = "inherit"
|
|
26
|
-
}) => color};
|
|
25
|
+
$color = "inherit"
|
|
26
|
+
}) => $color};
|
|
27
27
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
type: "
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
28
|
+
`;
|
|
29
|
+
function defaultResolveColor(value) {
|
|
30
|
+
return value;
|
|
31
|
+
}
|
|
32
|
+
function createTextColorAnnotation(options) {
|
|
33
|
+
const renderValue = options?.renderValue ?? defaultResolveColor;
|
|
34
|
+
return sanity.defineField({
|
|
35
|
+
type: "object",
|
|
36
|
+
name: `${types.typeName}.annotation.textColor`,
|
|
37
|
+
title: "Text Color",
|
|
38
|
+
icon: icons.ColorWheelIcon,
|
|
39
|
+
fields: [sanity.defineField({
|
|
40
|
+
name: "color",
|
|
41
|
+
type: "wild.color"
|
|
42
|
+
})],
|
|
43
|
+
components: {
|
|
44
|
+
annotation: (props) => {
|
|
45
|
+
const value = renderValue(props.value?.color);
|
|
46
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ColorText, { $color: value, children: props.renderDefault(props) });
|
|
47
|
+
}
|
|
41
48
|
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
const ColorBg = styledComponents.styled.span`
|
|
44
52
|
& > span {
|
|
45
53
|
background-color: ${({
|
|
46
|
-
color = "inherit"
|
|
47
|
-
}) => color};
|
|
54
|
+
$color = "inherit"
|
|
55
|
+
}) => $color};
|
|
48
56
|
border-bottom: unset;
|
|
49
57
|
color: inherit;
|
|
50
58
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
59
|
+
`;
|
|
60
|
+
function createHighlightColorAnnotation(options) {
|
|
61
|
+
const renderValue = options?.renderValue ?? defaultResolveColor;
|
|
62
|
+
return sanity.defineField({
|
|
63
|
+
type: "object",
|
|
64
|
+
name: `${types.typeName}.annotation.highlightColor`,
|
|
65
|
+
title: "Highlight Color",
|
|
66
|
+
icon: icons.HighlightIcon,
|
|
67
|
+
fields: [sanity.defineField({
|
|
68
|
+
name: "color",
|
|
69
|
+
type: "wild.color"
|
|
70
|
+
})],
|
|
71
|
+
components: {
|
|
72
|
+
annotation: (props) => {
|
|
73
|
+
const value = renderValue(props.value?.color);
|
|
74
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ColorBg, { $color: value, children: props.renderDefault(props) });
|
|
75
|
+
}
|
|
64
76
|
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
const link = sanity.defineField({
|
|
67
80
|
type: "wild.link",
|
|
68
81
|
name: `${types.typeName}.annotation.link`,
|
|
69
82
|
title: "Link",
|
|
@@ -73,8 +86,8 @@ const ColorText = styledComponents.styled.span`
|
|
|
73
86
|
collapsible: !1
|
|
74
87
|
}
|
|
75
88
|
});
|
|
76
|
-
function createAnnotations() {
|
|
77
|
-
return [link, textColor, highlightColor];
|
|
89
|
+
function createAnnotations(options) {
|
|
90
|
+
return [link, createTextColorAnnotation(options?.textColor), createHighlightColorAnnotation(options?.highlightColor)];
|
|
78
91
|
}
|
|
79
92
|
const strong = {
|
|
80
93
|
title: "Strong",
|
|
@@ -122,34 +135,41 @@ const bullet = {
|
|
|
122
135
|
function createLists() {
|
|
123
136
|
return [bullet, number];
|
|
124
137
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
138
|
+
function defaultRenderIconPreview(value) {
|
|
139
|
+
return React__namespace.isValidElement(value) ? value : /* @__PURE__ */ jsxRuntime.jsx("span", { role: "img", className: "inline-block size-[1em] shrink-0 text-current", title: typeof value == "string" ? value : "Icon", children: "\u{1F9FF}" });
|
|
140
|
+
}
|
|
141
|
+
function createIconSpan(options) {
|
|
142
|
+
const renderValuePreview = options?.renderValuePreview;
|
|
143
|
+
return sanity.defineArrayMember({
|
|
144
|
+
name: `${types.typeName}.span.icon`,
|
|
145
|
+
type: "object",
|
|
146
|
+
title: "Icon",
|
|
147
|
+
description: "Insert an icon.",
|
|
148
|
+
icon: () => /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: "\u{1F9FF}" }),
|
|
149
|
+
fields: [sanity.defineField({
|
|
150
|
+
name: "icon",
|
|
151
|
+
type: "wild.icon"
|
|
152
|
+
})],
|
|
153
|
+
components: {
|
|
154
|
+
// This is the inline-preview in the PortableText editor.
|
|
155
|
+
// It gets its props from the prepare function below.
|
|
156
|
+
preview: (props) => React__namespace.isValidElement(props.media) ? props.media : props.fallbackTitle
|
|
143
157
|
},
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
158
|
+
preview: {
|
|
159
|
+
select: {
|
|
160
|
+
icon: "icon"
|
|
161
|
+
},
|
|
162
|
+
prepare({
|
|
163
|
+
icon
|
|
164
|
+
}) {
|
|
165
|
+
return {
|
|
166
|
+
media: renderValuePreview?.(icon) ?? defaultRenderIconPreview(icon)
|
|
167
|
+
};
|
|
168
|
+
}
|
|
150
169
|
}
|
|
151
|
-
}
|
|
152
|
-
}
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
const media = sanity.defineArrayMember({
|
|
153
173
|
name: `${types.typeName}.span.media`,
|
|
154
174
|
type: "object",
|
|
155
175
|
title: "Inline Media",
|
|
@@ -176,8 +196,8 @@ const icon = sanity.defineArrayMember({
|
|
|
176
196
|
}
|
|
177
197
|
}
|
|
178
198
|
});
|
|
179
|
-
function createSpans() {
|
|
180
|
-
return [icon, media];
|
|
199
|
+
function createSpans(options) {
|
|
200
|
+
return [createIconSpan(options?.icon), media];
|
|
181
201
|
}
|
|
182
202
|
const h2 = {
|
|
183
203
|
title: "Heading 2",
|
|
@@ -215,6 +235,7 @@ function createStyles() {
|
|
|
215
235
|
}
|
|
216
236
|
exports.createAnnotations = createAnnotations;
|
|
217
237
|
exports.createDecorators = createDecorators;
|
|
238
|
+
exports.createIconSpan = createIconSpan;
|
|
218
239
|
exports.createLists = createLists;
|
|
219
240
|
exports.createSpans = createSpans;
|
|
220
241
|
exports.createStyles = createStyles;
|
package/dist/parts.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parts.cjs","sources":["../src/parts/annotations/color.tsx","../src/parts/annotations/link.tsx","../src/parts/annotations/index.tsx","../src/parts/decorators/index.tsx","../src/parts/lists/index.tsx","../src/parts/spans/icon.tsx","../src/parts/spans/media.tsx","../src/parts/spans/index.tsx","../src/parts/styles/index.tsx"],"sourcesContent":["import { ColorWheelIcon, HighlightIcon } from \"@sanity/icons\";\nimport { defineField } from \"sanity\";\nimport { styled } from \"styled-components\";\nimport { typeName } from \"../../types\";\n\nconst ColorText = styled.span<{ color?: string }>`\n & > span {\n background-color: inherit;\n border-bottom: unset;\n color: ${({ color = \"inherit\" }) => color};\n }\n`;\n\nexport const textColor = defineField({\n type: \"object\",\n name: `${typeName}.annotation.textColor`,\n title: \"Text Color\",\n icon: ColorWheelIcon,\n fields: [defineField({ name: \"color\", type: \"wild.color\" })],\n components: {\n annotation: (props) => {\n // @ts-expect-error: Sanity types are not aware of the color field structure.\n const color = props.value?.color?.value as string;\n return <ColorText color={color}>{props.renderDefault(props)}</ColorText>;\n },\n },\n});\n\nconst ColorBg = styled.span<{ color?: string }>`\n & > span {\n background-color: ${({ color = \"inherit\" }) => color};\n border-bottom: unset;\n color: inherit;\n }\n`;\n\nexport const highlightColor = defineField({\n type: \"object\",\n name: `${typeName}.annotation.highlightColor`,\n title: \"Highlight Color\",\n icon: HighlightIcon,\n fields: [defineField({ name: \"color\", type: \"wild.color\" })],\n components: {\n annotation: (props) => {\n // @ts-expect-error: Sanity types are not aware of the color field structure.\n const color = props.value?.color?.value as string;\n return <ColorBg color={color}>{props.renderDefault(props)}</ColorBg>;\n },\n },\n});\n","import { LinkIcon } from \"@sanity/icons\";\nimport { defineField } from \"sanity\";\nimport { typeName } from \"../../types\";\n\nexport const link = defineField({\n type: \"wild.link\",\n name: `${typeName}.annotation.link`,\n title: \"Link\",\n icon: LinkIcon,\n options: {\n collapsed: false,\n collapsible: false,\n },\n});\n","import { highlightColor, textColor } from \"./color\";\nimport { link } from \"./link\";\n\n/** @public */\nfunction createAnnotations() {\n return [link, textColor, highlightColor] as const;\n}\n\nexport { createAnnotations };\n","import { BoldIcon, CodeIcon, ItalicIcon } from \"@sanity/icons\";\nimport type { BlockDecoratorDefinition } from \"sanity\";\nimport { typeName } from \"../../types\";\n\nconst strong = {\n title: \"Strong\",\n value: `${typeName}.decorator.strong`,\n icon: BoldIcon,\n component: ({ children }) => <strong>{children}</strong>,\n} as const satisfies BlockDecoratorDefinition;\n\nconst em = {\n title: \"Emphasis\",\n value: `${typeName}.decorator.em`,\n icon: ItalicIcon,\n component: ({ children }) => <em>{children}</em>,\n} as const satisfies BlockDecoratorDefinition;\n\nconst code = {\n title: \"Code\",\n value: `${typeName}.decorator.code`,\n icon: CodeIcon,\n component: ({ children }) => <code>{children}</code>,\n} as const satisfies BlockDecoratorDefinition;\n\nconst sup = {\n title: \"Sup\",\n value: `${typeName}.decorator.sup`,\n icon: () => <sup>[1]</sup>,\n component: ({ children }) => <sup style={{ verticalAlign: \"super\" }}>{children}</sup>,\n} as const satisfies BlockDecoratorDefinition;\n\n/** @public */\nfunction createDecorators() {\n return [strong, em, code, sup] as const;\n}\n\nexport { createDecorators };\n","import { OlistIcon, UlistIcon } from \"@sanity/icons\";\nimport type { BlockListDefinition } from \"sanity\";\nimport { typeName } from \"../../types\";\n\nconst bullet = {\n title: \"Bullet\",\n value: `${typeName}.list.bullet`,\n icon: UlistIcon,\n} as const satisfies BlockListDefinition;\n\nconst number = {\n title: \"Number\",\n value: `${typeName}.list.number`,\n icon: OlistIcon,\n} as const satisfies BlockListDefinition;\n\n/** @public */\nfunction createLists() {\n return [bullet, number] as const;\n}\n\nexport { createLists };\n","import * as React from \"react\";\nimport { defineArrayMember, defineField } from \"sanity\";\nimport { typeName } from \"../../types\";\n\nexport const icon = defineArrayMember({\n name: `${typeName}.span.icon`,\n type: \"object\",\n title: \"Icon\",\n description: \"Insert an icon.\",\n icon: () => <>🧿</>,\n fields: [defineField({ name: \"icon\", type: \"wild.icon\" })],\n components: {\n // This is the inline-preview in the PortableText editor.\n // It gets its props from the prepare function below.\n preview: (props) => {\n return React.isValidElement(props.media) ? props.media : props.fallbackTitle;\n },\n },\n preview: {\n select: {\n icon: \"icon\",\n },\n prepare({ icon }) {\n return {\n media: (\n <span role=\"img\" className=\"inline-block size-[1em] shrink-0 text-current\" title={icon ?? \"Icon\"}>\n 🧿\n </span>\n ),\n };\n },\n },\n});\n","import { defineArrayMember, defineField } from \"sanity\";\nimport { typeName } from \"../../types\";\n\nexport const media = defineArrayMember({\n name: `${typeName}.span.media`,\n type: \"object\",\n title: \"Inline Media\",\n description: \"Embed inline video or image content.\",\n icon: () => <>🫧</>,\n fields: [\n defineField({\n name: \"media\",\n type: \"wild.media\",\n options: {\n inline: true,\n },\n }),\n ],\n components: {\n // This is the inline-preview in the PortableText editor.\n preview: (props) => {\n const icons = {\n video: <>🎥</>,\n image: <>🖼️</>,\n motion: <>🌀</>,\n };\n\n // @ts-expect-error: It gets its props from the prepare function below.\n return icons[props.kind as keyof typeof icons] || <>🖼️</>;\n },\n },\n preview: {\n select: {\n kind: \"media.kind\",\n },\n },\n});\n","import { icon } from \"./icon\";\nimport { media } from \"./media\";\n\n/** @public */\nfunction createSpans() {\n return [icon, media] as const;\n}\n\nexport { createSpans };\n","import type { BlockStyleDefinition } from \"sanity\";\nimport { typeName } from \"../../types\";\n\nconst h2 = {\n title: \"Heading 2\",\n value: `${typeName}.style.h2`,\n component: ({ children }) => (\n <h2\n style={{\n fontSize: \"2.0625rem\",\n fontWeight: \"700\",\n lineHeight: \"calc(41 / 33)\",\n }}\n >\n {children}\n </h2>\n ),\n} as const satisfies BlockStyleDefinition;\n\nconst h3 = {\n title: \"Heading 3\",\n value: `${typeName}.style.h3`,\n component: ({ children }) => (\n <h3\n style={{\n fontSize: \"1.6875rem\",\n fontWeight: \"700\",\n lineHeight: \"calc(35 / 27)\",\n }}\n >\n {children}\n </h3>\n ),\n} as const satisfies BlockStyleDefinition;\n\nconst h4 = {\n title: \"Heading 4\",\n value: `${typeName}.style.h4`,\n component: ({ children }) => (\n <h4\n style={{\n fontSize: \"1.3125rem\",\n fontWeight: \"700\",\n lineHeight: \"calc(29 / 21)\",\n }}\n >\n {children}\n </h4>\n ),\n} as const satisfies BlockStyleDefinition;\n\n/** @public */\nfunction createStyles() {\n return [h2, h3, h4] as const;\n}\n\nexport { createStyles };\n"],"names":["ColorText","styled","span","color","textColor","defineField","type","name","typeName","title","icon","ColorWheelIcon","fields","components","annotation","props","value","renderDefault","ColorBg","highlightColor","HighlightIcon","link","LinkIcon","options","collapsed","collapsible","createAnnotations","strong","BoldIcon","component","children","jsx","em","ItalicIcon","code","CodeIcon","sup","verticalAlign","createDecorators","bullet","UlistIcon","number","OlistIcon","createLists","defineArrayMember","description","Fragment","preview","React","isValidElement","media","fallbackTitle","select","prepare","inline","video","image","motion","kind","createSpans","h2","fontSize","fontWeight","lineHeight","h3","h4","createStyles"],"mappings":";;;;;;;;;;;;;;;;;;;AA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IACL8B,UAAU;AAAA,IACVC,YAAY;AAAA,IACZC,YAAY;AAAA,EAAA,GAGbjC,SAAAA,CACH;AAEJ;AAGA,SAASoC,eAAe;AACtB,SAAO,CAACN,IAAII,IAAIC,EAAE;AACpB;;;;;;"}
|
|
1
|
+
{"version":3,"file":"parts.cjs","sources":["../src/parts/annotations/color.tsx","../src/parts/annotations/link.tsx","../src/parts/annotations/index.tsx","../src/parts/decorators/index.tsx","../src/parts/lists/index.tsx","../src/parts/spans/icon.tsx","../src/parts/spans/media.tsx","../src/parts/spans/index.tsx","../src/parts/styles/index.tsx"],"sourcesContent":["import { ColorWheelIcon, HighlightIcon } from \"@sanity/icons\";\nimport { defineField } from \"sanity\";\nimport { styled } from \"styled-components\";\nimport { typeName } from \"../../types\";\n\ntype ColorAnnotationOptions = {\n renderValue?: (value: string | undefined) => string | undefined;\n};\n\nconst ColorText = styled.span<{ $color?: string }>`\n & > span {\n background-color: inherit;\n border-bottom: unset;\n color: ${({ $color = \"inherit\" }) => $color};\n }\n`;\n\nfunction defaultResolveColor(value: string | undefined) {\n return value;\n}\n\nfunction createTextColorAnnotation(options?: ColorAnnotationOptions) {\n const renderValue = options?.renderValue ?? defaultResolveColor;\n\n return defineField({\n type: \"object\",\n name: `${typeName}.annotation.textColor`,\n title: \"Text Color\",\n icon: ColorWheelIcon,\n fields: [defineField({ name: \"color\", type: \"wild.color\" })],\n components: {\n annotation: (props) => {\n const value = renderValue(props.value?.color);\n return <ColorText $color={value}>{props.renderDefault(props)}</ColorText>;\n },\n },\n });\n}\n\nconst ColorBg = styled.span<{ $color?: string }>`\n & > span {\n background-color: ${({ $color = \"inherit\" }) => $color};\n border-bottom: unset;\n color: inherit;\n }\n`;\n\nfunction createHighlightColorAnnotation(options?: ColorAnnotationOptions) {\n const renderValue = options?.renderValue ?? defaultResolveColor;\n\n return defineField({\n type: \"object\",\n name: `${typeName}.annotation.highlightColor`,\n title: \"Highlight Color\",\n icon: HighlightIcon,\n fields: [defineField({ name: \"color\", type: \"wild.color\" })],\n components: {\n annotation: (props) => {\n const value = renderValue(props.value?.color);\n return <ColorBg $color={value}>{props.renderDefault(props)}</ColorBg>;\n },\n },\n });\n}\n\nexport { createTextColorAnnotation, createHighlightColorAnnotation, type ColorAnnotationOptions };\n","import { LinkIcon } from \"@sanity/icons\";\nimport { defineField } from \"sanity\";\nimport { typeName } from \"../../types\";\n\nexport const link = defineField({\n type: \"wild.link\",\n name: `${typeName}.annotation.link`,\n title: \"Link\",\n icon: LinkIcon,\n options: {\n collapsed: false,\n collapsible: false,\n },\n});\n","import { type ColorAnnotationOptions, createHighlightColorAnnotation, createTextColorAnnotation } from \"./color\";\nimport { link } from \"./link\";\n\n/** @public */\nfunction createAnnotations(options?: { textColor?: ColorAnnotationOptions; highlightColor?: ColorAnnotationOptions }) {\n return [link, createTextColorAnnotation(options?.textColor), createHighlightColorAnnotation(options?.highlightColor)] as const;\n}\n\nexport { createAnnotations };\n","import { BoldIcon, CodeIcon, ItalicIcon } from \"@sanity/icons\";\nimport type { BlockDecoratorDefinition } from \"sanity\";\nimport { typeName } from \"../../types\";\n\nconst strong = {\n title: \"Strong\",\n value: `${typeName}.decorator.strong`,\n icon: BoldIcon,\n component: ({ children }) => <strong>{children}</strong>,\n} as const satisfies BlockDecoratorDefinition;\n\nconst em = {\n title: \"Emphasis\",\n value: `${typeName}.decorator.em`,\n icon: ItalicIcon,\n component: ({ children }) => <em>{children}</em>,\n} as const satisfies BlockDecoratorDefinition;\n\nconst code = {\n title: \"Code\",\n value: `${typeName}.decorator.code`,\n icon: CodeIcon,\n component: ({ children }) => <code>{children}</code>,\n} as const satisfies BlockDecoratorDefinition;\n\nconst sup = {\n title: \"Sup\",\n value: `${typeName}.decorator.sup`,\n icon: () => <sup>[1]</sup>,\n component: ({ children }) => <sup style={{ verticalAlign: \"super\" }}>{children}</sup>,\n} as const satisfies BlockDecoratorDefinition;\n\n/** @public */\nfunction createDecorators() {\n return [strong, em, code, sup] as const;\n}\n\nexport { createDecorators };\n","import { OlistIcon, UlistIcon } from \"@sanity/icons\";\nimport type { BlockListDefinition } from \"sanity\";\nimport { typeName } from \"../../types\";\n\nconst bullet = {\n title: \"Bullet\",\n value: `${typeName}.list.bullet`,\n icon: UlistIcon,\n} as const satisfies BlockListDefinition;\n\nconst number = {\n title: \"Number\",\n value: `${typeName}.list.number`,\n icon: OlistIcon,\n} as const satisfies BlockListDefinition;\n\n/** @public */\nfunction createLists() {\n return [bullet, number] as const;\n}\n\nexport { createLists };\n","import * as React from \"react\";\nimport { defineArrayMember, defineField } from \"sanity\";\nimport { typeName } from \"../../types\";\n\ntype IconSpanOptions = {\n renderValuePreview?: (value?: string) => React.ReactNode;\n};\n\nfunction defaultRenderIconPreview(value?: React.ReactNode) {\n if (React.isValidElement(value)) return value;\n return (\n <span role=\"img\" className=\"inline-block size-[1em] shrink-0 text-current\" title={typeof value === \"string\" ? value : \"Icon\"}>\n 🧿\n </span>\n );\n}\n\nfunction createIconSpan(options?: IconSpanOptions) {\n const renderValuePreview = options?.renderValuePreview;\n\n return defineArrayMember({\n name: `${typeName}.span.icon`,\n type: \"object\",\n title: \"Icon\",\n description: \"Insert an icon.\",\n icon: () => <>🧿</>,\n fields: [defineField({ name: \"icon\", type: \"wild.icon\" })],\n components: {\n // This is the inline-preview in the PortableText editor.\n // It gets its props from the prepare function below.\n preview: (props) => {\n return React.isValidElement(props.media) ? props.media : props.fallbackTitle;\n },\n },\n preview: {\n select: {\n icon: \"icon\",\n },\n prepare({ icon }) {\n return {\n media: renderValuePreview?.(icon) ?? defaultRenderIconPreview(icon),\n };\n },\n },\n });\n}\n\nexport { createIconSpan, type IconSpanOptions };\n","import { defineArrayMember, defineField } from \"sanity\";\nimport { typeName } from \"../../types\";\n\nexport const media = defineArrayMember({\n name: `${typeName}.span.media`,\n type: \"object\",\n title: \"Inline Media\",\n description: \"Embed inline video or image content.\",\n icon: () => <>🫧</>,\n fields: [\n defineField({\n name: \"media\",\n type: \"wild.media\",\n options: {\n inline: true,\n },\n }),\n ],\n components: {\n // This is the inline-preview in the PortableText editor.\n preview: (props) => {\n const icons = {\n video: <>🎥</>,\n image: <>🖼️</>,\n motion: <>🌀</>,\n };\n\n // @ts-expect-error: It gets its props from the prepare function below.\n return icons[props.kind as keyof typeof icons] || <>🖼️</>;\n },\n },\n preview: {\n select: {\n kind: \"media.kind\",\n },\n },\n});\n","import { createIconSpan, type IconSpanOptions } from \"./icon\";\nimport { media } from \"./media\";\n\n/** @public */\nfunction createSpans(options?: { icon?: IconSpanOptions }) {\n return [createIconSpan(options?.icon), media] as const;\n}\n\nexport { createSpans };\n","import type { BlockStyleDefinition } from \"sanity\";\nimport { typeName } from \"../../types\";\n\nconst h2 = {\n title: \"Heading 2\",\n value: `${typeName}.style.h2`,\n component: ({ children }) => (\n <h2\n style={{\n fontSize: \"2.0625rem\",\n fontWeight: \"700\",\n lineHeight: \"calc(41 / 33)\",\n }}\n >\n {children}\n </h2>\n ),\n} as const satisfies BlockStyleDefinition;\n\nconst h3 = {\n title: \"Heading 3\",\n value: `${typeName}.style.h3`,\n component: ({ children }) => (\n <h3\n style={{\n fontSize: \"1.6875rem\",\n fontWeight: \"700\",\n lineHeight: \"calc(35 / 27)\",\n }}\n >\n {children}\n </h3>\n ),\n} as const satisfies BlockStyleDefinition;\n\nconst h4 = {\n title: \"Heading 4\",\n value: `${typeName}.style.h4`,\n component: ({ children }) => (\n <h4\n style={{\n fontSize: \"1.3125rem\",\n fontWeight: \"700\",\n lineHeight: \"calc(29 / 21)\",\n }}\n >\n {children}\n </h4>\n ),\n} as const satisfies BlockStyleDefinition;\n\n/** @public */\nfunction createStyles() {\n return [h2, h3, h4] as const;\n}\n\nexport { createStyles };\n"],"names":["ColorText","styled","span","$color","defaultResolveColor","value","createTextColorAnnotation","options","renderValue","defineField","type","name","typeName","title","icon","ColorWheelIcon","fields","components","annotation","props","color","renderDefault","ColorBg","createHighlightColorAnnotation","HighlightIcon","link","LinkIcon","collapsed","collapsible","createAnnotations","textColor","highlightColor","strong","BoldIcon","component","children","jsx","em","ItalicIcon","code","CodeIcon","sup","verticalAlign","createDecorators","bullet","UlistIcon","number","OlistIcon","createLists","defaultRenderIconPreview","React","isValidElement","createIconSpan","renderValuePreview","defineArrayMember","description","Fragment","preview","media","fallbackTitle","select","prepare","inline","video","image","motion","kind","createSpans","h2","fontSize","fontWeight","lineHeight","h3","h4","createStyles"],"mappings":";;;;;;;;;;;;;;;;;;;AASA,MAAMA,YAAYC,iBAAAA,OAAOC;AAAAA;AAAAA;AAAAA;AAAAA,aAIZ,CAAC;AAAA,EAAEC,SAAS;AAAU,MAAMA,MAAM;AAAA;AAAA;AAI/C,SAASC,oBAAoBC,OAA2B;AACtD,SAAOA;AACT;AAEA,SAASC,0BAA0BC,SAAkC;AACnE,QAAMC,cAAcD,SAASC,eAAeJ;AAE5C,SAAOK,mBAAY;AAAA,IACjBC,MAAM;AAAA,IACNC,MAAM,GAAGC,MAAAA,QAAQ;AAAA,IACjBC,OAAO;AAAA,IACPC,MAAMC,MAAAA;AAAAA,IACNC,QAAQ,CAACP,OAAAA,YAAY;AAAA,MAAEE,MAAM;AAAA,MAASD,MAAM;AAAA,IAAA,CAAc,CAAC;AAAA,IAC3DO,YAAY;AAAA,MACVC,YAAaC,CAAAA,UAAU;AACrB,cAAMd,QAAQG,YAAYW,MAAMd,OAAOe,KAAK;AAC5C,8CAAQ,WAAA,EAAU,QAAQf,OAAQc,UAAAA,MAAME,cAAcF,KAAK,GAAE;AAAA,MAC/D;AAAA,IAAA;AAAA,EACF,CACD;AACH;AAEA,MAAMG,UAAUrB,iBAAAA,OAAOC;AAAAA;AAAAA,wBAEC,CAAC;AAAA,EAAEC,SAAS;AAAU,MAAMA,MAAM;AAAA;AAAA;AAAA;AAAA;AAM1D,SAASoB,+BAA+BhB,SAAkC;AACxE,QAAMC,cAAcD,SAASC,eAAeJ;AAE5C,SAAOK,mBAAY;AAAA,IACjBC,MAAM;AAAA,IACNC,MAAM,GAAGC,MAAAA,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