sanity 5.26.0-next.8 → 5.26.0-next.9

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.
@@ -1,4 +1,4 @@
1
- var version = "5.26.0-next.8";
1
+ var version = "5.26.0-next.9";
2
2
  let buildVersion;
3
3
  try {
4
4
  buildVersion = process.env.PKG_BUILD_VERSION;
@@ -7,7 +7,7 @@ try {
7
7
  try {
8
8
  buildVersion = buildVersion || // This is replaced by `@sanity/pkg-utils` at build time
9
9
  // and must always be references by its full static name, e.g. no optional chaining, no `if (process && process.env)` etc.
10
- "5.26.0-next.8";
10
+ "5.26.0-next.9";
11
11
  } catch {
12
12
  }
13
13
  const SANITY_VERSION = buildVersion || `${version}-dev`;
package/lib/index.js CHANGED
@@ -85135,6 +85135,29 @@ function StudioErrorBoundary(props2) {
85135
85135
  let t3;
85136
85136
  return $[16] !== caughtError.error || $[17] !== caughtError.eventId || $[18] !== heading ? (t3 = /* @__PURE__ */ jsx(FallbackErrorScreen, { heading, error: caughtError.error, eventId: caughtError.eventId, onReset: handleResetError }), $[16] = caughtError.error, $[17] = caughtError.eventId, $[18] = heading, $[19] = t3) : t3 = $[19], t3;
85137
85137
  }
85138
+ const StudioToolMountTimeMeasured = defineEvent({
85139
+ name: "Studio Tool Mount Time Measured",
85140
+ version: 1,
85141
+ description: "Time from a tool being selected to its component rendering its first effect (i.e. first paint after Suspense resolves the lazy chunk)."
85142
+ }), mountedTools = /* @__PURE__ */ new Set();
85143
+ function ToolMountTimer(t0) {
85144
+ const $ = c(5), {
85145
+ toolName,
85146
+ t0Ref
85147
+ } = t0, telemetry = useTelemetry();
85148
+ let t1, t2;
85149
+ return $[0] !== t0Ref || $[1] !== telemetry || $[2] !== toolName ? (t1 = () => {
85150
+ const t0$0 = t0Ref.current;
85151
+ if (t0$0 === null)
85152
+ return;
85153
+ const isFirstMount = !mountedTools.has(toolName);
85154
+ mountedTools.add(toolName), telemetry.log(StudioToolMountTimeMeasured, {
85155
+ toolName,
85156
+ durationMs: performance.now() - t0$0,
85157
+ isFirstMount
85158
+ });
85159
+ }, t2 = [telemetry, toolName, t0Ref], $[0] = t0Ref, $[1] = telemetry, $[2] = toolName, $[3] = t1, $[4] = t2) : (t1 = $[3], t2 = $[4]), useEffect(t1, t2), null;
85160
+ }
85138
85161
  const DetectViteDevServerStopped = lazy(() => import("./_chunks-es/ViteDevServerStopped.js").then((DevServerStopped) => ({
85139
85162
  default: DevServerStopped.DetectViteDevServerStopped
85140
85163
  }))), detectViteDevServerStopped = import.meta.hot && process.env.NODE_ENV === "development", SearchFullscreenPortalCard = styled(Card).withConfig({
@@ -85148,7 +85171,7 @@ function StudioLayout() {
85148
85171
  return $[0] !== Layout2 ? (t0 = /* @__PURE__ */ jsx(Layout2, {}), $[0] = Layout2, $[1] = t0) : t0 = $[1], t0;
85149
85172
  }
85150
85173
  function StudioLayoutComponent() {
85151
- const $ = c(69), {
85174
+ const $ = c(72), {
85152
85175
  name,
85153
85176
  title,
85154
85177
  tools
@@ -85159,98 +85182,106 @@ function StudioLayoutComponent() {
85159
85182
  const defaultRouteTools = t0, router = useRouter(), activeToolName = useRouterState(_temp$u);
85160
85183
  let t1;
85161
85184
  if ($[2] !== activeToolName || $[3] !== tools) {
85162
- let t26;
85163
- $[5] !== activeToolName ? (t26 = (tool) => tool.name === activeToolName, $[5] = activeToolName, $[6] = t26) : t26 = $[6], t1 = tools.find(t26), $[2] = activeToolName, $[3] = tools, $[4] = t1;
85185
+ let t28;
85186
+ $[5] !== activeToolName ? (t28 = (tool) => tool.name === activeToolName, $[5] = activeToolName, $[6] = t28) : t28 = $[6], t1 = tools.find(t28), $[2] = activeToolName, $[3] = tools, $[4] = t1;
85164
85187
  } else
85165
85188
  t1 = $[4];
85166
- const activeTool = t1, [searchFullscreenOpen, setSearchFullscreenOpen] = useState(!1), [searchFullscreenPortalEl, setSearchFullscreenPortalEl] = useState(null), [searchOpen, setSearchOpen] = useState(!1);
85167
- let t2;
85189
+ const activeTool = t1, toolMountT0Ref = useRef(null), lastToolNameRef = useRef(void 0);
85190
+ let t2, t3;
85191
+ $[7] !== activeToolName ? (t2 = () => {
85192
+ activeToolName !== lastToolNameRef.current && (lastToolNameRef.current = activeToolName, toolMountT0Ref.current = activeToolName ? performance.now() : null);
85193
+ }, t3 = [activeToolName], $[7] = activeToolName, $[8] = t2, $[9] = t3) : (t2 = $[8], t3 = $[9]), useEffect(t2, t3);
85194
+ const [searchFullscreenOpen, setSearchFullscreenOpen] = useState(!1), [searchFullscreenPortalEl, setSearchFullscreenPortalEl] = useState(null), [searchOpen, setSearchOpen] = useState(!1);
85195
+ let t4;
85168
85196
  bb0: {
85169
- let t32;
85170
- $[7] !== name || $[8] !== title ? (t32 = title || startCase(name), $[7] = name, $[8] = title, $[9] = t32) : t32 = $[9];
85171
- const workspaceTitle = t32, toolTitle = activeTool ? activeTool.title || activeTool.name : void 0;
85197
+ let t52;
85198
+ $[10] !== name || $[11] !== title ? (t52 = title || startCase(name), $[10] = name, $[11] = title, $[12] = t52) : t52 = $[12];
85199
+ const workspaceTitle = t52, toolTitle = activeTool ? activeTool.title || activeTool.name : void 0;
85172
85200
  if (toolTitle) {
85173
- t2 = `${toolTitle} | ${workspaceTitle}`;
85201
+ t4 = `${toolTitle} | ${workspaceTitle}`;
85174
85202
  break bb0;
85175
85203
  }
85176
- t2 = workspaceTitle;
85204
+ t4 = workspaceTitle;
85177
85205
  }
85178
- const documentTitle = t2, toolControlsDocumentTitle = !!activeTool?.controlsDocumentTitle;
85179
- let t3, t4;
85180
- $[10] !== documentTitle || $[11] !== toolControlsDocumentTitle ? (t3 = () => {
85181
- toolControlsDocumentTitle || (document.title = documentTitle);
85182
- }, t4 = [documentTitle, toolControlsDocumentTitle], $[10] = documentTitle, $[11] = toolControlsDocumentTitle, $[12] = t3, $[13] = t4) : (t3 = $[12], t4 = $[13]), useEffect(t3, t4);
85206
+ const documentTitle = t4, toolControlsDocumentTitle = !!activeTool?.controlsDocumentTitle;
85183
85207
  let t5, t6;
85184
- $[14] !== activeTool || $[15] !== telemetry || $[16] !== tools.length ? (t5 = () => {
85208
+ $[13] !== documentTitle || $[14] !== toolControlsDocumentTitle ? (t5 = () => {
85209
+ toolControlsDocumentTitle || (document.title = documentTitle);
85210
+ }, t6 = [documentTitle, toolControlsDocumentTitle], $[13] = documentTitle, $[14] = toolControlsDocumentTitle, $[15] = t5, $[16] = t6) : (t5 = $[15], t6 = $[16]), useEffect(t5, t6);
85211
+ let t7, t8;
85212
+ $[17] !== activeTool || $[18] !== telemetry || $[19] !== tools.length ? (t7 = () => {
85185
85213
  studioReadyFired || activeTool && (studioReadyFired = !0, telemetry.log(StudioReadyMeasured, {
85186
85214
  durationMs: performance.now(),
85187
85215
  toolsCount: tools.length,
85188
85216
  activeToolName: activeTool.name
85189
85217
  }));
85190
- }, t6 = [activeTool, telemetry, tools.length], $[14] = activeTool, $[15] = telemetry, $[16] = tools.length, $[17] = t5, $[18] = t6) : (t5 = $[17], t6 = $[18]), useEffect(t5, t6);
85191
- let t7;
85192
- $[19] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t7 = (open) => {
85218
+ }, t8 = [activeTool, telemetry, tools.length], $[17] = activeTool, $[18] = telemetry, $[19] = tools.length, $[20] = t7, $[21] = t8) : (t7 = $[20], t8 = $[21]), useEffect(t7, t8);
85219
+ let t9;
85220
+ $[22] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t9 = (open) => {
85193
85221
  setSearchFullscreenOpen(open);
85194
- }, $[19] = t7) : t7 = $[19];
85195
- const handleSearchFullscreenOpenChange = t7;
85196
- let t8;
85197
- $[20] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t8 = (open_0) => {
85222
+ }, $[22] = t9) : t9 = $[22];
85223
+ const handleSearchFullscreenOpenChange = t9;
85224
+ let t10;
85225
+ $[23] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t10 = (open_0) => {
85198
85226
  setSearchOpen(open_0);
85199
- }, $[20] = t8) : t8 = $[20];
85200
- const handleSearchOpenChange = t8;
85201
- let t9;
85202
- $[21] !== searchFullscreenOpen || $[22] !== searchFullscreenPortalEl || $[23] !== searchOpen ? (t9 = {
85227
+ }, $[23] = t10) : t10 = $[23];
85228
+ const handleSearchOpenChange = t10;
85229
+ let t11;
85230
+ $[24] !== searchFullscreenOpen || $[25] !== searchFullscreenPortalEl || $[26] !== searchOpen ? (t11 = {
85203
85231
  searchFullscreenOpen,
85204
85232
  searchFullscreenPortalEl,
85205
85233
  searchOpen,
85206
85234
  onSearchFullscreenOpenChange: handleSearchFullscreenOpenChange,
85207
85235
  onSearchOpenChange: handleSearchOpenChange
85208
- }, $[21] = searchFullscreenOpen, $[22] = searchFullscreenPortalEl, $[23] = searchOpen, $[24] = t9) : t9 = $[24];
85209
- const navbarContextValue = t9, Navbar = useNavbarComponent(), ActiveToolLayout = useActiveToolLayoutComponent();
85210
- let t10;
85211
- $[25] !== activeTool || $[26] !== activeToolName || $[27] !== tools ? (t10 = !activeTool && (activeToolName === "desk" || !activeToolName) && typeof window < "u" && /\/desk(\/|$)/.test(window.location.pathname) && tools.some(_temp2$b), $[25] = activeTool, $[26] = activeToolName, $[27] = tools, $[28] = t10) : t10 = $[28];
85212
- const isLegacyDeskRedirect = t10;
85213
- let t11, t12;
85214
- $[29] !== isLegacyDeskRedirect || $[30] !== router ? (t11 = () => {
85236
+ }, $[24] = searchFullscreenOpen, $[25] = searchFullscreenPortalEl, $[26] = searchOpen, $[27] = t11) : t11 = $[27];
85237
+ const navbarContextValue = t11, Navbar = useNavbarComponent(), ActiveToolLayout = useActiveToolLayoutComponent();
85238
+ let t12;
85239
+ $[28] !== activeTool || $[29] !== activeToolName || $[30] !== tools ? (t12 = !activeTool && (activeToolName === "desk" || !activeToolName) && typeof window < "u" && /\/desk(\/|$)/.test(window.location.pathname) && tools.some(_temp2$b), $[28] = activeTool, $[29] = activeToolName, $[30] = tools, $[31] = t12) : t12 = $[31];
85240
+ const isLegacyDeskRedirect = t12;
85241
+ let t13, t14;
85242
+ $[32] !== isLegacyDeskRedirect || $[33] !== router ? (t13 = () => {
85215
85243
  isLegacyDeskRedirect && router.navigateUrl({
85216
85244
  path: window.location.pathname.replace(/\/desk/, "/structure"),
85217
85245
  replace: !0
85218
85246
  });
85219
- }, t12 = [isLegacyDeskRedirect, router], $[29] = isLegacyDeskRedirect, $[30] = router, $[31] = t11, $[32] = t12) : (t11 = $[31], t12 = $[32]), useEffect(t11, t12);
85247
+ }, t14 = [isLegacyDeskRedirect, router], $[32] = isLegacyDeskRedirect, $[33] = router, $[34] = t13, $[35] = t14) : (t13 = $[34], t14 = $[35]), useEffect(t13, t14);
85220
85248
  const getErrorScreen = _temp3$5;
85221
- let t13;
85222
- $[33] !== Navbar ? (t13 = /* @__PURE__ */ jsx(Navbar, {}), $[33] = Navbar, $[34] = t13) : t13 = $[34];
85223
- let t14;
85224
- $[35] !== navbarContextValue || $[36] !== t13 ? (t14 = /* @__PURE__ */ jsx(NavbarContext.Provider, { value: navbarContextValue, children: t13 }), $[35] = navbarContextValue, $[36] = t13, $[37] = t14) : t14 = $[37];
85225
85249
  let t15;
85226
- $[38] !== isLegacyDeskRedirect ? (t15 = isLegacyDeskRedirect && /* @__PURE__ */ jsx(RedirectingScreen, {}), $[38] = isLegacyDeskRedirect, $[39] = t15) : t15 = $[39];
85250
+ $[36] !== Navbar ? (t15 = /* @__PURE__ */ jsx(Navbar, {}), $[36] = Navbar, $[37] = t15) : t15 = $[37];
85227
85251
  let t16;
85228
- $[40] !== activeTool || $[41] !== defaultRouteTools ? (t16 = !activeTool && defaultRouteTools.length === 0 && /* @__PURE__ */ jsx(NoToolsScreen, {}), $[40] = activeTool, $[41] = defaultRouteTools, $[42] = t16) : t16 = $[42];
85252
+ $[38] !== navbarContextValue || $[39] !== t15 ? (t16 = /* @__PURE__ */ jsx(NavbarContext.Provider, { value: navbarContextValue, children: t15 }), $[38] = navbarContextValue, $[39] = t15, $[40] = t16) : t16 = $[40];
85229
85253
  let t17;
85230
- $[43] !== activeTool || $[44] !== activeToolName || $[45] !== isLegacyDeskRedirect || $[46] !== tools.length ? (t17 = tools.length > 0 && !activeTool && activeToolName && !isLegacyDeskRedirect && /* @__PURE__ */ jsx(ToolNotFoundScreen, { toolName: activeToolName }), $[43] = activeTool, $[44] = activeToolName, $[45] = isLegacyDeskRedirect, $[46] = tools.length, $[47] = t17) : t17 = $[47];
85254
+ $[41] !== isLegacyDeskRedirect ? (t17 = isLegacyDeskRedirect && /* @__PURE__ */ jsx(RedirectingScreen, {}), $[41] = isLegacyDeskRedirect, $[42] = t17) : t17 = $[42];
85231
85255
  let t18;
85232
- $[48] !== searchFullscreenOpen ? (t18 = searchFullscreenOpen && /* @__PURE__ */ jsx(SearchFullscreenPortalCard, { ref: setSearchFullscreenPortalEl, overflow: "auto" }), $[48] = searchFullscreenOpen, $[49] = t18) : t18 = $[49];
85233
- const t19 = activeTool?.name, t20 = `The ${activeTool?.name} tool crashed`;
85234
- let t21;
85235
- $[50] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t21 = detectViteDevServerStopped && /* @__PURE__ */ jsx(DetectViteDevServerStopped, {}), $[50] = t21) : t21 = $[50];
85236
- let t22;
85237
- $[51] !== ActiveToolLayout || $[52] !== activeTool || $[53] !== activeToolName ? (t22 = activeTool && activeToolName && /* @__PURE__ */ jsx(RouteScope, { scope: activeToolName, __unsafe_disableScopedSearchParams: activeTool.router?.__unsafe_disableScopedSearchParams, children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(LoadingBlock, { showText: !0 }), children: /* @__PURE__ */ jsx(ActiveToolLayout, { activeTool }) }) }), $[51] = ActiveToolLayout, $[52] = activeTool, $[53] = activeToolName, $[54] = t22) : t22 = $[54];
85256
+ $[43] !== activeTool || $[44] !== defaultRouteTools ? (t18 = !activeTool && defaultRouteTools.length === 0 && /* @__PURE__ */ jsx(NoToolsScreen, {}), $[43] = activeTool, $[44] = defaultRouteTools, $[45] = t18) : t18 = $[45];
85257
+ let t19;
85258
+ $[46] !== activeTool || $[47] !== activeToolName || $[48] !== isLegacyDeskRedirect || $[49] !== tools.length ? (t19 = tools.length > 0 && !activeTool && activeToolName && !isLegacyDeskRedirect && /* @__PURE__ */ jsx(ToolNotFoundScreen, { toolName: activeToolName }), $[46] = activeTool, $[47] = activeToolName, $[48] = isLegacyDeskRedirect, $[49] = tools.length, $[50] = t19) : t19 = $[50];
85259
+ let t20;
85260
+ $[51] !== searchFullscreenOpen ? (t20 = searchFullscreenOpen && /* @__PURE__ */ jsx(SearchFullscreenPortalCard, { ref: setSearchFullscreenPortalEl, overflow: "auto" }), $[51] = searchFullscreenOpen, $[52] = t20) : t20 = $[52];
85261
+ const t21 = activeTool?.name, t22 = `The ${activeTool?.name} tool crashed`;
85238
85262
  let t23;
85239
- $[55] !== searchFullscreenOpen || $[56] !== t22 ? (t23 = /* @__PURE__ */ jsx(Card, { flex: 1, hidden: searchFullscreenOpen, children: t22 }), $[55] = searchFullscreenOpen, $[56] = t22, $[57] = t23) : t23 = $[57];
85263
+ $[53] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t23 = detectViteDevServerStopped && /* @__PURE__ */ jsx(DetectViteDevServerStopped, {}), $[53] = t23) : t23 = $[53];
85240
85264
  let t24;
85241
- $[58] !== t19 || $[59] !== t20 || $[60] !== t23 ? (t24 = /* @__PURE__ */ jsxs(StudioErrorBoundary, { heading: t20, getErrorScreen, children: [
85242
- t21,
85243
- t23
85244
- ] }, t19), $[58] = t19, $[59] = t20, $[60] = t23, $[61] = t24) : t24 = $[61];
85265
+ $[54] !== ActiveToolLayout || $[55] !== activeTool || $[56] !== activeToolName ? (t24 = activeTool && activeToolName && /* @__PURE__ */ jsx(RouteScope, { scope: activeToolName, __unsafe_disableScopedSearchParams: activeTool.router?.__unsafe_disableScopedSearchParams, children: /* @__PURE__ */ jsxs(Suspense, { fallback: /* @__PURE__ */ jsx(LoadingBlock, { showText: !0 }), children: [
85266
+ /* @__PURE__ */ jsx(ActiveToolLayout, { activeTool }),
85267
+ /* @__PURE__ */ jsx(ToolMountTimer, { toolName: activeTool.name, t0Ref: toolMountT0Ref })
85268
+ ] }) }), $[54] = ActiveToolLayout, $[55] = activeTool, $[56] = activeToolName, $[57] = t24) : t24 = $[57];
85245
85269
  let t25;
85246
- return $[62] !== t14 || $[63] !== t15 || $[64] !== t16 || $[65] !== t17 || $[66] !== t18 || $[67] !== t24 ? (t25 = /* @__PURE__ */ jsxs(Flex, { "data-ui": "ToolScreen", direction: "column", height: "fill", "data-testid": "studio-layout", children: [
85247
- t14,
85248
- t15,
85270
+ $[58] !== searchFullscreenOpen || $[59] !== t24 ? (t25 = /* @__PURE__ */ jsx(Card, { flex: 1, hidden: searchFullscreenOpen, children: t24 }), $[58] = searchFullscreenOpen, $[59] = t24, $[60] = t25) : t25 = $[60];
85271
+ let t26;
85272
+ $[61] !== t21 || $[62] !== t22 || $[63] !== t25 ? (t26 = /* @__PURE__ */ jsxs(StudioErrorBoundary, { heading: t22, getErrorScreen, children: [
85273
+ t23,
85274
+ t25
85275
+ ] }, t21), $[61] = t21, $[62] = t22, $[63] = t25, $[64] = t26) : t26 = $[64];
85276
+ let t27;
85277
+ return $[65] !== t16 || $[66] !== t17 || $[67] !== t18 || $[68] !== t19 || $[69] !== t20 || $[70] !== t26 ? (t27 = /* @__PURE__ */ jsxs(Flex, { "data-ui": "ToolScreen", direction: "column", height: "fill", "data-testid": "studio-layout", children: [
85249
85278
  t16,
85250
85279
  t17,
85251
85280
  t18,
85252
- t24
85253
- ] }), $[62] = t14, $[63] = t15, $[64] = t16, $[65] = t17, $[66] = t18, $[67] = t24, $[68] = t25) : t25 = $[68], t25;
85281
+ t19,
85282
+ t20,
85283
+ t26
85284
+ ] }), $[65] = t16, $[66] = t17, $[67] = t18, $[68] = t19, $[69] = t20, $[70] = t26, $[71] = t27) : t27 = $[71], t27;
85254
85285
  }
85255
85286
  function _temp3$5(error) {
85256
85287
  return isDocumentLimitError(error) ? /* @__PURE__ */ jsx(DocumentLimitsUpsellPanel, {}) : null;