Merge branch 'main' of github.com:theatre-js/theatre
This commit is contained in:
commit
7d235386e7
4 changed files with 37 additions and 2 deletions
|
@ -50,6 +50,7 @@ The quickest way to start tweaking things is to run the `playground` package.
|
||||||
```sh
|
```sh
|
||||||
$ cd ./packages/playground
|
$ cd ./packages/playground
|
||||||
$ yarn serve
|
$ yarn serve
|
||||||
|
$ yarn build
|
||||||
# or, shortcut:
|
# or, shortcut:
|
||||||
$ cd root
|
$ cd root
|
||||||
$ yarn playground
|
$ yarn playground
|
||||||
|
|
|
@ -13,6 +13,18 @@ export type {UnknownShorthandCompoundProps} from './propTypes'
|
||||||
import * as globalVariableNames from '@theatre/shared/globalVariableNames'
|
import * as globalVariableNames from '@theatre/shared/globalVariableNames'
|
||||||
import type StudioBundle from '@theatre/studio/StudioBundle'
|
import type StudioBundle from '@theatre/studio/StudioBundle'
|
||||||
import CoreBundle from './CoreBundle'
|
import CoreBundle from './CoreBundle'
|
||||||
|
import type {OnDiskState} from './projects/store/storeTypes'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* NOTE: **INTERNAL and UNSTABLE** - This _WILL_ break between minor versions.
|
||||||
|
*
|
||||||
|
* This type represents the object returned by `studio.createContnentOfSaveFile()`. It's
|
||||||
|
* meant for advanced users who want to interact with the state of projects. In the vast
|
||||||
|
* majority of cases, you __should not__ use this type. Either an API for your use-case
|
||||||
|
* already exists, or you should open an issue on GitHub: https://github.com/theatre-js/theatre/issues
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
export type __UNSTABLE_Project_OnDiskState = OnDiskState
|
||||||
|
|
||||||
registerCoreBundle()
|
registerCoreBundle()
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@ import {
|
||||||
} from './UIRoot/useKeyboardShortcuts'
|
} from './UIRoot/useKeyboardShortcuts'
|
||||||
import type TheatreSheetObject from '@theatre/core/sheetObjects/TheatreSheetObject'
|
import type TheatreSheetObject from '@theatre/core/sheetObjects/TheatreSheetObject'
|
||||||
import type TheatreSheet from '@theatre/core/sheets/TheatreSheet'
|
import type TheatreSheet from '@theatre/core/sheets/TheatreSheet'
|
||||||
|
import type {__UNSTABLE_Project_OnDiskState} from '@theatre/core'
|
||||||
|
|
||||||
export interface ITransactionAPI {
|
export interface ITransactionAPI {
|
||||||
/**
|
/**
|
||||||
|
@ -434,6 +435,18 @@ export interface IStudio {
|
||||||
* @param persistenceKey - same persistencyKey as in `studio.initialize(opts)`, if any
|
* @param persistenceKey - same persistencyKey as in `studio.initialize(opts)`, if any
|
||||||
*/
|
*/
|
||||||
__experimental_clearPersistentStorage(persistenceKey?: string): void
|
__experimental_clearPersistentStorage(persistenceKey?: string): void
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Warning: This is an experimental API and will change in the future.
|
||||||
|
*
|
||||||
|
* This is functionally the same as `studio.createContentOfSaveFile()`, but
|
||||||
|
* returns a typed object instead of a JSON object.
|
||||||
|
*
|
||||||
|
* See {@link __UNSTABLE_Project_OnDiskState} for more information.
|
||||||
|
*/
|
||||||
|
__experimental_createContentOfSaveFileTyped(
|
||||||
|
projectId: string,
|
||||||
|
): __UNSTABLE_Project_OnDiskState
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -474,6 +487,11 @@ export default class TheatreStudio implements IStudio {
|
||||||
__experimental_clearPersistentStorage(persistenceKey?: string): void {
|
__experimental_clearPersistentStorage(persistenceKey?: string): void {
|
||||||
return getStudio().clearPersistentStorage(persistenceKey)
|
return getStudio().clearPersistentStorage(persistenceKey)
|
||||||
},
|
},
|
||||||
|
__experimental_createContentOfSaveFileTyped(
|
||||||
|
projectId: string,
|
||||||
|
): __UNSTABLE_Project_OnDiskState {
|
||||||
|
return getStudio().createContentOfSaveFile(projectId) as $IntentionalAny
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -33,7 +33,7 @@ const PlayheadPositionPopover: React.FC<{
|
||||||
* Called when user hits enter/escape
|
* Called when user hits enter/escape
|
||||||
*/
|
*/
|
||||||
onRequestClose: (reason: string) => void
|
onRequestClose: (reason: string) => void
|
||||||
}> = ({layoutP}) => {
|
}> = ({layoutP, onRequestClose}) => {
|
||||||
const sheet = val(layoutP.sheet)
|
const sheet = val(layoutP.sheet)
|
||||||
const sequence = sheet.getSequence()
|
const sequence = sheet.getSequence()
|
||||||
|
|
||||||
|
@ -53,6 +53,7 @@ const PlayheadPositionPopover: React.FC<{
|
||||||
if (tempPosition) {
|
if (tempPosition) {
|
||||||
tempPosition = undefined
|
tempPosition = undefined
|
||||||
sequence.position = originalPosition
|
sequence.position = originalPosition
|
||||||
|
onRequestClose('discardTemporaryValue')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
permanentlySetValue(newPosition: number): void {
|
permanentlySetValue(newPosition: number): void {
|
||||||
|
@ -60,6 +61,7 @@ const PlayheadPositionPopover: React.FC<{
|
||||||
tempPosition = undefined
|
tempPosition = undefined
|
||||||
}
|
}
|
||||||
sequence.position = clamp(newPosition, 0, sequence.length)
|
sequence.position = clamp(newPosition, 0, sequence.length)
|
||||||
|
onRequestClose('permanentlySetValue')
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}, [layoutP, sequence])
|
}, [layoutP, sequence])
|
||||||
|
@ -72,11 +74,13 @@ const PlayheadPositionPopover: React.FC<{
|
||||||
return usePrism(() => {
|
return usePrism(() => {
|
||||||
const sequence = sheet.getSequence()
|
const sequence = sheet.getSequence()
|
||||||
|
|
||||||
|
const value = Number(val(sequence.pointer.position).toFixed(3))
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Container>
|
<Container>
|
||||||
<Label>Sequence position</Label>
|
<Label>Sequence position</Label>
|
||||||
<BasicNumberInput
|
<BasicNumberInput
|
||||||
value={Number(sequence.position.toFixed(3))}
|
value={value}
|
||||||
{...fns}
|
{...fns}
|
||||||
isValid={greaterThanOrEqualToZero}
|
isValid={greaterThanOrEqualToZero}
|
||||||
inputRef={inputRef}
|
inputRef={inputRef}
|
||||||
|
|
Loading…
Reference in a new issue