@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/dist/index.cjs +252 -24
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +228 -1
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/src/blocks/callout/content.tsx +3 -1
- package/src/components/field.tsx +3 -1
- package/src/components/guides.tsx +1 -2
- package/src/getting-started/how-to-use.tsx +3 -1
- package/src/getting-started/overview.tsx +2 -1
- package/src/icons/book-open-text.tsx +22 -0
- package/src/icons/book-text.tsx +19 -0
- package/src/icons/code.tsx +18 -0
- package/src/icons/image.tsx +19 -0
- package/src/icons/info.tsx +19 -0
- package/src/icons/layout-grid.tsx +20 -0
- package/src/icons/lightbulb.tsx +19 -0
- package/src/icons/list-plus.tsx +21 -0
- package/src/icons/message-circle-question-mark.tsx +19 -0
- package/src/icons/minus.tsx +17 -0
- package/src/icons/triangle-alert.tsx +19 -0
- package/src/icons/video.tsx +18 -0
- package/src/index.ts +1 -1
- package/src/lib/handbook-structure.ts +2 -1
- package/src/lib/icons.ts +6 -8
- package/src/schemas/blocks/callout.ts +1 -1
- package/src/schemas/blocks/code.ts +1 -1
- package/src/schemas/blocks/horizontal-rule.ts +1 -1
- package/src/schemas/blocks/image.ts +1 -1
- package/src/schemas/blocks/video.ts +1 -1
- package/src/schemas/types/guide.ts +1 -1
- package/src/schemas/types/handbook.ts +2 -1
package/dist/index.js
CHANGED
|
@@ -1,8 +1,26 @@
|
|
|
1
|
-
import { LightbulbIcon, InfoIcon, TriangleAlertIcon, BookOpenTextIcon, BookTextIcon, LayoutGridIcon, MessageCircleQuestionMarkIcon, CodeIcon, MinusIcon, ImageIcon, VideoIcon, ListPlusIcon } from "lucide-react";
|
|
2
1
|
import { useClient, useSchema, defineArrayMember, defineField, defineType, useCurrentUser, definePlugin } from "sanity";
|
|
3
2
|
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
4
3
|
import { forwardRef, useState, useEffect, createContext, useContext, useRef, createElement, useCallback, useMemo } from "react";
|
|
5
4
|
import { Card, Flex, Text, Box, Stack, Heading, useClickOutsideEvent, Popover, Code, Button } from "@sanity/ui";
|
|
5
|
+
function BookTextIcon(props) {
|
|
6
|
+
return /* @__PURE__ */ jsxs(
|
|
7
|
+
"svg",
|
|
8
|
+
{
|
|
9
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
10
|
+
viewBox: "0 0 24 24",
|
|
11
|
+
fill: "none",
|
|
12
|
+
stroke: "currentColor",
|
|
13
|
+
strokeLinecap: "round",
|
|
14
|
+
strokeLinejoin: "round",
|
|
15
|
+
...props,
|
|
16
|
+
children: [
|
|
17
|
+
/* @__PURE__ */ jsx("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" }),
|
|
18
|
+
/* @__PURE__ */ jsx("path", { d: "M8 11h8" }),
|
|
19
|
+
/* @__PURE__ */ jsx("path", { d: "M8 7h6" })
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
}
|
|
6
24
|
const ArrowLeftIcon = /* @__PURE__ */ forwardRef(function(props, ref) {
|
|
7
25
|
return /* @__PURE__ */ jsxs(
|
|
8
26
|
"svg",
|
|
@@ -228,6 +246,63 @@ function ContentPanel({ id, title, description, children }) {
|
|
|
228
246
|
}
|
|
229
247
|
);
|
|
230
248
|
}
|
|
249
|
+
function InfoIcon(props) {
|
|
250
|
+
return /* @__PURE__ */ jsxs(
|
|
251
|
+
"svg",
|
|
252
|
+
{
|
|
253
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
254
|
+
viewBox: "0 0 24 24",
|
|
255
|
+
fill: "none",
|
|
256
|
+
stroke: "currentColor",
|
|
257
|
+
strokeLinecap: "round",
|
|
258
|
+
strokeLinejoin: "round",
|
|
259
|
+
...props,
|
|
260
|
+
children: [
|
|
261
|
+
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "10" }),
|
|
262
|
+
/* @__PURE__ */ jsx("path", { d: "M12 16v-4" }),
|
|
263
|
+
/* @__PURE__ */ jsx("path", { d: "M12 8h.01" })
|
|
264
|
+
]
|
|
265
|
+
}
|
|
266
|
+
);
|
|
267
|
+
}
|
|
268
|
+
function LightbulbIcon(props) {
|
|
269
|
+
return /* @__PURE__ */ jsxs(
|
|
270
|
+
"svg",
|
|
271
|
+
{
|
|
272
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
273
|
+
viewBox: "0 0 24 24",
|
|
274
|
+
fill: "none",
|
|
275
|
+
stroke: "currentColor",
|
|
276
|
+
strokeLinecap: "round",
|
|
277
|
+
strokeLinejoin: "round",
|
|
278
|
+
...props,
|
|
279
|
+
children: [
|
|
280
|
+
/* @__PURE__ */ jsx("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" }),
|
|
281
|
+
/* @__PURE__ */ jsx("path", { d: "M9 18h6" }),
|
|
282
|
+
/* @__PURE__ */ jsx("path", { d: "M10 22h4" })
|
|
283
|
+
]
|
|
284
|
+
}
|
|
285
|
+
);
|
|
286
|
+
}
|
|
287
|
+
function TriangleAlertIcon(props) {
|
|
288
|
+
return /* @__PURE__ */ jsxs(
|
|
289
|
+
"svg",
|
|
290
|
+
{
|
|
291
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
292
|
+
viewBox: "0 0 24 24",
|
|
293
|
+
fill: "none",
|
|
294
|
+
stroke: "currentColor",
|
|
295
|
+
strokeLinecap: "round",
|
|
296
|
+
strokeLinejoin: "round",
|
|
297
|
+
...props,
|
|
298
|
+
children: [
|
|
299
|
+
/* @__PURE__ */ jsx("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" }),
|
|
300
|
+
/* @__PURE__ */ jsx("path", { d: "M12 9v4" }),
|
|
301
|
+
/* @__PURE__ */ jsx("path", { d: "M12 17h.01" })
|
|
302
|
+
]
|
|
303
|
+
}
|
|
304
|
+
);
|
|
305
|
+
}
|
|
231
306
|
const defaultIconProps = { width: "1em", height: "1em", strokeWidth: 1.5 };
|
|
232
307
|
function createSanityIcon(icon, props) {
|
|
233
308
|
return () => createElement(icon, { ...defaultIconProps, ...props });
|
|
@@ -583,6 +658,28 @@ function DocumentTypesPanels() {
|
|
|
583
658
|
});
|
|
584
659
|
});
|
|
585
660
|
}
|
|
661
|
+
function BookOpenTextIcon(props) {
|
|
662
|
+
return /* @__PURE__ */ jsxs(
|
|
663
|
+
"svg",
|
|
664
|
+
{
|
|
665
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
666
|
+
viewBox: "0 0 24 24",
|
|
667
|
+
fill: "none",
|
|
668
|
+
stroke: "currentColor",
|
|
669
|
+
strokeLinecap: "round",
|
|
670
|
+
strokeLinejoin: "round",
|
|
671
|
+
...props,
|
|
672
|
+
children: [
|
|
673
|
+
/* @__PURE__ */ jsx("path", { d: "M12 7v14" }),
|
|
674
|
+
/* @__PURE__ */ jsx("path", { d: "M16 12h2" }),
|
|
675
|
+
/* @__PURE__ */ jsx("path", { d: "M16 8h2" }),
|
|
676
|
+
/* @__PURE__ */ jsx("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" }),
|
|
677
|
+
/* @__PURE__ */ jsx("path", { d: "M6 12h2" }),
|
|
678
|
+
/* @__PURE__ */ jsx("path", { d: "M6 8h2" })
|
|
679
|
+
]
|
|
680
|
+
}
|
|
681
|
+
);
|
|
682
|
+
}
|
|
586
683
|
function isPortableTextSpan(node) {
|
|
587
684
|
return node._type === "span" && "text" in node && typeof node.text == "string" && (node.marks === void 0 || Array.isArray(node.marks) && node.marks.every((mark) => typeof mark == "string"));
|
|
588
685
|
}
|
|
@@ -1139,6 +1236,26 @@ function GuidesPanels() {
|
|
|
1139
1236
|
(group) => group.guides.map((guide) => /* @__PURE__ */ jsx(ContentPanel, { id: guide._key, title: guide.title, description: guide.description, children: /* @__PURE__ */ jsx(GuideContent, { content: guide.content }) }, guide._key))
|
|
1140
1237
|
);
|
|
1141
1238
|
}
|
|
1239
|
+
function LayoutGridIcon(props) {
|
|
1240
|
+
return /* @__PURE__ */ jsxs(
|
|
1241
|
+
"svg",
|
|
1242
|
+
{
|
|
1243
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1244
|
+
viewBox: "0 0 24 24",
|
|
1245
|
+
fill: "none",
|
|
1246
|
+
stroke: "currentColor",
|
|
1247
|
+
strokeLinecap: "round",
|
|
1248
|
+
strokeLinejoin: "round",
|
|
1249
|
+
...props,
|
|
1250
|
+
children: [
|
|
1251
|
+
/* @__PURE__ */ jsx("rect", { width: "7", height: "7", x: "3", y: "3", rx: "1" }),
|
|
1252
|
+
/* @__PURE__ */ jsx("rect", { width: "7", height: "7", x: "14", y: "3", rx: "1" }),
|
|
1253
|
+
/* @__PURE__ */ jsx("rect", { width: "7", height: "7", x: "14", y: "14", rx: "1" }),
|
|
1254
|
+
/* @__PURE__ */ jsx("rect", { width: "7", height: "7", x: "3", y: "14", rx: "1" })
|
|
1255
|
+
]
|
|
1256
|
+
}
|
|
1257
|
+
);
|
|
1258
|
+
}
|
|
1142
1259
|
function DocumentTypesOverview() {
|
|
1143
1260
|
const { groups, setActiveTab, setSidebarExpanded } = useHandbookContext();
|
|
1144
1261
|
return /* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column", gap: "2.5rem" }, children: groups.map((group) => {
|
|
@@ -1457,6 +1574,25 @@ function InlineCodeDecorator({ children }) {
|
|
|
1457
1574
|
}
|
|
1458
1575
|
);
|
|
1459
1576
|
}
|
|
1577
|
+
function MessageCircleQuestionMarkIcon(props) {
|
|
1578
|
+
return /* @__PURE__ */ jsxs(
|
|
1579
|
+
"svg",
|
|
1580
|
+
{
|
|
1581
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1582
|
+
viewBox: "0 0 24 24",
|
|
1583
|
+
fill: "none",
|
|
1584
|
+
stroke: "currentColor",
|
|
1585
|
+
strokeLinecap: "round",
|
|
1586
|
+
strokeLinejoin: "round",
|
|
1587
|
+
...props,
|
|
1588
|
+
children: [
|
|
1589
|
+
/* @__PURE__ */ jsx("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" }),
|
|
1590
|
+
/* @__PURE__ */ jsx("path", { d: "M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3" }),
|
|
1591
|
+
/* @__PURE__ */ jsx("path", { d: "M12 17h.01" })
|
|
1592
|
+
]
|
|
1593
|
+
}
|
|
1594
|
+
);
|
|
1595
|
+
}
|
|
1460
1596
|
const linkAnnotation = defineArrayMember({
|
|
1461
1597
|
name: "link",
|
|
1462
1598
|
type: "object",
|
|
@@ -1530,6 +1666,24 @@ const linkAnnotation = defineArrayMember({
|
|
|
1530
1666
|
function CodePreview({ code, language }) {
|
|
1531
1667
|
return isDefined(code) ? /* @__PURE__ */ jsx(CodeContent, { code, language }) : null;
|
|
1532
1668
|
}
|
|
1669
|
+
function CodeIcon(props) {
|
|
1670
|
+
return /* @__PURE__ */ jsxs(
|
|
1671
|
+
"svg",
|
|
1672
|
+
{
|
|
1673
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1674
|
+
viewBox: "0 0 24 24",
|
|
1675
|
+
fill: "none",
|
|
1676
|
+
stroke: "currentColor",
|
|
1677
|
+
strokeLinecap: "round",
|
|
1678
|
+
strokeLinejoin: "round",
|
|
1679
|
+
...props,
|
|
1680
|
+
children: [
|
|
1681
|
+
/* @__PURE__ */ jsx("path", { d: "m16 18 6-6-6-6" }),
|
|
1682
|
+
/* @__PURE__ */ jsx("path", { d: "m8 6-6 6 6 6" })
|
|
1683
|
+
]
|
|
1684
|
+
}
|
|
1685
|
+
);
|
|
1686
|
+
}
|
|
1533
1687
|
const handbookCodeType = defineType({
|
|
1534
1688
|
name: "handbook.code",
|
|
1535
1689
|
title: "Code",
|
|
@@ -1573,6 +1727,21 @@ const handbookCodeType = defineType({
|
|
|
1573
1727
|
function HorizontalRulePreview() {
|
|
1574
1728
|
return /* @__PURE__ */ jsx(HorizontalRuleContent, { marginBlock: "0.5rem" });
|
|
1575
1729
|
}
|
|
1730
|
+
function MinusIcon(props) {
|
|
1731
|
+
return /* @__PURE__ */ jsx(
|
|
1732
|
+
"svg",
|
|
1733
|
+
{
|
|
1734
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1735
|
+
viewBox: "0 0 24 24",
|
|
1736
|
+
fill: "none",
|
|
1737
|
+
stroke: "currentColor",
|
|
1738
|
+
strokeLinecap: "round",
|
|
1739
|
+
strokeLinejoin: "round",
|
|
1740
|
+
...props,
|
|
1741
|
+
children: /* @__PURE__ */ jsx("path", { d: "M5 12h14" })
|
|
1742
|
+
}
|
|
1743
|
+
);
|
|
1744
|
+
}
|
|
1576
1745
|
const handbookHorizontalRuleType = defineType({
|
|
1577
1746
|
name: "handbook.horizontalRule",
|
|
1578
1747
|
title: "Horizontal Rule",
|
|
@@ -1601,6 +1770,25 @@ const handbookHorizontalRuleType = defineType({
|
|
|
1601
1770
|
function ImagePreview({ url, alt, caption }) {
|
|
1602
1771
|
return isDefined(url) ? /* @__PURE__ */ jsx("div", { style: { padding: "0.5rem" }, children: /* @__PURE__ */ jsx(ImageContent, { url, alt, caption }) }) : null;
|
|
1603
1772
|
}
|
|
1773
|
+
function ImageIcon(props) {
|
|
1774
|
+
return /* @__PURE__ */ jsxs(
|
|
1775
|
+
"svg",
|
|
1776
|
+
{
|
|
1777
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1778
|
+
viewBox: "0 0 24 24",
|
|
1779
|
+
fill: "none",
|
|
1780
|
+
stroke: "currentColor",
|
|
1781
|
+
strokeLinecap: "round",
|
|
1782
|
+
strokeLinejoin: "round",
|
|
1783
|
+
...props,
|
|
1784
|
+
children: [
|
|
1785
|
+
/* @__PURE__ */ jsx("rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", ry: "2" }),
|
|
1786
|
+
/* @__PURE__ */ jsx("circle", { cx: "9", cy: "9", r: "2" }),
|
|
1787
|
+
/* @__PURE__ */ jsx("path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21" })
|
|
1788
|
+
]
|
|
1789
|
+
}
|
|
1790
|
+
);
|
|
1791
|
+
}
|
|
1604
1792
|
const handbookImageType = defineType({
|
|
1605
1793
|
name: "handbook.image",
|
|
1606
1794
|
title: "Image",
|
|
@@ -1638,6 +1826,24 @@ const handbookImageType = defineType({
|
|
|
1638
1826
|
function VideoPreview({ url, caption }) {
|
|
1639
1827
|
return isDefined(url) ? /* @__PURE__ */ jsx("div", { style: { padding: "0.5rem" }, children: /* @__PURE__ */ jsx(VideoContent, { url, caption }) }) : null;
|
|
1640
1828
|
}
|
|
1829
|
+
function VideoIcon(props) {
|
|
1830
|
+
return /* @__PURE__ */ jsxs(
|
|
1831
|
+
"svg",
|
|
1832
|
+
{
|
|
1833
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1834
|
+
viewBox: "0 0 24 24",
|
|
1835
|
+
fill: "none",
|
|
1836
|
+
stroke: "currentColor",
|
|
1837
|
+
strokeLinecap: "round",
|
|
1838
|
+
strokeLinejoin: "round",
|
|
1839
|
+
...props,
|
|
1840
|
+
children: [
|
|
1841
|
+
/* @__PURE__ */ jsx("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" }),
|
|
1842
|
+
/* @__PURE__ */ jsx("rect", { x: "2", y: "6", width: "14", height: "12", rx: "2" })
|
|
1843
|
+
]
|
|
1844
|
+
}
|
|
1845
|
+
);
|
|
1846
|
+
}
|
|
1641
1847
|
const handbookVideoType = defineType({
|
|
1642
1848
|
name: "handbook.video",
|
|
1643
1849
|
title: "Video",
|
|
@@ -1738,6 +1944,27 @@ function createHandbookGuideType(customBlocks = []) {
|
|
|
1738
1944
|
]
|
|
1739
1945
|
});
|
|
1740
1946
|
}
|
|
1947
|
+
function ListPlusIcon(props) {
|
|
1948
|
+
return /* @__PURE__ */ jsxs(
|
|
1949
|
+
"svg",
|
|
1950
|
+
{
|
|
1951
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1952
|
+
viewBox: "0 0 24 24",
|
|
1953
|
+
fill: "none",
|
|
1954
|
+
stroke: "currentColor",
|
|
1955
|
+
strokeLinecap: "round",
|
|
1956
|
+
strokeLinejoin: "round",
|
|
1957
|
+
...props,
|
|
1958
|
+
children: [
|
|
1959
|
+
/* @__PURE__ */ jsx("path", { d: "M16 5H3" }),
|
|
1960
|
+
/* @__PURE__ */ jsx("path", { d: "M11 12H3" }),
|
|
1961
|
+
/* @__PURE__ */ jsx("path", { d: "M16 19H3" }),
|
|
1962
|
+
/* @__PURE__ */ jsx("path", { d: "M18 9v6" }),
|
|
1963
|
+
/* @__PURE__ */ jsx("path", { d: "M21 12h-6" })
|
|
1964
|
+
]
|
|
1965
|
+
}
|
|
1966
|
+
);
|
|
1967
|
+
}
|
|
1741
1968
|
const handbookType = defineType({
|
|
1742
1969
|
name: "handbook.handbook",
|
|
1743
1970
|
title: "Handbook",
|