diff --git a/apps/client/src/common/stores/runtime.ts b/apps/client/src/common/stores/runtime.ts index 849a646ac..6bbb68c0b 100644 --- a/apps/client/src/common/stores/runtime.ts +++ b/apps/client/src/common/stores/runtime.ts @@ -1,58 +1,7 @@ import isEqual from 'react-fast-compare'; -import { Playback, RuntimeStore, SimpleDirection, SimplePlayback, TimerPhase } from 'ontime-types'; +import { RuntimeStore, runtimeStorePlaceholder } from 'ontime-types'; import { createWithEqualityFn, useStoreWithEqualityFn } from 'zustand/traditional'; -export const runtimeStorePlaceholder: RuntimeStore = { - clock: 0, - timer: { - addedTime: 0, - current: null, - duration: null, - elapsed: null, - expectedFinish: null, - finishedAt: null, - phase: TimerPhase.None, - playback: Playback.Stop, - secondaryTimer: null, - startedAt: null, - }, - onAir: false, - message: { - timer: { - text: '', - visible: false, - blink: false, - blackout: false, - secondarySource: null, - }, - external: '', - }, - runtime: { - selectedEventIndex: null, - numEvents: 0, - offset: 0, - plannedStart: 0, - plannedEnd: 0, - actualStart: null, - expectedEnd: null, - }, - currentBlock: { - block: null, - startedAt: null, - }, - eventNow: null, - eventNext: null, - publicEventNow: null, - publicEventNext: null, - auxtimer1: { - current: 0, - direction: SimpleDirection.CountUp, - duration: 0, - playback: SimplePlayback.Stop, - }, - frozen: false, -}; - const deepCompare = (a: T, b: T) => isEqual(a, b); export const runtimeStore = createWithEqualityFn( diff --git a/packages/types/src/definitions/runtime/RuntimeStore.ts b/packages/types/src/definitions/runtime/RuntimeStore.ts new file mode 100644 index 000000000..2634a7125 --- /dev/null +++ b/packages/types/src/definitions/runtime/RuntimeStore.ts @@ -0,0 +1,55 @@ +import { SimpleDirection, SimplePlayback } from './AuxTimer.type.js'; +import { Playback } from './Playback.type.js'; +import type { RuntimeStore } from './RuntimeStore.type.js'; +import { TimerPhase } from './TimerState.type.js'; + +export const runtimeStorePlaceholder: RuntimeStore = { + clock: 0, + timer: { + addedTime: 0, + current: null, + duration: null, + elapsed: null, + expectedFinish: null, + finishedAt: null, + phase: TimerPhase.None, + playback: Playback.Stop, + secondaryTimer: null, + startedAt: null, + }, + onAir: false, + message: { + timer: { + text: '', + visible: false, + blink: false, + blackout: false, + secondarySource: null, + }, + external: '', + }, + runtime: { + selectedEventIndex: null, + numEvents: 0, + offset: 0, + plannedStart: 0, + plannedEnd: 0, + actualStart: null, + expectedEnd: null, + }, + currentBlock: { + block: null, + startedAt: null, + }, + eventNow: null, + eventNext: null, + publicEventNow: null, + publicEventNext: null, + auxtimer1: { + current: 0, + direction: SimpleDirection.CountUp, + duration: 0, + playback: SimplePlayback.Stop, + }, + frozen: false, +}; diff --git a/packages/types/src/index.ts b/packages/types/src/index.ts index bb2cb0ed3..da93286bf 100644 --- a/packages/types/src/index.ts +++ b/packages/types/src/index.ts @@ -62,6 +62,7 @@ export type { TimerMessage, MessageState } from './definitions/runtime/MessageCo export type { Runtime } from './definitions/runtime/Runtime.type.js'; export type { RuntimeStore } from './definitions/runtime/RuntimeStore.type.js'; +export { runtimeStorePlaceholder } from './definitions/runtime/RuntimeStore.js'; export { type TimerState, TimerPhase } from './definitions/runtime/TimerState.type.js'; export type { CurrentBlockState } from './definitions/runtime/CurrentBlockState.type.js';