@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.cjs
CHANGED
|
@@ -1,6 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
3
|
-
var
|
|
3
|
+
var sanity = require("sanity"), jsxRuntime = require("react/jsx-runtime"), react = require("react"), ui = require("@sanity/ui");
|
|
4
|
+
function BookTextIcon(props) {
|
|
5
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6
|
+
"svg",
|
|
7
|
+
{
|
|
8
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
9
|
+
viewBox: "0 0 24 24",
|
|
10
|
+
fill: "none",
|
|
11
|
+
stroke: "currentColor",
|
|
12
|
+
strokeLinecap: "round",
|
|
13
|
+
strokeLinejoin: "round",
|
|
14
|
+
...props,
|
|
15
|
+
children: [
|
|
16
|
+
/* @__PURE__ */ jsxRuntime.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" }),
|
|
17
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M8 11h8" }),
|
|
18
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M8 7h6" })
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
}
|
|
4
23
|
const ArrowLeftIcon = /* @__PURE__ */ react.forwardRef(function(props, ref) {
|
|
5
24
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6
25
|
"svg",
|
|
@@ -226,6 +245,63 @@ function ContentPanel({ id, title, description, children }) {
|
|
|
226
245
|
}
|
|
227
246
|
);
|
|
228
247
|
}
|
|
248
|
+
function InfoIcon(props) {
|
|
249
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
250
|
+
"svg",
|
|
251
|
+
{
|
|
252
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
253
|
+
viewBox: "0 0 24 24",
|
|
254
|
+
fill: "none",
|
|
255
|
+
stroke: "currentColor",
|
|
256
|
+
strokeLinecap: "round",
|
|
257
|
+
strokeLinejoin: "round",
|
|
258
|
+
...props,
|
|
259
|
+
children: [
|
|
260
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "10" }),
|
|
261
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 16v-4" }),
|
|
262
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 8h.01" })
|
|
263
|
+
]
|
|
264
|
+
}
|
|
265
|
+
);
|
|
266
|
+
}
|
|
267
|
+
function LightbulbIcon(props) {
|
|
268
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
269
|
+
"svg",
|
|
270
|
+
{
|
|
271
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
272
|
+
viewBox: "0 0 24 24",
|
|
273
|
+
fill: "none",
|
|
274
|
+
stroke: "currentColor",
|
|
275
|
+
strokeLinecap: "round",
|
|
276
|
+
strokeLinejoin: "round",
|
|
277
|
+
...props,
|
|
278
|
+
children: [
|
|
279
|
+
/* @__PURE__ */ jsxRuntime.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" }),
|
|
280
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M9 18h6" }),
|
|
281
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M10 22h4" })
|
|
282
|
+
]
|
|
283
|
+
}
|
|
284
|
+
);
|
|
285
|
+
}
|
|
286
|
+
function TriangleAlertIcon(props) {
|
|
287
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
288
|
+
"svg",
|
|
289
|
+
{
|
|
290
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
291
|
+
viewBox: "0 0 24 24",
|
|
292
|
+
fill: "none",
|
|
293
|
+
stroke: "currentColor",
|
|
294
|
+
strokeLinecap: "round",
|
|
295
|
+
strokeLinejoin: "round",
|
|
296
|
+
...props,
|
|
297
|
+
children: [
|
|
298
|
+
/* @__PURE__ */ jsxRuntime.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" }),
|
|
299
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 9v4" }),
|
|
300
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 17h.01" })
|
|
301
|
+
]
|
|
302
|
+
}
|
|
303
|
+
);
|
|
304
|
+
}
|
|
229
305
|
const defaultIconProps = { width: "1em", height: "1em", strokeWidth: 1.5 };
|
|
230
306
|
function createSanityIcon(icon, props) {
|
|
231
307
|
return () => react.createElement(icon, { ...defaultIconProps, ...props });
|
|
@@ -387,7 +463,7 @@ function FieldHints({ tip, info, caution }) {
|
|
|
387
463
|
FieldHint,
|
|
388
464
|
{
|
|
389
465
|
label: "Tip",
|
|
390
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
466
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(LightbulbIcon, { ...defaultIconProps }),
|
|
391
467
|
color: "var(--card-icon-color)",
|
|
392
468
|
open: openHint === "tip",
|
|
393
469
|
onToggle: () => {
|
|
@@ -401,7 +477,7 @@ function FieldHints({ tip, info, caution }) {
|
|
|
401
477
|
FieldHint,
|
|
402
478
|
{
|
|
403
479
|
label: "Information",
|
|
404
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
480
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(InfoIcon, { ...defaultIconProps }),
|
|
405
481
|
color: "var(--card-icon-color)",
|
|
406
482
|
open: openHint === "info",
|
|
407
483
|
onToggle: () => {
|
|
@@ -415,7 +491,7 @@ function FieldHints({ tip, info, caution }) {
|
|
|
415
491
|
FieldHint,
|
|
416
492
|
{
|
|
417
493
|
label: "Caution",
|
|
418
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
494
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(TriangleAlertIcon, { ...defaultIconProps }),
|
|
419
495
|
color: "var(--card-icon-color)",
|
|
420
496
|
open: openHint === "caution",
|
|
421
497
|
onToggle: () => {
|
|
@@ -581,6 +657,28 @@ function DocumentTypesPanels() {
|
|
|
581
657
|
});
|
|
582
658
|
});
|
|
583
659
|
}
|
|
660
|
+
function BookOpenTextIcon(props) {
|
|
661
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
662
|
+
"svg",
|
|
663
|
+
{
|
|
664
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
665
|
+
viewBox: "0 0 24 24",
|
|
666
|
+
fill: "none",
|
|
667
|
+
stroke: "currentColor",
|
|
668
|
+
strokeLinecap: "round",
|
|
669
|
+
strokeLinejoin: "round",
|
|
670
|
+
...props,
|
|
671
|
+
children: [
|
|
672
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 7v14" }),
|
|
673
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M16 12h2" }),
|
|
674
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M16 8h2" }),
|
|
675
|
+
/* @__PURE__ */ jsxRuntime.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" }),
|
|
676
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M6 12h2" }),
|
|
677
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M6 8h2" })
|
|
678
|
+
]
|
|
679
|
+
}
|
|
680
|
+
);
|
|
681
|
+
}
|
|
584
682
|
function isPortableTextSpan(node) {
|
|
585
683
|
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"));
|
|
586
684
|
}
|
|
@@ -976,9 +1074,9 @@ function serializeBlock(options) {
|
|
|
976
1074
|
function noop() {
|
|
977
1075
|
}
|
|
978
1076
|
const variantConfig = {
|
|
979
|
-
tip: { icon:
|
|
980
|
-
info: { icon:
|
|
981
|
-
warning: { icon:
|
|
1077
|
+
tip: { icon: LightbulbIcon, tone: "positive" },
|
|
1078
|
+
info: { icon: InfoIcon, tone: "primary" },
|
|
1079
|
+
warning: { icon: TriangleAlertIcon, tone: "caution" }
|
|
982
1080
|
};
|
|
983
1081
|
function CalloutContent({ variant, children }) {
|
|
984
1082
|
const config = variantConfig[variant], Icon = config.icon;
|
|
@@ -1129,7 +1227,7 @@ function GuideContent({ content }) {
|
|
|
1129
1227
|
}
|
|
1130
1228
|
function GuidesTabs() {
|
|
1131
1229
|
const { configuration, loading } = useHandbookContext();
|
|
1132
|
-
return loading || !isDefined(configuration) ? null : configuration.groups.map((group) => /* @__PURE__ */ jsxRuntime.jsx(SidebarGroup, { heading: group.title, children: group.guides.map((guide) => /* @__PURE__ */ jsxRuntime.jsx(SidebarTab, { id: guide._key, label: guide.title, icon: createSanityIcon(
|
|
1230
|
+
return loading || !isDefined(configuration) ? null : configuration.groups.map((group) => /* @__PURE__ */ jsxRuntime.jsx(SidebarGroup, { heading: group.title, children: group.guides.map((guide) => /* @__PURE__ */ jsxRuntime.jsx(SidebarTab, { id: guide._key, label: guide.title, icon: createSanityIcon(BookOpenTextIcon) }, guide._key)) }, group._key));
|
|
1133
1231
|
}
|
|
1134
1232
|
function GuidesPanels() {
|
|
1135
1233
|
const { configuration, loading } = useHandbookContext();
|
|
@@ -1137,6 +1235,26 @@ function GuidesPanels() {
|
|
|
1137
1235
|
(group) => group.guides.map((guide) => /* @__PURE__ */ jsxRuntime.jsx(ContentPanel, { id: guide._key, title: guide.title, description: guide.description, children: /* @__PURE__ */ jsxRuntime.jsx(GuideContent, { content: guide.content }) }, guide._key))
|
|
1138
1236
|
);
|
|
1139
1237
|
}
|
|
1238
|
+
function LayoutGridIcon(props) {
|
|
1239
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1240
|
+
"svg",
|
|
1241
|
+
{
|
|
1242
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1243
|
+
viewBox: "0 0 24 24",
|
|
1244
|
+
fill: "none",
|
|
1245
|
+
stroke: "currentColor",
|
|
1246
|
+
strokeLinecap: "round",
|
|
1247
|
+
strokeLinejoin: "round",
|
|
1248
|
+
...props,
|
|
1249
|
+
children: [
|
|
1250
|
+
/* @__PURE__ */ jsxRuntime.jsx("rect", { width: "7", height: "7", x: "3", y: "3", rx: "1" }),
|
|
1251
|
+
/* @__PURE__ */ jsxRuntime.jsx("rect", { width: "7", height: "7", x: "14", y: "3", rx: "1" }),
|
|
1252
|
+
/* @__PURE__ */ jsxRuntime.jsx("rect", { width: "7", height: "7", x: "14", y: "14", rx: "1" }),
|
|
1253
|
+
/* @__PURE__ */ jsxRuntime.jsx("rect", { width: "7", height: "7", x: "3", y: "14", rx: "1" })
|
|
1254
|
+
]
|
|
1255
|
+
}
|
|
1256
|
+
);
|
|
1257
|
+
}
|
|
1140
1258
|
function DocumentTypesOverview() {
|
|
1141
1259
|
const { groups, setActiveTab, setSidebarExpanded } = useHandbookContext();
|
|
1142
1260
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexDirection: "column", gap: "2.5rem" }, children: groups.map((group) => {
|
|
@@ -1229,9 +1347,9 @@ function HowToUse() {
|
|
|
1229
1347
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Flex, { align: "center", paddingY: 1, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, weight: "medium", children: "Hints and Warnings" }) }),
|
|
1230
1348
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, muted: !0, children: "Look for these icons next to field names. Hover or click them to reveal additional guidance." }),
|
|
1231
1349
|
/* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 3, marginTop: 2, children: [
|
|
1232
|
-
/* @__PURE__ */ jsxRuntime.jsx(HintRow, { icon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1233
|
-
/* @__PURE__ */ jsxRuntime.jsx(HintRow, { icon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1234
|
-
/* @__PURE__ */ jsxRuntime.jsx(HintRow, { icon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1350
|
+
/* @__PURE__ */ jsxRuntime.jsx(HintRow, { icon: /* @__PURE__ */ jsxRuntime.jsx(LightbulbIcon, { ...defaultIconProps }), children: "Helpful tips and best practices for content editors." }),
|
|
1351
|
+
/* @__PURE__ */ jsxRuntime.jsx(HintRow, { icon: /* @__PURE__ */ jsxRuntime.jsx(InfoIcon, { ...defaultIconProps }), children: "Additional context about how the field is used." }),
|
|
1352
|
+
/* @__PURE__ */ jsxRuntime.jsx(HintRow, { icon: /* @__PURE__ */ jsxRuntime.jsx(TriangleAlertIcon, { ...defaultIconProps }), children: "Important warnings about constraints or potential issues." })
|
|
1235
1353
|
] })
|
|
1236
1354
|
] }),
|
|
1237
1355
|
/* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 3, children: [
|
|
@@ -1244,14 +1362,14 @@ const entries = [
|
|
|
1244
1362
|
{
|
|
1245
1363
|
name: "how-to-use-this-handbook",
|
|
1246
1364
|
title: "How to Use This Handbook",
|
|
1247
|
-
icon: createSanityIcon(
|
|
1365
|
+
icon: createSanityIcon(BookTextIcon),
|
|
1248
1366
|
description: "A quick guide to navigating the Handbook, understanding the information presented for each field, and making the most of tips, hints, and warnings.",
|
|
1249
1367
|
component: HowToUse
|
|
1250
1368
|
},
|
|
1251
1369
|
{
|
|
1252
1370
|
name: "document-types",
|
|
1253
1371
|
title: "Document Types",
|
|
1254
|
-
icon: createSanityIcon(
|
|
1372
|
+
icon: createSanityIcon(LayoutGridIcon),
|
|
1255
1373
|
description: "An overview of all document types, organised by group. Select a document type to view its fields, descriptions, and examples.",
|
|
1256
1374
|
component: DocumentTypesOverview
|
|
1257
1375
|
}
|
|
@@ -1407,8 +1525,8 @@ function handbookStructure(structureBuilder, context) {
|
|
|
1407
1525
|
if (!isPermittedEditor(registeredEditors, context.currentUser?.email)) return [];
|
|
1408
1526
|
const { listItem, document, documentTypeList } = structureBuilder;
|
|
1409
1527
|
return [
|
|
1410
|
-
listItem().title("Handbook").icon(createSanityIcon(
|
|
1411
|
-
listItem().title("Handbook Guides").icon(createSanityIcon(
|
|
1528
|
+
listItem().title("Handbook").icon(createSanityIcon(BookTextIcon)).child(document().id("handbook.handbook").schemaType("handbook.handbook").title("Handbook")),
|
|
1529
|
+
listItem().title("Handbook Guides").icon(createSanityIcon(BookOpenTextIcon)).child(documentTypeList("handbook.guide").title("Handbook Guides"))
|
|
1412
1530
|
];
|
|
1413
1531
|
}
|
|
1414
1532
|
function CalloutPreview({ variant, text }) {
|
|
@@ -1455,6 +1573,25 @@ function InlineCodeDecorator({ children }) {
|
|
|
1455
1573
|
}
|
|
1456
1574
|
);
|
|
1457
1575
|
}
|
|
1576
|
+
function MessageCircleQuestionMarkIcon(props) {
|
|
1577
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1578
|
+
"svg",
|
|
1579
|
+
{
|
|
1580
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1581
|
+
viewBox: "0 0 24 24",
|
|
1582
|
+
fill: "none",
|
|
1583
|
+
stroke: "currentColor",
|
|
1584
|
+
strokeLinecap: "round",
|
|
1585
|
+
strokeLinejoin: "round",
|
|
1586
|
+
...props,
|
|
1587
|
+
children: [
|
|
1588
|
+
/* @__PURE__ */ jsxRuntime.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" }),
|
|
1589
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3" }),
|
|
1590
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 17h.01" })
|
|
1591
|
+
]
|
|
1592
|
+
}
|
|
1593
|
+
);
|
|
1594
|
+
}
|
|
1458
1595
|
const linkAnnotation = sanity.defineArrayMember({
|
|
1459
1596
|
name: "link",
|
|
1460
1597
|
type: "object",
|
|
@@ -1471,7 +1608,7 @@ const linkAnnotation = sanity.defineArrayMember({
|
|
|
1471
1608
|
name: "handbook.callout",
|
|
1472
1609
|
title: "Callout",
|
|
1473
1610
|
type: "object",
|
|
1474
|
-
icon: createSanityIcon(
|
|
1611
|
+
icon: createSanityIcon(MessageCircleQuestionMarkIcon),
|
|
1475
1612
|
description: "A highlighted message block used to draw attention to tips, supplementary information, or warnings.",
|
|
1476
1613
|
preview: {
|
|
1477
1614
|
select: { variant: "variant", body: "body" },
|
|
@@ -1528,11 +1665,29 @@ const linkAnnotation = sanity.defineArrayMember({
|
|
|
1528
1665
|
function CodePreview({ code, language }) {
|
|
1529
1666
|
return isDefined(code) ? /* @__PURE__ */ jsxRuntime.jsx(CodeContent, { code, language }) : null;
|
|
1530
1667
|
}
|
|
1668
|
+
function CodeIcon(props) {
|
|
1669
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1670
|
+
"svg",
|
|
1671
|
+
{
|
|
1672
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1673
|
+
viewBox: "0 0 24 24",
|
|
1674
|
+
fill: "none",
|
|
1675
|
+
stroke: "currentColor",
|
|
1676
|
+
strokeLinecap: "round",
|
|
1677
|
+
strokeLinejoin: "round",
|
|
1678
|
+
...props,
|
|
1679
|
+
children: [
|
|
1680
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "m16 18 6-6-6-6" }),
|
|
1681
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "m8 6-6 6 6 6" })
|
|
1682
|
+
]
|
|
1683
|
+
}
|
|
1684
|
+
);
|
|
1685
|
+
}
|
|
1531
1686
|
const handbookCodeType = sanity.defineType({
|
|
1532
1687
|
name: "handbook.code",
|
|
1533
1688
|
title: "Code",
|
|
1534
1689
|
type: "object",
|
|
1535
|
-
icon: createSanityIcon(
|
|
1690
|
+
icon: createSanityIcon(CodeIcon),
|
|
1536
1691
|
description: "A syntax-highlighted code block with language selection.",
|
|
1537
1692
|
preview: {
|
|
1538
1693
|
select: { code: "code", language: "language" }
|
|
@@ -1571,11 +1726,26 @@ const handbookCodeType = sanity.defineType({
|
|
|
1571
1726
|
function HorizontalRulePreview() {
|
|
1572
1727
|
return /* @__PURE__ */ jsxRuntime.jsx(HorizontalRuleContent, { marginBlock: "0.5rem" });
|
|
1573
1728
|
}
|
|
1729
|
+
function MinusIcon(props) {
|
|
1730
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1731
|
+
"svg",
|
|
1732
|
+
{
|
|
1733
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1734
|
+
viewBox: "0 0 24 24",
|
|
1735
|
+
fill: "none",
|
|
1736
|
+
stroke: "currentColor",
|
|
1737
|
+
strokeLinecap: "round",
|
|
1738
|
+
strokeLinejoin: "round",
|
|
1739
|
+
...props,
|
|
1740
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M5 12h14" })
|
|
1741
|
+
}
|
|
1742
|
+
);
|
|
1743
|
+
}
|
|
1574
1744
|
const handbookHorizontalRuleType = sanity.defineType({
|
|
1575
1745
|
name: "handbook.horizontalRule",
|
|
1576
1746
|
title: "Horizontal Rule",
|
|
1577
1747
|
type: "object",
|
|
1578
|
-
icon: createSanityIcon(
|
|
1748
|
+
icon: createSanityIcon(MinusIcon),
|
|
1579
1749
|
description: "A visual divider between sections of content.",
|
|
1580
1750
|
preview: {
|
|
1581
1751
|
prepare() {
|
|
@@ -1599,11 +1769,30 @@ const handbookHorizontalRuleType = sanity.defineType({
|
|
|
1599
1769
|
function ImagePreview({ url, alt, caption }) {
|
|
1600
1770
|
return isDefined(url) ? /* @__PURE__ */ jsxRuntime.jsx("div", { style: { padding: "0.5rem" }, children: /* @__PURE__ */ jsxRuntime.jsx(ImageContent, { url, alt, caption }) }) : null;
|
|
1601
1771
|
}
|
|
1772
|
+
function ImageIcon(props) {
|
|
1773
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1774
|
+
"svg",
|
|
1775
|
+
{
|
|
1776
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1777
|
+
viewBox: "0 0 24 24",
|
|
1778
|
+
fill: "none",
|
|
1779
|
+
stroke: "currentColor",
|
|
1780
|
+
strokeLinecap: "round",
|
|
1781
|
+
strokeLinejoin: "round",
|
|
1782
|
+
...props,
|
|
1783
|
+
children: [
|
|
1784
|
+
/* @__PURE__ */ jsxRuntime.jsx("rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", ry: "2" }),
|
|
1785
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "9", cy: "9", r: "2" }),
|
|
1786
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21" })
|
|
1787
|
+
]
|
|
1788
|
+
}
|
|
1789
|
+
);
|
|
1790
|
+
}
|
|
1602
1791
|
const handbookImageType = sanity.defineType({
|
|
1603
1792
|
name: "handbook.image",
|
|
1604
1793
|
title: "Image",
|
|
1605
1794
|
type: "object",
|
|
1606
|
-
icon: createSanityIcon(
|
|
1795
|
+
icon: createSanityIcon(ImageIcon),
|
|
1607
1796
|
description: "An image with optional caption and alternative text for accessibility.",
|
|
1608
1797
|
preview: {
|
|
1609
1798
|
select: { caption: "caption", alt: "alt", url: "asset.asset.url" }
|
|
@@ -1636,11 +1825,29 @@ const handbookImageType = sanity.defineType({
|
|
|
1636
1825
|
function VideoPreview({ url, caption }) {
|
|
1637
1826
|
return isDefined(url) ? /* @__PURE__ */ jsxRuntime.jsx("div", { style: { padding: "0.5rem" }, children: /* @__PURE__ */ jsxRuntime.jsx(VideoContent, { url, caption }) }) : null;
|
|
1638
1827
|
}
|
|
1828
|
+
function VideoIcon(props) {
|
|
1829
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1830
|
+
"svg",
|
|
1831
|
+
{
|
|
1832
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1833
|
+
viewBox: "0 0 24 24",
|
|
1834
|
+
fill: "none",
|
|
1835
|
+
stroke: "currentColor",
|
|
1836
|
+
strokeLinecap: "round",
|
|
1837
|
+
strokeLinejoin: "round",
|
|
1838
|
+
...props,
|
|
1839
|
+
children: [
|
|
1840
|
+
/* @__PURE__ */ jsxRuntime.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" }),
|
|
1841
|
+
/* @__PURE__ */ jsxRuntime.jsx("rect", { x: "2", y: "6", width: "14", height: "12", rx: "2" })
|
|
1842
|
+
]
|
|
1843
|
+
}
|
|
1844
|
+
);
|
|
1845
|
+
}
|
|
1639
1846
|
const handbookVideoType = sanity.defineType({
|
|
1640
1847
|
name: "handbook.video",
|
|
1641
1848
|
title: "Video",
|
|
1642
1849
|
type: "object",
|
|
1643
|
-
icon: createSanityIcon(
|
|
1850
|
+
icon: createSanityIcon(VideoIcon),
|
|
1644
1851
|
description: "An uploaded video with optional caption.",
|
|
1645
1852
|
preview: {
|
|
1646
1853
|
select: { caption: "caption", url: "asset.asset.url" }
|
|
@@ -1707,7 +1914,7 @@ function createHandbookGuideType(customBlocks = []) {
|
|
|
1707
1914
|
name: "handbook.guide",
|
|
1708
1915
|
title: "Handbook Guide",
|
|
1709
1916
|
type: "document",
|
|
1710
|
-
icon: createSanityIcon(
|
|
1917
|
+
icon: createSanityIcon(BookOpenTextIcon),
|
|
1711
1918
|
description: "A handbook page authored with rich text, images, and custom blocks.",
|
|
1712
1919
|
preview: {
|
|
1713
1920
|
select: { title: "title", description: "description" },
|
|
@@ -1736,11 +1943,32 @@ function createHandbookGuideType(customBlocks = []) {
|
|
|
1736
1943
|
]
|
|
1737
1944
|
});
|
|
1738
1945
|
}
|
|
1946
|
+
function ListPlusIcon(props) {
|
|
1947
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1948
|
+
"svg",
|
|
1949
|
+
{
|
|
1950
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1951
|
+
viewBox: "0 0 24 24",
|
|
1952
|
+
fill: "none",
|
|
1953
|
+
stroke: "currentColor",
|
|
1954
|
+
strokeLinecap: "round",
|
|
1955
|
+
strokeLinejoin: "round",
|
|
1956
|
+
...props,
|
|
1957
|
+
children: [
|
|
1958
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M16 5H3" }),
|
|
1959
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M11 12H3" }),
|
|
1960
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M16 19H3" }),
|
|
1961
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M18 9v6" }),
|
|
1962
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M21 12h-6" })
|
|
1963
|
+
]
|
|
1964
|
+
}
|
|
1965
|
+
);
|
|
1966
|
+
}
|
|
1739
1967
|
const handbookType = sanity.defineType({
|
|
1740
1968
|
name: "handbook.handbook",
|
|
1741
1969
|
title: "Handbook",
|
|
1742
1970
|
type: "document",
|
|
1743
|
-
icon: createSanityIcon(
|
|
1971
|
+
icon: createSanityIcon(BookTextIcon),
|
|
1744
1972
|
description: "Defines the structure and ordering of the handbook, including groups and their guides.",
|
|
1745
1973
|
preview: {
|
|
1746
1974
|
prepare() {
|
|
@@ -1757,7 +1985,7 @@ const handbookType = sanity.defineType({
|
|
|
1757
1985
|
sanity.defineArrayMember({
|
|
1758
1986
|
name: "group",
|
|
1759
1987
|
type: "object",
|
|
1760
|
-
icon: createSanityIcon(
|
|
1988
|
+
icon: createSanityIcon(ListPlusIcon),
|
|
1761
1989
|
fields: [
|
|
1762
1990
|
sanity.defineField({
|
|
1763
1991
|
name: "title",
|
|
@@ -1854,7 +2082,7 @@ function handbookPlugin(config) {
|
|
|
1854
2082
|
{
|
|
1855
2083
|
name: "handbook",
|
|
1856
2084
|
title: config?.title ?? "Handbook",
|
|
1857
|
-
icon: createSanityIcon(
|
|
2085
|
+
icon: createSanityIcon(BookTextIcon),
|
|
1858
2086
|
component: createHandbookTool({ ...config, blocks: customBlocks })
|
|
1859
2087
|
}
|
|
1860
2088
|
]
|