2021-10-15 19:10:11 +02:00
|
|
|
/** eslint-env browser */
|
2019-03-01 23:26:40 +01:00
|
|
|
|
2019-04-04 19:35:38 +02:00
|
|
|
export {
|
2019-05-07 13:44:23 +02:00
|
|
|
Doc,
|
2019-04-04 19:35:38 +02:00
|
|
|
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,
|
2019-05-28 14:18:20 +02:00
|
|
|
Item,
|
2019-04-23 20:51:32 +02:00
|
|
|
AbstractStruct,
|
|
|
|
|
GC,
|
2023-11-06 16:49:33 -06:00
|
|
|
Skip,
|
2019-05-28 14:18:20 +02:00
|
|
|
ContentBinary,
|
|
|
|
|
ContentDeleted,
|
2023-11-06 16:49:33 -06:00
|
|
|
ContentDoc,
|
2019-05-28 14:18:20 +02:00
|
|
|
ContentEmbed,
|
|
|
|
|
ContentFormat,
|
|
|
|
|
ContentJSON,
|
2019-08-09 01:15:33 +02:00
|
|
|
ContentAny,
|
2019-05-28 14:18:20 +02:00
|
|
|
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,
|
2019-04-04 19:35:38 +02:00
|
|
|
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,
|
2023-11-21 12:24:21 +01:00
|
|
|
typeMapGetAllSnapshot,
|
2020-07-22 18:35:03 +03:00
|
|
|
createDocFromSnapshot,
|
2019-05-07 13:44:23 +02:00
|
|
|
applyUpdate,
|
2020-07-12 18:25:45 +02:00
|
|
|
applyUpdateV2,
|
2020-05-03 16:10:58 +02:00
|
|
|
readUpdate,
|
2020-07-12 18:25:45 +02:00
|
|
|
readUpdateV2,
|
2019-05-07 13:44:23 +02:00
|
|
|
encodeStateAsUpdate,
|
2020-07-12 18:25:45 +02:00
|
|
|
encodeStateAsUpdateV2,
|
2019-06-24 23:04:53 +02:00
|
|
|
encodeStateVector,
|
2019-09-03 16:33:29 +02:00
|
|
|
UndoManager,
|
|
|
|
|
decodeSnapshot,
|
|
|
|
|
encodeSnapshot,
|
2020-07-12 18:25:45 +02:00
|
|
|
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,
|
2021-01-13 01:16:21 +01:00
|
|
|
relativePositionToJSON,
|
2020-01-14 05:13:51 +01:00
|
|
|
isParentOf,
|
2019-09-17 18:53:59 +02:00
|
|
|
equalSnapshots,
|
2020-02-12 10:37:22 +01:00
|
|
|
tryGc,
|
2020-07-12 19:07:16 +02:00
|
|
|
transact,
|
2020-07-15 22:03:02 +02:00
|
|
|
AbstractConnector,
|
2020-12-07 19:47:48 +01:00
|
|
|
logType,
|
2020-12-16 23:26:38 +01:00
|
|
|
mergeUpdates,
|
2020-12-30 20:21:14 +01:00
|
|
|
mergeUpdatesV2,
|
|
|
|
|
encodeStateVectorFromUpdate,
|
2021-01-17 15:22:36 +01:00
|
|
|
encodeStateVectorFromUpdateV2,
|
|
|
|
|
encodeRelativePosition,
|
2021-01-29 18:18:09 +01:00
|
|
|
decodeRelativePosition,
|
|
|
|
|
diffUpdate,
|
2021-12-15 18:45:08 +01:00
|
|
|
diffUpdateV2,
|
|
|
|
|
convertUpdateFormatV1ToV2,
|
2022-06-14 13:16:35 +07:00
|
|
|
convertUpdateFormatV2ToV1,
|
2023-04-22 18:38:12 +02:00
|
|
|
obfuscateUpdate,
|
|
|
|
|
obfuscateUpdateV2,
|
2023-06-08 11:14:49 +02:00
|
|
|
UpdateEncoderV1,
|
2023-11-06 16:49:33 -06:00
|
|
|
UpdateEncoderV2,
|
|
|
|
|
UpdateDecoderV1,
|
|
|
|
|
UpdateDecoderV2,
|
2025-04-08 20:50:20 +02:00
|
|
|
snapshotContainsUpdate,
|
|
|
|
|
// idset
|
2025-04-10 21:07:59 +02:00
|
|
|
IdSet,
|
2025-04-08 20:50:20 +02:00
|
|
|
equalIdSets,
|
2025-04-12 14:44:37 +02:00
|
|
|
createDeleteSetFromStructStore,
|
2025-04-18 20:26:05 +02:00
|
|
|
IdMap,
|
2025-04-19 00:21:40 +02:00
|
|
|
createIdMap,
|
2025-04-29 22:42:56 +02:00
|
|
|
createAttributionItem,
|
2025-06-05 14:52:55 +02:00
|
|
|
createInsertSetFromStructStore as createInsertionSetFromStructStore,
|
2025-04-24 00:03:00 +02:00
|
|
|
diffIdMap,
|
|
|
|
|
diffIdSet,
|
2025-04-28 02:42:06 +02:00
|
|
|
AttributionItem as Attribution,
|
2025-04-28 17:06:32 +02:00
|
|
|
encodeIdMap,
|
|
|
|
|
createIdMapFromIdSet,
|
|
|
|
|
TwosetAttributionManager,
|
2025-04-29 22:42:56 +02:00
|
|
|
noAttributionsManager,
|
2025-05-22 19:46:27 +02:00
|
|
|
AbstractAttributionManager,
|
2025-05-01 15:46:28 +02:00
|
|
|
iterateStructsByIdSet,
|
|
|
|
|
createAttributionManagerFromDiff,
|
2025-05-31 21:00:30 +02:00
|
|
|
DiffAttributionManager,
|
2025-05-21 16:04:55 +02:00
|
|
|
createIdSet,
|
2025-05-24 01:14:21 +02:00
|
|
|
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
|
2019-04-04 19:35:38 +02:00
|
|
|
} from './internals.js'
|
2021-10-15 19:10:11 +02:00
|
|
|
|
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 : {})
|
2021-12-15 18:45:08 +01:00
|
|
|
|
2025-12-15 13:28:01 +01:00
|
|
|
const importIdentifier = '__ $YJS14$ __'
|
2021-10-15 19:10:11 +02:00
|
|
|
|
|
|
|
|
if (glo[importIdentifier] === true) {
|
|
|
|
|
/**
|
2022-06-13 10:27:04 +02:00
|
|
|
* Dear reader of this message. Please take this seriously.
|
2021-10-15 19:10:11 +02:00
|
|
|
*
|
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.
|
2021-10-15 19:10:11 +02:00
|
|
|
* 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
|
2021-10-15 19:10:11 +02:00
|
|
|
* do the constructor checks anymore - which might break the CRDT algorithm.
|
2022-06-16 12:56:37 +02:00
|
|
|
*
|
|
|
|
|
* https://github.com/yjs/yjs/issues/438
|
2021-10-15 19:10:11 +02:00
|
|
|
*/
|
2022-06-16 12:56:37 +02:00
|
|
|
console.error('Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438')
|
2021-10-15 19:10:11 +02:00
|
|
|
}
|
|
|
|
|
glo[importIdentifier] = true
|