Files
yjs/src/index.js

154 lines
3.6 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
YEvent,
Item,
2019-04-23 20:51:32 +02:00
AbstractStruct,
GC,
2023-11-06 16:49:33 -06:00
Skip,
ContentBinary,
ContentDeleted,
2023-11-06 16:49:33 -06:00
ContentDoc,
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,
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,
2025-01-15 21:44:18 +01:00
getItemCleanStart,
getItemCleanEnd,
2019-05-07 13:44:23 +02:00
typeListToArraySnapshot,
2019-04-23 20:51:32 +02:00
typeMapGetSnapshot,
typeMapGetAllSnapshot,
createDocFromSnapshot,
2019-05-07 13:44:23 +02:00
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,
2022-02-04 13:47:57 +01:00
decodeUpdate,
decodeUpdateV2,
relativePositionToJSON,
2020-01-14 05:13:51 +01:00
isParentOf,
equalSnapshots,
tryGc,
transact,
AbstractConnector,
2020-12-07 19:47:48 +01:00
logType,
2020-12-16 23:26:38 +01:00
mergeUpdates,
mergeUpdatesV2,
encodeStateVectorFromUpdate,
encodeStateVectorFromUpdateV2,
encodeRelativePosition,
decodeRelativePosition,
diffUpdate,
diffUpdateV2,
convertUpdateFormatV1ToV2,
2022-06-14 13:16:35 +07:00
convertUpdateFormatV2ToV1,
obfuscateUpdate,
obfuscateUpdateV2,
2023-06-08 11:14:49 +02:00
UpdateEncoderV1,
2023-11-06 16:49:33 -06:00
UpdateEncoderV2,
UpdateDecoderV1,
UpdateDecoderV2,
snapshotContainsUpdate,
// idset
2025-04-10 21:07:59 +02:00
IdSet,
equalIdSets,
2025-04-12 14:44:37 +02:00
createDeleteSetFromStructStore,
IdMap,
createIdMap,
createAttributionItem,
2025-06-05 14:52:55 +02:00
createInsertSetFromStructStore as createInsertionSetFromStructStore,
diffIdMap,
diffIdSet,
2025-04-28 02:42:06 +02:00
AttributionItem as Attribution,
encodeIdMap,
createIdMapFromIdSet,
TwosetAttributionManager,
noAttributionsManager,
2025-05-22 19:46:27 +02:00
AbstractAttributionManager,
2025-05-01 15:46:28 +02:00
iterateStructsByIdSet,
createAttributionManagerFromDiff,
DiffAttributionManager,
2025-05-21 16:04:55 +02:00
createIdSet,
mergeIdSets,
2025-11-17 23:59:01 +01:00
cloneDoc,
readUpdateIdRanges,
2025-11-18 01:47:34 +01:00
readUpdateIdRangesV2,
insertIntoIdMap,
insertIntoIdSet,
mergeIdMaps,
readIdMap,
2025-11-19 14:12:16 +01:00
readIdSet,
2025-11-27 19:59:26 +01:00
decodeIdMap,
diffDocsToDelta
} from './internals.js'
2022-06-01 13:36:32 +10:00
const glo = /** @type {any} */ (typeof globalThis !== 'undefined'
? globalThis
: typeof window !== 'undefined'
? window
// @ts-ignore
: typeof global !== 'undefined' ? global : {})
const importIdentifier = '__ $YJS14$ __'
if (glo[importIdentifier] === true) {
/**
2022-06-13 10:27:04 +02:00
* Dear reader of this message. Please take this seriously.
*
2022-06-13 10:27:04 +02:00
* If you see this message, 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.
*
* https://github.com/yjs/yjs/issues/438
*/
console.error('Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438')
}
glo[importIdentifier] = true