@driftime/sanity-plugin-handbook 0.3.0 → 0.3.1

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
@@ -82,7 +82,7 @@ interface SanityHandbookConfig {
82
82
  * @returns Sanity plugin definition.
83
83
  * @public
84
84
  */
85
- declare const handbookPlugin: import("sanity").Plugin<SanityHandbookConfig>;
85
+ export declare const handbookPlugin: import("sanity").Plugin<SanityHandbookConfig>;
86
86
  /**
87
87
  * Creates the Structure tool items for Handbook documents, yielding nothing when the current user is
88
88
  * not permitted to edit them.
@@ -93,7 +93,7 @@ declare const handbookPlugin: import("sanity").Plugin<SanityHandbookConfig>;
93
93
  * @returns The list items for the Handbook singleton and the guides list.
94
94
  * @public
95
95
  */
96
- declare function handbookStructure(structureBuilder: StructureBuilder, context: {
96
+ export declare function handbookStructure(structureBuilder: StructureBuilder, context: {
97
97
  currentUser: CurrentUser | null;
98
98
  }, editors?: string[]): import("sanity/structure").ListItemBuilder[];
99
99
  /**
@@ -104,7 +104,7 @@ declare function handbookStructure(structureBuilder: StructureBuilder, context:
104
104
  * @returns Whether the current user can edit Handbook documents.
105
105
  * @public
106
106
  */
107
- declare function useIsHandbookEditor(editors?: string[]): boolean;
107
+ export declare function useIsHandbookEditor(editors?: string[]): boolean;
108
108
  /** Drops a type's catch-all index signature, so a mistyped field name is an error rather than an unknown value. */
109
109
  type Strict<T> = { [K in keyof T as string extends K ? never : number extends K ? never : K]: T[K]; };
110
110
  /** Array of objects each carrying the key Sanity assigns to array items, keeping members identifiable. */
@@ -232,5 +232,5 @@ type SanityHandbookLink = Strict<PortableTextObject> & {
232
232
  /** Web address the link points to. */
233
233
  href?: string;
234
234
  };
235
- export { type SanityHandbook, type SanityHandbookBlockDefinition, type SanityHandbookCallout, type SanityHandbookCode, type SanityHandbookConfig, type SanityHandbookDocumentRole, type SanityHandbookGuide, type SanityHandbookGuideGroup, type SanityHandbookHorizontalRule, type SanityHandbookImage, type SanityHandbookLink, type SanityHandbookMetadata, type SanityHandbookVideo, handbookPlugin, handbookStructure, useIsHandbookEditor };
235
+ export type { SanityHandbook, SanityHandbookBlockDefinition, SanityHandbookCallout, SanityHandbookCode, SanityHandbookConfig, SanityHandbookDocumentRole, SanityHandbookGuide, SanityHandbookGuideGroup, SanityHandbookHorizontalRule, SanityHandbookImage, SanityHandbookLink, SanityHandbookMetadata, SanityHandbookVideo };
236
236
  //# 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;;;;;;;;;;cAWW,iCAAc,OAAA;;;;;;;;;;;iBCpFX,kBACd,kBAAkB,kBAClB;EAAW,aAAa;GACxB,gDAAkB;;;;;;;;;iBCXJ,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","../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"}
package/dist/index.js CHANGED
@@ -1604,7 +1604,7 @@ function hasOfArray(value) {
1604
1604
  * @returns The type name, or undefined when the value declares none.
1605
1605
  */
1606
1606
  function getTypeName(value) {
1607
- if (!(typeof value != "object" || !value || !("type" in value))) return typeof value.type == "string" ? value.type : void 0;
1607
+ if (typeof value == "object" && value && "type" in value) return typeof value.type == "string" ? value.type : void 0;
1608
1608
  }
1609
1609
  /**
1610
1610
  * Extracts the parent type name from a compiled schema type, if present.
@@ -1613,7 +1613,7 @@ function getTypeName(value) {
1613
1613
  * @returns The parent type name, or undefined when the type extends none.
1614
1614
  */
1615
1615
  function getParentTypeName(resolvedType) {
1616
- if (!(typeof resolvedType != "object" || !resolvedType || !("type" in resolvedType)) && !(typeof resolvedType.type != "object" || resolvedType.type === null || !("name" in resolvedType.type))) return String(resolvedType.type.name);
1616
+ if (typeof resolvedType == "object" && resolvedType && "type" in resolvedType && typeof resolvedType.type == "object" && resolvedType.type !== null && "name" in resolvedType.type) return String(resolvedType.type.name);
1617
1617
  }
1618
1618
  /**
1619
1619
  * Normalises a compiled schema field into the shape the Handbook renders. Type names already seen are