@madebywild/sanity-quote-field 0.0.2
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 +1 -0
- package/dist/index.cjs +59 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +23 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +59 -0
- package/dist/index.js.map +1 -0
- package/package.json +47 -0
- package/src/index.tsx +65 -0
- package/src/types.tsx +25 -0
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# @madebywild/sanity-quote-field
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
3
|
+
var sanity = require("sanity");
|
|
4
|
+
const typeName = "wild.quote", wildSanityQuoteFieldPlugin = sanity.definePlugin((config) => ({
|
|
5
|
+
name: "@madebywild/sanity-quote-field",
|
|
6
|
+
schema: {
|
|
7
|
+
types: [sanity.defineType({
|
|
8
|
+
name: typeName,
|
|
9
|
+
type: "object",
|
|
10
|
+
title: "Quote",
|
|
11
|
+
description: "A stylized quote with optional author.",
|
|
12
|
+
fields: [
|
|
13
|
+
sanity.defineField({
|
|
14
|
+
name: "quote",
|
|
15
|
+
type: "wild.richtext",
|
|
16
|
+
title: "Quote",
|
|
17
|
+
description: "The quote text.",
|
|
18
|
+
options: {
|
|
19
|
+
preset: "basic",
|
|
20
|
+
...config?.richtextOptions
|
|
21
|
+
}
|
|
22
|
+
}),
|
|
23
|
+
// Display a reference field if the user provided a author typeName.
|
|
24
|
+
...config?.authorTypeName ? [sanity.defineField({
|
|
25
|
+
type: "reference",
|
|
26
|
+
name: "author",
|
|
27
|
+
title: "Author",
|
|
28
|
+
description: "The author of the quote.",
|
|
29
|
+
to: [{
|
|
30
|
+
type: config.authorTypeName
|
|
31
|
+
}]
|
|
32
|
+
})] : [sanity.defineField({
|
|
33
|
+
type: "string",
|
|
34
|
+
name: "author",
|
|
35
|
+
title: "Author",
|
|
36
|
+
description: "The author of the quote."
|
|
37
|
+
})]
|
|
38
|
+
],
|
|
39
|
+
preview: {
|
|
40
|
+
select: {
|
|
41
|
+
quote: "quote",
|
|
42
|
+
author: config?.authorTypeName ? "author.title" : "author"
|
|
43
|
+
},
|
|
44
|
+
prepare({
|
|
45
|
+
quote,
|
|
46
|
+
author
|
|
47
|
+
}) {
|
|
48
|
+
return {
|
|
49
|
+
title: quote ? `"${quote}"` : "No quote",
|
|
50
|
+
subtitle: author ? `\u2014 ${author}` : void 0
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
})]
|
|
55
|
+
}
|
|
56
|
+
}));
|
|
57
|
+
exports.typeName = typeName;
|
|
58
|
+
exports.wildSanityQuoteFieldPlugin = wildSanityQuoteFieldPlugin;
|
|
59
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../src/types.tsx","../src/index.tsx"],"sourcesContent":["import type { FieldOptions as RichtextOptions } from \"@madebywild/sanity-richtext-field\";\nimport type { ObjectDefinition, ObjectOptions } from \"sanity\";\n\n/** @public */\nexport const typeName = \"wild.quote\" as const;\n\n/** @public */\nexport type PluginConfig = {\n authorTypeName?: string;\n richtextOptions?: RichtextOptions;\n};\n\n/** @public */\nexport type FieldOptions = ObjectOptions;\n\n// Add the custom field definition to Sanity's intrinsic definitions\n// so that type checking works correctly when using this field type.\ndeclare module \"sanity\" {\n export interface IntrinsicDefinitions {\n [typeName]: Omit<ObjectDefinition, \"type\" | \"fields\" | \"options\"> & {\n type: typeof typeName;\n options?: FieldOptions;\n };\n }\n}\n","import { defineField, definePlugin, defineType } from \"sanity\";\nimport { type PluginConfig, typeName } from \"./types\";\n\n/** @public */\n// biome-ignore lint/suspicious/noConfusingVoidType: it can be void.\nconst wildSanityQuoteFieldPlugin = definePlugin<PluginConfig | void>((config) => {\n return {\n name: \"@madebywild/sanity-quote-field\",\n schema: {\n types: [\n defineType({\n name: typeName,\n type: \"object\",\n title: \"Quote\",\n description: \"A stylized quote with optional author.\",\n fields: [\n defineField({\n name: \"quote\",\n type: \"wild.richtext\",\n title: \"Quote\",\n description: \"The quote text.\",\n options: {\n preset: \"basic\",\n ...config?.richtextOptions,\n },\n }),\n // Display a reference field if the user provided a author typeName.\n ...(config?.authorTypeName\n ? [\n defineField({\n type: \"reference\",\n name: \"author\",\n title: \"Author\",\n description: \"The author of the quote.\",\n to: [{ type: config.authorTypeName }],\n }),\n ]\n : [\n defineField({\n type: \"string\",\n name: \"author\",\n title: \"Author\",\n description: \"The author of the quote.\",\n }),\n ]),\n ],\n preview: {\n select: {\n quote: \"quote\",\n author: config?.authorTypeName ? \"author.title\" : \"author\",\n },\n prepare({ quote, author }) {\n return {\n title: quote ? `\"${quote}\"` : \"No quote\",\n subtitle: author ? `— ${author}` : undefined,\n };\n },\n },\n }),\n ],\n },\n };\n});\n\nexport { wildSanityQuoteFieldPlugin, typeName };\n"],"names":["typeName","wildSanityQuoteFieldPlugin","definePlugin","config","name","schema","types","defineType","type","title","description","fields","defineField","options","preset","richtextOptions","authorTypeName","to","preview","select","quote","author","prepare","subtitle","undefined"],"mappings":";;;AAIO,MAAMA,WAAW,cCClBC,6BAA6BC,OAAAA,aAAmCC,CAAAA,YAC7D;AAAA,EACLC,MAAM;AAAA,EACNC,QAAQ;AAAA,IACNC,OAAO,CACLC,OAAAA,WAAW;AAAA,MACTH,MAAMJ;AAAAA,MACNQ,MAAM;AAAA,MACNC,OAAO;AAAA,MACPC,aAAa;AAAA,MACbC,QAAQ;AAAA,QACNC,mBAAY;AAAA,UACVR,MAAM;AAAA,UACNI,MAAM;AAAA,UACNC,OAAO;AAAA,UACPC,aAAa;AAAA,UACbG,SAAS;AAAA,YACPC,QAAQ;AAAA,YACR,GAAGX,QAAQY;AAAAA,UAAAA;AAAAA,QACb,CACD;AAAA;AAAA,QAED,GAAIZ,QAAQa,iBACR,CACEJ,mBAAY;AAAA,UACVJ,MAAM;AAAA,UACNJ,MAAM;AAAA,UACNK,OAAO;AAAA,UACPC,aAAa;AAAA,UACbO,IAAI,CAAC;AAAA,YAAET,MAAML,OAAOa;AAAAA,UAAAA,CAAgB;AAAA,QAAA,CACrC,CAAC,IAEJ,CACEJ,mBAAY;AAAA,UACVJ,MAAM;AAAA,UACNJ,MAAM;AAAA,UACNK,OAAO;AAAA,UACPC,aAAa;AAAA,QAAA,CACd,CAAC;AAAA,MAAA;AAAA,MAGVQ,SAAS;AAAA,QACPC,QAAQ;AAAA,UACNC,OAAO;AAAA,UACPC,QAAQlB,QAAQa,iBAAiB,iBAAiB;AAAA,QAAA;AAAA,QAEpDM,QAAQ;AAAA,UAAEF;AAAAA,UAAOC;AAAAA,QAAAA,GAAU;AACzB,iBAAO;AAAA,YACLZ,OAAOW,QAAQ,IAAIA,KAAK,MAAM;AAAA,YAC9BG,UAAUF,SAAS,UAAKA,MAAM,KAAKG;AAAAA,UAAAA;AAAAA,QAEvC;AAAA,MAAA;AAAA,IACF,CACD,CAAC;AAAA,EAAA;AAGR,EACD;;;"}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as sanity0 from "sanity";
|
|
2
|
+
import { ObjectDefinition, ObjectOptions } from "sanity";
|
|
3
|
+
import { FieldOptions } from "@madebywild/sanity-richtext-field";
|
|
4
|
+
/** @public */
|
|
5
|
+
declare const typeName: "wild.quote";
|
|
6
|
+
/** @public */
|
|
7
|
+
type PluginConfig = {
|
|
8
|
+
authorTypeName?: string;
|
|
9
|
+
richtextOptions?: FieldOptions;
|
|
10
|
+
};
|
|
11
|
+
/** @public */
|
|
12
|
+
type FieldOptions$1 = ObjectOptions;
|
|
13
|
+
declare module "sanity" {
|
|
14
|
+
interface IntrinsicDefinitions {
|
|
15
|
+
[typeName]: Omit<ObjectDefinition, "type" | "fields" | "options"> & {
|
|
16
|
+
type: typeof typeName;
|
|
17
|
+
options?: FieldOptions$1;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
/** @public */
|
|
22
|
+
declare const wildSanityQuoteFieldPlugin: sanity0.Plugin<void | PluginConfig>;
|
|
23
|
+
export { typeName, wildSanityQuoteFieldPlugin };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as sanity0 from "sanity";
|
|
2
|
+
import { ObjectDefinition, ObjectOptions } from "sanity";
|
|
3
|
+
import { FieldOptions } from "@madebywild/sanity-richtext-field";
|
|
4
|
+
/** @public */
|
|
5
|
+
declare const typeName: "wild.quote";
|
|
6
|
+
/** @public */
|
|
7
|
+
type PluginConfig = {
|
|
8
|
+
authorTypeName?: string;
|
|
9
|
+
richtextOptions?: FieldOptions;
|
|
10
|
+
};
|
|
11
|
+
/** @public */
|
|
12
|
+
type FieldOptions$1 = ObjectOptions;
|
|
13
|
+
declare module "sanity" {
|
|
14
|
+
interface IntrinsicDefinitions {
|
|
15
|
+
[typeName]: Omit<ObjectDefinition, "type" | "fields" | "options"> & {
|
|
16
|
+
type: typeof typeName;
|
|
17
|
+
options?: FieldOptions$1;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
/** @public */
|
|
22
|
+
declare const wildSanityQuoteFieldPlugin: sanity0.Plugin<void | PluginConfig>;
|
|
23
|
+
export { typeName, wildSanityQuoteFieldPlugin };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { definePlugin, defineType, defineField } from "sanity";
|
|
2
|
+
const typeName = "wild.quote", wildSanityQuoteFieldPlugin = definePlugin((config) => ({
|
|
3
|
+
name: "@madebywild/sanity-quote-field",
|
|
4
|
+
schema: {
|
|
5
|
+
types: [defineType({
|
|
6
|
+
name: typeName,
|
|
7
|
+
type: "object",
|
|
8
|
+
title: "Quote",
|
|
9
|
+
description: "A stylized quote with optional author.",
|
|
10
|
+
fields: [
|
|
11
|
+
defineField({
|
|
12
|
+
name: "quote",
|
|
13
|
+
type: "wild.richtext",
|
|
14
|
+
title: "Quote",
|
|
15
|
+
description: "The quote text.",
|
|
16
|
+
options: {
|
|
17
|
+
preset: "basic",
|
|
18
|
+
...config?.richtextOptions
|
|
19
|
+
}
|
|
20
|
+
}),
|
|
21
|
+
// Display a reference field if the user provided a author typeName.
|
|
22
|
+
...config?.authorTypeName ? [defineField({
|
|
23
|
+
type: "reference",
|
|
24
|
+
name: "author",
|
|
25
|
+
title: "Author",
|
|
26
|
+
description: "The author of the quote.",
|
|
27
|
+
to: [{
|
|
28
|
+
type: config.authorTypeName
|
|
29
|
+
}]
|
|
30
|
+
})] : [defineField({
|
|
31
|
+
type: "string",
|
|
32
|
+
name: "author",
|
|
33
|
+
title: "Author",
|
|
34
|
+
description: "The author of the quote."
|
|
35
|
+
})]
|
|
36
|
+
],
|
|
37
|
+
preview: {
|
|
38
|
+
select: {
|
|
39
|
+
quote: "quote",
|
|
40
|
+
author: config?.authorTypeName ? "author.title" : "author"
|
|
41
|
+
},
|
|
42
|
+
prepare({
|
|
43
|
+
quote,
|
|
44
|
+
author
|
|
45
|
+
}) {
|
|
46
|
+
return {
|
|
47
|
+
title: quote ? `"${quote}"` : "No quote",
|
|
48
|
+
subtitle: author ? `\u2014 ${author}` : void 0
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
})]
|
|
53
|
+
}
|
|
54
|
+
}));
|
|
55
|
+
export {
|
|
56
|
+
typeName,
|
|
57
|
+
wildSanityQuoteFieldPlugin
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/types.tsx","../src/index.tsx"],"sourcesContent":["import type { FieldOptions as RichtextOptions } from \"@madebywild/sanity-richtext-field\";\nimport type { ObjectDefinition, ObjectOptions } from \"sanity\";\n\n/** @public */\nexport const typeName = \"wild.quote\" as const;\n\n/** @public */\nexport type PluginConfig = {\n authorTypeName?: string;\n richtextOptions?: RichtextOptions;\n};\n\n/** @public */\nexport type FieldOptions = ObjectOptions;\n\n// Add the custom field definition to Sanity's intrinsic definitions\n// so that type checking works correctly when using this field type.\ndeclare module \"sanity\" {\n export interface IntrinsicDefinitions {\n [typeName]: Omit<ObjectDefinition, \"type\" | \"fields\" | \"options\"> & {\n type: typeof typeName;\n options?: FieldOptions;\n };\n }\n}\n","import { defineField, definePlugin, defineType } from \"sanity\";\nimport { type PluginConfig, typeName } from \"./types\";\n\n/** @public */\n// biome-ignore lint/suspicious/noConfusingVoidType: it can be void.\nconst wildSanityQuoteFieldPlugin = definePlugin<PluginConfig | void>((config) => {\n return {\n name: \"@madebywild/sanity-quote-field\",\n schema: {\n types: [\n defineType({\n name: typeName,\n type: \"object\",\n title: \"Quote\",\n description: \"A stylized quote with optional author.\",\n fields: [\n defineField({\n name: \"quote\",\n type: \"wild.richtext\",\n title: \"Quote\",\n description: \"The quote text.\",\n options: {\n preset: \"basic\",\n ...config?.richtextOptions,\n },\n }),\n // Display a reference field if the user provided a author typeName.\n ...(config?.authorTypeName\n ? [\n defineField({\n type: \"reference\",\n name: \"author\",\n title: \"Author\",\n description: \"The author of the quote.\",\n to: [{ type: config.authorTypeName }],\n }),\n ]\n : [\n defineField({\n type: \"string\",\n name: \"author\",\n title: \"Author\",\n description: \"The author of the quote.\",\n }),\n ]),\n ],\n preview: {\n select: {\n quote: \"quote\",\n author: config?.authorTypeName ? \"author.title\" : \"author\",\n },\n prepare({ quote, author }) {\n return {\n title: quote ? `\"${quote}\"` : \"No quote\",\n subtitle: author ? `— ${author}` : undefined,\n };\n },\n },\n }),\n ],\n },\n };\n});\n\nexport { wildSanityQuoteFieldPlugin, typeName };\n"],"names":["typeName","wildSanityQuoteFieldPlugin","definePlugin","config","name","schema","types","defineType","type","title","description","fields","defineField","options","preset","richtextOptions","authorTypeName","to","preview","select","quote","author","prepare","subtitle","undefined"],"mappings":";AAIO,MAAMA,WAAW,cCClBC,6BAA6BC,aAAmCC,CAAAA,YAC7D;AAAA,EACLC,MAAM;AAAA,EACNC,QAAQ;AAAA,IACNC,OAAO,CACLC,WAAW;AAAA,MACTH,MAAMJ;AAAAA,MACNQ,MAAM;AAAA,MACNC,OAAO;AAAA,MACPC,aAAa;AAAA,MACbC,QAAQ;AAAA,QACNC,YAAY;AAAA,UACVR,MAAM;AAAA,UACNI,MAAM;AAAA,UACNC,OAAO;AAAA,UACPC,aAAa;AAAA,UACbG,SAAS;AAAA,YACPC,QAAQ;AAAA,YACR,GAAGX,QAAQY;AAAAA,UAAAA;AAAAA,QACb,CACD;AAAA;AAAA,QAED,GAAIZ,QAAQa,iBACR,CACEJ,YAAY;AAAA,UACVJ,MAAM;AAAA,UACNJ,MAAM;AAAA,UACNK,OAAO;AAAA,UACPC,aAAa;AAAA,UACbO,IAAI,CAAC;AAAA,YAAET,MAAML,OAAOa;AAAAA,UAAAA,CAAgB;AAAA,QAAA,CACrC,CAAC,IAEJ,CACEJ,YAAY;AAAA,UACVJ,MAAM;AAAA,UACNJ,MAAM;AAAA,UACNK,OAAO;AAAA,UACPC,aAAa;AAAA,QAAA,CACd,CAAC;AAAA,MAAA;AAAA,MAGVQ,SAAS;AAAA,QACPC,QAAQ;AAAA,UACNC,OAAO;AAAA,UACPC,QAAQlB,QAAQa,iBAAiB,iBAAiB;AAAA,QAAA;AAAA,QAEpDM,QAAQ;AAAA,UAAEF;AAAAA,UAAOC;AAAAA,QAAAA,GAAU;AACzB,iBAAO;AAAA,YACLZ,OAAOW,QAAQ,IAAIA,KAAK,MAAM;AAAA,YAC9BG,UAAUF,SAAS,UAAKA,MAAM,KAAKG;AAAAA,UAAAA;AAAAA,QAEvC;AAAA,MAAA;AAAA,IACF,CACD,CAAC;AAAA,EAAA;AAGR,EACD;"}
|
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@madebywild/sanity-quote-field",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"sideEffects": false,
|
|
6
|
+
"license": "UNLICENSED",
|
|
7
|
+
"browserslist": "extends @sanity/browserslist-config",
|
|
8
|
+
"exports": {
|
|
9
|
+
"./package.json": "./package.json",
|
|
10
|
+
".": {
|
|
11
|
+
"source": "./src/index.tsx",
|
|
12
|
+
"require": "./dist/index.cjs",
|
|
13
|
+
"default": "./dist/index.js"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist",
|
|
18
|
+
"src"
|
|
19
|
+
],
|
|
20
|
+
"publishConfig": {
|
|
21
|
+
"access": "restricted"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@madebywild/sanity-richtext-field": "0.1.26"
|
|
25
|
+
},
|
|
26
|
+
"peerDependencies": {
|
|
27
|
+
"@sanity/ui": "^3.1",
|
|
28
|
+
"react": "^19",
|
|
29
|
+
"react-dom": "^19",
|
|
30
|
+
"sanity": "^4.17 || ^5.0.0"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@sanity/pkg-utils": "^9.2",
|
|
34
|
+
"@types/react": "^19",
|
|
35
|
+
"@types/react-dom": "^19",
|
|
36
|
+
"babel-plugin-react-compiler": "1.0.0",
|
|
37
|
+
"react": "^19",
|
|
38
|
+
"react-dom": "^19",
|
|
39
|
+
"sanity": "^4.17 || ^5.0.0",
|
|
40
|
+
"typescript": "^5"
|
|
41
|
+
},
|
|
42
|
+
"scripts": {
|
|
43
|
+
"build": "pkg-utils build --strict",
|
|
44
|
+
"clear": "rm -rf dist && rm -rf node_modules",
|
|
45
|
+
"check": "tsc --noEmit && pkg-utils check"
|
|
46
|
+
}
|
|
47
|
+
}
|
package/src/index.tsx
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { defineField, definePlugin, defineType } from "sanity";
|
|
2
|
+
import { type PluginConfig, typeName } from "./types";
|
|
3
|
+
|
|
4
|
+
/** @public */
|
|
5
|
+
// biome-ignore lint/suspicious/noConfusingVoidType: it can be void.
|
|
6
|
+
const wildSanityQuoteFieldPlugin = definePlugin<PluginConfig | void>((config) => {
|
|
7
|
+
return {
|
|
8
|
+
name: "@madebywild/sanity-quote-field",
|
|
9
|
+
schema: {
|
|
10
|
+
types: [
|
|
11
|
+
defineType({
|
|
12
|
+
name: typeName,
|
|
13
|
+
type: "object",
|
|
14
|
+
title: "Quote",
|
|
15
|
+
description: "A stylized quote with optional author.",
|
|
16
|
+
fields: [
|
|
17
|
+
defineField({
|
|
18
|
+
name: "quote",
|
|
19
|
+
type: "wild.richtext",
|
|
20
|
+
title: "Quote",
|
|
21
|
+
description: "The quote text.",
|
|
22
|
+
options: {
|
|
23
|
+
preset: "basic",
|
|
24
|
+
...config?.richtextOptions,
|
|
25
|
+
},
|
|
26
|
+
}),
|
|
27
|
+
// Display a reference field if the user provided a author typeName.
|
|
28
|
+
...(config?.authorTypeName
|
|
29
|
+
? [
|
|
30
|
+
defineField({
|
|
31
|
+
type: "reference",
|
|
32
|
+
name: "author",
|
|
33
|
+
title: "Author",
|
|
34
|
+
description: "The author of the quote.",
|
|
35
|
+
to: [{ type: config.authorTypeName }],
|
|
36
|
+
}),
|
|
37
|
+
]
|
|
38
|
+
: [
|
|
39
|
+
defineField({
|
|
40
|
+
type: "string",
|
|
41
|
+
name: "author",
|
|
42
|
+
title: "Author",
|
|
43
|
+
description: "The author of the quote.",
|
|
44
|
+
}),
|
|
45
|
+
]),
|
|
46
|
+
],
|
|
47
|
+
preview: {
|
|
48
|
+
select: {
|
|
49
|
+
quote: "quote",
|
|
50
|
+
author: config?.authorTypeName ? "author.title" : "author",
|
|
51
|
+
},
|
|
52
|
+
prepare({ quote, author }) {
|
|
53
|
+
return {
|
|
54
|
+
title: quote ? `"${quote}"` : "No quote",
|
|
55
|
+
subtitle: author ? `— ${author}` : undefined,
|
|
56
|
+
};
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
}),
|
|
60
|
+
],
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
export { wildSanityQuoteFieldPlugin, typeName };
|
package/src/types.tsx
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { FieldOptions as RichtextOptions } from "@madebywild/sanity-richtext-field";
|
|
2
|
+
import type { ObjectDefinition, ObjectOptions } from "sanity";
|
|
3
|
+
|
|
4
|
+
/** @public */
|
|
5
|
+
export const typeName = "wild.quote" as const;
|
|
6
|
+
|
|
7
|
+
/** @public */
|
|
8
|
+
export type PluginConfig = {
|
|
9
|
+
authorTypeName?: string;
|
|
10
|
+
richtextOptions?: RichtextOptions;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
/** @public */
|
|
14
|
+
export type FieldOptions = ObjectOptions;
|
|
15
|
+
|
|
16
|
+
// Add the custom field definition to Sanity's intrinsic definitions
|
|
17
|
+
// so that type checking works correctly when using this field type.
|
|
18
|
+
declare module "sanity" {
|
|
19
|
+
export interface IntrinsicDefinitions {
|
|
20
|
+
[typeName]: Omit<ObjectDefinition, "type" | "fields" | "options"> & {
|
|
21
|
+
type: typeof typeName;
|
|
22
|
+
options?: FieldOptions;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
}
|