sanity-plugin-workspace-home
3.0.203.0.21
dist/index.js~
dist/index.jsModified+23−31
Index: package/dist/index.js
===================================================================
--- package/dist/index.js
+++ package/dist/index.js
@@ -12,9 +12,9 @@
if (isValidElementType(Icon)) return /* @__PURE__ */ jsx(Icon, {});
if (isValidElement(Icon)) return Icon;
}, MediaCard = styled(Card).withConfig({
displayName: "MediaCard",
- componentId: "sc-1dgrtp-0"
+ componentId: "sc-xyqtw-0"
})`width:35px;height:35px;svg{width:100%;height:100%;}`;
function WorkspacePreview(props) {
let $ = c(39), { workspace, index, query } = props, { icon, title, name, subtitle, dataset } = workspace, { setActiveWorkspace } = useActiveWorkspace(), t0;
$[0] === icon ? t0 = $[1] : (t0 = createIcon(icon), $[0] = icon, $[1] = t0);
@@ -143,24 +143,21 @@
}), $[36] = t1, $[37] = t18, $[38] = t19) : t19 = $[38], t19;
}
const TallCard = styled(Card).withConfig({
displayName: "TallCard",
- componentId: "sc-5cpcf-0"
+ componentId: "sc-1iob-0"
})`min-height:100%;`;
function WorkspaceHome() {
- let $ = c(29), t0 = useWorkspaces(), workspaces;
+ let $ = c(23), t0 = useWorkspaces(), workspaces;
$[0] === t0 ? workspaces = $[1] : ([, ...workspaces] = t0, $[0] = t0, $[1] = workspaces);
let { setActiveWorkspace } = useActiveWorkspace(), [query, setQuery] = useState(""), searchInput = useRef(null), t1;
$[2] === Symbol.for("react.memo_cache_sentinel") ? (t1 = (e) => {
setQuery(e.target.value);
}, $[2] = t1) : t1 = $[2];
let handleQuery = t1, t2;
- if ($[3] !== query || $[4] !== workspaces) {
- let t3;
- $[6] === query ? t3 = $[7] : (t3 = (workspace) => workspace.name.toLowerCase().includes(query.toLowerCase()) || workspace.dataset.toLowerCase().includes(query.toLowerCase()) || workspace.title.toLowerCase().includes(query.toLowerCase()), $[6] = query, $[7] = t3), t2 = workspaces.filter(t3), $[3] = query, $[4] = workspaces, $[5] = t2;
- } else t2 = $[5];
+ $[3] !== query || $[4] !== workspaces ? (t2 = workspaces.filter((workspace) => workspace.name.toLowerCase().includes(query.toLowerCase()) || workspace.dataset.toLowerCase().includes(query.toLowerCase()) || workspace.title.toLowerCase().includes(query.toLowerCase())), $[3] = query, $[4] = workspaces, $[5] = t2) : t2 = $[5];
let filteredWorkspaces = t2, t3, t4;
- $[8] !== query || $[9] !== setActiveWorkspace || $[10] !== workspaces ? (t3 = () => {
+ $[6] !== query || $[7] !== setActiveWorkspace || $[8] !== workspaces ? (t3 = () => {
let handleKeypress = (event) => {
if (query || searchInput.current === document.activeElement) return;
let index = parseInt(event.key, 10) - 1;
index >= 0 && index < workspaces.length && setActiveWorkspace(workspaces[index].name);
@@ -171,53 +168,48 @@
}, t4 = [
query,
workspaces,
setActiveWorkspace
- ], $[8] = query, $[9] = setActiveWorkspace, $[10] = workspaces, $[11] = t3, $[12] = t4) : (t3 = $[11], t4 = $[12]), useEffect(t3, t4);
+ ], $[6] = query, $[7] = setActiveWorkspace, $[8] = workspaces, $[9] = t3, $[10] = t4) : (t3 = $[9], t4 = $[10]), useEffect(t3, t4);
let t5;
- $[13] === Symbol.for("react.memo_cache_sentinel") ? (t5 = [
+ $[11] === Symbol.for("react.memo_cache_sentinel") ? (t5 = [
4,
5,
6,
6
- ], $[13] = t5) : t5 = $[13];
+ ], $[11] = t5) : t5 = $[11];
let t6;
- $[14] === Symbol.for("react.memo_cache_sentinel") ? (t6 = /* @__PURE__ */ jsx(Heading, { children: "Workspaces" }), $[14] = t6) : t6 = $[14];
+ $[12] === Symbol.for("react.memo_cache_sentinel") ? (t6 = /* @__PURE__ */ jsx(Heading, { children: "Workspaces" }), $[12] = t6) : t6 = $[12];
let t7;
- $[15] === Symbol.for("react.memo_cache_sentinel") ? (t7 = [
+ $[13] === Symbol.for("react.memo_cache_sentinel") ? (t7 = [
2,
3,
4,
4
- ], $[15] = t7) : t7 = $[15];
+ ], $[13] = t7) : t7 = $[13];
let t8;
- $[16] === Symbol.for("react.memo_cache_sentinel") ? (t8 = /* @__PURE__ */ jsx(Text, {
+ $[14] === Symbol.for("react.memo_cache_sentinel") ? (t8 = /* @__PURE__ */ jsx(Text, {
size: 1,
weight: "semibold",
children: "Search"
- }), $[16] = t8) : t8 = $[16];
+ }), $[14] = t8) : t8 = $[14];
let t9;
- $[17] === query ? t9 = $[18] : (t9 = /* @__PURE__ */ jsxs(Stack, {
+ $[15] === query ? t9 = $[16] : (t9 = /* @__PURE__ */ jsxs(Stack, {
gap: 2,
children: [t8, /* @__PURE__ */ jsx(TextInput, {
ref: searchInput,
value: query,
onChange: handleQuery
})]
- }), $[17] = query, $[18] = t9);
+ }), $[15] = query, $[16] = t9);
let t10;
- if ($[19] !== filteredWorkspaces || $[20] !== query) {
- let t11;
- $[22] === query ? t11 = $[23] : (t11 = (workspace_0, index_0) => /* @__PURE__ */ jsx(WorkspacePreview, {
- workspace: workspace_0,
- index: index_0,
- query
- }, workspace_0.name), $[22] = query, $[23] = t11), t10 = filteredWorkspaces.map(t11), $[19] = filteredWorkspaces, $[20] = query, $[21] = t10;
- } else t10 = $[21];
+ $[17] !== filteredWorkspaces || $[18] !== query ? (t10 = /* @__PURE__ */ jsx(Box, { children: filteredWorkspaces.map((workspace_0, index_0) => /* @__PURE__ */ jsx(WorkspacePreview, {
+ workspace: workspace_0,
+ index: index_0,
+ query
+ }, workspace_0.name)) }), $[17] = filteredWorkspaces, $[18] = query, $[19] = t10) : t10 = $[19];
let t11;
- $[24] === t10 ? t11 = $[25] : (t11 = /* @__PURE__ */ jsx(Box, { children: t10 }), $[24] = t10, $[25] = t11);
- let t12;
- return $[26] !== t11 || $[27] !== t9 ? (t12 = /* @__PURE__ */ jsx(TallCard, {
+ return $[20] !== t10 || $[21] !== t9 ? (t11 = /* @__PURE__ */ jsx(TallCard, {
tone: "transparent",
children: /* @__PURE__ */ jsx(Flex, {
direction: "column",
padding: t5,
@@ -228,14 +220,14 @@
radius: 3,
shadow: 2,
children: /* @__PURE__ */ jsxs(Stack, {
gap: 3,
- children: [t9, t11]
+ children: [t9, t10]
})
})]
}) })
})
- }), $[26] = t11, $[27] = t9, $[28] = t12) : t12 = $[28], t12;
+ }), $[20] = t10, $[21] = t9, $[22] = t11) : t11 = $[22], t11;
}
const workspaceHome = definePlugin(() => ({
name: "sanity-plugin-workspace-home",
tools: [{