@madebywild/sanity-richtext-field 1.0.0 → 1.1.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 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
+ renderAnnotation: (props, color) => <span style={{ color }}>{props.renderDefault(props)}</span>,
62
+ },
63
+ highlightColor: {
64
+ renderAnnotation: (props, color) => <mark style={{ backgroundColor: color }}>{props.renderDefault(props)}</mark>,
65
+ },
66
+ }),
67
+ ],
68
+ spans: [
69
+ ...createSpans({
70
+ icon: {
71
+ renderPreview: (value) => <span>{value}</span>,
72
+ },
73
+ }),
74
+ ],
75
+ });
76
+ ```
77
+
53
78
  ## Use in Schema
54
79
 
55
80
  ```ts
@@ -1,4 +1,4 @@
1
- import * as sanity53 from "sanity";
1
+ import * as sanity68 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<sanity53.ArrayOfEntry<ObjectDefinition>, "preview"> & {
20
- preview?: sanity53.PreviewConfig<{
19
+ } & Omit<sanity68.ArrayOfEntry<ObjectDefinition>, "preview"> & {
20
+ preview?: sanity68.PreviewConfig<{
21
21
  [x: string]: string;
22
22
  }, Record<string, string>> | undefined;
23
- } & sanity53.WidenValidation & sanity53.WidenInitialValue;
23
+ } & sanity68.WidenValidation & sanity68.WidenInitialValue;
24
24
  export { createBlock };
@@ -1,4 +1,4 @@
1
- import * as sanity45 from "sanity";
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<sanity45.ArrayOfEntry<ObjectDefinition>, "preview"> & {
20
- preview?: sanity45.PreviewConfig<{
19
+ } & Omit<sanity69.ArrayOfEntry<ObjectDefinition>, "preview"> & {
20
+ preview?: sanity69.PreviewConfig<{
21
21
  [x: string]: string;
22
22
  }, Record<string, string>> | undefined;
23
- } & sanity45.WidenValidation & sanity45.WidenInitialValue;
23
+ } & sanity69.WidenValidation & sanity69.WidenInitialValue;
24
24
  export { createBlock };
@@ -1,4 +1,4 @@
1
- import * as sanity49 from "sanity";
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<sanity49.ArrayOfEntry<ObjectDefinition>, "preview"> & {
20
- preview?: sanity49.PreviewConfig<{
19
+ } & Omit<sanity60.ArrayOfEntry<ObjectDefinition>, "preview"> & {
20
+ preview?: sanity60.PreviewConfig<{
21
21
  [x: string]: string;
22
22
  }, Record<string, string>> | undefined;
23
- } & sanity49.WidenValidation & sanity49.WidenInitialValue;
23
+ } & sanity60.WidenValidation & sanity60.WidenInitialValue;
24
24
  export { createBlock };
@@ -1,4 +1,4 @@
1
- import * as sanity49 from "sanity";
1
+ import * as sanity65 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<sanity49.ArrayOfEntry<ObjectDefinition>, "preview"> & {
20
- preview?: sanity49.PreviewConfig<{
19
+ } & Omit<sanity65.ArrayOfEntry<ObjectDefinition>, "preview"> & {
20
+ preview?: sanity65.PreviewConfig<{
21
21
  [x: string]: string;
22
22
  }, Record<string, string>> | undefined;
23
- } & sanity49.WidenValidation & sanity49.WidenInitialValue;
23
+ } & sanity65.WidenValidation & sanity65.WidenInitialValue;
24
24
  export { createBlock };
@@ -1,4 +1,4 @@
1
- import * as sanity58 from "sanity";
1
+ import * as sanity64 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<sanity58.ArrayOfEntry<ObjectDefinition>, "preview"> & {
20
- preview?: sanity58.PreviewConfig<{
19
+ } & Omit<sanity64.ArrayOfEntry<ObjectDefinition>, "preview"> & {
20
+ preview?: sanity64.PreviewConfig<{
21
21
  [x: string]: string;
22
22
  }, Record<string, string>> | undefined;
23
- } & sanity58.WidenValidation & sanity58.WidenInitialValue;
23
+ } & sanity64.WidenValidation & sanity64.WidenInitialValue;
24
24
  export { createBlock };
@@ -1,4 +1,4 @@
1
- import * as sanity58 from "sanity";
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<sanity58.ArrayOfEntry<ObjectDefinition>, "preview"> & {
20
- preview?: sanity58.PreviewConfig<{
19
+ } & Omit<sanity73.ArrayOfEntry<ObjectDefinition>, "preview"> & {
20
+ preview?: sanity73.PreviewConfig<{
21
21
  [x: string]: string;
22
22
  }, Record<string, string>> | undefined;
23
- } & sanity58.WidenValidation & sanity58.WidenInitialValue;
23
+ } & sanity73.WidenValidation & sanity73.WidenInitialValue;
24
24
  export { createBlock };
@@ -1,4 +1,4 @@
1
- import * as sanity45 from "sanity";
1
+ import * as sanity73 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<sanity45.ArrayOfEntry<ObjectDefinition>, "preview"> & {
13
- preview?: sanity45.PreviewConfig<{
12
+ } & Omit<sanity73.ArrayOfEntry<ObjectDefinition>, "preview"> & {
13
+ preview?: sanity73.PreviewConfig<{
14
14
  [x: string]: string;
15
15
  }, Record<string, string>> | undefined;
16
- } & sanity45.WidenValidation & sanity45.WidenInitialValue;
16
+ } & sanity73.WidenValidation & sanity73.WidenInitialValue;
17
17
  export { createBlock };
@@ -1,4 +1,4 @@
1
- import * as sanity53 from "sanity";
1
+ import * as sanity61 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<sanity53.ArrayOfEntry<ObjectDefinition>, "preview"> & {
13
- preview?: sanity53.PreviewConfig<{
12
+ } & Omit<sanity61.ArrayOfEntry<ObjectDefinition>, "preview"> & {
13
+ preview?: sanity61.PreviewConfig<{
14
14
  [x: string]: string;
15
15
  }, Record<string, string>> | undefined;
16
- } & sanity53.WidenValidation & sanity53.WidenInitialValue;
16
+ } & sanity61.WidenValidation & sanity61.WidenInitialValue;
17
17
  export { createBlock };
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import * as sanity57 from "sanity";
1
+ import * as sanity72 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: sanity57.Plugin<PluginConfig>;
89
+ declare const wildSanityRichtextFieldPlugin: sanity72.Plugin<PluginConfig>;
90
90
  export { type FieldOptions, type PluginConfig, typeName, wildSanityRichtextFieldPlugin };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import * as sanity57 from "sanity";
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: sanity57.Plugin<PluginConfig>;
89
+ declare const wildSanityRichtextFieldPlugin: sanity60.Plugin<PluginConfig>;
90
90
  export { type FieldOptions, type PluginConfig, typeName, wildSanityRichtextFieldPlugin };
package/dist/parts.cjs CHANGED
@@ -25,22 +25,32 @@ const ColorText = styledComponents.styled.span`
25
25
  color = "inherit"
26
26
  }) => color};
27
27
  }
28
- `, textColor = sanity.defineField({
29
- type: "object",
30
- name: `${types.typeName}.annotation.textColor`,
31
- title: "Text Color",
32
- icon: icons.ColorWheelIcon,
33
- fields: [sanity.defineField({
34
- name: "color",
35
- type: "wild.color"
36
- })],
37
- components: {
38
- annotation: (props) => {
39
- const color = props.value?.color?.value;
40
- return /* @__PURE__ */ jsxRuntime.jsx(ColorText, { color, children: props.renderDefault(props) });
28
+ `;
29
+ function defaultResolveColor(value) {
30
+ if (typeof value == "string") return value;
31
+ if (value && typeof value == "object" && "value" in value && typeof value.value == "string")
32
+ return value.value;
33
+ }
34
+ function createTextColorAnnotation(options) {
35
+ const resolveColor = options?.resolveColor ?? defaultResolveColor, renderAnnotation = options?.renderAnnotation;
36
+ return sanity.defineField({
37
+ type: "object",
38
+ name: `${types.typeName}.annotation.textColor`,
39
+ title: "Text Color",
40
+ icon: icons.ColorWheelIcon,
41
+ fields: [sanity.defineField({
42
+ name: "color",
43
+ type: "wild.color"
44
+ })],
45
+ components: {
46
+ annotation: (props) => {
47
+ const color = resolveColor(props.value?.color);
48
+ return renderAnnotation ? renderAnnotation(props, color) : /* @__PURE__ */ jsxRuntime.jsx(ColorText, { color, children: props.renderDefault(props) });
49
+ }
41
50
  }
42
- }
43
- }), ColorBg = styledComponents.styled.span`
51
+ });
52
+ }
53
+ const ColorBg = styledComponents.styled.span`
44
54
  & > span {
45
55
  background-color: ${({
46
56
  color = "inherit"
@@ -48,22 +58,27 @@ const ColorText = styledComponents.styled.span`
48
58
  border-bottom: unset;
49
59
  color: inherit;
50
60
  }
51
- `, highlightColor = sanity.defineField({
52
- type: "object",
53
- name: `${types.typeName}.annotation.highlightColor`,
54
- title: "Highlight Color",
55
- icon: icons.HighlightIcon,
56
- fields: [sanity.defineField({
57
- name: "color",
58
- type: "wild.color"
59
- })],
60
- components: {
61
- annotation: (props) => {
62
- const color = props.value?.color?.value;
63
- return /* @__PURE__ */ jsxRuntime.jsx(ColorBg, { color, children: props.renderDefault(props) });
61
+ `;
62
+ function createHighlightColorAnnotation(options) {
63
+ const resolveColor = options?.resolveColor ?? defaultResolveColor, renderAnnotation = options?.renderAnnotation;
64
+ return sanity.defineField({
65
+ type: "object",
66
+ name: `${types.typeName}.annotation.highlightColor`,
67
+ title: "Highlight Color",
68
+ icon: icons.HighlightIcon,
69
+ fields: [sanity.defineField({
70
+ name: "color",
71
+ type: "wild.color"
72
+ })],
73
+ components: {
74
+ annotation: (props) => {
75
+ const color = resolveColor(props.value?.color);
76
+ return renderAnnotation ? renderAnnotation(props, color) : /* @__PURE__ */ jsxRuntime.jsx(ColorBg, { color, children: props.renderDefault(props) });
77
+ }
64
78
  }
65
- }
66
- }), link = sanity.defineField({
79
+ });
80
+ }
81
+ const link = sanity.defineField({
67
82
  type: "wild.link",
68
83
  name: `${types.typeName}.annotation.link`,
69
84
  title: "Link",
@@ -73,8 +88,8 @@ const ColorText = styledComponents.styled.span`
73
88
  collapsible: !1
74
89
  }
75
90
  });
76
- function createAnnotations() {
77
- return [link, textColor, highlightColor];
91
+ function createAnnotations(options) {
92
+ return [link, createTextColorAnnotation(options?.textColor), createHighlightColorAnnotation(options?.highlightColor)];
78
93
  }
79
94
  const strong = {
80
95
  title: "Strong",
@@ -122,34 +137,41 @@ const bullet = {
122
137
  function createLists() {
123
138
  return [bullet, number];
124
139
  }
125
- const icon = sanity.defineArrayMember({
126
- name: `${types.typeName}.span.icon`,
127
- type: "object",
128
- title: "Icon",
129
- description: "Insert an icon.",
130
- icon: () => /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: "\u{1F9FF}" }),
131
- fields: [sanity.defineField({
132
- name: "icon",
133
- type: "wild.icon"
134
- })],
135
- components: {
136
- // This is the inline-preview in the PortableText editor.
137
- // It gets its props from the prepare function below.
138
- preview: (props) => React__namespace.isValidElement(props.media) ? props.media : props.fallbackTitle
139
- },
140
- preview: {
141
- select: {
142
- icon: "icon"
140
+ function defaultRenderIconPreview(value) {
141
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { role: "img", className: "inline-block size-[1em] shrink-0 text-current", title: value ?? "Icon", children: "\u{1F9FF}" });
142
+ }
143
+ function createIconSpan(options) {
144
+ const renderPreview = options?.renderPreview ?? defaultRenderIconPreview;
145
+ return sanity.defineArrayMember({
146
+ name: `${types.typeName}.span.icon`,
147
+ type: "object",
148
+ title: "Icon",
149
+ description: "Insert an icon.",
150
+ icon: () => /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: "\u{1F9FF}" }),
151
+ fields: [sanity.defineField({
152
+ name: "icon",
153
+ type: "wild.icon"
154
+ })],
155
+ components: {
156
+ // This is the inline-preview in the PortableText editor.
157
+ // It gets its props from the prepare function below.
158
+ preview: (props) => React__namespace.isValidElement(props.media) ? props.media : props.fallbackTitle
143
159
  },
144
- prepare({
145
- icon: icon2
146
- }) {
147
- return {
148
- media: /* @__PURE__ */ jsxRuntime.jsx("span", { role: "img", className: "inline-block size-[1em] shrink-0 text-current", title: icon2 ?? "Icon", children: "\u{1F9FF}" })
149
- };
160
+ preview: {
161
+ select: {
162
+ icon: "icon"
163
+ },
164
+ prepare({
165
+ icon
166
+ }) {
167
+ return {
168
+ media: renderPreview(icon)
169
+ };
170
+ }
150
171
  }
151
- }
152
- }), media = sanity.defineArrayMember({
172
+ });
173
+ }
174
+ const media = sanity.defineArrayMember({
153
175
  name: `${types.typeName}.span.media`,
154
176
  type: "object",
155
177
  title: "Inline Media",
@@ -176,8 +198,8 @@ const icon = sanity.defineArrayMember({
176
198
  }
177
199
  }
178
200
  });
179
- function createSpans() {
180
- return [icon, media];
201
+ function createSpans(options) {
202
+ return [createIconSpan(options?.icon), media];
181
203
  }
182
204
  const h2 = {
183
205
  title: "Heading 2",
@@ -215,6 +237,7 @@ function createStyles() {
215
237
  }
216
238
  exports.createAnnotations = createAnnotations;
217
239
  exports.createDecorators = createDecorators;
240
+ exports.createIconSpan = createIconSpan;
218
241
  exports.createLists = createLists;
219
242
  exports.createSpans = createSpans;
220
243
  exports.createStyles = createStyles;
@@ -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":";;;;;;;;;;;;;;;;;;;AAKA,MAAMA,YAAYC,iBAAAA,OAAOC;AAAAA;AAAAA;AAAAA;AAAAA,aAIZ,CAAC;AAAA,EAAEC,QAAQ;AAAU,MAAMA,KAAK;AAAA;AAAA,GAIhCC,YAAYC,OAAAA,YAAY;AAAA,EACnCC,MAAM;AAAA,EACNC,MAAM,GAAGC,MAAAA,QAAQ;AAAA,EACjBC,OAAO;AAAA,EACPC,MAAMC,MAAAA;AAAAA,EACNC,QAAQ,CAACP,OAAAA,YAAY;AAAA,IAAEE,MAAM;AAAA,IAASD,MAAM;AAAA,EAAA,CAAc,CAAC;AAAA,EAC3DO,YAAY;AAAA,IACVC,YAAaC,CAAAA,UAAU;AAErB,YAAMZ,QAAQY,MAAMC,OAAOb,OAAOa;AAClC,4CAAQ,WAAA,EAAU,OAAeD,UAAAA,MAAME,cAAcF,KAAK,GAAE;AAAA,IAC9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HA,MAAMU,KAAK;AAAA,EACTnD,OAAO;AAAA,EACPO,OAAO,GAAGR,MAAAA,QAAQ;AAAA,EAClBqB,WAAWA,CAAC;AAAA,IAAEC;AAAAA,EAAAA,MACZC,2BAAAA,IAAC,MAAA,EACC,OAAO;AAAA,IACL8B,UAAU;AAAA,IACVC,YAAY;AAAA,IACZC,YAAY;AAAA,EAAA,GAGbjC,SAAAA,CACH;AAEJ,GAEMkC,KAAK;AAAA,EACTvD,OAAO;AAAA,EACPO,OAAO,GAAGR,MAAAA,QAAQ;AAAA,EAClBqB,WAAWA,CAAC;AAAA,IAAEC;AAAAA,EAAAA,MACZC,2BAAAA,IAAC,MAAA,EACC,OAAO;AAAA,IACL8B,UAAU;AAAA,IACVC,YAAY;AAAA,IACZC,YAAY;AAAA,EAAA,GAGbjC,SAAAA,CACH;AAEJ,GAEMmC,KAAK;AAAA,EACTxD,OAAO;AAAA,EACPO,OAAO,GAAGR,MAAAA,QAAQ;AAAA,EAClBqB,WAAWA,CAAC;AAAA,IAAEC;AAAAA,EAAAA,MACZC,2BAAAA,IAAC,MAAA,EACC,OAAO;AAAA,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 { type BlockAnnotationProps, defineField } from \"sanity\";\nimport { styled } from \"styled-components\";\nimport { typeName } from \"../../types\";\n\ntype ColorAnnotationOptions = {\n resolveColor?: (value: unknown) => string | undefined;\n renderAnnotation?: (props: BlockAnnotationProps, color?: string) => React.JSX.Element;\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: unknown) {\n if (typeof value === \"string\") return value;\n if (value && typeof value === \"object\" && \"value\" in value && typeof value.value === \"string\") {\n return value.value;\n }\n return undefined;\n}\n\nfunction createTextColorAnnotation(options?: ColorAnnotationOptions) {\n const resolveColor = options?.resolveColor ?? defaultResolveColor;\n const renderAnnotation = options?.renderAnnotation;\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 color = resolveColor(props.value?.color);\n if (renderAnnotation) return renderAnnotation(props, color);\n return <ColorText color={color}>{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 resolveColor = options?.resolveColor ?? defaultResolveColor;\n const renderAnnotation = options?.renderAnnotation;\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 color = resolveColor(props.value?.color);\n if (renderAnnotation) return renderAnnotation(props, color);\n return <ColorBg color={color}>{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 renderPreview?: (value?: string) => React.ReactNode;\n};\n\nfunction defaultRenderIconPreview(value?: string) {\n return (\n <span role=\"img\" className=\"inline-block size-[1em] shrink-0 text-current\" title={value ?? \"Icon\"}>\n 🧿\n </span>\n );\n}\n\nfunction createIconSpan(options?: IconSpanOptions) {\n const renderPreview = options?.renderPreview ?? defaultRenderIconPreview;\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: renderPreview(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","resolveColor","renderAnnotation","defineField","type","name","typeName","title","icon","ColorWheelIcon","fields","components","annotation","props","jsx","renderDefault","ColorBg","createHighlightColorAnnotation","HighlightIcon","link","LinkIcon","collapsed","collapsible","createAnnotations","textColor","highlightColor","strong","BoldIcon","component","children","em","ItalicIcon","code","CodeIcon","sup","verticalAlign","createDecorators","bullet","UlistIcon","number","OlistIcon","createLists","defaultRenderIconPreview","createIconSpan","renderPreview","defineArrayMember","description","Fragment","preview","React","isValidElement","media","fallbackTitle","select","prepare","inline","video","image","motion","kind","createSpans","h2","fontSize","fontWeight","lineHeight","h3","h4","createStyles"],"mappings":";;;;;;;;;;;;;;;;;;;AAUA,MAAMA,YAAYC,iBAAAA,OAAOC;AAAAA;AAAAA;AAAAA;AAAAA,aAIZ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