sanity-plugin-workspace-home 1.1.3 → 2.0.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/LICENSE +1 -1
- package/README.md +0 -16
- package/dist/index.d.ts +11 -15
- package/dist/index.js +138 -254
- package/dist/index.js.map +1 -1
- package/package.json +32 -59
- package/dist/index.d.mts +0 -16
- package/dist/index.esm.js +0 -297
- package/dist/index.esm.js.map +0 -1
- package/dist/index.mjs +0 -297
- package/dist/index.mjs.map +0 -1
- package/sanity.json +0 -8
- package/src/components/WorkspaceHome.tsx +0 -102
- package/src/components/WorkspacePreview.tsx +0 -106
- package/src/index.ts +0 -29
- package/src/tool/index.ts +0 -10
- package/v2-incompatible.js +0 -11
package/package.json
CHANGED
|
@@ -1,95 +1,68 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sanity-plugin-workspace-home",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "A home screen for your multi-workspace Sanity Studio",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sanity",
|
|
7
7
|
"sanity-plugin"
|
|
8
8
|
],
|
|
9
|
-
"homepage": "https://github.com/sanity-io/sanity-plugin-workspace-home#readme",
|
|
9
|
+
"homepage": "https://github.com/sanity-io/plugins/tree/main/plugins/sanity-plugin-workspace-home#readme",
|
|
10
10
|
"bugs": {
|
|
11
|
-
"url": "https://github.com/sanity-io/
|
|
11
|
+
"url": "https://github.com/sanity-io/plugins/issues"
|
|
12
12
|
},
|
|
13
13
|
"repository": {
|
|
14
14
|
"type": "git",
|
|
15
|
-
"url": "git@github.com
|
|
15
|
+
"url": "git+ssh://git@github.com/sanity-io/plugins.git",
|
|
16
|
+
"directory": "plugins/sanity-plugin-workspace-home"
|
|
16
17
|
},
|
|
17
18
|
"license": "MIT",
|
|
18
19
|
"author": "Sanity <hello@sanity.io>",
|
|
19
|
-
"
|
|
20
|
+
"type": "module",
|
|
20
21
|
"exports": {
|
|
21
22
|
".": {
|
|
22
23
|
"source": "./src/index.ts",
|
|
23
|
-
"import": "./dist/index.mjs",
|
|
24
|
-
"require": "./dist/index.js",
|
|
25
24
|
"default": "./dist/index.js"
|
|
26
25
|
},
|
|
27
26
|
"./package.json": "./package.json"
|
|
28
27
|
},
|
|
29
|
-
"main": "./dist/index.js",
|
|
30
|
-
"module": "./dist/index.esm.js",
|
|
31
|
-
"source": "./src/index.ts",
|
|
32
28
|
"types": "./dist/index.d.ts",
|
|
33
29
|
"files": [
|
|
34
|
-
"dist"
|
|
35
|
-
"sanity.json",
|
|
36
|
-
"src",
|
|
37
|
-
"v2-incompatible.js"
|
|
30
|
+
"dist"
|
|
38
31
|
],
|
|
39
|
-
"scripts": {
|
|
40
|
-
"build": "run-s clean && pkg-utils build --strict && pkg-utils --strict",
|
|
41
|
-
"clean": "rimraf dist",
|
|
42
|
-
"format": "prettier --write --cache --ignore-unknown .",
|
|
43
|
-
"link-watch": "plugin-kit link-watch",
|
|
44
|
-
"lint": "eslint .",
|
|
45
|
-
"prepare": "husky install",
|
|
46
|
-
"prepublishOnly": "run-s build",
|
|
47
|
-
"watch": "pkg-utils watch --strict"
|
|
48
|
-
},
|
|
49
32
|
"dependencies": {
|
|
50
|
-
"@sanity/icons": "^
|
|
51
|
-
"@sanity/
|
|
33
|
+
"@sanity/icons": "^3.7.4",
|
|
34
|
+
"@sanity/ui": "^3.1.11",
|
|
35
|
+
"react-compiler-runtime": "^1.0.0",
|
|
36
|
+
"react-is": "^19.2.0"
|
|
52
37
|
},
|
|
53
38
|
"devDependencies": {
|
|
54
|
-
"@
|
|
55
|
-
"@
|
|
56
|
-
"@
|
|
57
|
-
"@
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"eslint-config
|
|
65
|
-
"
|
|
66
|
-
"eslint-plugin-react": "^7.34.1",
|
|
67
|
-
"eslint-plugin-react-hooks": "^4.6.0",
|
|
68
|
-
"eslint-plugin-simple-import-sort": "^12.0.0",
|
|
69
|
-
"husky": "^8.0.3",
|
|
70
|
-
"lint-staged": "^15.0.2",
|
|
71
|
-
"npm-run-all2": "^5.0.0",
|
|
72
|
-
"prettier": "^3.2.5",
|
|
73
|
-
"prettier-plugin-packagejson": "^2.4.14",
|
|
74
|
-
"react": "^18.2.0",
|
|
75
|
-
"react-dom": "^18.2.0",
|
|
76
|
-
"react-is": "^18.2.0",
|
|
77
|
-
"rimraf": "^4.4.1",
|
|
78
|
-
"sanity": "^3.40.0",
|
|
79
|
-
"semantic-release": "^23.0.7",
|
|
80
|
-
"typescript": "5.4.2"
|
|
39
|
+
"@sanity/pkg-utils": "^9.1.1",
|
|
40
|
+
"@types/react": "^19.2.6",
|
|
41
|
+
"@types/react-is": "^19.2.0",
|
|
42
|
+
"@typescript/native-preview": "7.0.0-dev.20251122.1",
|
|
43
|
+
"babel-plugin-react-compiler": "^1.0.0",
|
|
44
|
+
"eslint": "^9.39.1",
|
|
45
|
+
"react": "^19.2.0",
|
|
46
|
+
"sanity": "^4.17.0",
|
|
47
|
+
"typescript": "5.9.3",
|
|
48
|
+
"@repo/package.config": "0.0.0",
|
|
49
|
+
"@repo/eslint-config": "0.0.1",
|
|
50
|
+
"@repo/tsconfig": "0.0.0"
|
|
81
51
|
},
|
|
82
52
|
"peerDependencies": {
|
|
83
|
-
"
|
|
84
|
-
"
|
|
85
|
-
"react-dom": "^18",
|
|
86
|
-
"sanity": "^3.40.0 || ^4.0.0-0",
|
|
53
|
+
"react": "^18.3 || ^19",
|
|
54
|
+
"sanity": "^4",
|
|
87
55
|
"styled-components": "^6.1"
|
|
88
56
|
},
|
|
89
57
|
"engines": {
|
|
90
|
-
"node": ">=
|
|
58
|
+
"node": ">=20.19 <22 || >=22.12"
|
|
91
59
|
},
|
|
92
60
|
"publishConfig": {
|
|
93
61
|
"access": "public"
|
|
62
|
+
},
|
|
63
|
+
"scripts": {
|
|
64
|
+
"build": "pkg build --strict --check --clean",
|
|
65
|
+
"lint": "eslint .",
|
|
66
|
+
"typecheck": "(cd ../.. && tsgo --project plugins/sanity-plugin-workspace-home/tsconfig.json)"
|
|
94
67
|
}
|
|
95
|
-
}
|
|
68
|
+
}
|
package/dist/index.d.mts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import {Plugin as Plugin_2} from 'sanity'
|
|
2
|
-
import {WorkspaceOptions} from 'sanity'
|
|
3
|
-
|
|
4
|
-
export declare const workspaceHome: Plugin_2<void>
|
|
5
|
-
|
|
6
|
-
export declare const workspaceHomeConfig: ({
|
|
7
|
-
projectId,
|
|
8
|
-
dataset,
|
|
9
|
-
}: WorkspaceHomeConfigProps) => WorkspaceOptions
|
|
10
|
-
|
|
11
|
-
declare type WorkspaceHomeConfigProps = {
|
|
12
|
-
projectId: string
|
|
13
|
-
dataset: string
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export {}
|
package/dist/index.esm.js
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.esm.js.map
|
package/dist/index.esm.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","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,OAAO,IAAI,mBAAmB,GAAE,IAAE,OAAO,IAAI,gBAAgB,GAAE,IAAE,OAAO,IAAI,gBAAgB,GAAE,IAAE,OAAO,IAAI,eAAe,GAAE,IAAE,OAAO,IAAI,sBAAsB,GAAE,IAAE,OAAO,IAAI,mBAAmB,GAAE,IAAE,OAAO,IAAI,gBAAgB,GAAE,IAAE,OAAO,IAAI,qBAAqB,GAAE,IAAE,OAAO,IAAI,YAAY,GAAE,IAAE,OAAO,IAAI,YAAY,GAAE,IAAE,OAAO,IAAI,iBAAiB,GAAE;AAAE,MAAE,OAAO,IAAI,wBAAwB;AAChf,WAAS,EAAE,GAAE;AAAC,QAAc,OAAO,KAAlB,YAA4B,MAAP,MAAS;AAAC,UAAI,IAAE,EAAE;AAAS,cAAO,GAAC;AAAA,QAAE,KAAK;AAAE,kBAAO,IAAE,EAAE,MAAK;YAAG,KAAK;AAAA,YAAE,KAAK;AAAA,YAAE,KAAK;AAAA,YAAE,KAAK;AAAA,YAAE,KAAK;AAAE,qBAAO;AAAA,YAAE;AAAQ,sBAAO,IAAE,KAAG,EAAE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