@sanity/hierarchical-document-list
4.0.04.0.1
dist/index.js~
dist/index.jsModified+12−7
Index: package/dist/index.js
===================================================================
--- package/dist/index.js
+++ package/dist/index.js
@@ -1,12 +1,14 @@
+import "@sanity/ui/styles.css";
import * as Patch from "sanity";
import { FormField, IntentButton, PatchEvent, Preview, TextWithTone, definePlugin, defineType, prefixPath, setIfMissing, useClient, useDocumentOperation, useEditState, useRelativeTime, useSchema } from "sanity";
import { c } from "react/compiler-runtime";
-import { Box, Button, Card, Container, Flex, Heading, Inline, Menu, MenuButton, MenuDivider, MenuItem, Spinner, Stack, Text, Tooltip } from "@sanity/ui";
+import { Box, Button, Card, Container, Flex, Heading, Inline, Spinner, Stack, Text } from "@sanity/ui";
import { Children, Fragment, cloneElement, createContext, useContext, useEffect, useReducer, useState } from "react";
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
import { SortableTreeWithoutDndContext, getFlatDataFromTree, getVisibleNodeCount, isDescendant } from "@nosferatu500/react-sortable-tree";
import { AddCircleIcon } from "@sanity/icons/AddCircle";
+import { Tooltip } from "@sanity/ui/tooltip";
import { DndProvider } from "react-dnd";
import { HTML5Backend } from "react-dnd-html5-backend";
import { randomKey } from "@sanity/util/content";
import { HelpCircleIcon } from "@sanity/icons/HelpCircle";
@@ -16,8 +18,9 @@
import { CopyIcon } from "@sanity/icons/Copy";
import { EllipsisVerticalIcon } from "@sanity/icons/EllipsisVertical";
import { LaunchIcon } from "@sanity/icons/Launch";
import { RemoveCircleIcon } from "@sanity/icons/RemoveCircle";
+import { Menu, MenuButton, MenuDivider, MenuItem } from "@sanity/ui/menu";
import { blue, cyan, gray, red } from "@sanity/color";
import { ChevronDownIcon } from "@sanity/icons/ChevronDown";
import { ChevronRightIcon } from "@sanity/icons/ChevronRight";
import { DragHandleIcon } from "@sanity/icons/DragHandle";
@@ -430,9 +433,9 @@
if (typeof patchData == "object" && patchData) {
let newObject = {};
for (let key of Object.keys(patchData)) {
let value = patchData[key];
- key === "_type" && typeof value == "string" && [INTERNAL_NODE_TYPE, INTERNAL_NODE_VALUE_TYPE].includes(value) ? newObject[key] = getSchemaTypeName(documentType, value === INTERNAL_NODE_TYPE ? "node" : "nodeValue") : newObject[key] = injectNodeTypeInPatches(value, documentType);
+ newObject[key] = key === "_type" && typeof value == "string" && [INTERNAL_NODE_TYPE, INTERNAL_NODE_VALUE_TYPE].includes(value) ? getSchemaTypeName(documentType, value === INTERNAL_NODE_TYPE ? "node" : "nodeValue") : injectNodeTypeInPatches(value, documentType);
}
return newObject;
}
return patchData;
@@ -785,13 +788,15 @@
let t1;
$[8] !== listIndex || $[9] !== scaffoldBlockPxWidth || $[10] !== swapDepth || $[11] !== swapFrom || $[12] !== swapLength || $[13] !== treeIndex ? (t1 = (lowerSiblingCount, i) => {
if (lowerSiblingCount < 0 || treeIndex === listIndex || i !== swapDepth) return null;
let highlightLineClass;
- return highlightLineClass = listIndex === (swapFrom || 0) + (swapLength || 0) - 1 ? "rst__highlightBottomLeftCorner" : treeIndex === swapFrom ? "rst__highlightTopLeftCorner" : "rst__highlightLineVertical", /* @__PURE__ */ jsx("div", {
- style: {
- width: scaffoldBlockPxWidth,
- left: scaffoldBlockPxWidth * i
- },
+ highlightLineClass = listIndex === (swapFrom || 0) + (swapLength || 0) - 1 ? "rst__highlightBottomLeftCorner" : treeIndex === swapFrom ? "rst__highlightTopLeftCorner" : "rst__highlightLineVertical";
+ let style = {
+ width: scaffoldBlockPxWidth,
+ left: scaffoldBlockPxWidth * i
+ };
+ return /* @__PURE__ */ jsx("div", {
+ style,
className: `rst__unclickable rst__absoluteLineBlock ${highlightLineClass || ""}`,
tabIndex: -1
}, i);
}, $[8] = listIndex, $[9] = scaffoldBlockPxWidth, $[10] = swapDepth, $[11] = swapFrom, $[12] = swapLength, $[13] = treeIndex, $[14] = t1) : t1 = $[14], t0 = lowerSiblingCounts.map(t1), $[0] = listIndex, $[1] = lowerSiblingCounts, $[2] = scaffoldBlockPxWidth, $[3] = swapDepth, $[4] = swapFrom, $[5] = swapLength, $[6] = treeIndex, $[7] = t0;