import { readonly , shallowReactive , shallowRef , ref , Ref , watch , unref , toRefs } from 'vue' ; import type { UseQuantumDocument } from './document' ; const quantumDocument = shallowRef < UseQuantumDocument < any > > ( ) ; const hasUnsavedChanges = ref ( false ) ; export function useDocumentManager ( ) { function registerQuantumDocument ( newQuantumDocument ) { quantumDocument . value = newQuantumDocument ; } function loadDocument ( serializedData ) { let documentObject = JSON . parse ( serializedData ) ; quantumDocument . value ?. deserializeDocument ( documentObject ) ; } function saveDocument ( ) { let serializedData = JSON . stringify ( quantumDocument . value ?. serializeDocument ( ) ) ; return serializedData ; } return { registerQuantumDocument , loadDocument , saveDocument , currentDocument : quantumDocument , } ; }