-
Notifications
You must be signed in to change notification settings - Fork 440
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: switch to sanity/_createContext
- Loading branch information
1 parent
922f6de
commit 03294df
Showing
67 changed files
with
458 additions
and
307 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
packages/sanity/src/_singletons/context/ActiveWorkspaceMatcherContext.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 6 additions & 3 deletions
9
packages/sanity/src/_singletons/context/AddonDatasetContext.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,12 @@ | ||
import {createContext} from 'react' | ||
import {createContext} from 'sanity/_createContext' | ||
|
||
import type {AddonDatasetContextValue} from '../../../../core/studio/addonDataset/types' | ||
import type {AddonDatasetContextValue} from '../../core/studio/addonDataset/types' | ||
|
||
/** | ||
* @beta | ||
* @hidden | ||
*/ | ||
export const AddonDatasetContext = createContext<AddonDatasetContextValue | null>(null) | ||
export const AddonDatasetContext = createContext<AddonDatasetContextValue | null>( | ||
'sanity/_singletons/context/addon-dataset', | ||
null, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
import {createContext} from 'react' | ||
import {createContext} from 'sanity/_createContext' | ||
|
||
import type {CalendarContextValue} from '../../../../../../../../../../../../../core/studio/components/navbar/search/components/filters/filter/inputs/date/datePicker/calendar/contexts/CalendarContext' | ||
import type {CalendarContextValue} from '../../core/studio/components/navbar/search/components/filters/filter/inputs/date/datePicker/calendar/contexts/CalendarContext' | ||
|
||
/** | ||
* @internal | ||
*/ | ||
export const CalendarContext = createContext<CalendarContextValue | undefined>(undefined) | ||
export const CalendarContext = createContext<CalendarContextValue | undefined>( | ||
'sanity/_singletons/context/calendar', | ||
undefined, | ||
) |
14 changes: 10 additions & 4 deletions
14
packages/sanity/src/_singletons/context/ChangeIndicatorTrackerContexts.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,20 @@ | ||
import {createContext} from 'react' | ||
import {createContext} from 'sanity/_createContext' | ||
|
||
import type { | ||
ChangeIndicatorTrackerContextStoreType, | ||
ChangeIndicatorTrackerGetSnapshotType, | ||
} from '../../../core/changeIndicators/ChangeIndicatorTrackerContexts' | ||
} from '../../core/changeIndicators/ChangeIndicatorTrackerContexts' | ||
|
||
/** @internal */ | ||
export const ChangeIndicatorTrackerContextStore = | ||
createContext<ChangeIndicatorTrackerContextStoreType>(null) | ||
createContext<ChangeIndicatorTrackerContextStoreType>( | ||
'sanity/_singletons/context/change-indicator-tracker-store', | ||
null, | ||
) | ||
|
||
/** @internal */ | ||
export const ChangeIndicatorTrackerContextGetSnapshot = | ||
createContext<ChangeIndicatorTrackerGetSnapshotType>(null) | ||
createContext<ChangeIndicatorTrackerGetSnapshotType>( | ||
'sanity/_singletons/context/change-indicator-tracker-get-snapshot', | ||
null, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 6 additions & 3 deletions
9
packages/sanity/src/_singletons/context/ColorSchemeValueContext.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,12 @@ | ||
import {createContext} from 'react' | ||
import {createContext} from 'sanity/_createContext' | ||
|
||
import type {StudioThemeColorSchemeKey} from '../../../core/theme/types' | ||
import type {StudioThemeColorSchemeKey} from '../../core/theme/types' | ||
|
||
/** | ||
* Used to keep track of the internal value, which can be "system" in addition to "light" and "dark" | ||
* @internal | ||
*/ | ||
export const ColorSchemeValueContext = createContext<StudioThemeColorSchemeKey | null>(null) | ||
export const ColorSchemeValueContext = createContext<StudioThemeColorSchemeKey | null>( | ||
'sanity/_singletons/context/color-scheme-value', | ||
null, | ||
) |
9 changes: 6 additions & 3 deletions
9
packages/sanity/src/_singletons/context/CommentInputContext.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
import {createContext} from 'react' | ||
import {createContext} from 'sanity/_createContext' | ||
|
||
import type {CommentInputContextValue} from '../../../../../../core/comments/components/pte/comment-input/CommentInputProvider' | ||
import type {CommentInputContextValue} from '../../core/comments/components/pte/comment-input/CommentInputProvider' | ||
|
||
/** | ||
* @internal | ||
*/ | ||
export const CommentInputContext = createContext<CommentInputContextValue | null>(null) | ||
export const CommentInputContext = createContext<CommentInputContextValue | null>( | ||
'sanity/_singletons/context/comment-input', | ||
null, | ||
) |
5 changes: 3 additions & 2 deletions
5
packages/sanity/src/_singletons/context/CommentsAuthoringPathContext.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
import {createContext} from 'react' | ||
import {createContext} from 'sanity/_createContext' | ||
|
||
import type {CommentsAuthoringPathContextValue} from '../../../../core/comments/context/authoring-path/types' | ||
import type {CommentsAuthoringPathContextValue} from '../../core/comments/context/authoring-path/types' | ||
|
||
/** | ||
* @beta | ||
* @hidden | ||
*/ | ||
export const CommentsAuthoringPathContext = createContext<CommentsAuthoringPathContextValue | null>( | ||
'sanity/_singletons/context/comments-authoring-path', | ||
null, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
import {createContext} from 'react' | ||
import {createContext} from 'sanity/_createContext' | ||
|
||
import type {CommentsContextValue} from '../../../core/comments/context/comments/types' | ||
import type {CommentsContextValue} from '../../core/comments/context/comments/types' | ||
|
||
/** | ||
* @internal | ||
*/ | ||
export const CommentsContext = createContext<CommentsContextValue | null>(null) | ||
export const CommentsContext = createContext<CommentsContextValue | null>( | ||
'sanity/_singletons/context/comments', | ||
null, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/sanity/src/_singletons/context/CommentsIntentContext.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 6 additions & 3 deletions
9
packages/sanity/src/_singletons/context/CommentsOnboardingContext.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
import {createContext} from 'react' | ||
import {createContext} from 'sanity/_createContext' | ||
|
||
import type {CommentsOnboardingContextValue} from '../../../../core/comments/context/onboarding/types' | ||
import type {CommentsOnboardingContextValue} from '../../core/comments/context/onboarding/types' | ||
|
||
/** | ||
* @internal | ||
*/ | ||
export const CommentsOnboardingContext = createContext<CommentsOnboardingContextValue | null>(null) | ||
export const CommentsOnboardingContext = createContext<CommentsOnboardingContextValue | null>( | ||
'sanity/_singletons/context/comments-onboarding', | ||
null, | ||
) |
5 changes: 3 additions & 2 deletions
5
packages/sanity/src/_singletons/context/CommentsSelectedPathContext.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
import {createContext} from 'react' | ||
import {createContext} from 'sanity/_createContext' | ||
|
||
import type {CommentsSelectedPathContextValue} from '../../../../core/comments/context/selected-path/types' | ||
import type {CommentsSelectedPathContextValue} from '../../core/comments/context/selected-path/types' | ||
|
||
/** | ||
* @internal | ||
*/ | ||
export const CommentsSelectedPathContext = createContext<CommentsSelectedPathContextValue | null>( | ||
'sanity/_singletons/context/comments-selected-path', | ||
null, | ||
) |
9 changes: 6 additions & 3 deletions
9
packages/sanity/src/_singletons/context/CommentsUpsellContext.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
import {createContext} from 'react' | ||
import {createContext} from 'sanity/_createContext' | ||
|
||
import type {CommentsUpsellContextValue} from '../../../../core/comments/context/upsell/types' | ||
import type {CommentsUpsellContextValue} from '../../core/comments/context/upsell/types' | ||
|
||
/** | ||
* @internal | ||
*/ | ||
export const CommentsUpsellContext = createContext<CommentsUpsellContextValue | null>(null) | ||
export const CommentsUpsellContext = createContext<CommentsUpsellContextValue | null>( | ||
'sanity/_singletons/context/comments-upsell', | ||
null, | ||
) |
17 changes: 10 additions & 7 deletions
17
packages/sanity/src/_singletons/context/ConnectorContext.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,13 @@ | ||
import {createContext} from 'react' | ||
import {createContext} from 'sanity/_createContext' | ||
|
||
import type {ConnectorContextValue} from '../../../core/changeIndicators/ConnectorContext' | ||
import type {ConnectorContextValue} from '../../core/changeIndicators/ConnectorContext' | ||
|
||
/** @internal */ | ||
export const ConnectorContext = createContext<ConnectorContextValue>({ | ||
isReviewChangesOpen: false, | ||
onOpenReviewChanges: () => undefined, | ||
onSetFocus: () => undefined, | ||
} as ConnectorContextValue) | ||
export const ConnectorContext = createContext<ConnectorContextValue>( | ||
'sanity/_singletons/context/connector', | ||
{ | ||
isReviewChangesOpen: false, | ||
onOpenReviewChanges: () => undefined, | ||
onSetFocus: () => undefined, | ||
} as ConnectorContextValue, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,12 @@ | ||
import {createContext} from 'react' | ||
import {createContext} from 'sanity/_createContext' | ||
|
||
import type {CopyPasteContextType} from '../../../../core/studio/copyPaste' | ||
import type {CopyPasteContextType} from '../../core/studio/copyPaste' | ||
|
||
/** | ||
* @beta | ||
* @hidden | ||
*/ | ||
export const CopyPasteContext = createContext<CopyPasteContextType | null>(null) | ||
export const CopyPasteContext = createContext<CopyPasteContextType | null>( | ||
'sanity/_singletons/context/copy-paste', | ||
null, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
import type {Path} from '@sanity/types' | ||
import {createContext} from 'react' | ||
import {createContext} from 'sanity/_createContext' | ||
|
||
/** @internal */ | ||
export const DiffContext = createContext<{path: Path}>({path: []}) | ||
export const DiffContext = createContext<{ | ||
path: Path | ||
}>('sanity/_singletons/context/diff', { | ||
path: [], | ||
}) |
9 changes: 6 additions & 3 deletions
9
packages/sanity/src/_singletons/context/DocumentActionPropsContext.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
import {createContext} from 'react' | ||
import {createContext} from 'sanity/_createContext' | ||
|
||
import type {DocumentActionProps} from '../../../core/config/document/actions' | ||
import type {DocumentActionProps} from '../../core/config/document/actions' | ||
|
||
/** | ||
* @internal | ||
*/ | ||
export const DocumentActionPropsContext = createContext<DocumentActionProps | undefined>(undefined) | ||
export const DocumentActionPropsContext = createContext<DocumentActionProps | undefined>( | ||
'sanity/_singletons/context/document-action-props', | ||
undefined, | ||
) |
9 changes: 6 additions & 3 deletions
9
packages/sanity/src/_singletons/context/DocumentChangeContext.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
import {createContext} from 'react' | ||
import {createContext} from 'sanity/_createContext' | ||
|
||
import type {DocumentChangeContextInstance} from '../../../../core/field/diff/contexts/DocumentChangeContext' | ||
import type {DocumentChangeContextInstance} from '../../core/field/diff/contexts/DocumentChangeContext' | ||
|
||
/** @internal */ | ||
export const DocumentChangeContext = createContext<DocumentChangeContextInstance | null>(null) | ||
export const DocumentChangeContext = createContext<DocumentChangeContextInstance | null>( | ||
'sanity/_singletons/context/document-change', | ||
null, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 3 additions & 2 deletions
5
packages/sanity/src/_singletons/context/DocumentSheetListContext.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
import {createContext} from 'react' | ||
import {createContext} from 'sanity/_createContext' | ||
|
||
import type {DocumentSheetListContextValue} from '../../../../structure/panes/documentList/sheetList/DocumentSheetListProvider' | ||
import type {DocumentSheetListContextValue} from '../../structure/panes/documentList/sheetList/DocumentSheetListProvider' | ||
|
||
/** @internal */ | ||
export const DocumentSheetListContext = createContext<DocumentSheetListContextValue | undefined>( | ||
'sanity/_singletons/context/document-sheet-list', | ||
undefined, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 6 additions & 3 deletions
9
packages/sanity/src/_singletons/context/FormBuilderContext.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
import {createContext} from 'react' | ||
import {createContext} from 'sanity/_createContext' | ||
|
||
import type {FormBuilderContextValue} from '../../../core/form/FormBuilderContext' | ||
import type {FormBuilderContextValue} from '../../core/form/FormBuilderContext' | ||
|
||
/** | ||
* @internal | ||
*/ | ||
export const FormBuilderContext = createContext<FormBuilderContextValue | null>(null) | ||
export const FormBuilderContext = createContext<FormBuilderContextValue | null>( | ||
'sanity/_singletons/context/form-builder', | ||
null, | ||
) |
Oops, something went wrong.