{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["/**\n * Yjs should not be considered a public API. It is a third-party library that\n * _will_ experience breaking changes in the future.\n *\n * `@wordpress/sync` is a bundled package: each consumer bundles its own copy,\n * and no `wp.sync` global or `wp-sync` script handle is exposed by WordPress.\n * Two Yjs instances operating on the same document cause silent data\n * corruption:\n *\n * https://github.com/yjs/yjs/issues/438\n *\n * For that reason, sync providers registered via the `sync.providers` filter\n * must not bundle their own copy of Yjs. Each provider creator receives the\n * Yjs module used by the editor as the `Y` property of its options, alongside\n * `ydoc` and `awareness`, and must operate on documents through that instance.\n *\n * A provider that bundles third-party code importing `yjs` directly (for\n * example `y-websocket`) can share the editor's Yjs instance through a shim\n * module. The shim re-exports the Yjs symbols the bundled code uses and fills\n * them in at runtime from the `Y` option:\n *\n * ```ts\n * // yjs-shim.js\n * export let Doc;\n * export let applyUpdate;\n * export let encodeStateAsUpdate;\n * export let encodeStateVector;\n *\n * export function setYjsModule( Y ) {\n *   ( { Doc, applyUpdate, encodeStateAsUpdate, encodeStateVector } = Y );\n * }\n * ```\n *\n * The build then aliases the `yjs` module specifier to the shim, so bundled\n * dependencies resolve their Yjs imports to it instead of packaging a second\n * copy. For example, with webpack:\n *\n * ```ts\n * resolve: {\n *   alias: {\n *     yjs: path.resolve( __dirname, 'src/yjs-shim.js' ),\n *   },\n * },\n * ```\n *\n * Finally, the provider creator initializes the shim before using any of the\n * bundled code:\n *\n * ```ts\n * import { WebsocketProvider } from 'y-websocket';\n * import { setYjsModule } from './yjs-shim';\n *\n * const createProvider = async ( { awareness, ydoc, Y } ) => {\n *   setYjsModule( Y );\n *\n *   const provider = new WebsocketProvider( url, room, ydoc, { awareness } );\n *   // ...\n * };\n * ```\n *\n * See `packages/e2e-tests/plugins/rtc-websocket-provider` for a complete\n * working example.\n */\nexport * as Y from 'yjs';\n\n/**\n * The major version of Yjs that is bundled and exported by this package. This\n * can be used by third-party code to ensure that they are targeting a compatible\n * version of Yjs.\n */\nexport const YJS_VERSION = '13';\n\n/**\n * The Awareness protocol should not be considered a public API. It is a\n * third-party library that will experience breaking changes in the future.\n *\n * In general, awareness for core entity types is implemented by the `core-data`\n * package and third-party Yjs providers should not provide their own awareness\n * implementation. However, it may be desirable for custom entities to have a\n * custom awareness implementation.\n */\nexport { Awareness } from 'y-protocols/awareness';\n\n/**\n * Key of the in-memory meta entry marking a CRDT document as loaded from\n * persistence. It is not synced or persisted.\n */\nexport { CRDT_DOC_META_PERSISTENCE_KEY } from './config';\n\n/**\n * Root-level key for the map that holds the entity record data.\n */\nexport { CRDT_RECORD_MAP_KEY } from './config';\n\n/**\n * Origin string for CRDT document changes originating from the local editor.\n */\nexport { LOCAL_EDITOR_ORIGIN } from './config';\n\n/**\n * Origin string for CRDT document changes that should be synced but not\n * recorded in the undo history (e.g. status changes during publish).\n */\nexport { LOCAL_UNDO_IGNORED_ORIGIN } from './config';\n\n/**\n * Error codes reported by a sync provider when its connection fails.\n */\nexport { ConnectionErrorCode } from './errors';\n\n/**\n * Creates the sync manager, which orchestrates the lifecycle of syncing entity\n * records: it creates Yjs documents, connects to providers, creates awareness\n * instances, and coordinates with the `core-data` store. Exported for\n * `@wordpress/core-data`; plugins don't need it.\n */\nexport { createSyncManager } from './manager';\n\n/**\n * Quill Delta implementation used to describe rich text changes.\n */\nexport { default as Delta } from './quill-delta/Delta';\n\n/**\n * Retries the HTTP polling connection now instead of waiting for the next\n * automatic retry. Exported for `@wordpress/core-data`; plugins don't need it.\n */\nexport { retrySyncConnection } from './providers/http-polling/polling-manager';\n\nexport type * from './types';\n"],"mappings":";;;;;;;;;;;;;AAsEA,MAAa,cAAc"}