@driftime/sanity-plugin-handbook 0.3.2 → 0.4.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/dist/index.d.ts CHANGED
@@ -1,6 +1,5 @@
1
- import { CurrentUser, DocumentDefinition, KeyedSegment, PortableTextBlock, PortableTextObject, PortableTextSpan, PortableTextTextBlock, SanityDocument, SchemaTypeDefinition } from "sanity";
2
1
  import { ComponentType } from "react";
3
- import "@sanity/ui";
2
+ import { CurrentUser, DocumentDefinition, KeyedSegment, PortableTextBlock, PortableTextObject, PortableTextSpan, PortableTextTextBlock, SanityDocument, SchemaTypeDefinition } from "sanity";
4
3
  import { StructureBuilder } from "sanity/structure";
5
4
  declare module "@sanity/types" {
6
5
  interface FieldDefinitionBase {
@@ -61,17 +60,17 @@ interface SanityHandbookBlockDefinition {
61
60
  * @public
62
61
  */
63
62
  interface SanityHandbookConfig {
64
- /** Title shown in the Studio tool navigation. */
63
+ /** Title shown in the Studio tool navigation. `"Handbook"` when omitted. */
65
64
  title?: string;
66
- /** Heading displayed at the top of the sidebar. */
65
+ /** Heading displayed at the top of the sidebar. `"Handbook"` when omitted. */
67
66
  sidebarTitle?: string;
68
67
  /** Document roles, each shown as a labelled section in the sidebar. */
69
68
  roles: SanityHandbookDocumentRole[];
70
- /** Custom Portable Text block definitions for guide content. */
69
+ /** Custom Portable Text block definitions for guide content. None when omitted. */
71
70
  blocks?: SanityHandbookBlockDefinition[];
72
- /** Email addresses permitted to edit Handbook documents. */
71
+ /** Email addresses permitted to edit Handbook documents. Everyone when omitted. */
73
72
  editors?: string[];
74
- /** Fallback message shown when a field has no description. */
73
+ /** Fallback message shown when a field has no description. A prompt to ask the development team when omitted. */
75
74
  undocumentedFieldMessage?: string;
76
75
  }
77
76
  /**
@@ -105,9 +104,16 @@ export declare function handbookStructure(structureBuilder: StructureBuilder, co
105
104
  * @public
106
105
  */
107
106
  export declare function useIsHandbookEditor(editors?: string[]): boolean;
108
- /** Drops a type's catch-all index signature, so a mistyped field name is an error rather than an unknown value. */
107
+ /**
108
+ * Drops a type's catch-all index signature, so a mistyped field name is an error rather than an
109
+ * unknown value.
110
+ *
111
+ */
109
112
  type Strict<T> = { [K in keyof T as string extends K ? never : number extends K ? never : K]: T[K]; };
110
- /** Array of objects each carrying the key Sanity assigns to array items, keeping members identifiable. */
113
+ /**
114
+ * Array of objects each carrying the key Sanity assigns to array items, keeping members identifiable.
115
+ *
116
+ */
111
117
  type SanityKeyedArray<T> = (KeyedSegment & T)[];
112
118
  /**
113
119
  * A single Handbook page, authored as rich text and rendered in the tool.
@@ -148,46 +154,6 @@ type SanityHandbook = Strict<SanityDocument> & {
148
154
  };
149
155
  /** Document type name of the Handbook singleton. */
150
156
  declare const handbookTypeName = "handbook.handbook";
151
- /** The intent a callout is drawn with, choosing its icon and tone. */
152
- type CalloutVariant = "tip" | "info" | "warning";
153
- /**
154
- * A highlighted message set apart from the surrounding guide text.
155
- *
156
- * @public
157
- */
158
- type SanityHandbookCallout = Strict<PortableTextObject> & {
159
- _type: typeof calloutTypeName;
160
- /** Visual style and intent of the callout. */
161
- variant: CalloutVariant;
162
- /** Portable Text content displayed inside the callout, which offers no inline objects. */
163
- body: SanityKeyedArray<PortableTextTextBlock<PortableTextSpan>>;
164
- };
165
- /** Type name of the callout block. */
166
- declare const calloutTypeName = "handbook.callout";
167
- /**
168
- * A block of source code, rendered with syntax highlighting for its language.
169
- *
170
- * @public
171
- */
172
- type SanityHandbookCode = Strict<PortableTextObject> & {
173
- _type: typeof codeTypeName;
174
- /** Source code to display. */
175
- code?: string;
176
- /** Programming language used for syntax highlighting. */
177
- language?: string;
178
- };
179
- /** Type name of the code block. */
180
- declare const codeTypeName = "handbook.code";
181
- /**
182
- * A divider between sections of a guide, carrying no authored content of its own.
183
- *
184
- * @public
185
- */
186
- type SanityHandbookHorizontalRule = Strict<PortableTextObject> & {
187
- _type: typeof horizontalRuleTypeName;
188
- };
189
- /** Type name of the horizontal rule block. */
190
- declare const horizontalRuleTypeName = "handbook.horizontalRule";
191
157
  /**
192
158
  * An image placed in a guide, with the caption and alternative text shown alongside it.
193
159
  *
@@ -222,6 +188,50 @@ type SanityHandbookVideo = Strict<PortableTextObject> & {
222
188
  };
223
189
  /** Type name of the video block. */
224
190
  declare const videoTypeName = "handbook.video";
191
+ /**
192
+ * A block of source code, rendered with syntax highlighting for its language.
193
+ *
194
+ * @public
195
+ */
196
+ type SanityHandbookCode = Strict<PortableTextObject> & {
197
+ _type: typeof codeTypeName;
198
+ /** Source code to display. */
199
+ code?: string;
200
+ /** Programming language used for syntax highlighting. */
201
+ language?: string;
202
+ };
203
+ /** Type name of the code block. */
204
+ declare const codeTypeName = "handbook.code";
205
+ /**
206
+ * The intent a callout is drawn with, choosing its icon and tone.
207
+ *
208
+ * @public
209
+ */
210
+ type SanityHandbookCalloutVariant = "tip" | "info" | "warning";
211
+ /**
212
+ * A highlighted message set apart from the surrounding guide text.
213
+ *
214
+ * @public
215
+ */
216
+ type SanityHandbookCallout = Strict<PortableTextObject> & {
217
+ _type: typeof calloutTypeName;
218
+ /** Visual style and intent of the callout. */
219
+ variant: SanityHandbookCalloutVariant;
220
+ /** Portable Text content displayed inside the callout, which offers no inline objects. */
221
+ body: SanityKeyedArray<PortableTextTextBlock<PortableTextSpan>>;
222
+ };
223
+ /** Type name of the callout block. */
224
+ declare const calloutTypeName = "handbook.callout";
225
+ /**
226
+ * A divider between sections of a guide, carrying no authored content of its own.
227
+ *
228
+ * @public
229
+ */
230
+ type SanityHandbookHorizontalRule = Strict<PortableTextObject> & {
231
+ _type: typeof horizontalRuleTypeName;
232
+ };
233
+ /** Type name of the horizontal rule block. */
234
+ declare const horizontalRuleTypeName = "handbook.horizontalRule";
225
235
  /**
226
236
  * A web address applied to a run of guide text.
227
237
  *
@@ -232,5 +242,5 @@ type SanityHandbookLink = Strict<PortableTextObject> & {
232
242
  /** Web address the link points to. */
233
243
  href?: string;
234
244
  };
235
- export type { SanityHandbook, SanityHandbookBlockDefinition, SanityHandbookCallout, SanityHandbookCode, SanityHandbookConfig, SanityHandbookDocumentRole, SanityHandbookGuide, SanityHandbookGuideGroup, SanityHandbookHorizontalRule, SanityHandbookImage, SanityHandbookLink, SanityHandbookMetadata, SanityHandbookVideo };
245
+ export type { SanityHandbook, SanityHandbookBlockDefinition, SanityHandbookCallout, SanityHandbookCalloutVariant, SanityHandbookCode, SanityHandbookConfig, SanityHandbookDocumentRole, SanityHandbookGuide, SanityHandbookGuideGroup, SanityHandbookHorizontalRule, SanityHandbookImage, SanityHandbookLink, SanityHandbookMetadata, SanityHandbookVideo };
236
246
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/plugin.ts","../src/lib/structure.ts","../src/hooks/use-is-handbook-editor.ts","../src/types.ts","../src/schemas/types/guide.ts","../src/schemas/types/handbook.ts","../src/blocks/callout/content.tsx","../src/schemas/blocks/callout.ts","../src/schemas/blocks/code.ts","../src/schemas/blocks/horizontal-rule.ts","../src/schemas/blocks/image.ts","../src/schemas/blocks/video.ts","../src/schemas/annotations/link.ts"],"mappings":";;;;;YAoBY;IACR,WAAW;;YAIH;IACR,WAAW;;;;;;;;UASE;;EAEf;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;;;;;;UAQe;;EAEf;;EAEA;;EAEA,WAAW;;;;;;;UAQI;;EAEf,QAAQ;;EAER,WAAW;IAAgB,OAAO;;;;;;;;UAQnB;;EAEf;;EAEA;;EAEA,OAAO;;EAEP,SAAS;;EAET;;EAEA;;;;;;;;;;qBAWW,iCAAc,OAAA;;;;;;;;;;;wBCpFX,kBACd,kBAAkB,kBAClB;EAAW,aAAa;GACxB,gDAAkB;;;;;;;;;wBCXJ,oBAAoB;;KCNxB,OAAO,QAAQ,WAAW,oBAAoB,2BAA2B,YAAY,IAAI,EAAE;;KAG3F,iBAAiB,MAAM,eAAe;;;;;;KCMtC,sBAAsB,OAAO;EACvC,cAAc;;EAEd;;EAEA;;EAEA,SAAS,iBAAiB;;;cAIf;;;;;;UCVI;;EAEf;;EAEA,QAAQ,iBAAiB;;;;;;;KAQf,iBAAiB,OAAO;EAClC,cAAc;;EAEd,QAAQ,iBAAiB;;;cAId;;KCzBD;;;;;;KCOA,wBAAwB,OAAO;EACzC,cAAc;;EAEd,SAAS;;EAET,MAAM,iBAAiB,sBAAsB;;;cAIlC;;;;;;KCbD,qBAAqB,OAAO;EACtC,cAAc;;EAEd;;EAEA;;;cAIW;;;;;;KCTD,+BAA+B,OAAO;EAChD,cAAc;;;cAIH;;;;;;KCLD,sBAAsB,OAAO;EACvC,cAAc;;EAEd;IAAU;;;EAEV;;EAEA;;;cAIW;;;;;;KCXD,sBAAsB,OAAO;EACvC,cAAc;;EAEd;IAAU;;;EAEV;;;cAIW;;;;;;KCZD,qBAAqB,OAAO;EACtC;;EAEA"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/plugin.ts","../src/lib/structure.ts","../src/hooks/use-is-handbook-editor.ts","../src/types.ts"],"mappings":";;;;YAoBY;IACR,WAAW;;YAIH;IACR,WAAW;;;;;;;;UASE;;EAEf;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;;;;;;UAQe;;EAEf;;EAEA;;EAEA,WAAW;;;;;;;UAQI;;EAEf,QAAQ;;EAER,WAAW;IAAgB,OAAO;;;;;;;;UAQnB;;EAEf;;EAEA;;EAEA,OAAO;;EAEP,SAAS;;EAET;;EAEA;;;;;;;;;;qBAWW,iCAAc,OAAA;;;;;;;;;;;wBCrFX,kBACd,kBAAkB,kBAClB;EAAW,aAAa;GACxB,gDAAkB;;;;;;;;;wBCVJ,oBAAoB;;;;;;KCExB,OAAO,QAAQ,WAAW,oBAAoB,2BAA2B,YAAY,IAAI,EAAE;;;;;KAM3F,iBAAiB,MAAM,eAAe;;;;;;KAOtC,sBAAsB,OAAO;EACvC,cAAc;;EAEd;;EAEA;;EAEA,SAAS,iBAAiB;;;cAIf;;;;;;UAOI;;EAEf;;EAEA,QAAQ,iBAAiB;;;;;;;KAQf,iBAAiB,OAAO;EAClC,cAAc;;EAEd,QAAQ,iBAAiB;;;cAId;;;;;;KAOD,sBAAsB,OAAO;EACvC,cAAc;;EAEd;IAAU;;;EAEV;;EAEA;;;cAIW;;;;;;KAOD,sBAAsB,OAAO;EACvC,cAAc;;EAEd;IAAU;;;EAEV;;;cAIW;;;;;;KAOD,qBAAqB,OAAO;EACtC,cAAc;;EAEd;;EAEA;;;cAIW;;;;;;KAOD;;;;;;KAOA,wBAAwB,OAAO;EACzC,cAAc;;EAEd,SAAS;;EAET,MAAM,iBAAiB,sBAAsB;;;cAIlC;;;;;;KAOD,+BAA+B,OAAO;EAChD,cAAc;;;cAIH;;;;;;KAOD,qBAAqB,OAAO;EACtC;;EAEA"}