@driftime/sanity-plugin-handbook 0.1.0 → 0.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@driftime/sanity-plugin-handbook",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Schema-driven documentation and editorial guides, built right into Sanity Studio.",
5
5
  "keywords": [
6
6
  "sanity",
@@ -55,9 +55,6 @@
55
55
  "watch": "pkg-utils watch --strict",
56
56
  "build": "plugin-kit verify-package --silent && pkg-utils build --strict --clean --check"
57
57
  },
58
- "dependencies": {
59
- "lucide-react": "1.7.0"
60
- },
61
58
  "devDependencies": {
62
59
  "@sanity/browserslist-config": "1.0.5",
63
60
  "@sanity/pkg-utils": "10.4.13",
@@ -88,5 +85,8 @@
88
85
  "eslintImports": false,
89
86
  "scripts": false
90
87
  }
88
+ },
89
+ "dependencies": {
90
+ "@driftime/sanity-plugin-handbook": "file:.yalc/@driftime/sanity-plugin-handbook"
91
91
  }
92
92
  }
@@ -1,7 +1,9 @@
1
1
  import { Card, Flex, Text } from "@sanity/ui";
2
- import { InfoIcon, LightbulbIcon, TriangleAlertIcon } from "lucide-react";
3
2
  import type { ReactNode } from "react";
4
3
 
4
+ import { InfoIcon } from "../../icons/info";
5
+ import { LightbulbIcon } from "../../icons/lightbulb";
6
+ import { TriangleAlertIcon } from "../../icons/triangle-alert";
5
7
  import { defaultIconProps } from "../../lib/icons";
6
8
 
7
9
  export type CalloutVariant = "tip" | "info" | "warning";
@@ -1,12 +1,14 @@
1
1
  import { ChevronDownIcon, ChevronRightIcon } from "@sanity/icons";
2
2
  import { Box, Card, Flex, Popover, Stack, Text, useClickOutsideEvent } from "@sanity/ui";
3
- import { InfoIcon, LightbulbIcon, TriangleAlertIcon } from "lucide-react";
4
3
  import { useCallback, useRef, useState } from "react";
5
4
  import type { ReactNode } from "react";
6
5
  import type { FieldDefinition, SchemaType } from "sanity";
7
6
  import { useSchema } from "sanity";
8
7
 
9
8
  import { useHandbookContext } from "../contexts/handbook-context";
9
+ import { InfoIcon } from "../icons/info";
10
+ import { LightbulbIcon } from "../icons/lightbulb";
11
+ import { TriangleAlertIcon } from "../icons/triangle-alert";
10
12
  import { defaultIconProps } from "../lib/icons";
11
13
  import { convertCase, isDefined } from "../lib/utils";
12
14
 
@@ -1,6 +1,5 @@
1
- import { BookOpenTextIcon } from "lucide-react";
2
-
3
1
  import { useHandbookContext } from "../contexts/handbook-context";
2
+ import { BookOpenTextIcon } from "../icons/book-open-text";
4
3
  import { createSanityIcon } from "../lib/icons";
5
4
  import { isDefined } from "../lib/utils";
6
5
  import { ContentPanel } from "./content-panel";
@@ -1,7 +1,9 @@
1
1
  import { Box, Flex, Stack, Text } from "@sanity/ui";
2
- import { InfoIcon, LightbulbIcon, TriangleAlertIcon } from "lucide-react";
3
2
  import type { ReactNode } from "react";
4
3
 
4
+ import { InfoIcon } from "../icons/info";
5
+ import { LightbulbIcon } from "../icons/lightbulb";
6
+ import { TriangleAlertIcon } from "../icons/triangle-alert";
5
7
  import { defaultIconProps } from "../lib/icons";
6
8
 
7
9
  function HintRow({ icon, children }: { icon: ReactNode; children: string }) {
@@ -1,9 +1,10 @@
1
- import { BookTextIcon, LayoutGridIcon } from "lucide-react";
2
1
  import type { ComponentType, ReactElement } from "react";
3
2
 
4
3
  import { ContentPanel } from "../components/content-panel";
5
4
  import { SidebarGroup } from "../components/sidebar-group";
6
5
  import { SidebarTab } from "../components/sidebar-tab";
6
+ import { BookTextIcon } from "../icons/book-text";
7
+ import { LayoutGridIcon } from "../icons/layout-grid";
7
8
  import { createSanityIcon } from "../lib/icons";
8
9
  import { DocumentTypesOverview } from "./document-types";
9
10
  import { HowToUse } from "./how-to-use";
@@ -0,0 +1,22 @@
1
+ import type { SVGProps } from "react";
2
+
3
+ export function BookOpenTextIcon(props: SVGProps<SVGSVGElement>) {
4
+ return (
5
+ <svg
6
+ xmlns="http://www.w3.org/2000/svg"
7
+ viewBox="0 0 24 24"
8
+ fill="none"
9
+ stroke="currentColor"
10
+ strokeLinecap="round"
11
+ strokeLinejoin="round"
12
+ {...props}
13
+ >
14
+ <path d="M12 7v14" />
15
+ <path d="M16 12h2" />
16
+ <path d="M16 8h2" />
17
+ <path d="M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z" />
18
+ <path d="M6 12h2" />
19
+ <path d="M6 8h2" />
20
+ </svg>
21
+ );
22
+ }
@@ -0,0 +1,19 @@
1
+ import type { SVGProps } from "react";
2
+
3
+ export function BookTextIcon(props: SVGProps<SVGSVGElement>) {
4
+ return (
5
+ <svg
6
+ xmlns="http://www.w3.org/2000/svg"
7
+ viewBox="0 0 24 24"
8
+ fill="none"
9
+ stroke="currentColor"
10
+ strokeLinecap="round"
11
+ strokeLinejoin="round"
12
+ {...props}
13
+ >
14
+ <path d="M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20" />
15
+ <path d="M8 11h8" />
16
+ <path d="M8 7h6" />
17
+ </svg>
18
+ );
19
+ }
@@ -0,0 +1,18 @@
1
+ import type { SVGProps } from "react";
2
+
3
+ export function CodeIcon(props: SVGProps<SVGSVGElement>) {
4
+ return (
5
+ <svg
6
+ xmlns="http://www.w3.org/2000/svg"
7
+ viewBox="0 0 24 24"
8
+ fill="none"
9
+ stroke="currentColor"
10
+ strokeLinecap="round"
11
+ strokeLinejoin="round"
12
+ {...props}
13
+ >
14
+ <path d="m16 18 6-6-6-6" />
15
+ <path d="m8 6-6 6 6 6" />
16
+ </svg>
17
+ );
18
+ }
@@ -0,0 +1,19 @@
1
+ import type { SVGProps } from "react";
2
+
3
+ export function ImageIcon(props: SVGProps<SVGSVGElement>) {
4
+ return (
5
+ <svg
6
+ xmlns="http://www.w3.org/2000/svg"
7
+ viewBox="0 0 24 24"
8
+ fill="none"
9
+ stroke="currentColor"
10
+ strokeLinecap="round"
11
+ strokeLinejoin="round"
12
+ {...props}
13
+ >
14
+ <rect width="18" height="18" x="3" y="3" rx="2" ry="2" />
15
+ <circle cx="9" cy="9" r="2" />
16
+ <path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21" />
17
+ </svg>
18
+ );
19
+ }
@@ -0,0 +1,19 @@
1
+ import type { SVGProps } from "react";
2
+
3
+ export function InfoIcon(props: SVGProps<SVGSVGElement>) {
4
+ return (
5
+ <svg
6
+ xmlns="http://www.w3.org/2000/svg"
7
+ viewBox="0 0 24 24"
8
+ fill="none"
9
+ stroke="currentColor"
10
+ strokeLinecap="round"
11
+ strokeLinejoin="round"
12
+ {...props}
13
+ >
14
+ <circle cx="12" cy="12" r="10" />
15
+ <path d="M12 16v-4" />
16
+ <path d="M12 8h.01" />
17
+ </svg>
18
+ );
19
+ }
@@ -0,0 +1,20 @@
1
+ import type { SVGProps } from "react";
2
+
3
+ export function LayoutGridIcon(props: SVGProps<SVGSVGElement>) {
4
+ return (
5
+ <svg
6
+ xmlns="http://www.w3.org/2000/svg"
7
+ viewBox="0 0 24 24"
8
+ fill="none"
9
+ stroke="currentColor"
10
+ strokeLinecap="round"
11
+ strokeLinejoin="round"
12
+ {...props}
13
+ >
14
+ <rect width="7" height="7" x="3" y="3" rx="1" />
15
+ <rect width="7" height="7" x="14" y="3" rx="1" />
16
+ <rect width="7" height="7" x="14" y="14" rx="1" />
17
+ <rect width="7" height="7" x="3" y="14" rx="1" />
18
+ </svg>
19
+ );
20
+ }
@@ -0,0 +1,19 @@
1
+ import type { SVGProps } from "react";
2
+
3
+ export function LightbulbIcon(props: SVGProps<SVGSVGElement>) {
4
+ return (
5
+ <svg
6
+ xmlns="http://www.w3.org/2000/svg"
7
+ viewBox="0 0 24 24"
8
+ fill="none"
9
+ stroke="currentColor"
10
+ strokeLinecap="round"
11
+ strokeLinejoin="round"
12
+ {...props}
13
+ >
14
+ <path d="M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5" />
15
+ <path d="M9 18h6" />
16
+ <path d="M10 22h4" />
17
+ </svg>
18
+ );
19
+ }
@@ -0,0 +1,21 @@
1
+ import type { SVGProps } from "react";
2
+
3
+ export function ListPlusIcon(props: SVGProps<SVGSVGElement>) {
4
+ return (
5
+ <svg
6
+ xmlns="http://www.w3.org/2000/svg"
7
+ viewBox="0 0 24 24"
8
+ fill="none"
9
+ stroke="currentColor"
10
+ strokeLinecap="round"
11
+ strokeLinejoin="round"
12
+ {...props}
13
+ >
14
+ <path d="M16 5H3" />
15
+ <path d="M11 12H3" />
16
+ <path d="M16 19H3" />
17
+ <path d="M18 9v6" />
18
+ <path d="M21 12h-6" />
19
+ </svg>
20
+ );
21
+ }
@@ -0,0 +1,19 @@
1
+ import type { SVGProps } from "react";
2
+
3
+ export function MessageCircleQuestionMarkIcon(props: SVGProps<SVGSVGElement>) {
4
+ return (
5
+ <svg
6
+ xmlns="http://www.w3.org/2000/svg"
7
+ viewBox="0 0 24 24"
8
+ fill="none"
9
+ stroke="currentColor"
10
+ strokeLinecap="round"
11
+ strokeLinejoin="round"
12
+ {...props}
13
+ >
14
+ <path d="M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719" />
15
+ <path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3" />
16
+ <path d="M12 17h.01" />
17
+ </svg>
18
+ );
19
+ }
@@ -0,0 +1,17 @@
1
+ import type { SVGProps } from "react";
2
+
3
+ export function MinusIcon(props: SVGProps<SVGSVGElement>) {
4
+ return (
5
+ <svg
6
+ xmlns="http://www.w3.org/2000/svg"
7
+ viewBox="0 0 24 24"
8
+ fill="none"
9
+ stroke="currentColor"
10
+ strokeLinecap="round"
11
+ strokeLinejoin="round"
12
+ {...props}
13
+ >
14
+ <path d="M5 12h14" />
15
+ </svg>
16
+ );
17
+ }
@@ -0,0 +1,19 @@
1
+ import type { SVGProps } from "react";
2
+
3
+ export function TriangleAlertIcon(props: SVGProps<SVGSVGElement>) {
4
+ return (
5
+ <svg
6
+ xmlns="http://www.w3.org/2000/svg"
7
+ viewBox="0 0 24 24"
8
+ fill="none"
9
+ stroke="currentColor"
10
+ strokeLinecap="round"
11
+ strokeLinejoin="round"
12
+ {...props}
13
+ >
14
+ <path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3" />
15
+ <path d="M12 9v4" />
16
+ <path d="M12 17h.01" />
17
+ </svg>
18
+ );
19
+ }
@@ -0,0 +1,18 @@
1
+ import type { SVGProps } from "react";
2
+
3
+ export function VideoIcon(props: SVGProps<SVGSVGElement>) {
4
+ return (
5
+ <svg
6
+ xmlns="http://www.w3.org/2000/svg"
7
+ viewBox="0 0 24 24"
8
+ fill="none"
9
+ stroke="currentColor"
10
+ strokeLinecap="round"
11
+ strokeLinejoin="round"
12
+ {...props}
13
+ >
14
+ <path d="m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5" />
15
+ <rect x="2" y="6" width="14" height="12" rx="2" />
16
+ </svg>
17
+ );
18
+ }
package/src/index.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { BookTextIcon } from "lucide-react";
2
1
  import { definePlugin } from "sanity";
3
2
 
3
+ import { BookTextIcon } from "./icons/book-text";
4
4
  import { createHandbookTool } from "./layouts/tool";
5
5
  import { setHandbookEditors } from "./lib/handbook-structure";
6
6
  import { createSanityIcon } from "./lib/icons";
@@ -1,7 +1,8 @@
1
- import { BookOpenTextIcon, BookTextIcon } from "lucide-react";
2
1
  import type { CurrentUser } from "sanity";
3
2
  import type { StructureBuilder } from "sanity/structure";
4
3
 
4
+ import { BookOpenTextIcon } from "../icons/book-open-text";
5
+ import { BookTextIcon } from "../icons/book-text";
5
6
  import { createSanityIcon } from "./icons";
6
7
  import { isPermittedEditor } from "./utils";
7
8
 
package/src/lib/icons.ts CHANGED
@@ -1,18 +1,16 @@
1
- import type { LucideIcon, LucideProps } from "lucide-react";
1
+ import type { ComponentType, SVGProps } from "react";
2
2
  import { createElement } from "react";
3
3
 
4
- /**
5
- * Default properties applied to all Lucide icons throughout the plugin.
6
- */
7
- export const defaultIconProps: LucideProps = { width: "1em", height: "1em", strokeWidth: 1.5 };
4
+ /** Default properties applied to all icons throughout the plugin. */
5
+ export const defaultIconProps: SVGProps<SVGSVGElement> = { width: "1em", height: "1em", strokeWidth: 1.5 };
8
6
 
9
7
  /**
10
- * Creates a Sanity Studio icon component from a Lucide icon with default props applied.
8
+ * Creates a Sanity Studio icon component from an SVG icon with default props applied.
11
9
  *
12
- * @param icon - The Lucide icon component to wrap.
10
+ * @param icon - The icon component to wrap.
13
11
  * @param props - Optional props to merge with defaults.
14
12
  * @returns A React component function for use in Sanity Studio.
15
13
  */
16
- export function createSanityIcon(icon: LucideIcon, props?: LucideProps) {
14
+ export function createSanityIcon(icon: ComponentType<SVGProps<SVGSVGElement>>, props?: SVGProps<SVGSVGElement>) {
17
15
  return () => createElement(icon, { ...defaultIconProps, ...props });
18
16
  }
@@ -1,8 +1,8 @@
1
- import { MessageCircleQuestionMarkIcon } from "lucide-react";
2
1
  import { defineArrayMember, defineField, defineType } from "sanity";
3
2
 
4
3
  import { CalloutPreview } from "../../blocks/callout/preview";
5
4
  import { InlineCodeDecorator, ParagraphDecorator } from "../../components/decorators";
5
+ import { MessageCircleQuestionMarkIcon } from "../../icons/message-circle-question-mark";
6
6
  import { createSanityIcon } from "../../lib/icons";
7
7
  import { linkAnnotation } from "../annotations/link";
8
8
 
@@ -1,7 +1,7 @@
1
- import { CodeIcon } from "lucide-react";
2
1
  import { defineField, defineType } from "sanity";
3
2
 
4
3
  import { CodePreview } from "../../blocks/code/preview";
4
+ import { CodeIcon } from "../../icons/code";
5
5
  import { createSanityIcon } from "../../lib/icons";
6
6
 
7
7
  export const handbookCodeType = defineType({
@@ -1,7 +1,7 @@
1
- import { MinusIcon } from "lucide-react";
2
1
  import { defineField, defineType } from "sanity";
3
2
 
4
3
  import { HorizontalRulePreview } from "../../blocks/horizontal-rule/preview";
4
+ import { MinusIcon } from "../../icons/minus";
5
5
  import { createSanityIcon } from "../../lib/icons";
6
6
 
7
7
  export const handbookHorizontalRuleType = defineType({
@@ -1,7 +1,7 @@
1
- import { ImageIcon } from "lucide-react";
2
1
  import { defineField, defineType } from "sanity";
3
2
 
4
3
  import { ImagePreview } from "../../blocks/image/preview";
4
+ import { ImageIcon } from "../../icons/image";
5
5
  import { createSanityIcon } from "../../lib/icons";
6
6
 
7
7
  export const handbookImageType = defineType({
@@ -1,7 +1,7 @@
1
- import { VideoIcon } from "lucide-react";
2
1
  import { defineField, defineType } from "sanity";
3
2
 
4
3
  import { VideoPreview } from "../../blocks/video/preview";
4
+ import { VideoIcon } from "../../icons/video";
5
5
  import { createSanityIcon } from "../../lib/icons";
6
6
 
7
7
  export const handbookVideoType = defineType({
@@ -1,6 +1,6 @@
1
- import { BookOpenTextIcon } from "lucide-react";
2
1
  import { defineField, defineType } from "sanity";
3
2
 
3
+ import { BookOpenTextIcon } from "../../icons/book-open-text";
4
4
  import { createSanityIcon } from "../../lib/icons";
5
5
  import type { HandbookBlockDefinition, SanityHandbookGuide } from "../../types";
6
6
  import { createGuideContentField } from "../guide-content";
@@ -1,6 +1,7 @@
1
- import { BookTextIcon, ListPlusIcon } from "lucide-react";
2
1
  import { defineArrayMember, defineField, defineType } from "sanity";
3
2
 
3
+ import { BookTextIcon } from "../../icons/book-text";
4
+ import { ListPlusIcon } from "../../icons/list-plus";
4
5
  import { createSanityIcon } from "../../lib/icons";
5
6
  import { isDefined } from "../../lib/utils";
6
7
  import type { SanityHandbook } from "../../types";