sanity-plugin-workspace-home 1.1.3 → 2.0.1

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.mjs DELETED
@@ -1,297 +0,0 @@
1
- import { DatabaseIcon, HomeIcon } from "@sanity/icons";
2
- import { useActiveWorkspace, useWorkspaces, definePlugin } from "sanity";
3
- import { jsx, jsxs } from "react/jsx-runtime";
4
- import { Card, Grid, Stack, Button, Flex, Box, Text, Hotkeys, Container, Heading, TextInput } from "@sanity/ui";
5
- import { useMemo, createElement, isValidElement, useState, useRef, useCallback, useEffect } from "react";
6
- import { styled } from "styled-components";
7
- var reactIs = { exports: {} }, reactIs_production_min = {};
8
- /**
9
- * @license React
10
- * react-is.production.min.js
11
- *
12
- * Copyright (c) Facebook, Inc. and its affiliates.
13
- *
14
- * This source code is licensed under the MIT license found in the
15
- * LICENSE file in the root directory of this source tree.
16
- */
17
- var hasRequiredReactIs_production_min;
18
- function requireReactIs_production_min() {
19
- if (hasRequiredReactIs_production_min)
20
- return reactIs_production_min;
21
- hasRequiredReactIs_production_min = 1;
22
- var b = Symbol.for("react.element"), c = Symbol.for("react.portal"), d = Symbol.for("react.fragment"), e = Symbol.for("react.strict_mode"), f = Symbol.for("react.profiler"), g = Symbol.for("react.provider"), h = Symbol.for("react.context"), k = Symbol.for("react.server_context"), l = Symbol.for("react.forward_ref"), m = Symbol.for("react.suspense"), n = Symbol.for("react.suspense_list"), p = Symbol.for("react.memo"), q = Symbol.for("react.lazy"), t = Symbol.for("react.offscreen"), u;
23
- u = Symbol.for("react.module.reference");
24
- function v(a) {
25
- if (typeof a == "object" && a !== null) {
26
- var r = a.$$typeof;
27
- switch (r) {
28
- case b:
29
- switch (a = a.type, a) {
30
- case d:
31
- case f:
32
- case e:
33
- case m:
34
- case n:
35
- return a;
36
- default:
37
- switch (a = a && a.$$typeof, a) {
38
- case k:
39
- case h:
40
- case l:
41
- case q:
42
- case p:
43
- case g:
44
- return a;
45
- default:
46
- return r;
47
- }
48
- }
49
- case c:
50
- return r;
51
- }
52
- }
53
- }
54
- return reactIs_production_min.ContextConsumer = h, reactIs_production_min.ContextProvider = g, reactIs_production_min.Element = b, reactIs_production_min.ForwardRef = l, reactIs_production_min.Fragment = d, reactIs_production_min.Lazy = q, reactIs_production_min.Memo = p, reactIs_production_min.Portal = c, reactIs_production_min.Profiler = f, reactIs_production_min.StrictMode = e, reactIs_production_min.Suspense = m, reactIs_production_min.SuspenseList = n, reactIs_production_min.isAsyncMode = function() {
55
- return !1;
56
- }, reactIs_production_min.isConcurrentMode = function() {
57
- return !1;
58
- }, reactIs_production_min.isContextConsumer = function(a) {
59
- return v(a) === h;
60
- }, reactIs_production_min.isContextProvider = function(a) {
61
- return v(a) === g;
62
- }, reactIs_production_min.isElement = function(a) {
63
- return typeof a == "object" && a !== null && a.$$typeof === b;
64
- }, reactIs_production_min.isForwardRef = function(a) {
65
- return v(a) === l;
66
- }, reactIs_production_min.isFragment = function(a) {
67
- return v(a) === d;
68
- }, reactIs_production_min.isLazy = function(a) {
69
- return v(a) === q;
70
- }, reactIs_production_min.isMemo = function(a) {
71
- return v(a) === p;
72
- }, reactIs_production_min.isPortal = function(a) {
73
- return v(a) === c;
74
- }, reactIs_production_min.isProfiler = function(a) {
75
- return v(a) === f;
76
- }, reactIs_production_min.isStrictMode = function(a) {
77
- return v(a) === e;
78
- }, reactIs_production_min.isSuspense = function(a) {
79
- return v(a) === m;
80
- }, reactIs_production_min.isSuspenseList = function(a) {
81
- return v(a) === n;
82
- }, reactIs_production_min.isValidElementType = function(a) {
83
- return typeof a == "string" || typeof a == "function" || a === d || a === f || a === e || a === m || a === n || a === t || typeof a == "object" && a !== null && (a.$$typeof === q || a.$$typeof === p || a.$$typeof === g || a.$$typeof === h || a.$$typeof === l || a.$$typeof === u || a.getModuleId !== void 0);
84
- }, reactIs_production_min.typeOf = v, reactIs_production_min;
85
- }
86
- var reactIs_development = {};
87
- /**
88
- * @license React
89
- * react-is.development.js
90
- *
91
- * Copyright (c) Facebook, Inc. and its affiliates.
92
- *
93
- * This source code is licensed under the MIT license found in the
94
- * LICENSE file in the root directory of this source tree.
95
- */
96
- var hasRequiredReactIs_development;
97
- function requireReactIs_development() {
98
- return hasRequiredReactIs_development || (hasRequiredReactIs_development = 1, process.env.NODE_ENV !== "production" && function() {
99
- var REACT_ELEMENT_TYPE = Symbol.for("react.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_PROVIDER_TYPE = Symbol.for("react.provider"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_SERVER_CONTEXT_TYPE = Symbol.for("react.server_context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"), REACT_OFFSCREEN_TYPE = Symbol.for("react.offscreen"), enableScopeAPI = !1, enableCacheElement = !1, enableTransitionTracing = !1, enableLegacyHidden = !1, enableDebugTracing = !1, REACT_MODULE_REFERENCE;
100
- REACT_MODULE_REFERENCE = Symbol.for("react.module.reference");
101
- function isValidElementType(type) {
102
- return !!(typeof type == "string" || typeof type == "function" || type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing || typeof type == "object" && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object
103
- // types supported by any Flight configuration anywhere since
104
- // we don't know which Flight build this will end up being used
105
- // with.
106
- type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== void 0));
107
- }
108
- function typeOf(object) {
109
- if (typeof object == "object" && object !== null) {
110
- var $$typeof = object.$$typeof;
111
- switch ($$typeof) {
112
- case REACT_ELEMENT_TYPE:
113
- var type = object.type;
114
- switch (type) {
115
- case REACT_FRAGMENT_TYPE:
116
- case REACT_PROFILER_TYPE:
117
- case REACT_STRICT_MODE_TYPE:
118
- case REACT_SUSPENSE_TYPE:
119
- case REACT_SUSPENSE_LIST_TYPE:
120
- return type;
121
- default:
122
- var $$typeofType = type && type.$$typeof;
123
- switch ($$typeofType) {
124
- case REACT_SERVER_CONTEXT_TYPE:
125
- case REACT_CONTEXT_TYPE:
126
- case REACT_FORWARD_REF_TYPE:
127
- case REACT_LAZY_TYPE:
128
- case REACT_MEMO_TYPE:
129
- case REACT_PROVIDER_TYPE:
130
- return $$typeofType;
131
- default:
132
- return $$typeof;
133
- }
134
- }
135
- case REACT_PORTAL_TYPE:
136
- return $$typeof;
137
- }
138
- }
139
- }
140
- var ContextConsumer = REACT_CONTEXT_TYPE, ContextProvider = REACT_PROVIDER_TYPE, Element = REACT_ELEMENT_TYPE, ForwardRef = REACT_FORWARD_REF_TYPE, Fragment = REACT_FRAGMENT_TYPE, Lazy = REACT_LAZY_TYPE, Memo = REACT_MEMO_TYPE, Portal = REACT_PORTAL_TYPE, Profiler = REACT_PROFILER_TYPE, StrictMode = REACT_STRICT_MODE_TYPE, Suspense = REACT_SUSPENSE_TYPE, SuspenseList = REACT_SUSPENSE_LIST_TYPE, hasWarnedAboutDeprecatedIsAsyncMode = !1, hasWarnedAboutDeprecatedIsConcurrentMode = !1;
141
- function isAsyncMode(object) {
142
- return hasWarnedAboutDeprecatedIsAsyncMode || (hasWarnedAboutDeprecatedIsAsyncMode = !0, console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")), !1;
143
- }
144
- function isConcurrentMode(object) {
145
- return hasWarnedAboutDeprecatedIsConcurrentMode || (hasWarnedAboutDeprecatedIsConcurrentMode = !0, console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")), !1;
146
- }
147
- function isContextConsumer(object) {
148
- return typeOf(object) === REACT_CONTEXT_TYPE;
149
- }
150
- function isContextProvider(object) {
151
- return typeOf(object) === REACT_PROVIDER_TYPE;
152
- }
153
- function isElement(object) {
154
- return typeof object == "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
155
- }
156
- function isForwardRef(object) {
157
- return typeOf(object) === REACT_FORWARD_REF_TYPE;
158
- }
159
- function isFragment(object) {
160
- return typeOf(object) === REACT_FRAGMENT_TYPE;
161
- }
162
- function isLazy(object) {
163
- return typeOf(object) === REACT_LAZY_TYPE;
164
- }
165
- function isMemo(object) {
166
- return typeOf(object) === REACT_MEMO_TYPE;
167
- }
168
- function isPortal(object) {
169
- return typeOf(object) === REACT_PORTAL_TYPE;
170
- }
171
- function isProfiler(object) {
172
- return typeOf(object) === REACT_PROFILER_TYPE;
173
- }
174
- function isStrictMode(object) {
175
- return typeOf(object) === REACT_STRICT_MODE_TYPE;
176
- }
177
- function isSuspense(object) {
178
- return typeOf(object) === REACT_SUSPENSE_TYPE;
179
- }
180
- function isSuspenseList(object) {
181
- return typeOf(object) === REACT_SUSPENSE_LIST_TYPE;
182
- }
183
- reactIs_development.ContextConsumer = ContextConsumer, reactIs_development.ContextProvider = ContextProvider, reactIs_development.Element = Element, reactIs_development.ForwardRef = ForwardRef, reactIs_development.Fragment = Fragment, reactIs_development.Lazy = Lazy, reactIs_development.Memo = Memo, reactIs_development.Portal = Portal, reactIs_development.Profiler = Profiler, reactIs_development.StrictMode = StrictMode, reactIs_development.Suspense = Suspense, reactIs_development.SuspenseList = SuspenseList, reactIs_development.isAsyncMode = isAsyncMode, reactIs_development.isConcurrentMode = isConcurrentMode, reactIs_development.isContextConsumer = isContextConsumer, reactIs_development.isContextProvider = isContextProvider, reactIs_development.isElement = isElement, reactIs_development.isForwardRef = isForwardRef, reactIs_development.isFragment = isFragment, reactIs_development.isLazy = isLazy, reactIs_development.isMemo = isMemo, reactIs_development.isPortal = isPortal, reactIs_development.isProfiler = isProfiler, reactIs_development.isStrictMode = isStrictMode, reactIs_development.isSuspense = isSuspense, reactIs_development.isSuspenseList = isSuspenseList, reactIs_development.isValidElementType = isValidElementType, reactIs_development.typeOf = typeOf;
184
- }()), reactIs_development;
185
- }
186
- process.env.NODE_ENV === "production" ? reactIs.exports = requireReactIs_production_min() : reactIs.exports = requireReactIs_development();
187
- var reactIsExports = reactIs.exports;
188
- const createIcon = (icon) => {
189
- if (reactIsExports.isValidElementType(icon))
190
- return createElement(icon);
191
- if (isValidElement(icon))
192
- return icon;
193
- }, MediaCard = styled(Card)`
194
- width: 35px;
195
- height: 35px;
196
-
197
- svg {
198
- width: 100%;
199
- height: 100%;
200
- }
201
- `;
202
- function WorkspacePreview(props) {
203
- const { workspace, index, query } = props, { icon, title, name, subtitle, dataset } = workspace, { setActiveWorkspace } = useActiveWorkspace(), iconComponent = useMemo(() => createIcon(icon), [icon]), hotKeyIndex = index + 1 === 10 ? 0 : index + 1;
204
- return /* @__PURE__ */ jsx(Card, { borderTop: !!index, tone: "default", children: /* @__PURE__ */ jsxs(Grid, { columns: 5, gap: [2, 3, 4, 4], paddingY: 1, children: [
205
- /* @__PURE__ */ jsx(Card, { columnStart: 1, columnEnd: 4, children: /* @__PURE__ */ jsx(Stack, { children: /* @__PURE__ */ jsx(
206
- Button,
207
- {
208
- mode: "bleed",
209
- tone: "default",
210
- onClick: () => setActiveWorkspace(name),
211
- children: /* @__PURE__ */ jsxs(Flex, { align: "center", gap: [2, 3, 4, 4], children: [
212
- iconComponent ? /* @__PURE__ */ jsx(MediaCard, { children: createIcon(iconComponent) }) : null,
213
- /* @__PURE__ */ jsx(Box, { flex: 1, children: /* @__PURE__ */ jsxs(Stack, { space: [1, 2, 3, 3], children: [
214
- /* @__PURE__ */ jsx(Text, { size: 3, weight: "semibold", textOverflow: "ellipsis", children: title || name }),
215
- subtitle ? /* @__PURE__ */ jsx(Text, { muted: !0, children: subtitle }) : null
216
- ] }) })
217
- ] })
218
- }
219
- ) }) }),
220
- /* @__PURE__ */ jsx(Card, { columnStart: 4, columnEnd: 5, children: /* @__PURE__ */ jsxs(Flex, { height: "fill", align: "center", gap: 2, children: [
221
- /* @__PURE__ */ jsx(Text, { size: 1, weight: "semibold", children: /* @__PURE__ */ jsx(DatabaseIcon, {}) }),
222
- /* @__PURE__ */ jsx(Text, { size: 1, weight: "semibold", textOverflow: "ellipsis", children: dataset })
223
- ] }) }),
224
- /* @__PURE__ */ jsx(Card, { paddingRight: [2, 3, 3, 3], children: /* @__PURE__ */ jsx(Flex, { height: "fill", align: "center", justify: "flex-end", children: !query && hotKeyIndex < 10 ? /* @__PURE__ */ jsx(Hotkeys, { keys: [String(hotKeyIndex)], padding: 2 }) : null }) })
225
- ] }) });
226
- }
227
- const TallCard = styled(Card)`
228
- min-height: 100%;
229
- `;
230
- function WorkspaceHome() {
231
- const [, ...workspaces] = useWorkspaces(), { setActiveWorkspace } = useActiveWorkspace(), [query, setQuery] = useState(""), searchInput = useRef(null), handleQuery = useCallback(
232
- (e) => {
233
- setQuery(e.target.value);
234
- },
235
- [setQuery]
236
- ), filteredWorkspaces = useMemo(() => workspaces.filter((workspace) => workspace.name.toLowerCase().includes(query.toLowerCase()) || workspace.dataset.toLowerCase().includes(query.toLowerCase()) || workspace.title.toLowerCase().includes(query.toLowerCase())), [workspaces, query]);
237
- return useEffect(() => {
238
- const handleKeypress = (event) => {
239
- if (query || searchInput.current === document.activeElement)
240
- return;
241
- const index = parseInt(event.key, 10) - 1;
242
- index >= 0 && index < workspaces.length && setActiveWorkspace(workspaces[index].name);
243
- };
244
- return window.addEventListener("keypress", handleKeypress), () => {
245
- window.removeEventListener("keypress", handleKeypress);
246
- };
247
- }, [query, workspaces, setActiveWorkspace]), /* @__PURE__ */ jsx(TallCard, { tone: "transparent", children: /* @__PURE__ */ jsx(Flex, { direction: "column", padding: [4, 5, 6, 6], children: /* @__PURE__ */ jsx(Container, { children: /* @__PURE__ */ jsxs(Stack, { space: 4, children: [
248
- /* @__PURE__ */ jsx(Heading, { children: "Workspaces" }),
249
- /* @__PURE__ */ jsx(Card, { padding: [2, 3, 4, 4], radius: 3, shadow: 2, children: /* @__PURE__ */ jsxs(Stack, { space: 3, children: [
250
- /* @__PURE__ */ jsxs(Stack, { space: 2, children: [
251
- /* @__PURE__ */ jsx(Text, { size: 1, weight: "semibold", children: "Search" }),
252
- /* @__PURE__ */ jsx(
253
- TextInput,
254
- {
255
- ref: searchInput,
256
- value: query,
257
- onChange: handleQuery
258
- }
259
- )
260
- ] }),
261
- /* @__PURE__ */ jsx(Box, { children: filteredWorkspaces.map((workspace, index) => /* @__PURE__ */ jsx(
262
- WorkspacePreview,
263
- {
264
- workspace,
265
- index,
266
- query
267
- },
268
- workspace.name
269
- )) })
270
- ] }) })
271
- ] }) }) }) });
272
- }
273
- const workspaceHomeTool = {
274
- title: "Workspace Home",
275
- name: "workspace-home",
276
- icon: HomeIcon,
277
- component: WorkspaceHome
278
- }, workspaceHome = definePlugin(() => ({
279
- name: "sanity-plugin-workspace-home",
280
- tools: [workspaceHomeTool]
281
- })), workspaceHomeConfig = ({
282
- projectId = "",
283
- dataset = ""
284
- }) => ({
285
- name: "home",
286
- title: "Home",
287
- basePath: "/home",
288
- projectId,
289
- dataset,
290
- icon: HomeIcon,
291
- plugins: [workspaceHome()]
292
- });
293
- export {
294
- workspaceHome,
295
- workspaceHomeConfig
296
- };
297
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.mjs","sources":["../node_modules/react-is/cjs/react-is.production.min.js","../node_modules/react-is/cjs/react-is.development.js","../node_modules/react-is/index.js","../src/components/WorkspacePreview.tsx","../src/components/WorkspaceHome.tsx","../src/tool/index.ts","../src/index.ts"],"sourcesContent":["/**\n * @license React\n * react-is.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var b=Symbol.for(\"react.element\"),c=Symbol.for(\"react.portal\"),d=Symbol.for(\"react.fragment\"),e=Symbol.for(\"react.strict_mode\"),f=Symbol.for(\"react.profiler\"),g=Symbol.for(\"react.provider\"),h=Symbol.for(\"react.context\"),k=Symbol.for(\"react.server_context\"),l=Symbol.for(\"react.forward_ref\"),m=Symbol.for(\"react.suspense\"),n=Symbol.for(\"react.suspense_list\"),p=Symbol.for(\"react.memo\"),q=Symbol.for(\"react.lazy\"),t=Symbol.for(\"react.offscreen\"),u;u=Symbol.for(\"react.module.reference\");\nfunction v(a){if(\"object\"===typeof a&&null!==a){var r=a.$$typeof;switch(r){case b:switch(a=a.type,a){case d:case f:case e:case m:case n:return a;default:switch(a=a&&a.$$typeof,a){case k:case h:case l:case q:case p:case g:return a;default:return r}}case c:return r}}}exports.ContextConsumer=h;exports.ContextProvider=g;exports.Element=b;exports.ForwardRef=l;exports.Fragment=d;exports.Lazy=q;exports.Memo=p;exports.Portal=c;exports.Profiler=f;exports.StrictMode=e;exports.Suspense=m;\nexports.SuspenseList=n;exports.isAsyncMode=function(){return!1};exports.isConcurrentMode=function(){return!1};exports.isContextConsumer=function(a){return v(a)===h};exports.isContextProvider=function(a){return v(a)===g};exports.isElement=function(a){return\"object\"===typeof a&&null!==a&&a.$$typeof===b};exports.isForwardRef=function(a){return v(a)===l};exports.isFragment=function(a){return v(a)===d};exports.isLazy=function(a){return v(a)===q};exports.isMemo=function(a){return v(a)===p};\nexports.isPortal=function(a){return v(a)===c};exports.isProfiler=function(a){return v(a)===f};exports.isStrictMode=function(a){return v(a)===e};exports.isSuspense=function(a){return v(a)===m};exports.isSuspenseList=function(a){return v(a)===n};\nexports.isValidElementType=function(a){return\"string\"===typeof a||\"function\"===typeof a||a===d||a===f||a===e||a===m||a===n||a===t||\"object\"===typeof a&&null!==a&&(a.$$typeof===q||a.$$typeof===p||a.$$typeof===g||a.$$typeof===h||a.$$typeof===l||a.$$typeof===u||void 0!==a.getModuleId)?!0:!1};exports.typeOf=v;\n","/**\n * @license React\n * react-is.development.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nif (process.env.NODE_ENV !== \"production\") {\n (function() {\n'use strict';\n\n// ATTENTION\n// When adding new symbols to this file,\n// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'\n// The Symbol used to tag the ReactElement-like types.\nvar REACT_ELEMENT_TYPE = Symbol.for('react.element');\nvar REACT_PORTAL_TYPE = Symbol.for('react.portal');\nvar REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');\nvar REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');\nvar REACT_PROFILER_TYPE = Symbol.for('react.profiler');\nvar REACT_PROVIDER_TYPE = Symbol.for('react.provider');\nvar REACT_CONTEXT_TYPE = Symbol.for('react.context');\nvar REACT_SERVER_CONTEXT_TYPE = Symbol.for('react.server_context');\nvar REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');\nvar REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');\nvar REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');\nvar REACT_MEMO_TYPE = Symbol.for('react.memo');\nvar REACT_LAZY_TYPE = Symbol.for('react.lazy');\nvar REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');\n\n// -----------------------------------------------------------------------------\n\nvar enableScopeAPI = false; // Experimental Create Event Handle API.\nvar enableCacheElement = false;\nvar enableTransitionTracing = false; // No known bugs, but needs performance testing\n\nvar enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber\n// stuff. Intended to enable React core members to more easily debug scheduling\n// issues in DEV builds.\n\nvar enableDebugTracing = false; // Track which Fiber(s) schedule render work.\n\nvar REACT_MODULE_REFERENCE;\n\n{\n REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');\n}\n\nfunction isValidElementType(type) {\n if (typeof type === 'string' || typeof type === 'function') {\n return true;\n } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).\n\n\n if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing ) {\n return true;\n }\n\n if (typeof type === 'object' && type !== null) {\n if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object\n // types supported by any Flight configuration anywhere since\n // we don't know which Flight build this will end up being used\n // with.\n type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {\n return true;\n }\n }\n\n return false;\n}\n\nfunction typeOf(object) {\n if (typeof object === 'object' && object !== null) {\n var $$typeof = object.$$typeof;\n\n switch ($$typeof) {\n case REACT_ELEMENT_TYPE:\n var type = object.type;\n\n switch (type) {\n case REACT_FRAGMENT_TYPE:\n case REACT_PROFILER_TYPE:\n case REACT_STRICT_MODE_TYPE:\n case REACT_SUSPENSE_TYPE:\n case REACT_SUSPENSE_LIST_TYPE:\n return type;\n\n default:\n var $$typeofType = type && type.$$typeof;\n\n switch ($$typeofType) {\n case REACT_SERVER_CONTEXT_TYPE:\n case REACT_CONTEXT_TYPE:\n case REACT_FORWARD_REF_TYPE:\n case REACT_LAZY_TYPE:\n case REACT_MEMO_TYPE:\n case REACT_PROVIDER_TYPE:\n return $$typeofType;\n\n default:\n return $$typeof;\n }\n\n }\n\n case REACT_PORTAL_TYPE:\n return $$typeof;\n }\n }\n\n return undefined;\n}\nvar ContextConsumer = REACT_CONTEXT_TYPE;\nvar ContextProvider = REACT_PROVIDER_TYPE;\nvar Element = REACT_ELEMENT_TYPE;\nvar ForwardRef = REACT_FORWARD_REF_TYPE;\nvar Fragment = REACT_FRAGMENT_TYPE;\nvar Lazy = REACT_LAZY_TYPE;\nvar Memo = REACT_MEMO_TYPE;\nvar Portal = REACT_PORTAL_TYPE;\nvar Profiler = REACT_PROFILER_TYPE;\nvar StrictMode = REACT_STRICT_MODE_TYPE;\nvar Suspense = REACT_SUSPENSE_TYPE;\nvar SuspenseList = REACT_SUSPENSE_LIST_TYPE;\nvar hasWarnedAboutDeprecatedIsAsyncMode = false;\nvar hasWarnedAboutDeprecatedIsConcurrentMode = false; // AsyncMode should be deprecated\n\nfunction isAsyncMode(object) {\n {\n if (!hasWarnedAboutDeprecatedIsAsyncMode) {\n hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint\n\n console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 18+.');\n }\n }\n\n return false;\n}\nfunction isConcurrentMode(object) {\n {\n if (!hasWarnedAboutDeprecatedIsConcurrentMode) {\n hasWarnedAboutDeprecatedIsConcurrentMode = true; // Using console['warn'] to evade Babel and ESLint\n\n console['warn']('The ReactIs.isConcurrentMode() alias has been deprecated, ' + 'and will be removed in React 18+.');\n }\n }\n\n return false;\n}\nfunction isContextConsumer(object) {\n return typeOf(object) === REACT_CONTEXT_TYPE;\n}\nfunction isContextProvider(object) {\n return typeOf(object) === REACT_PROVIDER_TYPE;\n}\nfunction isElement(object) {\n return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;\n}\nfunction isForwardRef(object) {\n return typeOf(object) === REACT_FORWARD_REF_TYPE;\n}\nfunction isFragment(object) {\n return typeOf(object) === REACT_FRAGMENT_TYPE;\n}\nfunction isLazy(object) {\n return typeOf(object) === REACT_LAZY_TYPE;\n}\nfunction isMemo(object) {\n return typeOf(object) === REACT_MEMO_TYPE;\n}\nfunction isPortal(object) {\n return typeOf(object) === REACT_PORTAL_TYPE;\n}\nfunction isProfiler(object) {\n return typeOf(object) === REACT_PROFILER_TYPE;\n}\nfunction isStrictMode(object) {\n return typeOf(object) === REACT_STRICT_MODE_TYPE;\n}\nfunction isSuspense(object) {\n return typeOf(object) === REACT_SUSPENSE_TYPE;\n}\nfunction isSuspenseList(object) {\n return typeOf(object) === REACT_SUSPENSE_LIST_TYPE;\n}\n\nexports.ContextConsumer = ContextConsumer;\nexports.ContextProvider = ContextProvider;\nexports.Element = Element;\nexports.ForwardRef = ForwardRef;\nexports.Fragment = Fragment;\nexports.Lazy = Lazy;\nexports.Memo = Memo;\nexports.Portal = Portal;\nexports.Profiler = Profiler;\nexports.StrictMode = StrictMode;\nexports.Suspense = Suspense;\nexports.SuspenseList = SuspenseList;\nexports.isAsyncMode = isAsyncMode;\nexports.isConcurrentMode = isConcurrentMode;\nexports.isContextConsumer = isContextConsumer;\nexports.isContextProvider = isContextProvider;\nexports.isElement = isElement;\nexports.isForwardRef = isForwardRef;\nexports.isFragment = isFragment;\nexports.isLazy = isLazy;\nexports.isMemo = isMemo;\nexports.isPortal = isPortal;\nexports.isProfiler = isProfiler;\nexports.isStrictMode = isStrictMode;\nexports.isSuspense = isSuspense;\nexports.isSuspenseList = isSuspenseList;\nexports.isValidElementType = isValidElementType;\nexports.typeOf = typeOf;\n })();\n}\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-is.production.min.js');\n} else {\n module.exports = require('./cjs/react-is.development.js');\n}\n","import {DatabaseIcon} from '@sanity/icons'\nimport {Box, Button, Card, Flex, Grid, Hotkeys, Stack, Text} from '@sanity/ui'\nimport React, {createElement, isValidElement, useMemo} from 'react'\nimport {isValidElementType} from 'react-is'\nimport {useActiveWorkspace, WorkspaceSummary} from 'sanity'\nimport {styled} from 'styled-components'\n\nconst createIcon = (icon: React.ComponentType | React.ReactNode) => {\n if (isValidElementType(icon)) return createElement(icon)\n if (isValidElement(icon)) return icon\n return undefined\n}\n\nexport const MediaCard = styled(Card)`\n width: 35px;\n height: 35px;\n\n svg {\n width: 100%;\n height: 100%;\n }\n`\n\nexport type WorkspacePreviewProps = {\n workspace: WorkspaceSummary\n index: number\n query: string\n}\n\nexport default function WorkspacePreview(props: WorkspacePreviewProps) {\n const {workspace, index, query} = props\n const {icon, title, name, subtitle, dataset} = workspace\n\n const {setActiveWorkspace} = useActiveWorkspace()\n const iconComponent = useMemo(() => createIcon(icon), [icon])\n\n // TODO: Favorites feature\n // get favorite workspace name from localStorage\n // const favoriteWorkspace = localStorage.getItem('favoriteWorkspace')\n // save local state to force re-render\n // const [isFavourite, setIsFavourite] = React.useState(favoriteWorkspace === name)\n\n // set favorite workspace name to localStorage\n // const setFavoriteWorkspace = useCallback(() => {\n // localStorage.setItem('favoriteWorkspace', name)\n // }, [name])\n\n const hotKeyIndex = index + 1 === 10 ? 0 : index + 1\n\n return (\n <Card borderTop={Boolean(index)} tone=\"default\">\n <Grid columns={5} gap={[2, 3, 4, 4]} paddingY={1}>\n <Card columnStart={1} columnEnd={4}>\n <Stack>\n <Button\n mode=\"bleed\"\n tone=\"default\"\n onClick={() => setActiveWorkspace(name)}\n >\n <Flex align=\"center\" gap={[2, 3, 4, 4]}>\n {iconComponent ? (\n <MediaCard>{createIcon(iconComponent)}</MediaCard>\n ) : null}\n <Box flex={1}>\n <Stack space={[1, 2, 3, 3]}>\n <Text size={3} weight=\"semibold\" textOverflow=\"ellipsis\">\n {title || name}\n </Text>\n {subtitle ? <Text muted>{subtitle}</Text> : null}\n </Stack>\n </Box>\n </Flex>\n </Button>\n </Stack>\n </Card>\n <Card columnStart={4} columnEnd={5}>\n <Flex height=\"fill\" align=\"center\" gap={2}>\n <Text size={1} weight=\"semibold\">\n <DatabaseIcon />\n </Text>\n <Text size={1} weight=\"semibold\" textOverflow=\"ellipsis\">\n {dataset}\n </Text>\n </Flex>\n </Card>\n <Card paddingRight={[2, 3, 3, 3]}>\n <Flex height=\"fill\" align=\"center\" justify=\"flex-end\">\n {!query && hotKeyIndex < 10 ? (\n <Hotkeys keys={[String(hotKeyIndex)]} padding={2} />\n ) : null}\n </Flex>\n </Card>\n {/* <Button\n mode={isFavourite ? 'default' : 'bleed'}\n tone={isFavourite ? 'primary' : 'default'}\n icon={StarIcon}\n title=\"Favorite\"\n onClick={() => {\n setIsFavourite(!isFavourite)\n setFavoriteWorkspace()\n }}\n /> */}\n </Grid>\n </Card>\n )\n}\n","import {\n Box,\n Card,\n Container,\n Flex,\n Heading,\n Stack,\n Text,\n TextInput,\n} from '@sanity/ui'\nimport React, {useCallback, useEffect, useMemo, useRef, useState} from 'react'\nimport {useActiveWorkspace, useWorkspaces} from 'sanity'\nimport {styled} from 'styled-components'\n\nimport WorkspacePreview from './WorkspacePreview'\n\nexport const TallCard = styled(Card)`\n min-height: 100%;\n`\n\nexport default function WorkspaceHome() {\n const [, ...workspaces] = useWorkspaces()\n const {setActiveWorkspace} = useActiveWorkspace()\n\n // Handle search query\n const [query, setQuery] = useState('')\n const searchInput = useRef(null)\n const handleQuery = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n setQuery(e.target.value)\n },\n [setQuery]\n )\n\n // filter workspaces if name, dataset or title matches query\n const filteredWorkspaces = useMemo(() => {\n return workspaces.filter((workspace) => {\n return (\n workspace.name.toLowerCase().includes(query.toLowerCase()) ||\n workspace.dataset.toLowerCase().includes(query.toLowerCase()) ||\n workspace.title.toLowerCase().includes(query.toLowerCase())\n )\n })\n }, [workspaces, query])\n\n // Listen to keypress of workspace index\n useEffect(() => {\n const handleKeypress = (event: KeyboardEvent) => {\n // Ignore if search query exists or search input is focused\n if (query || searchInput.current === document.activeElement) {\n return\n }\n\n const index = parseInt(event.key, 10) - 1\n if (index >= 0 && index < workspaces.length) {\n setActiveWorkspace(workspaces[index].name)\n }\n }\n\n window.addEventListener('keypress', handleKeypress)\n\n return () => {\n window.removeEventListener('keypress', handleKeypress)\n }\n }, [query, workspaces, setActiveWorkspace])\n\n return (\n <TallCard tone=\"transparent\">\n <Flex direction=\"column\" padding={[4, 5, 6, 6]}>\n <Container>\n <Stack space={4}>\n <Heading>Workspaces</Heading>\n <Card padding={[2, 3, 4, 4]} radius={3} shadow={2}>\n <Stack space={3}>\n <Stack space={2}>\n <Text size={1} weight=\"semibold\">\n Search\n </Text>\n <TextInput\n ref={searchInput}\n value={query}\n onChange={handleQuery}\n />\n </Stack>\n <Box>\n {filteredWorkspaces.map((workspace, index) => (\n <WorkspacePreview\n key={workspace.name}\n workspace={workspace}\n index={index}\n query={query}\n />\n ))}\n </Box>\n </Stack>\n </Card>\n </Stack>\n </Container>\n </Flex>\n </TallCard>\n )\n}\n","import {HomeIcon} from '@sanity/icons'\n\nimport WorkspaceHome from '../components/WorkspaceHome'\n\nexport const workspaceHomeTool = {\n title: 'Workspace Home',\n name: 'workspace-home',\n icon: HomeIcon,\n component: WorkspaceHome,\n}\n","import {HomeIcon} from '@sanity/icons'\nimport {definePlugin, WorkspaceOptions} from 'sanity'\n\nimport {workspaceHomeTool} from './tool'\n\nexport const workspaceHome = definePlugin(() => {\n return {\n name: 'sanity-plugin-workspace-home',\n tools: [workspaceHomeTool],\n }\n})\n\ntype WorkspaceHomeConfigProps = {\n projectId: string\n dataset: string\n}\n\nexport const workspaceHomeConfig = ({\n projectId = ``,\n dataset = ``,\n}: WorkspaceHomeConfigProps): WorkspaceOptions => ({\n name: 'home',\n title: 'Home',\n basePath: '/home',\n projectId,\n dataset,\n icon: HomeIcon,\n plugins: [workspaceHome()],\n})\n"],"names":["reactIsModule","require$$0","require$$1","isValidElementType"],"mappings":";;;;;;;;;;;;;;;;;;;;;AASa,MAAI,IAAE,OAAO,IAAI,eAAe,GAAE,IAAE,OAAO,IAAI,cAAc,GAAE,IAAE,OAAO,IAAI,gBAAgB,GAAE,IAAE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ACjGO,MAAM,oBAAoB;AAAA,EAC/B,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;AAAA,EACN,WAAW;AACb,GCJa,gBAAgB,aAAa,OACjC;AAAA,EACL,MAAM;AAAA,EACN,OAAO,CAAC,iBAAiB;AAC3B,EACD,GAOY,sBAAsB,CAAC;AAAA,EAClC,YAAY;AAAA,EACZ,UAAU;AACZ,OAAmD;AAAA,EACjD,MAAM;AAAA,EACN,OAAO;AAAA,EACP,UAAU;AAAA,EACV;AAAA,EACA;AAAA,EACA,MAAM;AAAA,EACN,SAAS,CAAC,eAAe;AAC3B;","x_google_ignoreList":[0,1,2]}
package/sanity.json DELETED
@@ -1,8 +0,0 @@
1
- {
2
- "parts": [
3
- {
4
- "implements": "part:@sanity/base/sanity-root",
5
- "path": "./v2-incompatible.js"
6
- }
7
- ]
8
- }
@@ -1,102 +0,0 @@
1
- import {
2
- Box,
3
- Card,
4
- Container,
5
- Flex,
6
- Heading,
7
- Stack,
8
- Text,
9
- TextInput,
10
- } from '@sanity/ui'
11
- import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react'
12
- import {useActiveWorkspace, useWorkspaces} from 'sanity'
13
- import {styled} from 'styled-components'
14
-
15
- import WorkspacePreview from './WorkspacePreview'
16
-
17
- export const TallCard = styled(Card)`
18
- min-height: 100%;
19
- `
20
-
21
- export default function WorkspaceHome() {
22
- const [, ...workspaces] = useWorkspaces()
23
- const {setActiveWorkspace} = useActiveWorkspace()
24
-
25
- // Handle search query
26
- const [query, setQuery] = useState('')
27
- const searchInput = useRef(null)
28
- const handleQuery = useCallback(
29
- (e: React.ChangeEvent<HTMLInputElement>) => {
30
- setQuery(e.target.value)
31
- },
32
- [setQuery]
33
- )
34
-
35
- // filter workspaces if name, dataset or title matches query
36
- const filteredWorkspaces = useMemo(() => {
37
- return workspaces.filter((workspace) => {
38
- return (
39
- workspace.name.toLowerCase().includes(query.toLowerCase()) ||
40
- workspace.dataset.toLowerCase().includes(query.toLowerCase()) ||
41
- workspace.title.toLowerCase().includes(query.toLowerCase())
42
- )
43
- })
44
- }, [workspaces, query])
45
-
46
- // Listen to keypress of workspace index
47
- useEffect(() => {
48
- const handleKeypress = (event: KeyboardEvent) => {
49
- // Ignore if search query exists or search input is focused
50
- if (query || searchInput.current === document.activeElement) {
51
- return
52
- }
53
-
54
- const index = parseInt(event.key, 10) - 1
55
- if (index >= 0 && index < workspaces.length) {
56
- setActiveWorkspace(workspaces[index].name)
57
- }
58
- }
59
-
60
- window.addEventListener('keypress', handleKeypress)
61
-
62
- return () => {
63
- window.removeEventListener('keypress', handleKeypress)
64
- }
65
- }, [query, workspaces, setActiveWorkspace])
66
-
67
- return (
68
- <TallCard tone="transparent">
69
- <Flex direction="column" padding={[4, 5, 6, 6]}>
70
- <Container>
71
- <Stack space={4}>
72
- <Heading>Workspaces</Heading>
73
- <Card padding={[2, 3, 4, 4]} radius={3} shadow={2}>
74
- <Stack space={3}>
75
- <Stack space={2}>
76
- <Text size={1} weight="semibold">
77
- Search
78
- </Text>
79
- <TextInput
80
- ref={searchInput}
81
- value={query}
82
- onChange={handleQuery}
83
- />
84
- </Stack>
85
- <Box>
86
- {filteredWorkspaces.map((workspace, index) => (
87
- <WorkspacePreview
88
- key={workspace.name}
89
- workspace={workspace}
90
- index={index}
91
- query={query}
92
- />
93
- ))}
94
- </Box>
95
- </Stack>
96
- </Card>
97
- </Stack>
98
- </Container>
99
- </Flex>
100
- </TallCard>
101
- )
102
- }
@@ -1,106 +0,0 @@
1
- import {DatabaseIcon} from '@sanity/icons'
2
- import {Box, Button, Card, Flex, Grid, Hotkeys, Stack, Text} from '@sanity/ui'
3
- import React, {createElement, isValidElement, useMemo} from 'react'
4
- import {isValidElementType} from 'react-is'
5
- import {useActiveWorkspace, WorkspaceSummary} from 'sanity'
6
- import {styled} from 'styled-components'
7
-
8
- const createIcon = (icon: React.ComponentType | React.ReactNode) => {
9
- if (isValidElementType(icon)) return createElement(icon)
10
- if (isValidElement(icon)) return icon
11
- return undefined
12
- }
13
-
14
- export const MediaCard = styled(Card)`
15
- width: 35px;
16
- height: 35px;
17
-
18
- svg {
19
- width: 100%;
20
- height: 100%;
21
- }
22
- `
23
-
24
- export type WorkspacePreviewProps = {
25
- workspace: WorkspaceSummary
26
- index: number
27
- query: string
28
- }
29
-
30
- export default function WorkspacePreview(props: WorkspacePreviewProps) {
31
- const {workspace, index, query} = props
32
- const {icon, title, name, subtitle, dataset} = workspace
33
-
34
- const {setActiveWorkspace} = useActiveWorkspace()
35
- const iconComponent = useMemo(() => createIcon(icon), [icon])
36
-
37
- // TODO: Favorites feature
38
- // get favorite workspace name from localStorage
39
- // const favoriteWorkspace = localStorage.getItem('favoriteWorkspace')
40
- // save local state to force re-render
41
- // const [isFavourite, setIsFavourite] = React.useState(favoriteWorkspace === name)
42
-
43
- // set favorite workspace name to localStorage
44
- // const setFavoriteWorkspace = useCallback(() => {
45
- // localStorage.setItem('favoriteWorkspace', name)
46
- // }, [name])
47
-
48
- const hotKeyIndex = index + 1 === 10 ? 0 : index + 1
49
-
50
- return (
51
- <Card borderTop={Boolean(index)} tone="default">
52
- <Grid columns={5} gap={[2, 3, 4, 4]} paddingY={1}>
53
- <Card columnStart={1} columnEnd={4}>
54
- <Stack>
55
- <Button
56
- mode="bleed"
57
- tone="default"
58
- onClick={() => setActiveWorkspace(name)}
59
- >
60
- <Flex align="center" gap={[2, 3, 4, 4]}>
61
- {iconComponent ? (
62
- <MediaCard>{createIcon(iconComponent)}</MediaCard>
63
- ) : null}
64
- <Box flex={1}>
65
- <Stack space={[1, 2, 3, 3]}>
66
- <Text size={3} weight="semibold" textOverflow="ellipsis">
67
- {title || name}
68
- </Text>
69
- {subtitle ? <Text muted>{subtitle}</Text> : null}
70
- </Stack>
71
- </Box>
72
- </Flex>
73
- </Button>
74
- </Stack>
75
- </Card>
76
- <Card columnStart={4} columnEnd={5}>
77
- <Flex height="fill" align="center" gap={2}>
78
- <Text size={1} weight="semibold">
79
- <DatabaseIcon />
80
- </Text>
81
- <Text size={1} weight="semibold" textOverflow="ellipsis">
82
- {dataset}
83
- </Text>
84
- </Flex>
85
- </Card>
86
- <Card paddingRight={[2, 3, 3, 3]}>
87
- <Flex height="fill" align="center" justify="flex-end">
88
- {!query && hotKeyIndex < 10 ? (
89
- <Hotkeys keys={[String(hotKeyIndex)]} padding={2} />
90
- ) : null}
91
- </Flex>
92
- </Card>
93
- {/* <Button
94
- mode={isFavourite ? 'default' : 'bleed'}
95
- tone={isFavourite ? 'primary' : 'default'}
96
- icon={StarIcon}
97
- title="Favorite"
98
- onClick={() => {
99
- setIsFavourite(!isFavourite)
100
- setFavoriteWorkspace()
101
- }}
102
- /> */}
103
- </Grid>
104
- </Card>
105
- )
106
- }
package/src/index.ts DELETED
@@ -1,29 +0,0 @@
1
- import {HomeIcon} from '@sanity/icons'
2
- import {definePlugin, WorkspaceOptions} from 'sanity'
3
-
4
- import {workspaceHomeTool} from './tool'
5
-
6
- export const workspaceHome = definePlugin(() => {
7
- return {
8
- name: 'sanity-plugin-workspace-home',
9
- tools: [workspaceHomeTool],
10
- }
11
- })
12
-
13
- type WorkspaceHomeConfigProps = {
14
- projectId: string
15
- dataset: string
16
- }
17
-
18
- export const workspaceHomeConfig = ({
19
- projectId = ``,
20
- dataset = ``,
21
- }: WorkspaceHomeConfigProps): WorkspaceOptions => ({
22
- name: 'home',
23
- title: 'Home',
24
- basePath: '/home',
25
- projectId,
26
- dataset,
27
- icon: HomeIcon,
28
- plugins: [workspaceHome()],
29
- })
package/src/tool/index.ts DELETED
@@ -1,10 +0,0 @@
1
- import {HomeIcon} from '@sanity/icons'
2
-
3
- import WorkspaceHome from '../components/WorkspaceHome'
4
-
5
- export const workspaceHomeTool = {
6
- title: 'Workspace Home',
7
- name: 'workspace-home',
8
- icon: HomeIcon,
9
- component: WorkspaceHome,
10
- }
@@ -1,11 +0,0 @@
1
- const {showIncompatiblePluginDialog} = require('@sanity/incompatible-plugin')
2
- const {name, version, sanityExchangeUrl} = require('./package.json')
3
-
4
- export default showIncompatiblePluginDialog({
5
- name: name,
6
- versions: {
7
- v3: version,
8
- v2: undefined,
9
- },
10
- sanityExchangeUrl,
11
- })