superdoc 2.13.0-next.2 → 2.13.0-next.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -19,7 +19,7 @@ var COLLABORATION_UPGRADE_ENGINE_MINIMUM_NODE_MAJOR = 20;
19
19
  var PRIVATE_ENGINE_INFO = (0, _superdoc_docx_engine_collaboration_upgrade_engine.getCollaborationUpgradeEngineInfo)();
20
20
  var ENGINE_INFO = Object.freeze({
21
21
  ...PRIVATE_ENGINE_INFO,
22
- superdocVersion: "2.13.0-next.2",
22
+ superdocVersion: "2.13.0-next.3",
23
23
  roomSchemaVersion: Object.freeze({ ...PRIVATE_ENGINE_INFO.roomSchemaVersion }),
24
24
  supportedBundleVersions: SUPPORTED_COLLABORATION_UPGRADE_BUNDLE_VERSIONS,
25
25
  supportedV1ReaderContractVersions: SUPPORTED_V1_READER_CONTRACT_VERSIONS
@@ -18,7 +18,7 @@ var COLLABORATION_UPGRADE_ENGINE_MINIMUM_NODE_MAJOR = 20;
18
18
  var PRIVATE_ENGINE_INFO = getCollaborationUpgradeEngineInfo$1();
19
19
  var ENGINE_INFO = Object.freeze({
20
20
  ...PRIVATE_ENGINE_INFO,
21
- superdocVersion: "2.13.0-next.2",
21
+ superdocVersion: "2.13.0-next.3",
22
22
  roomSchemaVersion: Object.freeze({ ...PRIVATE_ENGINE_INFO.roomSchemaVersion }),
23
23
  supportedBundleVersions: SUPPORTED_COLLABORATION_UPGRADE_BUNDLE_VERSIONS,
24
24
  supportedV1ReaderContractVersions: SUPPORTED_V1_READER_CONTRACT_VERSIONS
@@ -0,0 +1,9 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ let _superdoc_docx_engine_collaboration_worker = require("@superdoc/docx-engine/collaboration-worker");
3
+ //#region src/public/collaboration-worker.ts
4
+ /** Register provider adapters and start the worker used by `workerUrls.collaboration`. */
5
+ function bootstrapSuperDocCollaborationWorker(options) {
6
+ (0, _superdoc_docx_engine_collaboration_worker.bootstrapSuperDocCollaborationWorker)(options);
7
+ }
8
+ //#endregion
9
+ exports.bootstrapSuperDocCollaborationWorker = bootstrapSuperDocCollaborationWorker;
@@ -0,0 +1,8 @@
1
+ import { bootstrapSuperDocCollaborationWorker as bootstrapSuperDocCollaborationWorker$1 } from "@superdoc/docx-engine/collaboration-worker";
2
+ //#region src/public/collaboration-worker.ts
3
+ /** Register provider adapters and start the worker used by `workerUrls.collaboration`. */
4
+ function bootstrapSuperDocCollaborationWorker(options) {
5
+ bootstrapSuperDocCollaborationWorker$1(options);
6
+ }
7
+ //#endregion
8
+ export { bootstrapSuperDocCollaborationWorker };
package/dist/style.css CHANGED
@@ -1818,11 +1818,11 @@ img[data-v-c95b2073] {
1818
1818
  pointer-events: auto;
1819
1819
  }
1820
1820
 
1821
- .superdoc[data-v-0d27f262] {
1821
+ .superdoc[data-v-f0b56abb] {
1822
1822
  display: flex;
1823
1823
  position: relative;
1824
1824
  }
1825
- .sd-visually-hidden[data-v-0d27f262] {
1825
+ .sd-visually-hidden[data-v-f0b56abb] {
1826
1826
  position: absolute;
1827
1827
  width: 1px;
1828
1828
  height: 1px;
@@ -1833,14 +1833,14 @@ img[data-v-c95b2073] {
1833
1833
  white-space: nowrap;
1834
1834
  border: 0;
1835
1835
  }
1836
- .superdoc__mutation-status[data-v-0d27f262] {
1836
+ .superdoc__mutation-status[data-v-f0b56abb] {
1837
1837
  position: sticky;
1838
1838
  z-index: 10;
1839
1839
  top: 12px;
1840
1840
  height: 0;
1841
1841
  pointer-events: none;
1842
1842
  }
1843
- .superdoc__edit-rejected-status[data-v-0d27f262] {
1843
+ .superdoc__edit-rejected-status[data-v-f0b56abb] {
1844
1844
  position: absolute;
1845
1845
  top: 0;
1846
1846
  left: 50%;
@@ -1858,30 +1858,30 @@ img[data-v-c95b2073] {
1858
1858
  line-height: 20px;
1859
1859
  pointer-events: none;
1860
1860
  }
1861
- .right-sidebar[data-v-0d27f262] {
1861
+ .right-sidebar[data-v-f0b56abb] {
1862
1862
  min-width: 320px;
1863
1863
  height: 100%;
1864
1864
  }
1865
- .floating-comments[data-v-0d27f262] {
1865
+ .floating-comments[data-v-f0b56abb] {
1866
1866
  min-width: 300px;
1867
1867
  width: 300px;
1868
1868
  height: 100%;
1869
1869
  overflow: visible;
1870
1870
  }
1871
- .superdoc__layers[data-v-0d27f262] {
1871
+ .superdoc__layers[data-v-f0b56abb] {
1872
1872
  height: 100%;
1873
1873
  position: relative;
1874
1874
  box-sizing: border-box;
1875
1875
  }
1876
- .superdoc__document[data-v-0d27f262] {
1876
+ .superdoc__document[data-v-f0b56abb] {
1877
1877
  width: 100%;
1878
1878
  position: relative;
1879
1879
  }
1880
- .superdoc__sub-document[data-v-0d27f262] {
1880
+ .superdoc__sub-document[data-v-f0b56abb] {
1881
1881
  width: 100%;
1882
1882
  position: relative;
1883
1883
  }
1884
- .superdoc__selection-layer[data-v-0d27f262] {
1884
+ .superdoc__selection-layer[data-v-f0b56abb] {
1885
1885
  position: absolute;
1886
1886
  min-width: 100%;
1887
1887
  min-height: 100%;
@@ -1892,13 +1892,13 @@ img[data-v-c95b2073] {
1892
1892
  /* SD-3497: PDF whiteboard overlay sits above the rendered PDF canvas but below
1893
1893
  the PDF comment anchors (z-index 6 in PdfCommentsLayer) so anchors stay
1894
1894
  clickable, and below the selection layer (z-index 10). */
1895
- .superdoc__whiteboard-layer[data-v-0d27f262] {
1895
+ .superdoc__whiteboard-layer[data-v-f0b56abb] {
1896
1896
  z-index: 4;
1897
1897
  }
1898
- .superdoc__temp-selection[data-v-0d27f262] {
1898
+ .superdoc__temp-selection[data-v-f0b56abb] {
1899
1899
  position: absolute;
1900
1900
  }
1901
- .superdoc__right-sidebar[data-v-0d27f262] {
1901
+ .superdoc__right-sidebar[data-v-f0b56abb] {
1902
1902
  width: 320px;
1903
1903
  min-width: 320px;
1904
1904
  padding: 0 10px;
@@ -1906,7 +1906,7 @@ img[data-v-c95b2073] {
1906
1906
  position: relative;
1907
1907
  z-index: 2;
1908
1908
  }
1909
- .superdoc__compact-comment-popover[data-v-0d27f262] {
1909
+ .superdoc__compact-comment-popover[data-v-f0b56abb] {
1910
1910
  position: absolute;
1911
1911
  top: 12px;
1912
1912
  right: 12px;
@@ -1915,14 +1915,14 @@ img[data-v-c95b2073] {
1915
1915
  }
1916
1916
 
1917
1917
  /* Tools styles */
1918
- .tools[data-v-0d27f262] {
1918
+ .tools[data-v-f0b56abb] {
1919
1919
  position: absolute;
1920
1920
  z-index: 3;
1921
1921
  display: flex;
1922
1922
  flex-direction: column;
1923
1923
  gap: var(--sd-ui-tools-gap, 6px);
1924
1924
  }
1925
- .tools-item[data-v-0d27f262] {
1925
+ .tools-item[data-v-f0b56abb] {
1926
1926
  display: flex;
1927
1927
  align-items: center;
1928
1928
  justify-content: center;
@@ -1933,10 +1933,10 @@ img[data-v-c95b2073] {
1933
1933
  cursor: pointer;
1934
1934
  position: relative;
1935
1935
  }
1936
- .tools-item i[data-v-0d27f262] {
1936
+ .tools-item i[data-v-f0b56abb] {
1937
1937
  cursor: pointer;
1938
1938
  }
1939
- .superdoc__tools-icon[data-v-0d27f262] {
1939
+ .superdoc__tools-icon[data-v-f0b56abb] {
1940
1940
  width: var(--sd-ui-tools-icon-size, 20px);
1941
1941
  height: var(--sd-ui-tools-icon-size, 20px);
1942
1942
  flex-shrink: 0;
@@ -1951,22 +1951,22 @@ img[data-v-c95b2073] {
1951
1951
 
1952
1952
  /* 834px is iPad screen size in portrait orientation */
1953
1953
  @media (max-width: 834px) {
1954
- .superdoc .superdoc__layers[data-v-0d27f262] {
1954
+ .superdoc .superdoc__layers[data-v-f0b56abb] {
1955
1955
  margin: 0;
1956
1956
  border: 0 !important;
1957
1957
  box-shadow: none;
1958
1958
  }
1959
- .superdoc__sub-document[data-v-0d27f262] {
1959
+ .superdoc__sub-document[data-v-f0b56abb] {
1960
1960
  max-width: 100%;
1961
1961
  }
1962
- .superdoc__right-sidebar[data-v-0d27f262] {
1962
+ .superdoc__right-sidebar[data-v-f0b56abb] {
1963
1963
  padding: 10px;
1964
1964
  position: relative;
1965
1965
  }
1966
1966
  }
1967
1967
 
1968
1968
  /* AI Writer styles */
1969
- .ai-writer-container[data-v-0d27f262] {
1969
+ .ai-writer-container[data-v-f0b56abb] {
1970
1970
  position: fixed;
1971
1971
  z-index: 1000;
1972
1972
  background: white;
@@ -1982,10 +1982,10 @@ img[data-v-c95b2073] {
1982
1982
  transform: translateY(-50%);
1983
1983
  z-index: 50;
1984
1984
  } */
1985
- .ai-tool > svg[data-v-0d27f262] {
1985
+ .ai-tool > svg[data-v-f0b56abb] {
1986
1986
  fill: transparent;
1987
1987
  }
1988
- .ai-tool[data-v-0d27f262]::before {
1988
+ .ai-tool[data-v-f0b56abb]::before {
1989
1989
  content: '';
1990
1990
  position: absolute;
1991
1991
  width: 20px;
@@ -2006,7 +2006,7 @@ img[data-v-c95b2073] {
2006
2006
  filter: brightness(1.2);
2007
2007
  transition: filter 0.2s ease;
2008
2008
  }
2009
- .ai-tool[data-v-0d27f262]:hover::before {
2009
+ .ai-tool[data-v-f0b56abb]:hover::before {
2010
2010
  filter: brightness(1.3);
2011
2011
  }
2012
2012
 
@@ -1818,11 +1818,11 @@ img[data-v-c95b2073] {
1818
1818
  pointer-events: auto;
1819
1819
  }
1820
1820
 
1821
- .superdoc[data-v-0d27f262] {
1821
+ .superdoc[data-v-f0b56abb] {
1822
1822
  display: flex;
1823
1823
  position: relative;
1824
1824
  }
1825
- .sd-visually-hidden[data-v-0d27f262] {
1825
+ .sd-visually-hidden[data-v-f0b56abb] {
1826
1826
  position: absolute;
1827
1827
  width: 1px;
1828
1828
  height: 1px;
@@ -1833,14 +1833,14 @@ img[data-v-c95b2073] {
1833
1833
  white-space: nowrap;
1834
1834
  border: 0;
1835
1835
  }
1836
- .superdoc__mutation-status[data-v-0d27f262] {
1836
+ .superdoc__mutation-status[data-v-f0b56abb] {
1837
1837
  position: sticky;
1838
1838
  z-index: 10;
1839
1839
  top: 12px;
1840
1840
  height: 0;
1841
1841
  pointer-events: none;
1842
1842
  }
1843
- .superdoc__edit-rejected-status[data-v-0d27f262] {
1843
+ .superdoc__edit-rejected-status[data-v-f0b56abb] {
1844
1844
  position: absolute;
1845
1845
  top: 0;
1846
1846
  left: 50%;
@@ -1858,30 +1858,30 @@ img[data-v-c95b2073] {
1858
1858
  line-height: 20px;
1859
1859
  pointer-events: none;
1860
1860
  }
1861
- .right-sidebar[data-v-0d27f262] {
1861
+ .right-sidebar[data-v-f0b56abb] {
1862
1862
  min-width: 320px;
1863
1863
  height: 100%;
1864
1864
  }
1865
- .floating-comments[data-v-0d27f262] {
1865
+ .floating-comments[data-v-f0b56abb] {
1866
1866
  min-width: 300px;
1867
1867
  width: 300px;
1868
1868
  height: 100%;
1869
1869
  overflow: visible;
1870
1870
  }
1871
- .superdoc__layers[data-v-0d27f262] {
1871
+ .superdoc__layers[data-v-f0b56abb] {
1872
1872
  height: 100%;
1873
1873
  position: relative;
1874
1874
  box-sizing: border-box;
1875
1875
  }
1876
- .superdoc__document[data-v-0d27f262] {
1876
+ .superdoc__document[data-v-f0b56abb] {
1877
1877
  width: 100%;
1878
1878
  position: relative;
1879
1879
  }
1880
- .superdoc__sub-document[data-v-0d27f262] {
1880
+ .superdoc__sub-document[data-v-f0b56abb] {
1881
1881
  width: 100%;
1882
1882
  position: relative;
1883
1883
  }
1884
- .superdoc__selection-layer[data-v-0d27f262] {
1884
+ .superdoc__selection-layer[data-v-f0b56abb] {
1885
1885
  position: absolute;
1886
1886
  min-width: 100%;
1887
1887
  min-height: 100%;
@@ -1892,13 +1892,13 @@ img[data-v-c95b2073] {
1892
1892
  /* SD-3497: PDF whiteboard overlay sits above the rendered PDF canvas but below
1893
1893
  the PDF comment anchors (z-index 6 in PdfCommentsLayer) so anchors stay
1894
1894
  clickable, and below the selection layer (z-index 10). */
1895
- .superdoc__whiteboard-layer[data-v-0d27f262] {
1895
+ .superdoc__whiteboard-layer[data-v-f0b56abb] {
1896
1896
  z-index: 4;
1897
1897
  }
1898
- .superdoc__temp-selection[data-v-0d27f262] {
1898
+ .superdoc__temp-selection[data-v-f0b56abb] {
1899
1899
  position: absolute;
1900
1900
  }
1901
- .superdoc__right-sidebar[data-v-0d27f262] {
1901
+ .superdoc__right-sidebar[data-v-f0b56abb] {
1902
1902
  width: 320px;
1903
1903
  min-width: 320px;
1904
1904
  padding: 0 10px;
@@ -1906,7 +1906,7 @@ img[data-v-c95b2073] {
1906
1906
  position: relative;
1907
1907
  z-index: 2;
1908
1908
  }
1909
- .superdoc__compact-comment-popover[data-v-0d27f262] {
1909
+ .superdoc__compact-comment-popover[data-v-f0b56abb] {
1910
1910
  position: absolute;
1911
1911
  top: 12px;
1912
1912
  right: 12px;
@@ -1915,14 +1915,14 @@ img[data-v-c95b2073] {
1915
1915
  }
1916
1916
 
1917
1917
  /* Tools styles */
1918
- .tools[data-v-0d27f262] {
1918
+ .tools[data-v-f0b56abb] {
1919
1919
  position: absolute;
1920
1920
  z-index: 3;
1921
1921
  display: flex;
1922
1922
  flex-direction: column;
1923
1923
  gap: var(--sd-ui-tools-gap, 6px);
1924
1924
  }
1925
- .tools-item[data-v-0d27f262] {
1925
+ .tools-item[data-v-f0b56abb] {
1926
1926
  display: flex;
1927
1927
  align-items: center;
1928
1928
  justify-content: center;
@@ -1933,10 +1933,10 @@ img[data-v-c95b2073] {
1933
1933
  cursor: pointer;
1934
1934
  position: relative;
1935
1935
  }
1936
- .tools-item i[data-v-0d27f262] {
1936
+ .tools-item i[data-v-f0b56abb] {
1937
1937
  cursor: pointer;
1938
1938
  }
1939
- .superdoc__tools-icon[data-v-0d27f262] {
1939
+ .superdoc__tools-icon[data-v-f0b56abb] {
1940
1940
  width: var(--sd-ui-tools-icon-size, 20px);
1941
1941
  height: var(--sd-ui-tools-icon-size, 20px);
1942
1942
  flex-shrink: 0;
@@ -1951,22 +1951,22 @@ img[data-v-c95b2073] {
1951
1951
 
1952
1952
  /* 834px is iPad screen size in portrait orientation */
1953
1953
  @media (max-width: 834px) {
1954
- .superdoc .superdoc__layers[data-v-0d27f262] {
1954
+ .superdoc .superdoc__layers[data-v-f0b56abb] {
1955
1955
  margin: 0;
1956
1956
  border: 0 !important;
1957
1957
  box-shadow: none;
1958
1958
  }
1959
- .superdoc__sub-document[data-v-0d27f262] {
1959
+ .superdoc__sub-document[data-v-f0b56abb] {
1960
1960
  max-width: 100%;
1961
1961
  }
1962
- .superdoc__right-sidebar[data-v-0d27f262] {
1962
+ .superdoc__right-sidebar[data-v-f0b56abb] {
1963
1963
  padding: 10px;
1964
1964
  position: relative;
1965
1965
  }
1966
1966
  }
1967
1967
 
1968
1968
  /* AI Writer styles */
1969
- .ai-writer-container[data-v-0d27f262] {
1969
+ .ai-writer-container[data-v-f0b56abb] {
1970
1970
  position: fixed;
1971
1971
  z-index: 1000;
1972
1972
  background: white;
@@ -1982,10 +1982,10 @@ img[data-v-c95b2073] {
1982
1982
  transform: translateY(-50%);
1983
1983
  z-index: 50;
1984
1984
  } */
1985
- .ai-tool > svg[data-v-0d27f262] {
1985
+ .ai-tool > svg[data-v-f0b56abb] {
1986
1986
  fill: transparent;
1987
1987
  }
1988
- .ai-tool[data-v-0d27f262]::before {
1988
+ .ai-tool[data-v-f0b56abb]::before {
1989
1989
  content: '';
1990
1990
  position: absolute;
1991
1991
  width: 20px;
@@ -2006,7 +2006,7 @@ img[data-v-c95b2073] {
2006
2006
  filter: brightness(1.2);
2007
2007
  transition: filter 0.2s ease;
2008
2008
  }
2009
- .ai-tool[data-v-0d27f262]:hover::before {
2009
+ .ai-tool[data-v-f0b56abb]:hover::before {
2010
2010
  filter: brightness(1.3);
2011
2011
  }
2012
2012
 
@@ -14,13 +14,13 @@
14
14
  * keys, auth endpoints, and query strings are never echoed back in diagnostics.
15
15
  */
16
16
  /** Provider families the shipped v2 single-doc runtime can drive. */
17
- export type SupportedV2ProviderFamily = 'y-websocket' | 'hocuspocus' | 'liveblocks';
17
+ export type SupportedV2ProviderFamily = 'y-websocket' | 'hocuspocus' | 'liveblocks' | 'extension';
18
18
  /**
19
19
  * Stable, machine-readable reasons a target cannot be treated as a supported v2
20
20
  * collaboration room. These strings are part of the diagnostic contract and are
21
21
  * safe to assert against in tests; they never carry caller-provided values.
22
22
  */
23
- export type V2CollaborationUnsupportedReason = 'missing-target' | 'invalid-document-id' | 'invalid-server-url' | 'invalid-room-mode' | 'invalid-auth-endpoint' | 'missing-auth' | 'mixed-auth' | 'unsupported-document-type' | 'unsupported-multi-document' | 'unsupported-legacy-provider' | 'unsupported-provider-family';
23
+ export type V2CollaborationUnsupportedReason = 'missing-target' | 'invalid-document-id' | 'invalid-server-url' | 'invalid-room-mode' | 'invalid-auth-endpoint' | 'invalid-adapter-id' | 'invalid-provider-options' | 'missing-auth' | 'mixed-auth' | 'unsupported-document-type' | 'unsupported-multi-document' | 'unsupported-legacy-provider' | 'unsupported-provider-family';
24
24
  /**
25
25
  * Normalized, supported v2 collaboration room target.
26
26
  *
@@ -38,11 +38,15 @@ export interface NormalizedV2CollaborationTarget {
38
38
  /** Optional connection query params (e.g. auth token) forwarded verbatim. */
39
39
  params?: Record<string, string>;
40
40
  /** Hocuspocus auth-message token. */
41
- token?: string;
41
+ token?: string | (() => string | Promise<string>);
42
42
  /** Liveblocks anonymous public key auth mode. */
43
43
  publicApiKey?: string;
44
44
  /** Liveblocks server-side auth endpoint mode. */
45
45
  authEndpoint?: string;
46
+ /** Adapter registration key for a customer collaboration Worker. */
47
+ adapterId?: string;
48
+ /** Structured-clone-safe options interpreted by the registered adapter. */
49
+ providerOptions?: unknown;
46
50
  /** Explicit room operation; join is the default at the untrusted input boundary. */
47
51
  roomMode: 'join' | 'create';
48
52
  }
@@ -591,6 +591,8 @@ export interface CollaborationProvider {
591
591
  off?: (...args: unknown[]) => unknown;
592
592
  disconnect?: () => unknown;
593
593
  destroy?: () => unknown;
594
+ /** Send a provider-specific stateless string payload. */
595
+ sendStateless?: (message: string) => unknown;
594
596
  [key: string]: unknown;
595
597
  }
596
598
  /**
@@ -604,18 +606,17 @@ export interface CollaborationProvider {
604
606
  * single-doc provider internally. One `documentId` maps to exactly one
605
607
  * room/provider/root identity.
606
608
  *
607
- * SuperDoc v2 supports three first-class provider families through this field:
608
- * y-websocket, Hocuspocus, and Liveblocks. The provider is selected with
609
- * `providerType`; omitting it preserves the original y-websocket-only shape
610
- * (`{ documentId, serverUrl, params? }`) for backward compatibility.
609
+ * SuperDoc v2 includes y-websocket, Hocuspocus, and Liveblocks adapters and can
610
+ * route a named provider extension through a configured collaboration Worker.
611
+ * The provider is selected with `providerType`; omitting it preserves the
612
+ * original y-websocket-only shape (`{ documentId, serverUrl, params? }`).
611
613
  *
612
614
  * This is intentionally distinct from the legacy provider-agnostic
613
- * {@link CollaborationConfig} (`Config.modules.collaboration`): v2 owns its
614
- * provider internally and does **not** accept an external Yjs `provider`/`ydoc`
615
- * through this field. External `{ ydoc, provider }` remains a v1 /
616
- * provider-compat concern only and is rejected as a v2 content driver.
615
+ * {@link CollaborationConfig} (`Config.modules.collaboration`): v2 owns the
616
+ * Y.Doc. Provider extensions receive that document inside the collaboration
617
+ * Worker instead of replacing it.
617
618
  */
618
- export type V2CollaborationConfig = V2YWebsocketCollaborationConfig | V2HocuspocusCollaborationConfig | V2LiveblocksCollaborationConfig;
619
+ export type V2CollaborationConfig = V2YWebsocketCollaborationConfig | V2HocuspocusCollaborationConfig | V2LiveblocksCollaborationConfig | V2ProviderExtensionCollaborationConfig;
619
620
  /**
620
621
  * y-websocket single-doc provider config.
621
622
  *
@@ -653,8 +654,8 @@ export interface V2HocuspocusCollaborationConfig {
653
654
  url?: string;
654
655
  /** Optional connection params forwarded to the backend. */
655
656
  params?: Record<string, string> | null;
656
- /** Auth-message token forwarded to the Hocuspocus backend. */
657
- token?: string;
657
+ /** Static auth token or resolver invoked for every Hocuspocus connection. */
658
+ token?: string | (() => string | Promise<string>);
658
659
  /** Explicit room operation. Defaults to `'join'`; `'create'` never joins an existing room. */
659
660
  roomMode?: 'join' | 'create';
660
661
  }
@@ -681,6 +682,20 @@ export interface V2LiveblocksCollaborationConfig {
681
682
  /** Explicit room operation. Defaults to `'join'`; `'create'` never joins an existing room. */
682
683
  roomMode?: 'join' | 'create';
683
684
  }
685
+ /** Named provider adapter implemented by the configured collaboration Worker. */
686
+ export interface V2ProviderExtensionCollaborationConfig {
687
+ providerType: 'extension';
688
+ /** Adapter registration key understood by the collaboration Worker. */
689
+ adapterId: string;
690
+ /** Stable shared document identity. */
691
+ documentId: string;
692
+ /** Structured-clone-safe options passed to the registered adapter factory. */
693
+ providerOptions?: unknown;
694
+ /** Optional host-owned credential resolver available to the adapter. */
695
+ token?: string | (() => string | Promise<string>);
696
+ /** Explicit room operation. Defaults to `'join'`; `'create'` never joins an existing room. */
697
+ roomMode?: 'join' | 'create';
698
+ }
684
699
  export interface Comment {
685
700
  id?: string;
686
701
  commentId?: string;
@@ -0,0 +1,18 @@
1
+ // Generated by scripts/ensure-types.cjs. Do not edit by hand.
2
+ import type { SuperDocCollaborationProviderAdapter as __Cjs_SuperDocCollaborationProviderAdapter } from './collaboration-worker.js' with { "resolution-mode": "import" };
3
+ import type { SuperDocCollaborationProviderAttachInput as __Cjs_SuperDocCollaborationProviderAttachInput } from './collaboration-worker.js' with { "resolution-mode": "import" };
4
+ import type { SuperDocCollaborationProviderAwareness as __Cjs_SuperDocCollaborationProviderAwareness } from './collaboration-worker.js' with { "resolution-mode": "import" };
5
+ import type { SuperDocCollaborationProviderFactory as __Cjs_SuperDocCollaborationProviderFactory } from './collaboration-worker.js' with { "resolution-mode": "import" };
6
+ import type { SuperDocCollaborationProviderFactoryInput as __Cjs_SuperDocCollaborationProviderFactoryInput } from './collaboration-worker.js' with { "resolution-mode": "import" };
7
+ import type { SuperDocCollaborationProviderFamily as __Cjs_SuperDocCollaborationProviderFamily } from './collaboration-worker.js' with { "resolution-mode": "import" };
8
+ import type { SuperDocCollaborationProviderTransport as __Cjs_SuperDocCollaborationProviderTransport } from './collaboration-worker.js' with { "resolution-mode": "import" };
9
+ import type { SuperDocCollaborationWorkerOptions as __Cjs_SuperDocCollaborationWorkerOptions } from './collaboration-worker.js' with { "resolution-mode": "import" };
10
+ export declare const bootstrapSuperDocCollaborationWorker: typeof import('./collaboration-worker.js', { with: { "resolution-mode": "import" } }).bootstrapSuperDocCollaborationWorker;
11
+ export type { __Cjs_SuperDocCollaborationProviderAdapter as SuperDocCollaborationProviderAdapter };
12
+ export type { __Cjs_SuperDocCollaborationProviderAttachInput as SuperDocCollaborationProviderAttachInput };
13
+ export type { __Cjs_SuperDocCollaborationProviderAwareness as SuperDocCollaborationProviderAwareness };
14
+ export type { __Cjs_SuperDocCollaborationProviderFactory as SuperDocCollaborationProviderFactory };
15
+ export type { __Cjs_SuperDocCollaborationProviderFactoryInput as SuperDocCollaborationProviderFactoryInput };
16
+ export type { __Cjs_SuperDocCollaborationProviderFamily as SuperDocCollaborationProviderFamily };
17
+ export type { __Cjs_SuperDocCollaborationProviderTransport as SuperDocCollaborationProviderTransport };
18
+ export type { __Cjs_SuperDocCollaborationWorkerOptions as SuperDocCollaborationWorkerOptions };
@@ -0,0 +1,48 @@
1
+ import { Doc as YDoc } from 'yjs';
2
+ export type SuperDocCollaborationProviderFamily = 'y-websocket' | 'hocuspocus' | 'liveblocks';
3
+ export interface SuperDocCollaborationProviderAwareness {
4
+ getLocalState(): Record<string, unknown> | null;
5
+ setLocalState(state: Record<string, unknown> | null): void;
6
+ getStates(): Map<number, Record<string, unknown>>;
7
+ on(event: 'change' | 'update', listener: (payload: {
8
+ added: number[];
9
+ updated: number[];
10
+ removed: number[];
11
+ }) => void): void;
12
+ off(event: 'change' | 'update', listener: (payload: {
13
+ added: number[];
14
+ updated: number[];
15
+ removed: number[];
16
+ }) => void): void;
17
+ }
18
+ export interface SuperDocCollaborationProviderAttachInput {
19
+ readonly rootId: string;
20
+ readonly ydoc: YDoc;
21
+ readonly providerRoomName: string;
22
+ onSynced(): void;
23
+ onDegraded(): void;
24
+ onFailed(detail: Record<string, unknown>): void;
25
+ onStateless(message: string): void;
26
+ }
27
+ export interface SuperDocCollaborationProviderTransport {
28
+ readonly awareness?: SuperDocCollaborationProviderAwareness | null;
29
+ disconnect(): void;
30
+ destroy(): void;
31
+ sendStateless?(message: string): Promise<void> | void;
32
+ }
33
+ export interface SuperDocCollaborationProviderAdapter {
34
+ readonly providerFamily: SuperDocCollaborationProviderFamily;
35
+ attach(input: SuperDocCollaborationProviderAttachInput): SuperDocCollaborationProviderTransport;
36
+ destroy?(): void;
37
+ }
38
+ export interface SuperDocCollaborationProviderFactoryInput {
39
+ readonly documentId: string;
40
+ readonly providerOptions: unknown;
41
+ readonly token: string | (() => Promise<string>) | null;
42
+ }
43
+ export type SuperDocCollaborationProviderFactory = (input: SuperDocCollaborationProviderFactoryInput) => SuperDocCollaborationProviderAdapter;
44
+ export interface SuperDocCollaborationWorkerOptions {
45
+ readonly providerAdapters: Readonly<Record<string, SuperDocCollaborationProviderFactory>>;
46
+ }
47
+ /** Register provider adapters and start the worker used by `workerUrls.collaboration`. */
48
+ export declare function bootstrapSuperDocCollaborationWorker(options: SuperDocCollaborationWorkerOptions): void;