Fix: Moved privateAPI() to the core package
This commit is contained in:
parent
47f7da157a
commit
1ba89d76e1
13 changed files with 40 additions and 33 deletions
|
@ -1,8 +1,10 @@
|
|||
import type Studio from '@theatre/studio/Studio'
|
||||
import type {Studio} from '@theatre/studio/Studio'
|
||||
import projectsSingleton from './projects/projectsSingleton'
|
||||
import {privateAPI} from './privateAPIs'
|
||||
|
||||
export type CoreBits = {
|
||||
projectsP: typeof projectsSingleton.atom.pointer.projects
|
||||
privateAPI: typeof privateAPI
|
||||
}
|
||||
|
||||
export default class CoreBundle {
|
||||
|
@ -24,6 +26,7 @@ export default class CoreBundle {
|
|||
this._studio = studio
|
||||
const bits: CoreBits = {
|
||||
projectsP: projectsSingleton.atom.pointer.projects,
|
||||
privateAPI: privateAPI,
|
||||
}
|
||||
|
||||
callback(bits)
|
||||
|
|
30
theatre/core/src/privateAPIs.ts
Normal file
30
theatre/core/src/privateAPIs.ts
Normal file
|
@ -0,0 +1,30 @@
|
|||
import type {IProject} from '@theatre/core/projects/TheatreProject'
|
||||
import type Project from '@theatre/core/projects/Project'
|
||||
import type Sequence from '@theatre/core/sequences/Sequence'
|
||||
import type {ISequence} from '@theatre/core/sequences/TheatreSequence'
|
||||
import type SheetObject from '@theatre/core/sheetObjects/SheetObject'
|
||||
import type {ISheetObject} from '@theatre/core/sheetObjects/TheatreSheetObject'
|
||||
import type Sheet from '@theatre/core/sheets/Sheet'
|
||||
import type {ISheet} from '@theatre/core/sheets/TheatreSheet'
|
||||
import type {$IntentionalAny} from '@theatre/shared/utils/types'
|
||||
|
||||
const publicAPIToPrivateAPIMap = new WeakMap()
|
||||
|
||||
export function privateAPI(pub: IProject): Project
|
||||
export function privateAPI(pub: ISheet): Sheet
|
||||
export function privateAPI(pub: ISheetObject<$IntentionalAny>): SheetObject
|
||||
export function privateAPI(pub: ISequence): Sequence
|
||||
export function privateAPI(pub: {}): unknown {
|
||||
return publicAPIToPrivateAPIMap.get(pub)
|
||||
}
|
||||
|
||||
export function setPrivateAPI(pub: IProject, priv: Project): void
|
||||
export function setPrivateAPI(pub: ISheet, priv: Sheet): void
|
||||
export function setPrivateAPI(pub: ISequence, priv: Sequence): void
|
||||
export function setPrivateAPI(
|
||||
pub: ISheetObject<$IntentionalAny>,
|
||||
priv: SheetObject,
|
||||
): void
|
||||
export function setPrivateAPI(pub: {}, priv: {}): void {
|
||||
publicAPIToPrivateAPIMap.set(pub, priv)
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
import {privateAPI, setPrivateAPI} from '@theatre/shared/privateAPIs'
|
||||
import {privateAPI, setPrivateAPI} from '@theatre/core/privateAPIs'
|
||||
import Project from '@theatre/core/projects/Project'
|
||||
import type {ISheet} from '@theatre/core/sheets/TheatreSheet'
|
||||
import type {ProjectAddress} from '@theatre/shared/utils/addresses'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import logger from '@theatre/shared/logger'
|
||||
import {privateAPI, setPrivateAPI} from '@theatre/shared/privateAPIs'
|
||||
import {privateAPI, setPrivateAPI} from '@theatre/core/privateAPIs'
|
||||
import {defer} from '@theatre/shared/utils/defer'
|
||||
import type Sequence from './Sequence'
|
||||
import type {IPlaybackDirection, IPlaybackRange} from './Sequence'
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {privateAPI, setPrivateAPI} from '@theatre/shared/privateAPIs'
|
||||
import {privateAPI, setPrivateAPI} from '@theatre/core/privateAPIs'
|
||||
import type {IProject} from '@theatre/core/projects/TheatreProject'
|
||||
import coreTicker from '@theatre/core/coreTicker'
|
||||
import type {ISheet} from '@theatre/core/sheets/TheatreSheet'
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {privateAPI, setPrivateAPI} from '@theatre/shared/privateAPIs'
|
||||
import {privateAPI, setPrivateAPI} from '@theatre/core/privateAPIs'
|
||||
import type {IProject} from '@theatre/core/projects/TheatreProject'
|
||||
import type TheatreSequence from '@theatre/core/sequences/TheatreSequence'
|
||||
import type {ISequence} from '@theatre/core/sequences/TheatreSequence'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue