Files
yjs/src/index.js

116 lines
2.8 KiB
JavaScript
Raw Normal View History

/** eslint-env browser */
2019-03-01 23:26:40 +01:00
export {
2019-05-07 13:44:23 +02:00
Doc,
Transaction,
YArray as Array,
YMap as Map,
YText as Text,
YXmlText as XmlText,
YXmlHook as XmlHook,
YXmlElement as XmlElement,
YXmlFragment as XmlFragment,
2019-04-23 20:51:32 +02:00
YXmlEvent,
YMapEvent,
YArrayEvent,
2020-07-12 20:13:18 +02:00
YTextEvent,
2019-04-23 20:51:32 +02:00
YEvent,
Item,
2019-04-23 20:51:32 +02:00
AbstractStruct,
GC,
ContentBinary,
ContentDeleted,
ContentEmbed,
ContentFormat,
ContentJSON,
2019-08-09 01:15:33 +02:00
ContentAny,
ContentString,
ContentType,
2019-04-23 20:51:32 +02:00
AbstractType,
2020-05-11 01:45:27 +02:00
getTypeChildren,
2019-05-07 13:44:23 +02:00
createRelativePositionFromTypeIndex,
createRelativePositionFromJSON,
createAbsolutePositionFromRelativePosition,
compareRelativePositions,
2021-11-06 15:55:59 +01:00
AbsolutePosition,
RelativePosition,
ID,
createID,
compareIDs,
getState,
2019-04-23 20:51:32 +02:00
Snapshot,
2019-08-31 22:42:18 +02:00
createSnapshot,
2019-09-04 22:08:05 +02:00
createDeleteSet,
createDeleteSetFromStructStore,
2021-11-06 15:55:59 +01:00
cleanupYTextFormatting,
2019-09-03 16:33:29 +02:00
snapshot,
emptySnapshot,
2019-04-23 20:51:32 +02:00
findRootTypeKey,
2021-10-07 11:31:40 +02:00
findIndexSS,
2020-11-21 19:27:12 +01:00
getItem,
2019-05-07 13:44:23 +02:00
typeListToArraySnapshot,
2019-04-23 20:51:32 +02:00
typeMapGetSnapshot,
createDocFromSnapshot,
2019-05-07 13:44:23 +02:00
iterateDeletedStructs,
applyUpdate,
applyUpdateV2,
readUpdate,
readUpdateV2,
2019-05-07 13:44:23 +02:00
encodeStateAsUpdate,
encodeStateAsUpdateV2,
2019-06-24 23:04:53 +02:00
encodeStateVector,
2019-09-03 16:33:29 +02:00
UndoManager,
decodeSnapshot,
encodeSnapshot,
decodeSnapshotV2,
encodeSnapshotV2,
2020-07-12 18:41:34 +02:00
decodeStateVector,
2020-12-16 21:25:00 +01:00
logUpdate,
logUpdateV2,
relativePositionToJSON,
2019-09-03 16:33:29 +02:00
isDeleted,
2020-01-14 05:13:51 +01:00
isParentOf,
equalSnapshots,
PermanentUserData, // @TODO experimental
tryGc,
transact,
AbstractConnector,
2020-12-07 19:47:48 +01:00
logType,
2020-12-16 23:26:38 +01:00
mergeUpdates,
mergeUpdatesV2,
parseUpdateMeta,
parseUpdateMetaV2,
encodeStateVectorFromUpdate,
encodeStateVectorFromUpdateV2,
encodeRelativePosition,
decodeRelativePosition,
diffUpdate,
diffUpdateV2,
convertUpdateFormatV1ToV2,
convertUpdateFormatV2ToV1
} from './internals.js'
const glo = /** @type {any} */ (typeof window !== 'undefined'
? window
// @ts-ignore
: typeof global !== 'undefined' ? global : {})
const importIdentifier = '__ $YJS$ __'
if (glo[importIdentifier] === true) {
/**
2021-10-15 19:14:11 +02:00
* Dear reader of this warning message. Please take this seriously.
*
* If you see this message, please make sure that you only import one version of Yjs. In many cases,
2021-10-15 19:14:11 +02:00
* your package manager installs two versions of Yjs that are used by different packages within your project.
* Another reason for this message is that some parts of your project use the commonjs version of Yjs
* and others use the EcmaScript version of Yjs.
*
2021-10-15 19:14:11 +02:00
* This often leads to issues that are hard to debug. We often need to perform constructor checks,
* e.g. `struct instanceof GC`. If you imported different versions of Yjs, it is impossible for us to
* do the constructor checks anymore - which might break the CRDT algorithm.
*/
console.warn('Yjs was already imported. Importing different versions of Yjs often leads to issues.')
}
glo[importIdentifier] = true