Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(core) : merge next into corel (Do not merge, run tests) #8318

Merged
merged 3 commits into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 2 additions & 27 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -22,30 +22,5 @@
/packages/@sanity/cli/src/commands/typegen @sanity-io/content-lake-dx
/packages/@sanity/cli/src/workers/typegenGenerate.ts @sanity-io/content-lake-dx

# Internals used by @sanity/presentation
# See https://github.com/sanity-io/visual-editing/blob/main/packages/presentation/src/internals.ts for exactly which exports
/packages/sanity/src/_singletons/structure/components/paneRouter/PaneRouterContext.tsx @sanity-io/ecosystem @sanity-io/studio
/packages/sanity/src/core/comments/context/intent/CommentsIntentProvider.tsx @sanity-io/ecosystem @sanity-io/studio
/packages/sanity/src/core/comments/types.ts @sanity-io/ecosystem @sanity-io/studio
/packages/sanity/src/core/config/document/fieldActions/define.ts @sanity-io/ecosystem @sanity-io/studio
/packages/sanity/src/core/config/document/fieldActions/types.ts @sanity-io/ecosystem @sanity-io/studio
/packages/sanity/src/core/field/paths/helpers.ts @sanity-io/ecosystem @sanity-io/studio
/packages/sanity/src/core/hooks/useEditState.ts @sanity-io/ecosystem @sanity-io/studio
/packages/sanity/src/core/preview/components/Preview.tsx @sanity-io/ecosystem @sanity-io/studio
/packages/sanity/src/core/store/_legacy/datastores.ts @sanity-io/ecosystem @sanity-io/studio
/packages/sanity/src/core/store/_legacy/document/document-store.ts @sanity-io/ecosystem @sanity-io/studio
/packages/sanity/src/core/studio/activeWorkspaceMatcher/useActiveWorkspace.ts @sanity-io/ecosystem @sanity-io/studio
/packages/sanity/src/core/studio/workspace.tsx @sanity-io/ecosystem @sanity-io/studio
/packages/sanity/src/core/util/draftUtils.ts @sanity-io/ecosystem @sanity-io/studio
/packages/sanity/src/core/util/isRecord.ts @sanity-io/ecosystem @sanity-io/studio
/packages/sanity/src/core/util/useUnique.ts @sanity-io/ecosystem @sanity-io/studio
/packages/sanity/src/router/utils/jsonParamsEncoding.ts @sanity-io/ecosystem @sanity-io/studio
/packages/sanity/src/structure/components/pane/PaneLayout.tsx @sanity-io/ecosystem @sanity-io/studio
/packages/sanity/src/structure/components/paneRouter/types.ts @sanity-io/ecosystem @sanity-io/studio
/packages/sanity/src/structure/panes/document/DocumentPane.tsx @sanity-io/ecosystem @sanity-io/studio
/packages/sanity/src/structure/panes/document/useDocumentPane.tsx @sanity-io/ecosystem @sanity-io/studio
/packages/sanity/src/structure/panes/documentList/index.ts @sanity-io/ecosystem @sanity-io/studio
/packages/sanity/src/structure/panes/documentList/pane.ts @sanity-io/ecosystem @sanity-io/studio
/packages/sanity/src/structure/panes/documentList/PaneContainer.tsx @sanity-io/ecosystem @sanity-io/studio
/packages/sanity/src/structure/StructureToolProvider.tsx @sanity-io/ecosystem @sanity-io/studio
/packages/sanity/src/structure/types.ts @sanity-io/ecosystem @sanity-io/studio
# Presentation Tool, which interfaces with Visual Editing libraries
/packages/sanity/src/presentation/ @sanity-io/ecosystem
10 changes: 8 additions & 2 deletions .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,16 @@
"@portabletext/editor",
"@sanity/bifur-client",
"@sanity/client",
"@sanity/comlink",
"@sanity/export",
"@sanity/icons",
"@sanity/insert-menu",
"@sanity/mutate",
"@sanity/presentation",
"@sanity/presentation-comlink",
"@sanity/preview-url-secret",
"@sanity/template-validator",
"@sanity/ui",
"@sanity/visual-editing-csm",
"get-it",
"groq-js",
"react-rx"
Expand All @@ -67,16 +70,19 @@
"@portabletext/editor",
"@sanity/bifur-client",
"@sanity/client",
"@sanity/comlink",
"@sanity/eslint-config-i18n",
"@sanity/export",
"@sanity/icons",
"@sanity/insert-menu",
"@sanity/mutate",
"@sanity/pkg-utils",
"@sanity/presentation",
"@sanity/presentation-comlink",
"@sanity/preview-url-secret",
"@sanity/template-validator",
"@sanity/tsdoc",
"@sanity/ui",
"@sanity/visual-editing-csm",
"esbuild",
"get-it",
"groq-js",
Expand Down
2 changes: 1 addition & 1 deletion dev/test-studio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"@portabletext/editor": "^1.21.5",
"@portabletext/react": "^3.0.0",
"@sanity/assist": "^3.1.0",
"@sanity/client": "^6.24.4",
"@sanity/client": "^6.25.0",
"@sanity/color": "^3.0.0",
"@sanity/color-input": "^4.0.1",
"@sanity/google-maps-input": "^4.0.0",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
"@repo/package.config": "workspace:*",
"@repo/test-config": "workspace:*",
"@repo/tsconfig": "workspace:*",
"@sanity/client": "^6.24.4",
"@sanity/client": "^6.25.0",
"@sanity/eslint-config-i18n": "1.0.0",
"@sanity/eslint-config-studio": "^4.0.0",
"@sanity/mutate": "^0.11.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/@sanity/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
},
"dependencies": {
"@babel/traverse": "^7.23.5",
"@sanity/client": "^6.24.4",
"@sanity/client": "^6.25.0",
"@sanity/codegen": "3.70.0",
"@sanity/telemetry": "^0.7.7",
"@sanity/template-validator": "^2.3.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/@sanity/migrate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"watch": "pkg-utils watch"
},
"dependencies": {
"@sanity/client": "^6.24.4",
"@sanity/client": "^6.25.0",
"@sanity/mutate": "^0.11.1",
"@sanity/types": "3.70.0",
"@sanity/util": "3.70.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/@sanity/types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"watch": "pkg-utils watch"
},
"dependencies": {
"@sanity/client": "^6.24.4"
"@sanity/client": "^6.25.0"
},
"devDependencies": {
"@repo/package.config": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/@sanity/util/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
"watch": "pkg-utils watch"
},
"dependencies": {
"@sanity/client": "^6.24.4",
"@sanity/client": "^6.25.0",
"@sanity/types": "3.70.0",
"get-random-values-esm": "1.0.2",
"moment": "^2.30.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/@sanity/vision/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"devDependencies": {
"@repo/package.config": "workspace:*",
"@sanity/cli": "workspace:*",
"@sanity/client": "^6.24.4",
"@sanity/client": "^6.25.0",
"@sanity/codegen": "workspace:*",
"@sanity/diff": "workspace:*",
"@sanity/migrate": "workspace:*",
Expand Down
4 changes: 4 additions & 0 deletions packages/sanity/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,10 @@ module.exports = {
name: 'sanity',
message: 'Use relative type imports instead',
},
{
name: 'sanity/presentation',
message: 'Use relative type imports instead',
},
{
name: 'sanity/structure',
message: 'Use relative type imports instead',
Expand Down
6 changes: 6 additions & 0 deletions packages/sanity/package.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ import {defineConfig} from '@sanity/pkg-utils'
export default defineConfig({
...baseConfig,

define: {
...baseConfig.define,
PRESENTATION_ENABLE_LIVE_DRAFT_EVENTS:
process.env.PRESENTATION_ENABLE_LIVE_DRAFT_EVENTS === 'true',
},

// Build unexposed bundles for scripts that need to be spawned/used in workers
bundles: [
{
Expand Down
17 changes: 13 additions & 4 deletions packages/sanity/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,9 @@
"@sanity/asset-utils": "^2.0.6",
"@sanity/bifur-client": "^0.4.1",
"@sanity/cli": "3.70.0",
"@sanity/client": "^6.24.4",
"@sanity/client": "^6.25.0",
"@sanity/color": "^3.0.0",
"@sanity/comlink": "^3.0.1",
"@sanity/diff": "3.70.0",
"@sanity/diff-match-patch": "^3.1.1",
"@sanity/eventsource": "^5.0.0",
Expand All @@ -170,16 +171,17 @@
"@sanity/image-url": "^1.0.2",
"@sanity/import": "^3.37.9",
"@sanity/insert-menu": "1.0.19",
"@sanity/logos": "^2.1.4",
"@sanity/logos": "^2.1.13",
"@sanity/migrate": "3.70.0",
"@sanity/mutator": "3.70.0",
"@sanity/presentation": "1.22.1-release.0",
"@sanity/presentation-comlink": "^1.0.0",
"@sanity/preview-url-secret": "^2.0.0",
"@sanity/schema": "3.70.0",
"@sanity/telemetry": "^0.7.7",
"@sanity/types": "3.70.0",
"@sanity/ui": "^2.11.2",
"@sanity/util": "3.70.0",
"@sanity/uuid": "^3.0.1",
"@sanity/uuid": "^3.0.2",
"@sentry/react": "^8.33.0",
"@tanstack/react-table": "^8.16.0",
"@tanstack/react-virtual": "^3.11.2",
Expand All @@ -205,6 +207,7 @@
"esbuild-register": "^3.5.0",
"execa": "^2.0.0",
"exif-component": "^1.0.1",
"fast-deep-equal": "3.1.3",
"form-data": "^4.0.0",
"framer-motion": "^11.15.0",
"get-it": "^8.6.6",
Expand All @@ -223,6 +226,7 @@
"lodash": "^4.17.21",
"log-symbols": "^2.2.0",
"mendoza": "^3.0.0",
"mnemonist": "0.39.8",
"module-alias": "^2.2.2",
"nano-pubsub": "^3.0.0",
"nanoid": "^3.1.30",
Expand All @@ -231,6 +235,7 @@
"oneline": "^1.0.3",
"open": "^8.4.0",
"p-map": "^7.0.0",
"path-to-regexp": "^6.3.0",
"pirates": "^4.0.0",
"pluralize-esm": "^9.0.2",
"polished": "^4.2.2",
Expand All @@ -257,12 +262,15 @@
"semver": "^7.3.5",
"shallow-equals": "^1.0.0",
"speakingurl": "^14.0.1",
"suspend-react": "0.1.3",
"tar-fs": "^2.1.1",
"tar-stream": "^3.1.7",
"use-device-pixel-ratio": "^1.1.0",
"use-effect-event": "^1.0.2",
"use-hot-module-reload": "^2.0.0",
"use-sync-external-store": "^1.2.0",
"uuid": "^11.0.5",
"valibot": "0.31.1",
"vite": "^6.0.7",
"yargs": "^17.3.0"
},
Expand All @@ -277,6 +285,7 @@
"@sanity/pkg-utils": "6.13.4",
"@sanity/tsdoc": "1.0.169",
"@sanity/ui-workshop": "^1.2.11",
"@sanity/visual-editing-csm": "^1.0.0",
"@sentry/types": "^8.12.0",
"@testing-library/jest-dom": "^6.4.8",
"@testing-library/react": "^16.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/sanity/src/_exports/presentation.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from '@sanity/presentation'
export * from '../presentation'
11 changes: 11 additions & 0 deletions packages/sanity/src/_singletons/context/PresentationContext.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import {createContext} from 'sanity/_createContext'

import type {PresentationContextValue} from '../../presentation/types'

/**
* @internal
*/
export const PresentationContext = createContext<PresentationContextValue | null>(
'sanity/_singletons/context/presentation',
null,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import {createContext} from 'sanity/_createContext'

import type {PresentationDisplayedDocumentContextValue} from '../../presentation/loader/types'

/**
* @internal
*/
export const PresentationDisplayedDocumentContext =
createContext<PresentationDisplayedDocumentContextValue | null>(
'sanity/_singletons/context/presentation/displayed-document',
null,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import {createContext} from 'sanity/_createContext'

import type {PresentationDocumentContextValue} from '../../presentation/document/types'

/**
* @internal
*/
export const PresentationDocumentContext = createContext<PresentationDocumentContextValue | null>(
'sanity/_singletons/context/presentation/document',
null,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import {createContext} from 'sanity/_createContext'

import type {PresentationNavigateContextValue} from '../../presentation/types'

/**
* @internal
*/
export const PresentationNavigateContext = createContext<PresentationNavigateContextValue | null>(
'sanity/_singletons/context/presentation/navigate',
null,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import {createContext} from 'sanity/_createContext'

import type {PresentationPanelsContextValue} from '../../presentation/panels/types'

/**
* @internal
*/
export const PresentationPanelsContext = createContext<PresentationPanelsContextValue | null>(
'sanity/_singletons/context/presentation/panels',
null,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import {createContext} from 'sanity/_createContext'

import type {PresentationParamsContextValue} from '../../presentation/types'

/**
* @internal
*/
export const PresentationParamsContext = createContext<PresentationParamsContextValue | null>(
'sanity/_singletons/context/presentation/params',
null,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import {createContext} from 'sanity/_createContext'

import type {PresentationSharedStateContextValue} from '../../presentation/overlays/types'

/**
* @internal
*/
export const PresentationSharedStateContext =
createContext<PresentationSharedStateContextValue | null>(
'sanity/_singletons/context/presentation/shared-state',
null,
)
7 changes: 7 additions & 0 deletions packages/sanity/src/_singletons/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ export * from './context/PortableTextMemberItemElementRefsContext'
export * from './context/PortableTextMemberItemsContext'
export * from './context/PresenceContext'
export * from './context/PresenceTrackerContexts'
export * from './context/PresentationContext'
export * from './context/PresentationDisplayedDocumentContext'
export * from './context/PresentationDocumentContext'
export * from './context/PresentationNavigateContext'
export * from './context/PresentationPanelsContext'
export * from './context/PresentationParamsContext'
export * from './context/PresentationSharedStateContext'
export * from './context/PreviewCardContext'
export * from './context/ReferenceInputOptionsContext'
export * from './context/ReferenceItemRefContext'
Expand Down
29 changes: 29 additions & 0 deletions packages/sanity/src/presentation/PostMessagePerspective.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import {type ClientPerspective} from '@sanity/client'
import {type FC, memo, useEffect} from 'react'

import {type VisualEditingConnection} from './types'

export interface PostMessagePerspectiveProps {
comlink: VisualEditingConnection
perspective: ClientPerspective
}

const PostMessagePerspective: FC<PostMessagePerspectiveProps> = (props) => {
const {comlink, perspective} = props

// Return the perspective when requested
useEffect(() => {
return comlink.on('visual-editing/fetch-perspective', () => ({
perspective,
}))
}, [comlink, perspective])

// Dispatch a perspective message when the perspective changes
useEffect(() => {
comlink.post('presentation/perspective', {perspective})
}, [comlink, perspective])

return null
}

export default memo(PostMessagePerspective)
27 changes: 27 additions & 0 deletions packages/sanity/src/presentation/PostMessageTelemetry.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import {useTelemetry} from '@sanity/telemetry/react'
import {type FC, memo, useEffect} from 'react'

import {type VisualEditingConnection} from './types'

export interface PostMessageTelemetryProps {
comlink: VisualEditingConnection
}

const PostMessageTelemetry: FC<PostMessageTelemetryProps> = (props) => {
const {comlink} = props

const telemetry = useTelemetry()

useEffect(() => {
return comlink.on('visual-editing/telemetry-log', async (message) => {
const {event, data} = message

// SANITY_STUDIO_DEBUG_TELEMETRY ensures noop/in-browser logging for telemetry events
// eslint-disable-next-line no-unused-expressions
data ? telemetry.log(event, data) : telemetry.log(event)
})
}, [comlink, telemetry])

return null
}
export default memo(PostMessageTelemetry)
Loading
Loading