@sanity/dashboard 3.1.0 → 3.1.2

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/lib/index.esm.js CHANGED
@@ -1,2 +1,729 @@
1
- var e,n,t,r,i,o,l,a,d,s,c,u,h,p,g,m,f,b,y,w;function v(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function j(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?v(Object(t),!0).forEach((function(n){x(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):v(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function x(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function O(e,n){return n||(n=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}import{jsxs as k,jsx as z,Fragment as P}from"react/jsx-runtime";import{forwardRef as _,createContext as S,useContext as R,useMemo as I,createElement as L,useState as q,useEffect as A,useCallback as E}from"react";import{Card as Y,Box as B,Heading as D,Button as H,Stack as M,Label as T,Grid as V,Text as X,Code as N,Spinner as U,Flex as C,Container as F}from"@sanity/ui";import G,{css as Q}from"styled-components";import{useClient as W,useUserStore as Z,DefaultPreview as J,definePlugin as K}from"sanity";import{from as $}from"rxjs";import{switchMap as ee,map as ne}from"rxjs/operators";import{RobotIcon as te,PlayIcon as re}from"@sanity/icons";import ie from"@sanity/image-url";const oe=G(Y)(e||(e=O(["\n display: flex;\n flex-direction: column;\n justify-content: stretch;\n height: 100%;\n box-sizing: border-box;\n position: relative;\n"]))),le=G(Y)(n||(n=O(["\n position: sticky;\n top: 0;\n z-index: 2;\n border-top-left-radius: inherit;\n border-top-right-radius: inherit;\n"]))),ae=G(Y)(t||(t=O(["\n position: sticky;\n overflow: hidden;\n bottom: 0;\n z-index: 2;\n border-bottom-right-radius: inherit;\n border-bottom-left-radius: inherit;\n margin-top: auto;\n"]))),de=G(B)(r||(r=O(["\n position: relative;\n z-index: 1;\n height: stretch;\n min-height: 21.5em;\n\n @media (min-width: ","px) {\n overflow-y: auto;\n outline: none;\n }\n"])),(e=>{let{theme:n}=e;return n.sanity.media[0]})),se=_((function(e,n){const{header:t,children:r,footer:i}=e;return k(oe,{radius:3,display:"flex",ref:n,children:[t&&z(le,{borderBottom:!0,paddingX:3,paddingY:4,children:z(D,{size:1,textOverflow:"ellipsis",children:t})}),r&&z(de,{children:r}),i&&z(ae,{borderTop:!0,children:i})]})}));function ce(){return W({apiVersion:"1"})}const ue=S({widgets:[]});function he(e){const n=R(ue),t=I((()=>j(j({},e.layout||{}),n.layout||{})),[e.layout,n.layout]);return z(Y,{shadow:1,"data-width":t.width,"data-height":t.height,children:L(e.component,{})})}function pe(e,n){return"https://".concat(e,".api.sanity.io/v1/groq/").concat(n)}function ge(e){return"https://manage.sanity.io/projects/".concat(e)}const me=[],fe=[];function be(e){const{__experimental_before:n=me,data:t=fe}=e,[r,i]=q(),[o,l]=q(),a=ce(),{projectId:d="unknown",dataset:s="unknown"}=a.config();A((()=>{const e=[];return e.push(a.observable.request({uri:"/projects/".concat(d)}).subscribe({next:e=>{const{studioHost:n}=e;i(n?"https://".concat(n,".sanity.studio"):void 0)},error:e=>{console.error("Error while looking for studioHost",e),i({error:"Something went wrong while looking up studioHost. See console."})}})),e.push(a.observable.request({method:"HEAD",uri:"/graphql/".concat(s,"/default")}).subscribe({next:()=>l(function(e,n){return"https://".concat(e,".api.sanity.io/v1/graphql/").concat(n,"/default")}(d,s)),error:e=>{404===e.statusCode?l(void 0):(console.error("Error while looking for graphqlApi",e),l({error:"Something went wrong while looking up graphqlApi. See console."}))}})),()=>{e.forEach((e=>e.unsubscribe()))}}),[s,d,a,l,i]);const c=I((()=>{var e;let n=[{title:"Sanity project",rows:[{title:"Project ID",value:d},{title:"Dataset",value:s}]}];const i=[r?{title:"Studio",value:r}:null,...t.filter((e=>"apps"===e.category))].filter((e=>!!e));i.length>0&&(n=n.concat([{title:"Apps",rows:i}])),n=n.concat([{title:"APIs",rows:[{title:"GROQ",value:pe(d,s)},{title:"GraphQL",value:null!=(e="object"==typeof o?"Error":o)?e:"Not deployed"}]}],t.filter((e=>"apis"===e.category)));const l={};return t.forEach((e=>{e.category&&"apps"!==e.category&&"apis"!==e.category&&(l[e.category]||(l[e.category]=[]),l[e.category].push(e))})),Object.keys(l).forEach((e=>{n.push({title:e,rows:l[e]})})),n}),[o,r,d,s,t]);return k(P,{children:[n.map(((e,n)=>z(he,j({},e),n))),z(B,{height:"fill",marginTop:(null==n?void 0:n.length)>0?4:0,children:z(se,{footer:z(H,{style:{width:"100%"},paddingX:2,paddingY:4,mode:"bleed",tone:"primary",text:"Manage project",as:"a",href:ge(d)}),children:z(Y,{paddingY:4,radius:2,role:"table","aria-label":"Project info","aria-describedby":"project_info_table",children:k(M,{space:4,children:[z(B,{paddingX:3,as:"header",children:z(D,{size:1,as:"h2",id:"project_info_table",children:"Project info"})}),c.map((e=>e&&e.rows?k(M,{space:3,children:[z(Y,{borderBottom:!0,padding:3,children:z(T,{size:0,muted:!0,role:"columnheader",children:e.title})}),z(M,{space:4,paddingX:3,role:"rowgroup",children:e.rows.map((e=>{var n,t;return k(V,{columns:2,role:"row",children:[z(X,{weight:"medium",role:"rowheader",children:e.title}),"object"==typeof e.value&&z(X,{size:1,children:null==(n=e.value)?void 0:n.error}),"string"==typeof e.value&&z(P,{children:(t=e.value,t&&/^https?:\/\//.test("".concat(t))?z(X,{size:1,role:"cell",style:{wordBreak:"break-word"},children:z("a",{href:e.value,children:e.value})}):z(N,{size:1,role:"cell",style:{wordBreak:"break-word"},children:e.value}))})]},e.title)}))})]},e.title):null))]})})})})]})}function ye(e){var n;return{name:"project-info",component:be,layout:null!=(n=null==e?void 0:e.layout)?n:{width:"medium"}}}const we=G(Y)(i||(i=O(["\n box-sizing: border-box;\n border-radius: 50%;\n border-color: transparent;\n overflow: hidden;\n width: 100%;\n height: 100%;\n\n & > img {\n width: 100%;\n height: auto;\n }\n"])));function ve(){const[e,n]=q(),[t,r]=q(),[i,o]=q(),l=Z(),a=ce(),d=E((()=>{const{projectId:e}=a.config(),t=a.observable.request({uri:"/projects/".concat(e)}).pipe(ee((e=>$(l.getUsers(e.members.map((e=>e.id)))).pipe(ne((n=>({project:e,users:n}))))))).subscribe({next:e=>{let{users:t,project:i}=e;n(i),r((Array.isArray(t)?t:[t]).sort(((e,n)=>function(e,n,t){const{members:r}=t,i=r.find((n=>n.id===(null==e?void 0:e.id))),o=r.find((e=>e.id===(null==n?void 0:n.id)));if(null==i?void 0:i.isRobot)return 1;if(null==o?void 0:o.isRobot)return-1;return 0}(e,n,i))))},error:e=>o(e)});return()=>t.unsubscribe()}),[l,a]);A((()=>d()),[d]);const s=E((()=>d()),[d]),c=!t||!e;return i?z(se,{header:"Project users",children:z(B,{padding:4,children:k(X,{children:["Something went wrong while fetching data. You could"," ",z("a",{onClick:s,title:"Retry users fetch",style:{cursor:"pointer"},children:"retry"}),"..?"]})})}):k(se,{header:"Project users",footer:z(H,{style:{width:"100%"},paddingX:2,paddingY:4,mode:"bleed",tone:"primary",text:"Invite members",as:"a",loading:c,href:c?void 0:(u=e.id,"https://manage.sanity.io/projects/".concat(u,"/team/invite"))}),children:[c&&z(B,{paddingY:5,paddingX:2,children:k(M,{space:4,children:[z(X,{align:"center",muted:!0,size:1,children:z(U,{})}),z(X,{align:"center",size:1,muted:!0,children:"Loading items..."})]})}),!c&&z(M,{space:3,padding:3,children:null==t?void 0:t.map((n=>{const t=e.members.find((e=>e.id===n.id)),r=(null==t?void 0:t.isRobot)?z(X,{size:3,children:z(te,{})}):z(we,{tone:"transparent",children:(null==n?void 0:n.imageUrl)&&z("img",{src:n.imageUrl,alt:null==n?void 0:n.displayName})});return z(B,{children:z(J,{title:n.displayName,subtitle:null==t?void 0:t.role,media:r})},n.id)}))})]});var u}function je(e){return{name:"project-info",component:ve,layout:null==e?void 0:e.layout}}const xe=G(B)(o||(o=O(["\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n\n &:before {\n content: '';\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n width: 2.75em;\n height: 2.75em;\n border-radius: 50%;\n background: ",";\n opacity: 0.75;\n }\n"])),(e=>{let{theme:n}=e;return n.sanity.color.card.enabled.bg})),Oe=G(C)(l||(l=O(["\n &:hover {\n "," {\n &:before {\n opacity: 1;\n }\n }\n }\n"])),xe),ke=G(Y)(a||(a=O(["\n width: 100%;\n padding-bottom: calc(9 / 16 * 100%);\n position: relative;\n"]))),ze=G.img(d||(d=O(["\n position: absolute;\n top: 0;\n left: 0;\n height: 100%;\n width: 100%;\n object-fit: cover;\n display: block;\n\n &:not([src]) {\n display: none;\n }\n"])));function Pe(e){const{title:n,posterURL:t,showPlayIcon:r,href:i,presenterName:o,presenterSubtitle:l}=e;return z(Oe,{flex:1,children:z(Y,{sizing:"border",flex:1,padding:2,radius:2,as:"a",href:i,target:"_blank",rel:"noopener noreferrer",style:{position:"relative"},children:k(C,{direction:"column",style:{height:"100%"},children:[t&&k(ke,{marginBottom:1,children:[z(ze,{src:t}),r&&z(xe,{display:"flex",children:z(X,{align:"center",children:z(re,{})})})]}),k(C,{direction:"column",justify:"space-between",paddingY:2,flex:1,children:[z(D,{as:"h3",size:1,children:n}),z(B,{marginTop:4,children:k(M,{space:2,flex:1,children:[z(X,{size:1,children:o}),z(X,{size:0,style:{opacity:.7},children:l})]})})]})]})})})}const _e={projectId:"3do82whm",dataset:"next"};function Se(e){const{templateRepoId:n}=e,[t,r]=q([]),{getFeed:i,urlBuilder:o}=function(){const e=ce();return I((()=>({getFeed:n=>{const t=n?"/addons/dashboard?templateRepoId=".concat(n):"/addons/dashboard";return e.observable.request({uri:t,withCredentials:!1})},urlBuilder:ie(_e)})),[e])}();A((()=>{const e=i(n).subscribe((e=>{r(e.items)}));return()=>{e.unsubscribe()}}),[r,i,n]);return z(se,{header:"Learn about Sanity",children:z(C,{as:"ul",overflow:"auto",align:"stretch",paddingY:2,children:null==t?void 0:t.map(((e,n)=>{var r;if(!e.title||!e.guideOrTutorial&&!e.externalLink)return null;const i=e.presenter||(null==(r=e.guideOrTutorial)?void 0:r.presenter)||{},l=e.category,{guideOrTutorial:a={}}=e,d=(a.slug?(s=a.slug,"tutorial"===(c=a._type)?"https://www.sanity.io/docs/tutorials/".concat(s.current):"guide"===c&&"https://www.sanity.io/docs/guides/".concat(s.current)):e.externalLink)||e.externalLink;var s,c;return z(C,{as:"li",paddingRight:n<(null==t?void 0:t.length)-1?1:3,paddingLeft:0===n?3:0,align:"stretch",style:{minWidth:272,width:"30%"},children:z(Pe,{title:e.title,href:null!=d?d:"",presenterName:i.name,presenterSubtitle:l,showPlayIcon:e.hasVideo,posterURL:e.poster?o.image(e.poster).height(360).url():void 0})},e._id)}))})})}function Re(e){var n;return{name:"sanity-tutorials",component:Se,layout:null!=(n=null==e?void 0:e.layout)?n:{width:"full"}}}function Ie(e){return z(F,{width:4,padding:4,sizing:"border",style:{minHeight:"100%"},children:e.children})}const Le=function(){return Q(s||(s=O(["\n @media (min-width: ","px) {\n ","\n }\n "])),(e=>{let{theme:n}=e;return n.sanity.media[0]}),Q(...arguments))},qe=function(){return Q(c||(c=O(["\n @media (min-width: ","px) {\n ","\n }\n "])),(e=>{let{theme:n}=e;return n.sanity.media[2]}),Q(...arguments))},Ae=G(V)(u||(u=O(["\n grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));\n\n & > div {\n overflow: hidden;\n }\n\n & > div[data-width='medium'] {\n ","\n }\n\n & > div[data-width='large'] {\n ","\n\n ","\n }\n\n & > div[data-width='full'] {\n ","\n }\n\n & > div[data-height='medium'] {\n ","\n }\n\n & > div[data-height='large'] {\n ","\n\n ","\n }\n\n & > div[data-height='full'] {\n ","\n }\n"])),Le(h||(h=O(["\n grid-column: span 2;\n "]))),Le(p||(p=O(["\n grid-column: span 2;\n "]))),qe(g||(g=O(["\n grid-column: span 3;\n "]))),Le(m||(m=O(["\n grid-column: 1 / -1;\n "]))),Le(f||(f=O(["\n grid-row: span 2;\n "]))),Le(b||(b=O(["\n grid-row: span 2;\n "]))),qe(y||(y=O(["\n grid-row: span 3;\n "]))),qe(w||(w=O(["\n grid-row: 1 / -1;\n "])))),Ee=[],Ye={};function Be(e){const{config:{layout:n=Ye,widgets:t=Ee}}=e;return k(Ae,{autoFlow:"row dense","data-width":n.width||"auto","data-height":n.height||"auto",gap:4,children:[t.length?null:z(Y,{padding:4,shadow:1,tone:"primary",children:z(X,{align:"center",children:"Add some widgets to populate this space."})}),t.map(((e,n)=>"__experimental_group"===e.type?z(Be,{config:e},n):e.component?z(he,j({},e),n):k(B,{children:[e.name," is missing widget component"]},n)))]})}function De(e){let{config:n}=e;return n?z(ue.Provider,{value:n,children:z(Ie,{children:z(Be,{config:n})})}):null}const He={stroke:"currentColor",strokeWidth:1.2},Me=()=>k("svg",{"data-sanity-icon":!0,viewBox:"0 0 25 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",preserveAspectRatio:"xMidYMid",width:"1em",height:"1em",children:[z("path",{d:"M19.5 19.5H5.5V5.5H19.5V19.5Z",style:He}),z("path",{d:"M5.5 12.5H19.5",style:He}),z("path",{d:"M14.5 19.5V12.5M10.5 12.5V5.5",style:He})]}),Te=K((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var n,t,r,i,o;const l={layout:null!=(n=e.defaultLayout)?n:{},widgets:null!=(t=e.widgets)?t:[]},a=null!=(r=e.title)?r:"Dashboard",d=null!=(i=e.name)?i:"dashboard",s=null!=(o=e.icon)?o:Me;return{name:"dashboard",tools:(e,n)=>[...e,{title:a,name:d,icon:s,component:()=>z(De,{config:l})}]}}));export{se as DashboardWidgetContainer,Te as dashboardTool,ye as projectInfoWidget,je as projectUsersWidget,Re as sanityTutorialsWidget};
1
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20;
2
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
6
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
7
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
8
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
9
+ import { forwardRef, createContext, useContext, useMemo, createElement, useState, useEffect, useCallback } from 'react';
10
+ import { Card, Box, Heading, Button, Stack, Label, Grid, Text, Code, Spinner, Flex, Container } from '@sanity/ui';
11
+ import styled, { css } from 'styled-components';
12
+ import { useClient, useUserStore, DefaultPreview, definePlugin } from 'sanity';
13
+ import { from } from 'rxjs';
14
+ import { switchMap, map } from 'rxjs/operators';
15
+ import { RobotIcon, PlayIcon } from '@sanity/icons';
16
+ import imageUrlBuilder from '@sanity/image-url';
17
+ const Root$2 = styled(Card)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n justify-content: stretch;\n height: 100%;\n box-sizing: border-box;\n position: relative;\n"])));
18
+ const Header = styled(Card)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: sticky;\n top: 0;\n z-index: 2;\n border-top-left-radius: inherit;\n border-top-right-radius: inherit;\n"])));
19
+ const Footer = styled(Card)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n position: sticky;\n overflow: hidden;\n bottom: 0;\n z-index: 2;\n border-bottom-right-radius: inherit;\n border-bottom-left-radius: inherit;\n margin-top: auto;\n"])));
20
+ const Content = styled(Box)(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n position: relative;\n z-index: 1;\n height: stretch;\n min-height: 21.5em;\n\n @media (min-width: ", "px) {\n overflow-y: auto;\n outline: none;\n }\n"])), _ref => {
21
+ let {
22
+ theme
23
+ } = _ref;
24
+ return theme.sanity.media[0];
25
+ });
26
+ const DashboardWidgetContainer = forwardRef(function DashboardWidgetContainer2(props, ref) {
27
+ const {
28
+ header,
29
+ children,
30
+ footer
31
+ } = props;
32
+ return /* @__PURE__ */jsxs(Root$2, {
33
+ radius: 3,
34
+ display: "flex",
35
+ ref,
36
+ children: [header && /* @__PURE__ */jsx(Header, {
37
+ borderBottom: true,
38
+ paddingX: 3,
39
+ paddingY: 4,
40
+ children: /* @__PURE__ */jsx(Heading, {
41
+ size: 1,
42
+ textOverflow: "ellipsis",
43
+ children: header
44
+ })
45
+ }), children && /* @__PURE__ */jsx(Content, {
46
+ children
47
+ }), footer && /* @__PURE__ */jsx(Footer, {
48
+ borderTop: true,
49
+ children: footer
50
+ })]
51
+ });
52
+ });
53
+ function useVersionedClient() {
54
+ return useClient({
55
+ apiVersion: "1"
56
+ });
57
+ }
58
+ const DashboardContext = createContext({
59
+ widgets: []
60
+ });
61
+ function useDashboardConfig() {
62
+ return useContext(DashboardContext);
63
+ }
64
+ function WidgetContainer(props) {
65
+ const config = useDashboardConfig();
66
+ const layout = useMemo(() => _objectSpread(_objectSpread({}, props.layout || {}), config.layout || {}), [props.layout, config.layout]);
67
+ return /* @__PURE__ */jsx(Card, {
68
+ shadow: 1,
69
+ "data-width": layout.width,
70
+ "data-height": layout.height,
71
+ children: createElement(props.component, {})
72
+ });
73
+ }
74
+ function isUrl(url) {
75
+ return url && /^https?:\/\//.test("".concat(url));
76
+ }
77
+ function getGraphQlUrl(projectId, dataset) {
78
+ return "https://".concat(projectId, ".api.sanity.io/v1/graphql/").concat(dataset, "/default");
79
+ }
80
+ function getGroqUrl(projectId, dataset) {
81
+ return "https://".concat(projectId, ".api.sanity.io/v1/groq/").concat(dataset);
82
+ }
83
+ function getManageUrl(projectId) {
84
+ return "https://manage.sanity.io/projects/".concat(projectId);
85
+ }
86
+ const NO_EXPERIMENTAL = [];
87
+ const NO_DATA = [];
88
+ function ProjectInfo(props) {
89
+ const {
90
+ __experimental_before = NO_EXPERIMENTAL,
91
+ data = NO_DATA
92
+ } = props;
93
+ const [studioHost, setStudioHost] = useState();
94
+ const [graphqlApi, setGraphQlApi] = useState();
95
+ const versionedClient = useVersionedClient();
96
+ const {
97
+ projectId = "unknown",
98
+ dataset = "unknown"
99
+ } = versionedClient.config();
100
+ useEffect(() => {
101
+ const subscriptions = [];
102
+ subscriptions.push(versionedClient.observable.request({
103
+ uri: "/projects/".concat(projectId)
104
+ }).subscribe({
105
+ next: result => {
106
+ const {
107
+ studioHost: host
108
+ } = result;
109
+ setStudioHost(host ? "https://".concat(host, ".sanity.studio") : void 0);
110
+ },
111
+ error: error => {
112
+ console.error("Error while looking for studioHost", error);
113
+ setStudioHost({
114
+ error: "Something went wrong while looking up studioHost. See console."
115
+ });
116
+ }
117
+ }));
118
+ subscriptions.push(versionedClient.observable.request({
119
+ method: "HEAD",
120
+ uri: "/graphql/".concat(dataset, "/default")
121
+ }).subscribe({
122
+ next: () => setGraphQlApi(getGraphQlUrl(projectId, dataset)),
123
+ error: error => {
124
+ if (error.statusCode === 404) {
125
+ setGraphQlApi(void 0);
126
+ } else {
127
+ console.error("Error while looking for graphqlApi", error);
128
+ setGraphQlApi({
129
+ error: "Something went wrong while looking up graphqlApi. See console."
130
+ });
131
+ }
132
+ }
133
+ }));
134
+ return () => {
135
+ subscriptions.forEach(s => s.unsubscribe());
136
+ };
137
+ }, [dataset, projectId, versionedClient, setGraphQlApi, setStudioHost]);
138
+ const assembleTableRows = useMemo(() => {
139
+ var _a;
140
+ let result = [{
141
+ title: "Sanity project",
142
+ rows: [{
143
+ title: "Project ID",
144
+ value: projectId
145
+ }, {
146
+ title: "Dataset",
147
+ value: dataset
148
+ }]
149
+ }];
150
+ const apps = [studioHost ? {
151
+ title: "Studio",
152
+ value: studioHost
153
+ } : null, ...data.filter(item => item.category === "apps")].filter(a => !!a);
154
+ if (apps.length > 0) {
155
+ result = result.concat([{
156
+ title: "Apps",
157
+ rows: apps
158
+ }]);
159
+ }
160
+ result = result.concat([{
161
+ title: "APIs",
162
+ rows: [{
163
+ title: "GROQ",
164
+ value: getGroqUrl(projectId, dataset)
165
+ }, {
166
+ title: "GraphQL",
167
+ value: (_a = typeof graphqlApi === "object" ? "Error" : graphqlApi) != null ? _a : "Not deployed"
168
+ }]
169
+ }], data.filter(item => item.category === "apis"));
170
+ const otherStuff = {};
171
+ data.forEach(item => {
172
+ if (item.category && item.category !== "apps" && item.category !== "apis") {
173
+ if (!otherStuff[item.category]) {
174
+ otherStuff[item.category] = [];
175
+ }
176
+ otherStuff[item.category].push(item);
177
+ }
178
+ });
179
+ Object.keys(otherStuff).forEach(category => {
180
+ result.push({
181
+ title: category,
182
+ rows: otherStuff[category]
183
+ });
184
+ });
185
+ return result;
186
+ }, [graphqlApi, studioHost, projectId, dataset, data]);
187
+ return /* @__PURE__ */jsxs(Fragment, {
188
+ children: [__experimental_before.map((widgetConfig, idx) => /* @__PURE__ */jsx(WidgetContainer, _objectSpread({}, widgetConfig), idx)), /* @__PURE__ */jsx(Box, {
189
+ height: "fill",
190
+ marginTop: (__experimental_before == null ? void 0 : __experimental_before.length) > 0 ? 4 : 0,
191
+ children: /* @__PURE__ */jsx(DashboardWidgetContainer, {
192
+ footer: /* @__PURE__ */jsx(Button, {
193
+ style: {
194
+ width: "100%"
195
+ },
196
+ paddingX: 2,
197
+ paddingY: 4,
198
+ mode: "bleed",
199
+ tone: "primary",
200
+ text: "Manage project",
201
+ as: "a",
202
+ href: getManageUrl(projectId)
203
+ }),
204
+ children: /* @__PURE__ */jsx(Card, {
205
+ paddingY: 4,
206
+ radius: 2,
207
+ role: "table",
208
+ "aria-label": "Project info",
209
+ "aria-describedby": "project_info_table",
210
+ children: /* @__PURE__ */jsxs(Stack, {
211
+ space: 4,
212
+ children: [/* @__PURE__ */jsx(Box, {
213
+ paddingX: 3,
214
+ as: "header",
215
+ children: /* @__PURE__ */jsx(Heading, {
216
+ size: 1,
217
+ as: "h2",
218
+ id: "project_info_table",
219
+ children: "Project info"
220
+ })
221
+ }), assembleTableRows.map(item => {
222
+ if (!item || !item.rows) {
223
+ return null;
224
+ }
225
+ return /* @__PURE__ */jsxs(Stack, {
226
+ space: 3,
227
+ children: [/* @__PURE__ */jsx(Card, {
228
+ borderBottom: true,
229
+ padding: 3,
230
+ children: /* @__PURE__ */jsx(Label, {
231
+ size: 0,
232
+ muted: true,
233
+ role: "columnheader",
234
+ children: item.title
235
+ })
236
+ }), /* @__PURE__ */jsx(Stack, {
237
+ space: 4,
238
+ paddingX: 3,
239
+ role: "rowgroup",
240
+ children: item.rows.map(row => {
241
+ var _a;
242
+ return /* @__PURE__ */jsxs(Grid, {
243
+ columns: 2,
244
+ role: "row",
245
+ children: [/* @__PURE__ */jsx(Text, {
246
+ weight: "medium",
247
+ role: "rowheader",
248
+ children: row.title
249
+ }), typeof row.value === "object" && /* @__PURE__ */jsx(Text, {
250
+ size: 1,
251
+ children: (_a = row.value) == null ? void 0 : _a.error
252
+ }), typeof row.value === "string" && /* @__PURE__ */jsx(Fragment, {
253
+ children: isUrl(row.value) ? /* @__PURE__ */jsx(Text, {
254
+ size: 1,
255
+ role: "cell",
256
+ style: {
257
+ wordBreak: "break-word"
258
+ },
259
+ children: /* @__PURE__ */jsx("a", {
260
+ href: row.value,
261
+ children: row.value
262
+ })
263
+ }) : /* @__PURE__ */jsx(Code, {
264
+ size: 1,
265
+ role: "cell",
266
+ style: {
267
+ wordBreak: "break-word"
268
+ },
269
+ children: row.value
270
+ })
271
+ })]
272
+ }, row.title);
273
+ })
274
+ })]
275
+ }, item.title);
276
+ })]
277
+ })
278
+ })
279
+ })
280
+ })]
281
+ });
282
+ }
283
+ function projectInfoWidget(config) {
284
+ var _a;
285
+ return {
286
+ name: "project-info",
287
+ component: ProjectInfo,
288
+ layout: (_a = config == null ? void 0 : config.layout) != null ? _a : {
289
+ width: "medium"
290
+ }
291
+ };
292
+ }
293
+ const AvatarWrapper = styled(Card)(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n box-sizing: border-box;\n border-radius: 50%;\n border-color: transparent;\n overflow: hidden;\n width: 100%;\n height: 100%;\n\n & > img {\n width: 100%;\n height: auto;\n }\n"])));
294
+ function getInviteUrl(projectId) {
295
+ return "https://manage.sanity.io/projects/".concat(projectId, "/team/invite");
296
+ }
297
+ function ProjectUsers() {
298
+ const [project, setProject] = useState();
299
+ const [users, setUsers] = useState();
300
+ const [error, setError] = useState();
301
+ const userStore = useUserStore();
302
+ const versionedClient = useVersionedClient();
303
+ const fetchData = useCallback(() => {
304
+ const {
305
+ projectId
306
+ } = versionedClient.config();
307
+ const subscription = versionedClient.observable.request({
308
+ uri: "/projects/".concat(projectId)
309
+ }).pipe(switchMap(_project => from(userStore.getUsers(_project.members.map(mem => mem.id))).pipe(map(_users => ({
310
+ project: _project,
311
+ users: _users
312
+ }))))).subscribe({
313
+ next: _ref2 => {
314
+ let {
315
+ users: _users,
316
+ project: _project
317
+ } = _ref2;
318
+ setProject(_project);
319
+ setUsers((Array.isArray(_users) ? _users : [_users]).sort((userA, userB) => sortUsersByRobotStatus(userA, userB, _project)));
320
+ },
321
+ error: e => setError(e)
322
+ });
323
+ return () => subscription.unsubscribe();
324
+ }, [userStore, versionedClient]);
325
+ useEffect(() => fetchData(), [fetchData]);
326
+ const handleRetryFetch = useCallback(() => fetchData(), [fetchData]);
327
+ const isLoading = !users || !project;
328
+ if (error) {
329
+ return /* @__PURE__ */jsx(DashboardWidgetContainer, {
330
+ header: "Project users",
331
+ children: /* @__PURE__ */jsx(Box, {
332
+ padding: 4,
333
+ children: /* @__PURE__ */jsxs(Text, {
334
+ children: ["Something went wrong while fetching data. You could", " ", /* @__PURE__ */jsx("a", {
335
+ onClick: handleRetryFetch,
336
+ title: "Retry users fetch",
337
+ style: {
338
+ cursor: "pointer"
339
+ },
340
+ children: "retry"
341
+ }), "..?"]
342
+ })
343
+ })
344
+ });
345
+ }
346
+ return /* @__PURE__ */jsxs(DashboardWidgetContainer, {
347
+ header: "Project users",
348
+ footer: /* @__PURE__ */jsx(Button, {
349
+ style: {
350
+ width: "100%"
351
+ },
352
+ paddingX: 2,
353
+ paddingY: 4,
354
+ mode: "bleed",
355
+ tone: "primary",
356
+ text: "Invite members",
357
+ as: "a",
358
+ loading: isLoading,
359
+ href: isLoading ? void 0 : getInviteUrl(project.id)
360
+ }),
361
+ children: [isLoading && /* @__PURE__ */jsx(Box, {
362
+ paddingY: 5,
363
+ paddingX: 2,
364
+ children: /* @__PURE__ */jsxs(Stack, {
365
+ space: 4,
366
+ children: [/* @__PURE__ */jsx(Text, {
367
+ align: "center",
368
+ muted: true,
369
+ size: 1,
370
+ children: /* @__PURE__ */jsx(Spinner, {})
371
+ }), /* @__PURE__ */jsx(Text, {
372
+ align: "center",
373
+ size: 1,
374
+ muted: true,
375
+ children: "Loading items..."
376
+ })]
377
+ })
378
+ }), !isLoading && /* @__PURE__ */jsx(Stack, {
379
+ space: 3,
380
+ padding: 3,
381
+ children: users == null ? void 0 : users.map(user => {
382
+ const membership = project.members.find(member => member.id === user.id);
383
+ const media = (membership == null ? void 0 : membership.isRobot) ? /* @__PURE__ */jsx(Text, {
384
+ size: 3,
385
+ children: /* @__PURE__ */jsx(RobotIcon, {})
386
+ }) : /* @__PURE__ */jsx(AvatarWrapper, {
387
+ tone: "transparent",
388
+ children: (user == null ? void 0 : user.imageUrl) && /* @__PURE__ */jsx("img", {
389
+ src: user.imageUrl,
390
+ alt: user == null ? void 0 : user.displayName
391
+ })
392
+ });
393
+ return /* @__PURE__ */jsx(Box, {
394
+ children: /* @__PURE__ */jsx(DefaultPreview, {
395
+ title: user.displayName,
396
+ subtitle: membership == null ? void 0 : membership.role,
397
+ media
398
+ })
399
+ }, user.id);
400
+ })
401
+ })]
402
+ });
403
+ }
404
+ function sortUsersByRobotStatus(userA, userB, project) {
405
+ const {
406
+ members
407
+ } = project;
408
+ const membershipA = members.find(member => member.id === (userA == null ? void 0 : userA.id));
409
+ const membershipB = members.find(member => member.id === (userB == null ? void 0 : userB.id));
410
+ if (membershipA == null ? void 0 : membershipA.isRobot) {
411
+ return 1;
412
+ }
413
+ if (membershipB == null ? void 0 : membershipB.isRobot) {
414
+ return -1;
415
+ }
416
+ return 0;
417
+ }
418
+ function projectUsersWidget(config) {
419
+ return {
420
+ name: "project-info",
421
+ component: ProjectUsers,
422
+ layout: config == null ? void 0 : config.layout
423
+ };
424
+ }
425
+ const PlayIconBox = styled(Box)(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n\n &:before {\n content: '';\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n width: 2.75em;\n height: 2.75em;\n border-radius: 50%;\n background: ", ";\n opacity: 0.75;\n }\n"])), _ref3 => {
426
+ let {
427
+ theme
428
+ } = _ref3;
429
+ return theme.sanity.color.card.enabled.bg;
430
+ });
431
+ const Root$1 = styled(Flex)(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n &:hover {\n ", " {\n &:before {\n opacity: 1;\n }\n }\n }\n"])), PlayIconBox);
432
+ const PosterCard = styled(Card)(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n width: 100%;\n padding-bottom: calc(9 / 16 * 100%);\n position: relative;\n"])));
433
+ const Poster = styled.img(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n left: 0;\n height: 100%;\n width: 100%;\n object-fit: cover;\n display: block;\n\n &:not([src]) {\n display: none;\n }\n"])));
434
+ function Tutorial(props) {
435
+ const {
436
+ title,
437
+ posterURL,
438
+ showPlayIcon,
439
+ href,
440
+ presenterName,
441
+ presenterSubtitle
442
+ } = props;
443
+ return /* @__PURE__ */jsx(Root$1, {
444
+ flex: 1,
445
+ children: /* @__PURE__ */jsx(Card, {
446
+ sizing: "border",
447
+ flex: 1,
448
+ padding: 2,
449
+ radius: 2,
450
+ as: "a",
451
+ href,
452
+ target: "_blank",
453
+ rel: "noopener noreferrer",
454
+ style: {
455
+ position: "relative"
456
+ },
457
+ children: /* @__PURE__ */jsxs(Flex, {
458
+ direction: "column",
459
+ style: {
460
+ height: "100%"
461
+ },
462
+ children: [posterURL && /* @__PURE__ */jsxs(PosterCard, {
463
+ marginBottom: 1,
464
+ children: [/* @__PURE__ */jsx(Poster, {
465
+ src: posterURL
466
+ }), showPlayIcon && /* @__PURE__ */jsx(PlayIconBox, {
467
+ display: "flex",
468
+ children: /* @__PURE__ */jsx(Text, {
469
+ align: "center",
470
+ children: /* @__PURE__ */jsx(PlayIcon, {})
471
+ })
472
+ })]
473
+ }), /* @__PURE__ */jsxs(Flex, {
474
+ direction: "column",
475
+ justify: "space-between",
476
+ paddingY: 2,
477
+ flex: 1,
478
+ children: [/* @__PURE__ */jsx(Heading, {
479
+ as: "h3",
480
+ size: 1,
481
+ children: title
482
+ }), /* @__PURE__ */jsx(Box, {
483
+ marginTop: 4,
484
+ children: /* @__PURE__ */jsxs(Stack, {
485
+ space: 2,
486
+ flex: 1,
487
+ children: [/* @__PURE__ */jsx(Text, {
488
+ size: 1,
489
+ children: presenterName
490
+ }), /* @__PURE__ */jsx(Text, {
491
+ size: 0,
492
+ style: {
493
+ opacity: 0.7
494
+ },
495
+ children: presenterSubtitle
496
+ })]
497
+ })
498
+ })]
499
+ })]
500
+ })
501
+ })
502
+ });
503
+ }
504
+ const tutorialsProjectConfig = {
505
+ projectId: "3do82whm",
506
+ dataset: "next"
507
+ };
508
+ function useDataAdapter() {
509
+ const versionedClient = useVersionedClient();
510
+ return useMemo(() => ({
511
+ getFeed: templateRepoId => {
512
+ const uri = templateRepoId ? "/addons/dashboard?templateRepoId=".concat(templateRepoId) : "/addons/dashboard";
513
+ return versionedClient.observable.request({
514
+ uri,
515
+ withCredentials: false
516
+ });
517
+ },
518
+ urlBuilder: imageUrlBuilder(tutorialsProjectConfig)
519
+ }), [versionedClient]);
520
+ }
521
+ function createUrl(slug, type) {
522
+ if (type === "tutorial") {
523
+ return "https://www.sanity.io/docs/tutorials/".concat(slug.current);
524
+ } else if (type === "guide") {
525
+ return "https://www.sanity.io/docs/guides/".concat(slug.current);
526
+ }
527
+ return false;
528
+ }
529
+ function SanityTutorials(props) {
530
+ const {
531
+ templateRepoId
532
+ } = props;
533
+ const [feedItems, setFeedItems] = useState([]);
534
+ const {
535
+ getFeed,
536
+ urlBuilder
537
+ } = useDataAdapter();
538
+ useEffect(() => {
539
+ const subscription = getFeed(templateRepoId).subscribe(response => {
540
+ setFeedItems(response.items);
541
+ });
542
+ return () => {
543
+ subscription.unsubscribe();
544
+ };
545
+ }, [setFeedItems, getFeed, templateRepoId]);
546
+ const title = "Learn about Sanity";
547
+ return /* @__PURE__ */jsx(DashboardWidgetContainer, {
548
+ header: title,
549
+ children: /* @__PURE__ */jsx(Flex, {
550
+ as: "ul",
551
+ overflow: "auto",
552
+ align: "stretch",
553
+ paddingY: 2,
554
+ children: feedItems == null ? void 0 : feedItems.map((feedItem, index) => {
555
+ var _a;
556
+ if (!feedItem.title || !feedItem.guideOrTutorial && !feedItem.externalLink) {
557
+ return null;
558
+ }
559
+ const presenter = feedItem.presenter || ((_a = feedItem.guideOrTutorial) == null ? void 0 : _a.presenter) || {};
560
+ const subtitle = feedItem.category;
561
+ const {
562
+ guideOrTutorial = {}
563
+ } = feedItem;
564
+ const href = (guideOrTutorial.slug ? createUrl(guideOrTutorial.slug, guideOrTutorial._type) : feedItem.externalLink) || feedItem.externalLink;
565
+ return /* @__PURE__ */jsx(Flex, {
566
+ as: "li",
567
+ paddingRight: index < (feedItems == null ? void 0 : feedItems.length) - 1 ? 1 : 3,
568
+ paddingLeft: index === 0 ? 3 : 0,
569
+ align: "stretch",
570
+ style: {
571
+ minWidth: 272,
572
+ width: "30%"
573
+ },
574
+ children: /* @__PURE__ */jsx(Tutorial, {
575
+ title: feedItem.title,
576
+ href: href != null ? href : "",
577
+ presenterName: presenter.name,
578
+ presenterSubtitle: subtitle,
579
+ showPlayIcon: feedItem.hasVideo,
580
+ posterURL: feedItem.poster ? urlBuilder.image(feedItem.poster).height(360).url() : void 0
581
+ })
582
+ }, feedItem._id);
583
+ })
584
+ })
585
+ });
586
+ }
587
+ function sanityTutorialsWidget(config) {
588
+ var _a;
589
+ return {
590
+ name: "sanity-tutorials",
591
+ component: SanityTutorials,
592
+ layout: (_a = config == null ? void 0 : config.layout) != null ? _a : {
593
+ width: "full"
594
+ }
595
+ };
596
+ }
597
+ function DashboardLayout(props) {
598
+ return /* @__PURE__ */jsx(Container, {
599
+ width: 4,
600
+ padding: 4,
601
+ sizing: "border",
602
+ style: {
603
+ height: "100%",
604
+ overflowY: "auto"
605
+ },
606
+ children: props.children
607
+ });
608
+ }
609
+ const media = {
610
+ small: function () {
611
+ return css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n @media (min-width: ", "px) {\n ", "\n }\n "])), _ref4 => {
612
+ let {
613
+ theme
614
+ } = _ref4;
615
+ return theme.sanity.media[0];
616
+ }, css(...arguments));
617
+ },
618
+ medium: function () {
619
+ return css(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n @media (min-width: ", "px) {\n ", "\n }\n "])), _ref5 => {
620
+ let {
621
+ theme
622
+ } = _ref5;
623
+ return theme.sanity.media[2];
624
+ }, css(...arguments));
625
+ }
626
+ };
627
+ const Root = styled(Grid)(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));\n\n & > div {\n overflow: hidden;\n }\n\n & > div[data-width='medium'] {\n ", "\n }\n\n & > div[data-width='large'] {\n ", "\n\n ", "\n }\n\n & > div[data-width='full'] {\n ", "\n }\n\n & > div[data-height='medium'] {\n ", "\n }\n\n & > div[data-height='large'] {\n ", "\n\n ", "\n }\n\n & > div[data-height='full'] {\n ", "\n }\n"])), media.small(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n grid-column: span 2;\n "]))), media.small(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["\n grid-column: span 2;\n "]))), media.medium(_templateObject15 || (_templateObject15 = _taggedTemplateLiteral(["\n grid-column: span 3;\n "]))), media.small(_templateObject16 || (_templateObject16 = _taggedTemplateLiteral(["\n grid-column: 1 / -1;\n "]))), media.small(_templateObject17 || (_templateObject17 = _taggedTemplateLiteral(["\n grid-row: span 2;\n "]))), media.small(_templateObject18 || (_templateObject18 = _taggedTemplateLiteral(["\n grid-row: span 2;\n "]))), media.medium(_templateObject19 || (_templateObject19 = _taggedTemplateLiteral(["\n grid-row: span 3;\n "]))), media.medium(_templateObject20 || (_templateObject20 = _taggedTemplateLiteral(["\n grid-row: 1 / -1;\n "]))));
628
+ const NO_WIDGETS = [];
629
+ const NO_LAYOUT = {};
630
+ function WidgetGroup(props) {
631
+ const {
632
+ config: {
633
+ layout = NO_LAYOUT,
634
+ widgets = NO_WIDGETS
635
+ }
636
+ } = props;
637
+ return /* @__PURE__ */jsxs(Root, {
638
+ autoFlow: "row dense",
639
+ "data-width": layout.width || "auto",
640
+ "data-height": layout.height || "auto",
641
+ gap: 4,
642
+ children: [widgets.length ? null : /* @__PURE__ */jsx(Card, {
643
+ padding: 4,
644
+ shadow: 1,
645
+ tone: "primary",
646
+ children: /* @__PURE__ */jsx(Text, {
647
+ align: "center",
648
+ children: "Add some widgets to populate this space."
649
+ })
650
+ }), widgets.map((widgetConfig, index) => {
651
+ if (widgetConfig.type === "__experimental_group") {
652
+ return /* @__PURE__ */jsx(WidgetGroup, {
653
+ config: widgetConfig
654
+ }, index);
655
+ }
656
+ if (widgetConfig.component) {
657
+ return /* @__PURE__ */jsx(WidgetContainer, _objectSpread({}, widgetConfig), index);
658
+ }
659
+ return /* @__PURE__ */jsxs(Box, {
660
+ children: [widgetConfig.name, " is missing widget component"]
661
+ }, index);
662
+ })]
663
+ });
664
+ }
665
+ function Dashboard(_ref6) {
666
+ let {
667
+ config
668
+ } = _ref6;
669
+ if (!config) {
670
+ return null;
671
+ }
672
+ return /* @__PURE__ */jsx(DashboardContext.Provider, {
673
+ value: config,
674
+ children: /* @__PURE__ */jsx(DashboardLayout, {
675
+ children: /* @__PURE__ */jsx(WidgetGroup, {
676
+ config
677
+ })
678
+ })
679
+ });
680
+ }
681
+ const strokeStyle = {
682
+ stroke: "currentColor",
683
+ strokeWidth: 1.2
684
+ };
685
+ const DashboardIcon = () => /* @__PURE__ */jsxs("svg", {
686
+ "data-sanity-icon": true,
687
+ viewBox: "0 0 25 25",
688
+ fill: "none",
689
+ xmlns: "http://www.w3.org/2000/svg",
690
+ preserveAspectRatio: "xMidYMid",
691
+ width: "1em",
692
+ height: "1em",
693
+ children: [/* @__PURE__ */jsx("path", {
694
+ d: "M19.5 19.5H5.5V5.5H19.5V19.5Z",
695
+ style: strokeStyle
696
+ }), /* @__PURE__ */jsx("path", {
697
+ d: "M5.5 12.5H19.5",
698
+ style: strokeStyle
699
+ }), /* @__PURE__ */jsx("path", {
700
+ d: "M14.5 19.5V12.5M10.5 12.5V5.5",
701
+ style: strokeStyle
702
+ })]
703
+ });
704
+ const dashboardTool = definePlugin(function () {
705
+ let config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
706
+ var _a, _b, _c, _d, _e;
707
+ const pluginConfig = {
708
+ layout: (_a = config.defaultLayout) != null ? _a : {},
709
+ widgets: (_b = config.widgets) != null ? _b : []
710
+ };
711
+ const title = (_c = config.title) != null ? _c : "Dashboard";
712
+ const name = (_d = config.name) != null ? _d : "dashboard";
713
+ const icon = (_e = config.icon) != null ? _e : DashboardIcon;
714
+ return {
715
+ name: "dashboard",
716
+ tools: (prev, context) => {
717
+ return [...prev, {
718
+ title,
719
+ name,
720
+ icon,
721
+ component: () => /* @__PURE__ */jsx(Dashboard, {
722
+ config: pluginConfig
723
+ })
724
+ }];
725
+ }
726
+ };
727
+ });
728
+ export { DashboardWidgetContainer, dashboardTool, projectInfoWidget, projectUsersWidget, sanityTutorialsWidget };
2
729
  //# sourceMappingURL=index.esm.js.map