@ai-matrx/office 0.8.66 → 0.8.68

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.
Files changed (38) hide show
  1. package/CHANGELOG.md +15 -1
  2. package/dist/collab-sheets-transform.d.cts +2 -1
  3. package/dist/collab-sheets-transform.d.ts +2 -1
  4. package/dist/core-page-setup-apply.d.cts +3 -2
  5. package/dist/core-page-setup-apply.d.ts +3 -2
  6. package/dist/core.d.cts +3 -2
  7. package/dist/core.d.ts +3 -2
  8. package/dist/docs-host.d.cts +2 -1
  9. package/dist/docs-host.d.ts +2 -1
  10. package/dist/docs-io.d.cts +2 -1
  11. package/dist/docs-io.d.ts +2 -1
  12. package/dist/docs-tools.d.cts +2 -1
  13. package/dist/docs-tools.d.ts +2 -1
  14. package/dist/docs.d.cts +3 -2
  15. package/dist/docs.d.ts +3 -2
  16. package/dist/{document-page-style-6yKEDjHE.d.cts → document-page-style-DRTPPf4K.d.cts} +2 -1
  17. package/dist/{document-page-style-6yKEDjHE.d.ts → document-page-style-DRTPPf4K.d.ts} +2 -1
  18. package/dist/pdf-model.d.cts +2 -1
  19. package/dist/pdf-model.d.ts +2 -1
  20. package/dist/pdf.d.cts +2 -1
  21. package/dist/pdf.d.ts +2 -1
  22. package/dist/sheets-comment-anchors.d.cts +2 -1
  23. package/dist/sheets-comment-anchors.d.ts +2 -1
  24. package/dist/sheets-xlsx.d.cts +2 -1
  25. package/dist/sheets-xlsx.d.ts +2 -1
  26. package/dist/sheets.d.cts +2 -1
  27. package/dist/sheets.d.ts +2 -1
  28. package/dist/univer-collab.d.cts +2 -1
  29. package/dist/univer-collab.d.ts +2 -1
  30. package/dist/univer-history.d.cts +2 -1
  31. package/dist/univer-history.d.ts +2 -1
  32. package/dist/univer-realtime.d.cts +2 -1
  33. package/dist/univer-realtime.d.ts +2 -1
  34. package/dist/univer.cjs.map +1 -1
  35. package/dist/univer.d.cts +4 -13
  36. package/dist/univer.d.ts +4 -13
  37. package/dist/univer.js.map +1 -1
  38. package/package.json +2 -42
package/CHANGELOG.md CHANGED
@@ -1,10 +1,24 @@
1
1
  # Changelog
2
2
 
3
- ## 0.8.66
3
+ ## 0.8.68
4
4
 
5
5
  UNVERIFIED: this release has no Unreleased entry and the source comparison could not be made (the caller supplied no source comparison). Whether source changed is unknown; consumer action is unknown.
6
6
  Check the package's gitHead on npm against this version's gitHead: `git diff <previous gitHead> <this gitHead> -- apps/shared/office/src`.
7
7
 
8
+ ## 0.8.67
9
+
10
+ Automatic changed-only republish (docs/metadata drift since the last published version; verified: `git diff 00cdf507e0 5efc49da2e -- apps/shared/office/src`
11
+ has no shipped-source changes outside tests, fixtures and docs). No consumer action required.
12
+
13
+ ## 0.8.66
14
+
15
+ SOURCE CHANGED WITH NO RELEASE NOTE. This release shipped source changes that nobody described in an Unreleased entry,
16
+ so they may include breaking API changes. Consumer action is UNKNOWN: read the diff before upgrading.
17
+ Diff: `git diff ba2eaed14f 00cdf507e0 -- apps/shared/office/src`
18
+
19
+ Changed shipped source files (1):
20
+ - `apps/shared/office/src/docs/import-document-file.ts`
21
+
8
22
  ## 0.8.65
9
23
 
10
24
  - Correct `DocumentRow.organization_id` to the non-null UUID required by `workbench.udt_documents`. Consumer action: pass the document's organization ID when constructing a row; database reads already carry it.
@@ -247,4 +247,5 @@ declare function refSheetsAfter(refSheets: RefSheets | undefined, change: RefCha
247
247
  /** `refSheets` for the given formula texts: every sheet name they qualify a reference with, resolved now. */
248
248
  declare function refSheetsFor(texts: Iterable<string>, sheets: Readonly<Record<string, string>>): RefSheets | undefined;
249
249
 
250
- export { type Axis, type AxisOp, type Barrier, type BarrierEntry, CONTENT_KEYS, type CoveredEntry, type FormulaCtx, type NeverEntry, PAIR_BARRIERS, REF_ERROR, type RefChange, type RefSheets, type RegistryEntry, type Rewritten, SHEET_MUTATIONS, SHEET_TRANSFORMER_VERSION, SIDE_CAR_PARAMS, type SheetFamily, type SheetGroup, type SheetMutation, type SheetRange, type Side, type TransformResult, type Transformed, allowParams, annotateFormulas, annotateSheetOps, cellRef, completeCellContent, exactMergeRemovals, forApply, formulaBarrier, inlineSheetStyles, isBarrier, isFormulaText, isStructuralMutation, mapIndex, mergeFixupsOwed, mergeThrough, refSheetsAfter, refSheetsFor, rewriteFormula, sheetTransformer, spanThrough, transformAxis, transformGroup, transformMutation };
250
+ export { CONTENT_KEYS, PAIR_BARRIERS, REF_ERROR, SHEET_MUTATIONS, SHEET_TRANSFORMER_VERSION, SIDE_CAR_PARAMS, allowParams, annotateFormulas, annotateSheetOps, cellRef, completeCellContent, exactMergeRemovals, forApply, formulaBarrier, inlineSheetStyles, isBarrier, isFormulaText, isStructuralMutation, mapIndex, mergeFixupsOwed, mergeThrough, refSheetsAfter, refSheetsFor, rewriteFormula, sheetTransformer, spanThrough, transformAxis, transformGroup, transformMutation };
251
+ export type { Axis, AxisOp, Barrier, BarrierEntry, CoveredEntry, FormulaCtx, NeverEntry, RefChange, RefSheets, RegistryEntry, Rewritten, SheetFamily, SheetGroup, SheetMutation, SheetRange, Side, TransformResult, Transformed };
@@ -247,4 +247,5 @@ declare function refSheetsAfter(refSheets: RefSheets | undefined, change: RefCha
247
247
  /** `refSheets` for the given formula texts: every sheet name they qualify a reference with, resolved now. */
248
248
  declare function refSheetsFor(texts: Iterable<string>, sheets: Readonly<Record<string, string>>): RefSheets | undefined;
249
249
 
250
- export { type Axis, type AxisOp, type Barrier, type BarrierEntry, CONTENT_KEYS, type CoveredEntry, type FormulaCtx, type NeverEntry, PAIR_BARRIERS, REF_ERROR, type RefChange, type RefSheets, type RegistryEntry, type Rewritten, SHEET_MUTATIONS, SHEET_TRANSFORMER_VERSION, SIDE_CAR_PARAMS, type SheetFamily, type SheetGroup, type SheetMutation, type SheetRange, type Side, type TransformResult, type Transformed, allowParams, annotateFormulas, annotateSheetOps, cellRef, completeCellContent, exactMergeRemovals, forApply, formulaBarrier, inlineSheetStyles, isBarrier, isFormulaText, isStructuralMutation, mapIndex, mergeFixupsOwed, mergeThrough, refSheetsAfter, refSheetsFor, rewriteFormula, sheetTransformer, spanThrough, transformAxis, transformGroup, transformMutation };
250
+ export { CONTENT_KEYS, PAIR_BARRIERS, REF_ERROR, SHEET_MUTATIONS, SHEET_TRANSFORMER_VERSION, SIDE_CAR_PARAMS, allowParams, annotateFormulas, annotateSheetOps, cellRef, completeCellContent, exactMergeRemovals, forApply, formulaBarrier, inlineSheetStyles, isBarrier, isFormulaText, isStructuralMutation, mapIndex, mergeFixupsOwed, mergeThrough, refSheetsAfter, refSheetsFor, rewriteFormula, sheetTransformer, spanThrough, transformAxis, transformGroup, transformMutation };
251
+ export type { Axis, AxisOp, Barrier, BarrierEntry, CoveredEntry, FormulaCtx, NeverEntry, RefChange, RefSheets, RegistryEntry, Rewritten, SheetFamily, SheetGroup, SheetMutation, SheetRange, Side, TransformResult, Transformed };
@@ -1,4 +1,4 @@
1
- import { e as PageSetupValues } from './document-page-style-6yKEDjHE.cjs';
1
+ import { PageSetupValues } from './core.cjs';
2
2
  import '@univerjs/core';
3
3
 
4
4
  /** The slice of the Univer facade this needs. Structural on purpose. */
@@ -18,4 +18,5 @@ declare const PAGE_SETUP_COMMAND = "docs.command.page-setup";
18
18
  declare function readPageSetup(api: PageSetupApiLike | null | undefined): PageSetupValues;
19
19
  declare function applyPageSetup(api: PageSetupApiLike, values: PageSetupValues): Promise<void>;
20
20
 
21
- export { PAGE_SETUP_COMMAND, type PageSetupApiLike, applyPageSetup, readPageSetup };
21
+ export { PAGE_SETUP_COMMAND, applyPageSetup, readPageSetup };
22
+ export type { PageSetupApiLike };
@@ -1,4 +1,4 @@
1
- import { e as PageSetupValues } from './document-page-style-6yKEDjHE.js';
1
+ import { PageSetupValues } from './core.js';
2
2
  import '@univerjs/core';
3
3
 
4
4
  /** The slice of the Univer facade this needs. Structural on purpose. */
@@ -18,4 +18,5 @@ declare const PAGE_SETUP_COMMAND = "docs.command.page-setup";
18
18
  declare function readPageSetup(api: PageSetupApiLike | null | undefined): PageSetupValues;
19
19
  declare function applyPageSetup(api: PageSetupApiLike, values: PageSetupValues): Promise<void>;
20
20
 
21
- export { PAGE_SETUP_COMMAND, type PageSetupApiLike, applyPageSetup, readPageSetup };
21
+ export { PAGE_SETUP_COMMAND, applyPageSetup, readPageSetup };
22
+ export type { PageSetupApiLike };
package/dist/core.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ComponentType, ReactNode } from 'react';
2
- export { D as DEFAULT_DOCUMENT_PAGE_STYLE, a as DEFAULT_PAGE_COLOR, P as PAGE_COLORS, b as PAGE_COLOR_KEY, c as PAPER_SIZES, d as PX_PER_INCH, e as PageSetupValues, f as PaperSizeName, g as defaultDocumentPageStyle, i as isLegacySqueezedPageStyle, p as pageSetupCommandParams, h as pageSetupFromStyle } from './document-page-style-6yKEDjHE.cjs';
2
+ export { D as DEFAULT_DOCUMENT_PAGE_STYLE, a as DEFAULT_PAGE_COLOR, P as PAGE_COLORS, b as PAGE_COLOR_KEY, c as PAPER_SIZES, d as PX_PER_INCH, e as PageSetupValues, f as PaperSizeName, g as defaultDocumentPageStyle, i as isLegacySqueezedPageStyle, p as pageSetupCommandParams, h as pageSetupFromStyle } from './document-page-style-DRTPPf4K.cjs';
3
3
  import '@univerjs/core';
4
4
 
5
5
  /**
@@ -400,4 +400,5 @@ interface DocumentSnapshot {
400
400
  snapshot: unknown;
401
401
  }
402
402
 
403
- export { AUTOMATE_TAB, type DocumentRow, type DocumentSnapshot, type DocumentSnapshotOrigin, type DocumentSource, type EditorMenu, type EditorMenuAction, type EditorMenuEntry, type EditorMenuSeparator, type EditorMenuSubmenu, type EditorShortcut, type EditorToolbarItem, type FlatEditorAction, type GoogleOnlyRows, type GoogleProduct, HELP_HEAD_CONTROLS, OFFICE_PRODUCTS, type OfficeHostMap, type OfficeProduct, type PageSetup, type ResolvedRibbonControl, type ResolvedRibbonGroup, type ResolvedRibbonTab, type RibbonControlSpec, type RibbonGroupSpec, type RibbonSize, type RibbonTabSpec, type ShownTo, type Visibility, type Workbook, type WorkbookSnapshot, type WorkbookSnapshotOrigin, type WorkbookSource, boundActions, configureOfficeHosts, flattenMenus, formatShortcut, googleExtensionsMenu, googleHelpHead, indexCommands, isMacPlatform, matchesShortcut, officeHref, officeOrigin, resolveRibbon, ribbonCoverage, searchActions, sep, soon };
403
+ export { AUTOMATE_TAB, HELP_HEAD_CONTROLS, OFFICE_PRODUCTS, boundActions, configureOfficeHosts, flattenMenus, formatShortcut, googleExtensionsMenu, googleHelpHead, indexCommands, isMacPlatform, matchesShortcut, officeHref, officeOrigin, resolveRibbon, ribbonCoverage, searchActions, sep, soon };
404
+ export type { DocumentRow, DocumentSnapshot, DocumentSnapshotOrigin, DocumentSource, EditorMenu, EditorMenuAction, EditorMenuEntry, EditorMenuSeparator, EditorMenuSubmenu, EditorShortcut, EditorToolbarItem, FlatEditorAction, GoogleOnlyRows, GoogleProduct, OfficeHostMap, OfficeProduct, PageSetup, ResolvedRibbonControl, ResolvedRibbonGroup, ResolvedRibbonTab, RibbonControlSpec, RibbonGroupSpec, RibbonSize, RibbonTabSpec, ShownTo, Visibility, Workbook, WorkbookSnapshot, WorkbookSnapshotOrigin, WorkbookSource };
package/dist/core.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ComponentType, ReactNode } from 'react';
2
- export { D as DEFAULT_DOCUMENT_PAGE_STYLE, a as DEFAULT_PAGE_COLOR, P as PAGE_COLORS, b as PAGE_COLOR_KEY, c as PAPER_SIZES, d as PX_PER_INCH, e as PageSetupValues, f as PaperSizeName, g as defaultDocumentPageStyle, i as isLegacySqueezedPageStyle, p as pageSetupCommandParams, h as pageSetupFromStyle } from './document-page-style-6yKEDjHE.js';
2
+ export { D as DEFAULT_DOCUMENT_PAGE_STYLE, a as DEFAULT_PAGE_COLOR, P as PAGE_COLORS, b as PAGE_COLOR_KEY, c as PAPER_SIZES, d as PX_PER_INCH, e as PageSetupValues, f as PaperSizeName, g as defaultDocumentPageStyle, i as isLegacySqueezedPageStyle, p as pageSetupCommandParams, h as pageSetupFromStyle } from './document-page-style-DRTPPf4K.js';
3
3
  import '@univerjs/core';
4
4
 
5
5
  /**
@@ -400,4 +400,5 @@ interface DocumentSnapshot {
400
400
  snapshot: unknown;
401
401
  }
402
402
 
403
- export { AUTOMATE_TAB, type DocumentRow, type DocumentSnapshot, type DocumentSnapshotOrigin, type DocumentSource, type EditorMenu, type EditorMenuAction, type EditorMenuEntry, type EditorMenuSeparator, type EditorMenuSubmenu, type EditorShortcut, type EditorToolbarItem, type FlatEditorAction, type GoogleOnlyRows, type GoogleProduct, HELP_HEAD_CONTROLS, OFFICE_PRODUCTS, type OfficeHostMap, type OfficeProduct, type PageSetup, type ResolvedRibbonControl, type ResolvedRibbonGroup, type ResolvedRibbonTab, type RibbonControlSpec, type RibbonGroupSpec, type RibbonSize, type RibbonTabSpec, type ShownTo, type Visibility, type Workbook, type WorkbookSnapshot, type WorkbookSnapshotOrigin, type WorkbookSource, boundActions, configureOfficeHosts, flattenMenus, formatShortcut, googleExtensionsMenu, googleHelpHead, indexCommands, isMacPlatform, matchesShortcut, officeHref, officeOrigin, resolveRibbon, ribbonCoverage, searchActions, sep, soon };
403
+ export { AUTOMATE_TAB, HELP_HEAD_CONTROLS, OFFICE_PRODUCTS, boundActions, configureOfficeHosts, flattenMenus, formatShortcut, googleExtensionsMenu, googleHelpHead, indexCommands, isMacPlatform, matchesShortcut, officeHref, officeOrigin, resolveRibbon, ribbonCoverage, searchActions, sep, soon };
404
+ export type { DocumentRow, DocumentSnapshot, DocumentSnapshotOrigin, DocumentSource, EditorMenu, EditorMenuAction, EditorMenuEntry, EditorMenuSeparator, EditorMenuSubmenu, EditorShortcut, EditorToolbarItem, FlatEditorAction, GoogleOnlyRows, GoogleProduct, OfficeHostMap, OfficeProduct, PageSetup, ResolvedRibbonControl, ResolvedRibbonGroup, ResolvedRibbonTab, RibbonControlSpec, RibbonGroupSpec, RibbonSize, RibbonTabSpec, ShownTo, Visibility, Workbook, WorkbookSnapshot, WorkbookSnapshotOrigin, WorkbookSource };
@@ -33,4 +33,5 @@ interface DocsHostPorts {
33
33
  declare function configureDocsHost(ports: DocsHostPorts): void;
34
34
  declare function getDocsHost(): DocsHostPorts;
35
35
 
36
- export { type DocsHostPorts, type DocsSupabase, configureDocsHost, getDocsHost };
36
+ export { configureDocsHost, getDocsHost };
37
+ export type { DocsHostPorts, DocsSupabase };
@@ -33,4 +33,5 @@ interface DocsHostPorts {
33
33
  declare function configureDocsHost(ports: DocsHostPorts): void;
34
34
  declare function getDocsHost(): DocsHostPorts;
35
35
 
36
- export { type DocsHostPorts, type DocsSupabase, configureDocsHost, getDocsHost };
36
+ export { configureDocsHost, getDocsHost };
37
+ export type { DocsHostPorts, DocsSupabase };
@@ -169,4 +169,5 @@ interface OpenFormatDeps {
169
169
  declare function exportOpenFormat(markdown: string, format: OpenFormat, title: string | null | undefined, deps: OpenFormatDeps): Promise<string>;
170
170
  declare function downloadOpenFormat(markdown: string, format: OpenFormat, title: string | null | undefined): Promise<string>;
171
171
 
172
- export { DOCUMENT_UPLOAD_ACCEPT, type DocToMarkdownOptions, type DocxParts, HEADING_LEVEL_BY_FONT_SIZE, OPEN_FORMATS, type OpenFormat, type OpenFormatDeps, deriveDocumentName, documentFileKind, documentFileToMarkdown, documentImageSources, docxRelationships, docxXmlToMarkdown, downloadOpenFormat, exportOpenFormat, htmlToDocumentMarkdown, imageMarkdownSource, importDocumentFile, markdownToUniverDoc, univerDocToMarkdown };
172
+ export { DOCUMENT_UPLOAD_ACCEPT, HEADING_LEVEL_BY_FONT_SIZE, OPEN_FORMATS, deriveDocumentName, documentFileKind, documentFileToMarkdown, documentImageSources, docxRelationships, docxXmlToMarkdown, downloadOpenFormat, exportOpenFormat, htmlToDocumentMarkdown, imageMarkdownSource, importDocumentFile, markdownToUniverDoc, univerDocToMarkdown };
173
+ export type { DocToMarkdownOptions, DocxParts, OpenFormat, OpenFormatDeps };
package/dist/docs-io.d.ts CHANGED
@@ -169,4 +169,5 @@ interface OpenFormatDeps {
169
169
  declare function exportOpenFormat(markdown: string, format: OpenFormat, title: string | null | undefined, deps: OpenFormatDeps): Promise<string>;
170
170
  declare function downloadOpenFormat(markdown: string, format: OpenFormat, title: string | null | undefined): Promise<string>;
171
171
 
172
- export { DOCUMENT_UPLOAD_ACCEPT, type DocToMarkdownOptions, type DocxParts, HEADING_LEVEL_BY_FONT_SIZE, OPEN_FORMATS, type OpenFormat, type OpenFormatDeps, deriveDocumentName, documentFileKind, documentFileToMarkdown, documentImageSources, docxRelationships, docxXmlToMarkdown, downloadOpenFormat, exportOpenFormat, htmlToDocumentMarkdown, imageMarkdownSource, importDocumentFile, markdownToUniverDoc, univerDocToMarkdown };
172
+ export { DOCUMENT_UPLOAD_ACCEPT, HEADING_LEVEL_BY_FONT_SIZE, OPEN_FORMATS, deriveDocumentName, documentFileKind, documentFileToMarkdown, documentImageSources, docxRelationships, docxXmlToMarkdown, downloadOpenFormat, exportOpenFormat, htmlToDocumentMarkdown, imageMarkdownSource, importDocumentFile, markdownToUniverDoc, univerDocToMarkdown };
173
+ export type { DocToMarkdownOptions, DocxParts, OpenFormat, OpenFormatDeps };
@@ -154,4 +154,5 @@ declare function createDocEditOps(deps: {
154
154
  /** Write one plain key onto the document style (it rides the snapshot like the paper color does). */
155
155
  declare function writeDocumentStyleKey(api: ApiLike, key: string, value: string): Promise<void>;
156
156
 
157
- export { BOOKMARK_ANCHOR, BOOKMARK_RANGE_TYPE, BUILDING_BLOCKS, type Bookmark, type BorderChoice, type BorderDash, type BorderSide, type BuildingBlock, DOCUMENT_LANGUAGES, DOCUMENT_LANGUAGE_KEY, type DocEditOps, type MarkdownFragment, type RulerGeometry, blockInsertPlan, bookmarkBody, bookmarkFromHash, bookmarkHash, cleanBookmarkName, collectBookmarks, createDocEditOps, looksLikeMarkdown, markdownFragment, paragraphBorderParams, readDocumentLanguage, rulerGeometry, writeDocumentStyleKey };
157
+ export { BOOKMARK_ANCHOR, BOOKMARK_RANGE_TYPE, BUILDING_BLOCKS, DOCUMENT_LANGUAGES, DOCUMENT_LANGUAGE_KEY, blockInsertPlan, bookmarkBody, bookmarkFromHash, bookmarkHash, cleanBookmarkName, collectBookmarks, createDocEditOps, looksLikeMarkdown, markdownFragment, paragraphBorderParams, readDocumentLanguage, rulerGeometry, writeDocumentStyleKey };
158
+ export type { Bookmark, BorderChoice, BorderDash, BorderSide, BuildingBlock, DocEditOps, MarkdownFragment, RulerGeometry };
@@ -154,4 +154,5 @@ declare function createDocEditOps(deps: {
154
154
  /** Write one plain key onto the document style (it rides the snapshot like the paper color does). */
155
155
  declare function writeDocumentStyleKey(api: ApiLike, key: string, value: string): Promise<void>;
156
156
 
157
- export { BOOKMARK_ANCHOR, BOOKMARK_RANGE_TYPE, BUILDING_BLOCKS, type Bookmark, type BorderChoice, type BorderDash, type BorderSide, type BuildingBlock, DOCUMENT_LANGUAGES, DOCUMENT_LANGUAGE_KEY, type DocEditOps, type MarkdownFragment, type RulerGeometry, blockInsertPlan, bookmarkBody, bookmarkFromHash, bookmarkHash, cleanBookmarkName, collectBookmarks, createDocEditOps, looksLikeMarkdown, markdownFragment, paragraphBorderParams, readDocumentLanguage, rulerGeometry, writeDocumentStyleKey };
157
+ export { BOOKMARK_ANCHOR, BOOKMARK_RANGE_TYPE, BUILDING_BLOCKS, DOCUMENT_LANGUAGES, DOCUMENT_LANGUAGE_KEY, blockInsertPlan, bookmarkBody, bookmarkFromHash, bookmarkHash, cleanBookmarkName, collectBookmarks, createDocEditOps, looksLikeMarkdown, markdownFragment, paragraphBorderParams, readDocumentLanguage, rulerGeometry, writeDocumentStyleKey };
158
+ export type { Bookmark, BorderChoice, BorderDash, BorderSide, BuildingBlock, DocEditOps, MarkdownFragment, RulerGeometry };
package/dist/docs.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { SupabaseClient } from '@supabase/supabase-js';
2
2
  import { ServiceResult } from '@ai-matrx/records/core';
3
- import { IDocumentData } from '@univerjs/core';
3
+ import { IDocumentData, CustomRangeType } from '@univerjs/core';
4
4
  import { WorkingCopyHandle, CommitReason } from '@ai-matrx/kit/working-copy';
5
5
  import { AwarenessState } from '@ai-matrx/data/realtime/collab';
6
6
 
@@ -892,4 +892,5 @@ declare function removeCommentAnchorActions(documentDataModel: unknown, anchorId
892
892
  */
893
893
  declare function isDocsAnchorOnlyOp(op: unknown): boolean;
894
894
 
895
- export { type BodyEdit, type BodyText, CARET_HEARTBEAT_MS, CARET_MAX_RANGES, CARET_STALE_MS, COMMENT_ANCHOR_LABEL_MAX, COMMENT_ANCHOR_PART_PREFIX, COMMENT_ANCHOR_RANGE_TYPE, type CaretRange, type CommentAnchorSpan, type CreateDocumentArgs, DOCUMENT_BODY_MAX_LENGTH, DOCUMENT_DESCRIPTION_MAX_LENGTH, DOCUMENT_NAME_MAX_LENGTH, DOCUMENT_SAVE_DELAY_MS, type DocsHostPorts, type DocsSupabase, type DocumentAwareness, type DocumentBodyPort, type DocumentBodyWriteHandler, type DocumentCollabBase, type DocumentCollabFactory, type DocumentCollabHandle, DocumentModel, type DocumentModelDeps, type DocumentOtFactory, type DocumentOtHandle, type DocumentSnapshotData, type DocumentViewPort, EMOJI_GROUPS, type Glyph, MIN_FIT_ZOOM, type ParkedDocumentEditor, type PublishedCaret, type RemoteCaret, RemoteCaretBook, SPECIAL_GROUPS, type SaveDocumentSnapshotArgs, addCommentAnchorActions, anchorIdOfPartAnchor, bodyTextOf, commentAnchorPartKey, commentAnchorsOf, commentPartAnchor, configureDocsHost, copyDocument, createDocument, deleteDocument, discardFailedDocument, documentBodyWriteHandler, documentSourceLabel, fitZoomRatio, getDocsHost, getDocument, getLatestDocumentSnapshot, isDocsAnchorOnlyOp, keepInsideTheBody, listAccessibleDocuments, listDocumentSnapshots, listTrashedDocuments, mapOffsetThroughReplace, moveDocument, movePeerRangesThroughBodyEdit, moveRangesThroughBodyEdit, newCommentAnchorId, planBodyEdit, publishedCaretFromSelection, quoteOfCommentAnchor, removeCommentAnchorActions, renameDocument, restoreDocument, sanitizeUniverDocSnapshot, saveDocumentSnapshot, searchSymbols, updateDocumentDescription, validateDocumentBody, validateDocumentDescription, validateDocumentName, writeBodyText };
895
+ export { CARET_HEARTBEAT_MS, CARET_MAX_RANGES, CARET_STALE_MS, COMMENT_ANCHOR_LABEL_MAX, COMMENT_ANCHOR_PART_PREFIX, COMMENT_ANCHOR_RANGE_TYPE, DOCUMENT_BODY_MAX_LENGTH, DOCUMENT_DESCRIPTION_MAX_LENGTH, DOCUMENT_NAME_MAX_LENGTH, DOCUMENT_SAVE_DELAY_MS, DocumentModel, EMOJI_GROUPS, MIN_FIT_ZOOM, RemoteCaretBook, SPECIAL_GROUPS, addCommentAnchorActions, anchorIdOfPartAnchor, bodyTextOf, commentAnchorPartKey, commentAnchorsOf, commentPartAnchor, configureDocsHost, copyDocument, createDocument, deleteDocument, discardFailedDocument, documentBodyWriteHandler, documentSourceLabel, fitZoomRatio, getDocsHost, getDocument, getLatestDocumentSnapshot, isDocsAnchorOnlyOp, keepInsideTheBody, listAccessibleDocuments, listDocumentSnapshots, listTrashedDocuments, mapOffsetThroughReplace, moveDocument, movePeerRangesThroughBodyEdit, moveRangesThroughBodyEdit, newCommentAnchorId, planBodyEdit, publishedCaretFromSelection, quoteOfCommentAnchor, removeCommentAnchorActions, renameDocument, restoreDocument, sanitizeUniverDocSnapshot, saveDocumentSnapshot, searchSymbols, updateDocumentDescription, validateDocumentBody, validateDocumentDescription, validateDocumentName, writeBodyText };
896
+ export type { BodyEdit, BodyText, CaretRange, CommentAnchorSpan, CreateDocumentArgs, DocsHostPorts, DocsSupabase, DocumentAwareness, DocumentBodyPort, DocumentBodyWriteHandler, DocumentCollabBase, DocumentCollabFactory, DocumentCollabHandle, DocumentModelDeps, DocumentOtFactory, DocumentOtHandle, DocumentSnapshotData, DocumentViewPort, Glyph, ParkedDocumentEditor, PublishedCaret, RemoteCaret, SaveDocumentSnapshotArgs };
package/dist/docs.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { SupabaseClient } from '@supabase/supabase-js';
2
2
  import { ServiceResult } from '@ai-matrx/records/core';
3
- import { IDocumentData } from '@univerjs/core';
3
+ import { IDocumentData, CustomRangeType } from '@univerjs/core';
4
4
  import { WorkingCopyHandle, CommitReason } from '@ai-matrx/kit/working-copy';
5
5
  import { AwarenessState } from '@ai-matrx/data/realtime/collab';
6
6
 
@@ -892,4 +892,5 @@ declare function removeCommentAnchorActions(documentDataModel: unknown, anchorId
892
892
  */
893
893
  declare function isDocsAnchorOnlyOp(op: unknown): boolean;
894
894
 
895
- export { type BodyEdit, type BodyText, CARET_HEARTBEAT_MS, CARET_MAX_RANGES, CARET_STALE_MS, COMMENT_ANCHOR_LABEL_MAX, COMMENT_ANCHOR_PART_PREFIX, COMMENT_ANCHOR_RANGE_TYPE, type CaretRange, type CommentAnchorSpan, type CreateDocumentArgs, DOCUMENT_BODY_MAX_LENGTH, DOCUMENT_DESCRIPTION_MAX_LENGTH, DOCUMENT_NAME_MAX_LENGTH, DOCUMENT_SAVE_DELAY_MS, type DocsHostPorts, type DocsSupabase, type DocumentAwareness, type DocumentBodyPort, type DocumentBodyWriteHandler, type DocumentCollabBase, type DocumentCollabFactory, type DocumentCollabHandle, DocumentModel, type DocumentModelDeps, type DocumentOtFactory, type DocumentOtHandle, type DocumentSnapshotData, type DocumentViewPort, EMOJI_GROUPS, type Glyph, MIN_FIT_ZOOM, type ParkedDocumentEditor, type PublishedCaret, type RemoteCaret, RemoteCaretBook, SPECIAL_GROUPS, type SaveDocumentSnapshotArgs, addCommentAnchorActions, anchorIdOfPartAnchor, bodyTextOf, commentAnchorPartKey, commentAnchorsOf, commentPartAnchor, configureDocsHost, copyDocument, createDocument, deleteDocument, discardFailedDocument, documentBodyWriteHandler, documentSourceLabel, fitZoomRatio, getDocsHost, getDocument, getLatestDocumentSnapshot, isDocsAnchorOnlyOp, keepInsideTheBody, listAccessibleDocuments, listDocumentSnapshots, listTrashedDocuments, mapOffsetThroughReplace, moveDocument, movePeerRangesThroughBodyEdit, moveRangesThroughBodyEdit, newCommentAnchorId, planBodyEdit, publishedCaretFromSelection, quoteOfCommentAnchor, removeCommentAnchorActions, renameDocument, restoreDocument, sanitizeUniverDocSnapshot, saveDocumentSnapshot, searchSymbols, updateDocumentDescription, validateDocumentBody, validateDocumentDescription, validateDocumentName, writeBodyText };
895
+ export { CARET_HEARTBEAT_MS, CARET_MAX_RANGES, CARET_STALE_MS, COMMENT_ANCHOR_LABEL_MAX, COMMENT_ANCHOR_PART_PREFIX, COMMENT_ANCHOR_RANGE_TYPE, DOCUMENT_BODY_MAX_LENGTH, DOCUMENT_DESCRIPTION_MAX_LENGTH, DOCUMENT_NAME_MAX_LENGTH, DOCUMENT_SAVE_DELAY_MS, DocumentModel, EMOJI_GROUPS, MIN_FIT_ZOOM, RemoteCaretBook, SPECIAL_GROUPS, addCommentAnchorActions, anchorIdOfPartAnchor, bodyTextOf, commentAnchorPartKey, commentAnchorsOf, commentPartAnchor, configureDocsHost, copyDocument, createDocument, deleteDocument, discardFailedDocument, documentBodyWriteHandler, documentSourceLabel, fitZoomRatio, getDocsHost, getDocument, getLatestDocumentSnapshot, isDocsAnchorOnlyOp, keepInsideTheBody, listAccessibleDocuments, listDocumentSnapshots, listTrashedDocuments, mapOffsetThroughReplace, moveDocument, movePeerRangesThroughBodyEdit, moveRangesThroughBodyEdit, newCommentAnchorId, planBodyEdit, publishedCaretFromSelection, quoteOfCommentAnchor, removeCommentAnchorActions, renameDocument, restoreDocument, sanitizeUniverDocSnapshot, saveDocumentSnapshot, searchSymbols, updateDocumentDescription, validateDocumentBody, validateDocumentDescription, validateDocumentName, writeBodyText };
896
+ export type { BodyEdit, BodyText, CaretRange, CommentAnchorSpan, CreateDocumentArgs, DocsHostPorts, DocsSupabase, DocumentAwareness, DocumentBodyPort, DocumentBodyWriteHandler, DocumentCollabBase, DocumentCollabFactory, DocumentCollabHandle, DocumentModelDeps, DocumentOtFactory, DocumentOtHandle, DocumentSnapshotData, DocumentViewPort, Glyph, ParkedDocumentEditor, PublishedCaret, RemoteCaret, SaveDocumentSnapshotArgs };
@@ -106,4 +106,5 @@ declare function pageSetupCommandParams(v: PageSetupValues): {
106
106
  marginRight: number;
107
107
  };
108
108
 
109
- export { DEFAULT_DOCUMENT_PAGE_STYLE as D, PAGE_COLORS as P, DEFAULT_PAGE_COLOR as a, PAGE_COLOR_KEY as b, PAPER_SIZES as c, PX_PER_INCH as d, type PageSetupValues as e, type PaperSizeName as f, defaultDocumentPageStyle as g, pageSetupFromStyle as h, isLegacySqueezedPageStyle as i, pageSetupCommandParams as p };
109
+ export { DEFAULT_DOCUMENT_PAGE_STYLE as D, PAGE_COLORS as P, DEFAULT_PAGE_COLOR as a, PAGE_COLOR_KEY as b, PAPER_SIZES as c, PX_PER_INCH as d, defaultDocumentPageStyle as g, pageSetupFromStyle as h, isLegacySqueezedPageStyle as i, pageSetupCommandParams as p };
110
+ export type { PageSetupValues as e, PaperSizeName as f };
@@ -106,4 +106,5 @@ declare function pageSetupCommandParams(v: PageSetupValues): {
106
106
  marginRight: number;
107
107
  };
108
108
 
109
- export { DEFAULT_DOCUMENT_PAGE_STYLE as D, PAGE_COLORS as P, DEFAULT_PAGE_COLOR as a, PAGE_COLOR_KEY as b, PAPER_SIZES as c, PX_PER_INCH as d, type PageSetupValues as e, type PaperSizeName as f, defaultDocumentPageStyle as g, pageSetupFromStyle as h, isLegacySqueezedPageStyle as i, pageSetupCommandParams as p };
109
+ export { DEFAULT_DOCUMENT_PAGE_STYLE as D, PAGE_COLORS as P, DEFAULT_PAGE_COLOR as a, PAGE_COLOR_KEY as b, PAPER_SIZES as c, PX_PER_INCH as d, defaultDocumentPageStyle as g, pageSetupFromStyle as h, isLegacySqueezedPageStyle as i, pageSetupCommandParams as p };
110
+ export type { PageSetupValues as e, PaperSizeName as f };
@@ -454,4 +454,5 @@ interface PdfWorkspaceHost {
454
454
  }>;
455
455
  }
456
456
 
457
- export { HISTORY_LIMIT, type History, type KeyLike, MARKUP_KIND_LABEL, MARKUP_SIZES, MARKUP_STYLE_FIELDS, MARKUP_SWATCHES, PDF_COMING_SOON, PDF_MARKUP_COMING_SOON, PDF_MARKUP_SHORTCUTS, PDF_MARKUP_TOOLS, PDF_SHORTCUTS, PDF_TOOLS, type PageDecisions, type PageOp, type PdfActionId, type PdfHostTool, type PdfHostToolContext, type PdfMarkupEngine, type PdfMarkupHistoryEvent, type PdfMarkupKind, type PdfMarkupSnapshot, type PdfMarkupStyle, type PdfMarkupTool, type PdfMarkupToolDef, type PdfMarkupToolId, type PdfRunRequest, type PdfRunResult, type PdfShortcut, type PdfToolDef, type PdfToolId, type PdfViewerState, type PdfWorkspaceHost, type SessionTimeline, type StepOrigin, TIMELINE_LIMIT, type Turn, canRedo, canUndo, comingSoonIdOf, compilePageOps, deletePages, dropOrigin, emptyTimeline, formatKeys, freshDecisions, isDirty, keptOrder, markupComingSoonId, markupRedoneElsewhere, markupUndoneElsewhere, matchMarkupKey, matchShortcut, nextRedo, nextUndo, pdfMarkupTool, pdfTool, pushStep, recordStep, redo, redoLabel, reorderPages, restorePages, startHistory, stepBack, stepForward, turnPages, undo, undoLabel };
457
+ export { HISTORY_LIMIT, MARKUP_KIND_LABEL, MARKUP_SIZES, MARKUP_STYLE_FIELDS, MARKUP_SWATCHES, PDF_COMING_SOON, PDF_MARKUP_COMING_SOON, PDF_MARKUP_SHORTCUTS, PDF_MARKUP_TOOLS, PDF_SHORTCUTS, PDF_TOOLS, TIMELINE_LIMIT, canRedo, canUndo, comingSoonIdOf, compilePageOps, deletePages, dropOrigin, emptyTimeline, formatKeys, freshDecisions, isDirty, keptOrder, markupComingSoonId, markupRedoneElsewhere, markupUndoneElsewhere, matchMarkupKey, matchShortcut, nextRedo, nextUndo, pdfMarkupTool, pdfTool, pushStep, recordStep, redo, redoLabel, reorderPages, restorePages, startHistory, stepBack, stepForward, turnPages, undo, undoLabel };
458
+ export type { History, KeyLike, PageDecisions, PageOp, PdfActionId, PdfHostTool, PdfHostToolContext, PdfMarkupEngine, PdfMarkupHistoryEvent, PdfMarkupKind, PdfMarkupSnapshot, PdfMarkupStyle, PdfMarkupTool, PdfMarkupToolDef, PdfMarkupToolId, PdfRunRequest, PdfRunResult, PdfShortcut, PdfToolDef, PdfToolId, PdfViewerState, PdfWorkspaceHost, SessionTimeline, StepOrigin, Turn };
@@ -454,4 +454,5 @@ interface PdfWorkspaceHost {
454
454
  }>;
455
455
  }
456
456
 
457
- export { HISTORY_LIMIT, type History, type KeyLike, MARKUP_KIND_LABEL, MARKUP_SIZES, MARKUP_STYLE_FIELDS, MARKUP_SWATCHES, PDF_COMING_SOON, PDF_MARKUP_COMING_SOON, PDF_MARKUP_SHORTCUTS, PDF_MARKUP_TOOLS, PDF_SHORTCUTS, PDF_TOOLS, type PageDecisions, type PageOp, type PdfActionId, type PdfHostTool, type PdfHostToolContext, type PdfMarkupEngine, type PdfMarkupHistoryEvent, type PdfMarkupKind, type PdfMarkupSnapshot, type PdfMarkupStyle, type PdfMarkupTool, type PdfMarkupToolDef, type PdfMarkupToolId, type PdfRunRequest, type PdfRunResult, type PdfShortcut, type PdfToolDef, type PdfToolId, type PdfViewerState, type PdfWorkspaceHost, type SessionTimeline, type StepOrigin, TIMELINE_LIMIT, type Turn, canRedo, canUndo, comingSoonIdOf, compilePageOps, deletePages, dropOrigin, emptyTimeline, formatKeys, freshDecisions, isDirty, keptOrder, markupComingSoonId, markupRedoneElsewhere, markupUndoneElsewhere, matchMarkupKey, matchShortcut, nextRedo, nextUndo, pdfMarkupTool, pdfTool, pushStep, recordStep, redo, redoLabel, reorderPages, restorePages, startHistory, stepBack, stepForward, turnPages, undo, undoLabel };
457
+ export { HISTORY_LIMIT, MARKUP_KIND_LABEL, MARKUP_SIZES, MARKUP_STYLE_FIELDS, MARKUP_SWATCHES, PDF_COMING_SOON, PDF_MARKUP_COMING_SOON, PDF_MARKUP_SHORTCUTS, PDF_MARKUP_TOOLS, PDF_SHORTCUTS, PDF_TOOLS, TIMELINE_LIMIT, canRedo, canUndo, comingSoonIdOf, compilePageOps, deletePages, dropOrigin, emptyTimeline, formatKeys, freshDecisions, isDirty, keptOrder, markupComingSoonId, markupRedoneElsewhere, markupUndoneElsewhere, matchMarkupKey, matchShortcut, nextRedo, nextUndo, pdfMarkupTool, pdfTool, pushStep, recordStep, redo, redoLabel, reorderPages, restorePages, startHistory, stepBack, stepForward, turnPages, undo, undoLabel };
458
+ export type { History, KeyLike, PageDecisions, PageOp, PdfActionId, PdfHostTool, PdfHostToolContext, PdfMarkupEngine, PdfMarkupHistoryEvent, PdfMarkupKind, PdfMarkupSnapshot, PdfMarkupStyle, PdfMarkupTool, PdfMarkupToolDef, PdfMarkupToolId, PdfRunRequest, PdfRunResult, PdfShortcut, PdfToolDef, PdfToolId, PdfViewerState, PdfWorkspaceHost, SessionTimeline, StepOrigin, Turn };
package/dist/pdf.d.cts CHANGED
@@ -461,4 +461,5 @@ declare const canRedo: (h: History<unknown>) => boolean;
461
461
  declare const undoLabel: (h: History<unknown>) => string;
462
462
  declare const redoLabel: (h: History<unknown>) => string;
463
463
 
464
- export { HISTORY_LIMIT, type History, type KeyLike, MARKUP_KIND_LABEL, MARKUP_SIZES, MARKUP_STYLE_FIELDS, MARKUP_SWATCHES, PDF_COMING_SOON, PDF_MARKUP_COMING_SOON, PDF_MARKUP_SHORTCUTS, PDF_MARKUP_TOOLS, PDF_SHORTCUTS, PDF_TOOLS, type PageDecisions, type PageOp, type PdfActionId, type PdfHostTool, type PdfHostToolContext, type PdfMarkupEngine, type PdfMarkupHistoryEvent, type PdfMarkupKind, type PdfMarkupSnapshot, type PdfMarkupStyle, type PdfMarkupTool, type PdfMarkupToolDef, type PdfMarkupToolId, type PdfRunRequest, type PdfRunResult, type PdfShortcut, type PdfToolDef, type PdfToolId, type PdfViewerState, PdfWorkspace, type PdfWorkspaceHost, type PdfWorkspaceProps, type SessionTimeline, type StepOrigin, TIMELINE_LIMIT, type Turn, canRedo, canUndo, comingSoonIdOf, compilePageOps, deletePages, dropOrigin, emptyTimeline, formatKeys, freshDecisions, isDirty, keptOrder, markupComingSoonId, markupRedoneElsewhere, markupUndoneElsewhere, matchMarkupKey, matchShortcut, nextRedo, nextUndo, pdfMarkupTool, pdfTool, pushStep, recordStep, redo, redoLabel, reorderPages, restorePages, startHistory, stepBack, stepForward, turnPages, undo, undoLabel };
464
+ export { HISTORY_LIMIT, MARKUP_KIND_LABEL, MARKUP_SIZES, MARKUP_STYLE_FIELDS, MARKUP_SWATCHES, PDF_COMING_SOON, PDF_MARKUP_COMING_SOON, PDF_MARKUP_SHORTCUTS, PDF_MARKUP_TOOLS, PDF_SHORTCUTS, PDF_TOOLS, PdfWorkspace, TIMELINE_LIMIT, canRedo, canUndo, comingSoonIdOf, compilePageOps, deletePages, dropOrigin, emptyTimeline, formatKeys, freshDecisions, isDirty, keptOrder, markupComingSoonId, markupRedoneElsewhere, markupUndoneElsewhere, matchMarkupKey, matchShortcut, nextRedo, nextUndo, pdfMarkupTool, pdfTool, pushStep, recordStep, redo, redoLabel, reorderPages, restorePages, startHistory, stepBack, stepForward, turnPages, undo, undoLabel };
465
+ export type { History, KeyLike, PageDecisions, PageOp, PdfActionId, PdfHostTool, PdfHostToolContext, PdfMarkupEngine, PdfMarkupHistoryEvent, PdfMarkupKind, PdfMarkupSnapshot, PdfMarkupStyle, PdfMarkupTool, PdfMarkupToolDef, PdfMarkupToolId, PdfRunRequest, PdfRunResult, PdfShortcut, PdfToolDef, PdfToolId, PdfViewerState, PdfWorkspaceHost, PdfWorkspaceProps, SessionTimeline, StepOrigin, Turn };
package/dist/pdf.d.ts CHANGED
@@ -461,4 +461,5 @@ declare const canRedo: (h: History<unknown>) => boolean;
461
461
  declare const undoLabel: (h: History<unknown>) => string;
462
462
  declare const redoLabel: (h: History<unknown>) => string;
463
463
 
464
- export { HISTORY_LIMIT, type History, type KeyLike, MARKUP_KIND_LABEL, MARKUP_SIZES, MARKUP_STYLE_FIELDS, MARKUP_SWATCHES, PDF_COMING_SOON, PDF_MARKUP_COMING_SOON, PDF_MARKUP_SHORTCUTS, PDF_MARKUP_TOOLS, PDF_SHORTCUTS, PDF_TOOLS, type PageDecisions, type PageOp, type PdfActionId, type PdfHostTool, type PdfHostToolContext, type PdfMarkupEngine, type PdfMarkupHistoryEvent, type PdfMarkupKind, type PdfMarkupSnapshot, type PdfMarkupStyle, type PdfMarkupTool, type PdfMarkupToolDef, type PdfMarkupToolId, type PdfRunRequest, type PdfRunResult, type PdfShortcut, type PdfToolDef, type PdfToolId, type PdfViewerState, PdfWorkspace, type PdfWorkspaceHost, type PdfWorkspaceProps, type SessionTimeline, type StepOrigin, TIMELINE_LIMIT, type Turn, canRedo, canUndo, comingSoonIdOf, compilePageOps, deletePages, dropOrigin, emptyTimeline, formatKeys, freshDecisions, isDirty, keptOrder, markupComingSoonId, markupRedoneElsewhere, markupUndoneElsewhere, matchMarkupKey, matchShortcut, nextRedo, nextUndo, pdfMarkupTool, pdfTool, pushStep, recordStep, redo, redoLabel, reorderPages, restorePages, startHistory, stepBack, stepForward, turnPages, undo, undoLabel };
464
+ export { HISTORY_LIMIT, MARKUP_KIND_LABEL, MARKUP_SIZES, MARKUP_STYLE_FIELDS, MARKUP_SWATCHES, PDF_COMING_SOON, PDF_MARKUP_COMING_SOON, PDF_MARKUP_SHORTCUTS, PDF_MARKUP_TOOLS, PDF_SHORTCUTS, PDF_TOOLS, PdfWorkspace, TIMELINE_LIMIT, canRedo, canUndo, comingSoonIdOf, compilePageOps, deletePages, dropOrigin, emptyTimeline, formatKeys, freshDecisions, isDirty, keptOrder, markupComingSoonId, markupRedoneElsewhere, markupUndoneElsewhere, matchMarkupKey, matchShortcut, nextRedo, nextUndo, pdfMarkupTool, pdfTool, pushStep, recordStep, redo, redoLabel, reorderPages, restorePages, startHistory, stepBack, stepForward, turnPages, undo, undoLabel };
465
+ export type { History, KeyLike, PageDecisions, PageOp, PdfActionId, PdfHostTool, PdfHostToolContext, PdfMarkupEngine, PdfMarkupHistoryEvent, PdfMarkupKind, PdfMarkupSnapshot, PdfMarkupStyle, PdfMarkupTool, PdfMarkupToolDef, PdfMarkupToolId, PdfRunRequest, PdfRunResult, PdfShortcut, PdfToolDef, PdfToolId, PdfViewerState, PdfWorkspaceHost, PdfWorkspaceProps, SessionTimeline, StepOrigin, Turn };
@@ -64,4 +64,5 @@ interface SheetCommentAnchorsHandle {
64
64
  /** Register the anchor mutation, the resource and the structural listener on one Univer (idempotent). */
65
65
  declare function installSheetCommentAnchors(univer: unknown): SheetCommentAnchorsHandle;
66
66
 
67
- export { SET_SHEET_COMMENT_ANCHOR, SHEET_COMMENT_ANCHORS_RESOURCE, type SetSheetCommentAnchorParams, type SheetAnchorCell, type SheetAnchors, type SheetCommentAnchorsHandle, applyToSheetAnchors, installSheetCommentAnchors, sheetAnchorsFromJson, sheetAnchorsToJson, sheetCellName };
67
+ export { SET_SHEET_COMMENT_ANCHOR, SHEET_COMMENT_ANCHORS_RESOURCE, applyToSheetAnchors, installSheetCommentAnchors, sheetAnchorsFromJson, sheetAnchorsToJson, sheetCellName };
68
+ export type { SetSheetCommentAnchorParams, SheetAnchorCell, SheetAnchors, SheetCommentAnchorsHandle };
@@ -64,4 +64,5 @@ interface SheetCommentAnchorsHandle {
64
64
  /** Register the anchor mutation, the resource and the structural listener on one Univer (idempotent). */
65
65
  declare function installSheetCommentAnchors(univer: unknown): SheetCommentAnchorsHandle;
66
66
 
67
- export { SET_SHEET_COMMENT_ANCHOR, SHEET_COMMENT_ANCHORS_RESOURCE, type SetSheetCommentAnchorParams, type SheetAnchorCell, type SheetAnchors, type SheetCommentAnchorsHandle, applyToSheetAnchors, installSheetCommentAnchors, sheetAnchorsFromJson, sheetAnchorsToJson, sheetCellName };
67
+ export { SET_SHEET_COMMENT_ANCHOR, SHEET_COMMENT_ANCHORS_RESOURCE, applyToSheetAnchors, installSheetCommentAnchors, sheetAnchorsFromJson, sheetAnchorsToJson, sheetCellName };
68
+ export type { SetSheetCommentAnchorParams, SheetAnchorCell, SheetAnchors, SheetCommentAnchorsHandle };
@@ -150,4 +150,5 @@ declare function importWorkbookFile(file: File, organizationId: string | null):
150
150
  notCarried: string[];
151
151
  }>;
152
152
 
153
- export { type ExportImagePort, type ExportXlsxOptions, H_ALIGN_IN, H_ALIGN_OUT, RESOURCE, type RangeLike, type UniverResource, V_ALIGN_IN, V_ALIGN_OUT, type XlsxExportReport, a1, argbToColor, borderFromExcel, borderToExcel, buildXlsxFromUniver, colCharsToPx, colPxToChars, colorToArgb, downloadUniverAsXlsx, importWorkbookFile, parseA1Range, rangeToA1, readResource, rowPtToPx, rowPxToPt, univerSnapshotToRegisteredXlsxBytes, univerSnapshotToWorkbookJson, univerSnapshotToXlsxBytes, unsupportedFileReason, writeResource, xlsxToUniverWorkbook };
153
+ export { H_ALIGN_IN, H_ALIGN_OUT, RESOURCE, V_ALIGN_IN, V_ALIGN_OUT, a1, argbToColor, borderFromExcel, borderToExcel, buildXlsxFromUniver, colCharsToPx, colPxToChars, colorToArgb, downloadUniverAsXlsx, importWorkbookFile, parseA1Range, rangeToA1, readResource, rowPtToPx, rowPxToPt, univerSnapshotToRegisteredXlsxBytes, univerSnapshotToWorkbookJson, univerSnapshotToXlsxBytes, unsupportedFileReason, writeResource, xlsxToUniverWorkbook };
154
+ export type { ExportImagePort, ExportXlsxOptions, RangeLike, UniverResource, XlsxExportReport };
@@ -150,4 +150,5 @@ declare function importWorkbookFile(file: File, organizationId: string | null):
150
150
  notCarried: string[];
151
151
  }>;
152
152
 
153
- export { type ExportImagePort, type ExportXlsxOptions, H_ALIGN_IN, H_ALIGN_OUT, RESOURCE, type RangeLike, type UniverResource, V_ALIGN_IN, V_ALIGN_OUT, type XlsxExportReport, a1, argbToColor, borderFromExcel, borderToExcel, buildXlsxFromUniver, colCharsToPx, colPxToChars, colorToArgb, downloadUniverAsXlsx, importWorkbookFile, parseA1Range, rangeToA1, readResource, rowPtToPx, rowPxToPt, univerSnapshotToRegisteredXlsxBytes, univerSnapshotToWorkbookJson, univerSnapshotToXlsxBytes, unsupportedFileReason, writeResource, xlsxToUniverWorkbook };
153
+ export { H_ALIGN_IN, H_ALIGN_OUT, RESOURCE, V_ALIGN_IN, V_ALIGN_OUT, a1, argbToColor, borderFromExcel, borderToExcel, buildXlsxFromUniver, colCharsToPx, colPxToChars, colorToArgb, downloadUniverAsXlsx, importWorkbookFile, parseA1Range, rangeToA1, readResource, rowPtToPx, rowPxToPt, univerSnapshotToRegisteredXlsxBytes, univerSnapshotToWorkbookJson, univerSnapshotToXlsxBytes, unsupportedFileReason, writeResource, xlsxToUniverWorkbook };
154
+ export type { ExportImagePort, ExportXlsxOptions, RangeLike, UniverResource, XlsxExportReport };
package/dist/sheets.d.cts CHANGED
@@ -611,4 +611,5 @@ declare function registerWorkbookScopeSource(registration: Registration): () =>
611
611
  */
612
612
  declare function readWorkbookScopeSource(workbookId: string): WorkbookLiveScope | null;
613
613
 
614
- export { type CellRange, type CfRule, type CreateWorkbookArgs, DEFAULT_SHEET_PAGE_SETUP, GRID_MAX_COLUMNS, GRID_MAX_ROWS, type GridCell, type GridSheet, MARGIN_PRESET_INCHES, PRINT_ROW_HEIGHT, type PageSetupResult, type PrintDocument, type PrintGeometry, type PrintPage, type PrintPlan, type PrintSheet, SHEET_MARGIN_PRESETS, SHEET_PRINT_SCOPES, SHEET_SCALES, type SaveSnapshotArgs, type SheetAlignH, type SheetAlignV, type SheetMarginPreset, type SheetPageOrder, type SheetPageSetup, type SheetPrintOptions, type SheetPrintScope, type SheetScale, type SheetsHostPorts, type SheetsSupabase, type SnapshotRows, THUMB_HEIGHT, THUMB_WIDTH, type Workbook, type WorkbookLiveScope, buildSheetPrintDocument, cfMatch, collectPrintSheets, configureSheetsHost, copyWorkbook, createWorkbook, deleteWorkbook, discardFailedWorkbook, documentPreviewSvg, downloadSheetAsCsv, downloadSheetAsHtml, downloadSheetAsPdf, downloadSheetAsTsv, formatCellValue, getLatestSnapshot, getSheetsHost, getWorkbook, listAccessibleWorkbooks, listSnapshots, listTrashedWorkbooks, moveWorkbook, normalizeSheetPageSetup, pageSetupFromMetadata, parseResource, planSheetPrint, printColumnWidths, printDocumentHtml, printGeometry, printSheet, readSheetPageSetup, readWorkbookScopeSource, registerWorkbookScopeSource, renameWorkbook, restoreWorkbook, saveSnapshot, sheetGridToCsv, sheetGridToMarkdownTable, snapshotPreviewSvg, snapshotToGridSheets, univerSheetIds, univerSnapshotToRows, updateWorkbookDescription, workbookPreviewSvg, workbookSourceLabel, writeSheetPageSetup };
614
+ export { DEFAULT_SHEET_PAGE_SETUP, GRID_MAX_COLUMNS, GRID_MAX_ROWS, MARGIN_PRESET_INCHES, PRINT_ROW_HEIGHT, SHEET_MARGIN_PRESETS, SHEET_PRINT_SCOPES, SHEET_SCALES, THUMB_HEIGHT, THUMB_WIDTH, buildSheetPrintDocument, cfMatch, collectPrintSheets, configureSheetsHost, copyWorkbook, createWorkbook, deleteWorkbook, discardFailedWorkbook, documentPreviewSvg, downloadSheetAsCsv, downloadSheetAsHtml, downloadSheetAsPdf, downloadSheetAsTsv, formatCellValue, getLatestSnapshot, getSheetsHost, getWorkbook, listAccessibleWorkbooks, listSnapshots, listTrashedWorkbooks, moveWorkbook, normalizeSheetPageSetup, pageSetupFromMetadata, parseResource, planSheetPrint, printColumnWidths, printDocumentHtml, printGeometry, printSheet, readSheetPageSetup, readWorkbookScopeSource, registerWorkbookScopeSource, renameWorkbook, restoreWorkbook, saveSnapshot, sheetGridToCsv, sheetGridToMarkdownTable, snapshotPreviewSvg, snapshotToGridSheets, univerSheetIds, univerSnapshotToRows, updateWorkbookDescription, workbookPreviewSvg, workbookSourceLabel, writeSheetPageSetup };
615
+ export type { CellRange, CfRule, CreateWorkbookArgs, GridCell, GridSheet, PageSetupResult, PrintDocument, PrintGeometry, PrintPage, PrintPlan, PrintSheet, SaveSnapshotArgs, SheetAlignH, SheetAlignV, SheetMarginPreset, SheetPageOrder, SheetPageSetup, SheetPrintOptions, SheetPrintScope, SheetScale, SheetsHostPorts, SheetsSupabase, SnapshotRows, Workbook, WorkbookLiveScope };
package/dist/sheets.d.ts CHANGED
@@ -611,4 +611,5 @@ declare function registerWorkbookScopeSource(registration: Registration): () =>
611
611
  */
612
612
  declare function readWorkbookScopeSource(workbookId: string): WorkbookLiveScope | null;
613
613
 
614
- export { type CellRange, type CfRule, type CreateWorkbookArgs, DEFAULT_SHEET_PAGE_SETUP, GRID_MAX_COLUMNS, GRID_MAX_ROWS, type GridCell, type GridSheet, MARGIN_PRESET_INCHES, PRINT_ROW_HEIGHT, type PageSetupResult, type PrintDocument, type PrintGeometry, type PrintPage, type PrintPlan, type PrintSheet, SHEET_MARGIN_PRESETS, SHEET_PRINT_SCOPES, SHEET_SCALES, type SaveSnapshotArgs, type SheetAlignH, type SheetAlignV, type SheetMarginPreset, type SheetPageOrder, type SheetPageSetup, type SheetPrintOptions, type SheetPrintScope, type SheetScale, type SheetsHostPorts, type SheetsSupabase, type SnapshotRows, THUMB_HEIGHT, THUMB_WIDTH, type Workbook, type WorkbookLiveScope, buildSheetPrintDocument, cfMatch, collectPrintSheets, configureSheetsHost, copyWorkbook, createWorkbook, deleteWorkbook, discardFailedWorkbook, documentPreviewSvg, downloadSheetAsCsv, downloadSheetAsHtml, downloadSheetAsPdf, downloadSheetAsTsv, formatCellValue, getLatestSnapshot, getSheetsHost, getWorkbook, listAccessibleWorkbooks, listSnapshots, listTrashedWorkbooks, moveWorkbook, normalizeSheetPageSetup, pageSetupFromMetadata, parseResource, planSheetPrint, printColumnWidths, printDocumentHtml, printGeometry, printSheet, readSheetPageSetup, readWorkbookScopeSource, registerWorkbookScopeSource, renameWorkbook, restoreWorkbook, saveSnapshot, sheetGridToCsv, sheetGridToMarkdownTable, snapshotPreviewSvg, snapshotToGridSheets, univerSheetIds, univerSnapshotToRows, updateWorkbookDescription, workbookPreviewSvg, workbookSourceLabel, writeSheetPageSetup };
614
+ export { DEFAULT_SHEET_PAGE_SETUP, GRID_MAX_COLUMNS, GRID_MAX_ROWS, MARGIN_PRESET_INCHES, PRINT_ROW_HEIGHT, SHEET_MARGIN_PRESETS, SHEET_PRINT_SCOPES, SHEET_SCALES, THUMB_HEIGHT, THUMB_WIDTH, buildSheetPrintDocument, cfMatch, collectPrintSheets, configureSheetsHost, copyWorkbook, createWorkbook, deleteWorkbook, discardFailedWorkbook, documentPreviewSvg, downloadSheetAsCsv, downloadSheetAsHtml, downloadSheetAsPdf, downloadSheetAsTsv, formatCellValue, getLatestSnapshot, getSheetsHost, getWorkbook, listAccessibleWorkbooks, listSnapshots, listTrashedWorkbooks, moveWorkbook, normalizeSheetPageSetup, pageSetupFromMetadata, parseResource, planSheetPrint, printColumnWidths, printDocumentHtml, printGeometry, printSheet, readSheetPageSetup, readWorkbookScopeSource, registerWorkbookScopeSource, renameWorkbook, restoreWorkbook, saveSnapshot, sheetGridToCsv, sheetGridToMarkdownTable, snapshotPreviewSvg, snapshotToGridSheets, univerSheetIds, univerSnapshotToRows, updateWorkbookDescription, workbookPreviewSvg, workbookSourceLabel, writeSheetPageSetup };
615
+ export type { CellRange, CfRule, CreateWorkbookArgs, GridCell, GridSheet, PageSetupResult, PrintDocument, PrintGeometry, PrintPage, PrintPlan, PrintSheet, SaveSnapshotArgs, SheetAlignH, SheetAlignV, SheetMarginPreset, SheetPageOrder, SheetPageSetup, SheetPrintOptions, SheetPrintScope, SheetScale, SheetsHostPorts, SheetsSupabase, SnapshotRows, Workbook, WorkbookLiveScope };
@@ -1036,4 +1036,5 @@ declare function startWorkbookOtRoom(port: SheetsOtPort & {
1036
1036
  dispose?: () => void;
1037
1037
  }, o: WorkbookOtRoomOptions): Promise<WorkbookOtRoomHandle>;
1038
1038
 
1039
- export { COLLAB_COVERED_KEY, type CollabBase, type CollabMutationInfo, type CollabProviderLike, type CommandServiceLike, DOCS_COLLAB_PROTO, DOCS_TRANSFORM_VERSION, DOC_LOCAL_KEYS, type DocsLocalMutation, type DocsLost, type DocsOp, type DocsOtNotice, type DocsOtPort, type DocsOtRoom, type DocsTransformResult, type DocumentOtFactoryOptions, type DocumentRestoreDeps, type DocumentRestoreResult, type EditedCell, type EditorBridgeLike, type FilterRangeLike, type FilterServiceLike, type OpenDocsOtRoomOptions, type OpenSheetsOtRoomOptions, type OtRoomsKnob, REDO_COMMAND, RICH_TEXT_EDITING, SENDER_VIEW_PARAMS, SHEETS_COLLAB_PROTO, SHEETS_EDIT_GROUP, SHEETS_READABLE_PROTOS, SHEET_ROOM_EDITOR_PRESETS, SHEET_ROOM_PLUGIN_PACKAGES, type SheetOp, type SheetSelection, type SheetsCommandService, type SheetsLocalEvent, type SheetsLocalGroup, type SheetsNotShared, type SheetsOtAdapter, type SheetsOtAdapterHooks, type SheetsOtNotice, type SheetsOtPort, type SheetsOtRoom, type SheetsWorkbookLike, type SheetsWorksheetLike, UNDO_COMMAND, type UniverSheetsOtPortOptions, WorkbookCollabSession, type WorkbookCollabSessionOptions, type WorkbookOtRoomHandle, type WorkbookOtRoomOptions, type WorkbookOtRoomsKnob, applyDocsOp, asLoadedDocsSnapshot, canonicalDocsSnapshot, canonicalDocsString, canonicalKeys, canonicalSheet, canonicalSheetString, composeDocsOps, createSheetsOtAdapter, decodeSheetOp, docsStateHash, documentOtFactory, documentUsesOrderedRoom, dropEmptyStyleRetains, editorBridgeCell, encodeSheetOp, filterServiceRange, invertDocsOp, isCellEditorScratch, isNoopDocsOp, joiningAwareness, moveSelectionsThrough, normalizeDocsOp, offlineTextOfGroups, openDocsOtRoom, openSheetsOtRoom, rebaseSheetUndoStack, rebaseUndoStack, restoreDocumentSnapshot, sheetsStateHash, stampCovered, stampDeterministicIds, startWorkbookOtRoom, stripSenderView, takeCovered, touchesEditedCell, transformDocsOp, transformSheetOp, transformTextX, undoStacksOf, univerSheetsOtPort, workbookUsesOrderedRoom };
1039
+ export { COLLAB_COVERED_KEY, DOCS_COLLAB_PROTO, DOCS_TRANSFORM_VERSION, DOC_LOCAL_KEYS, REDO_COMMAND, RICH_TEXT_EDITING, SENDER_VIEW_PARAMS, SHEETS_COLLAB_PROTO, SHEETS_EDIT_GROUP, SHEETS_READABLE_PROTOS, SHEET_ROOM_EDITOR_PRESETS, SHEET_ROOM_PLUGIN_PACKAGES, UNDO_COMMAND, WorkbookCollabSession, applyDocsOp, asLoadedDocsSnapshot, canonicalDocsSnapshot, canonicalDocsString, canonicalKeys, canonicalSheet, canonicalSheetString, composeDocsOps, createSheetsOtAdapter, decodeSheetOp, docsStateHash, documentOtFactory, documentUsesOrderedRoom, dropEmptyStyleRetains, editorBridgeCell, encodeSheetOp, filterServiceRange, invertDocsOp, isCellEditorScratch, isNoopDocsOp, joiningAwareness, moveSelectionsThrough, normalizeDocsOp, offlineTextOfGroups, openDocsOtRoom, openSheetsOtRoom, rebaseSheetUndoStack, rebaseUndoStack, restoreDocumentSnapshot, sheetsStateHash, stampCovered, stampDeterministicIds, startWorkbookOtRoom, stripSenderView, takeCovered, touchesEditedCell, transformDocsOp, transformSheetOp, transformTextX, undoStacksOf, univerSheetsOtPort, workbookUsesOrderedRoom };
1040
+ export type { CollabBase, CollabMutationInfo, CollabProviderLike, CommandServiceLike, DocsLocalMutation, DocsLost, DocsOp, DocsOtNotice, DocsOtPort, DocsOtRoom, DocsTransformResult, DocumentOtFactoryOptions, DocumentRestoreDeps, DocumentRestoreResult, EditedCell, EditorBridgeLike, FilterRangeLike, FilterServiceLike, OpenDocsOtRoomOptions, OpenSheetsOtRoomOptions, OtRoomsKnob, SheetOp, SheetSelection, SheetsCommandService, SheetsLocalEvent, SheetsLocalGroup, SheetsNotShared, SheetsOtAdapter, SheetsOtAdapterHooks, SheetsOtNotice, SheetsOtPort, SheetsOtRoom, SheetsWorkbookLike, SheetsWorksheetLike, UniverSheetsOtPortOptions, WorkbookCollabSessionOptions, WorkbookOtRoomHandle, WorkbookOtRoomOptions, WorkbookOtRoomsKnob };
@@ -1036,4 +1036,5 @@ declare function startWorkbookOtRoom(port: SheetsOtPort & {
1036
1036
  dispose?: () => void;
1037
1037
  }, o: WorkbookOtRoomOptions): Promise<WorkbookOtRoomHandle>;
1038
1038
 
1039
- export { COLLAB_COVERED_KEY, type CollabBase, type CollabMutationInfo, type CollabProviderLike, type CommandServiceLike, DOCS_COLLAB_PROTO, DOCS_TRANSFORM_VERSION, DOC_LOCAL_KEYS, type DocsLocalMutation, type DocsLost, type DocsOp, type DocsOtNotice, type DocsOtPort, type DocsOtRoom, type DocsTransformResult, type DocumentOtFactoryOptions, type DocumentRestoreDeps, type DocumentRestoreResult, type EditedCell, type EditorBridgeLike, type FilterRangeLike, type FilterServiceLike, type OpenDocsOtRoomOptions, type OpenSheetsOtRoomOptions, type OtRoomsKnob, REDO_COMMAND, RICH_TEXT_EDITING, SENDER_VIEW_PARAMS, SHEETS_COLLAB_PROTO, SHEETS_EDIT_GROUP, SHEETS_READABLE_PROTOS, SHEET_ROOM_EDITOR_PRESETS, SHEET_ROOM_PLUGIN_PACKAGES, type SheetOp, type SheetSelection, type SheetsCommandService, type SheetsLocalEvent, type SheetsLocalGroup, type SheetsNotShared, type SheetsOtAdapter, type SheetsOtAdapterHooks, type SheetsOtNotice, type SheetsOtPort, type SheetsOtRoom, type SheetsWorkbookLike, type SheetsWorksheetLike, UNDO_COMMAND, type UniverSheetsOtPortOptions, WorkbookCollabSession, type WorkbookCollabSessionOptions, type WorkbookOtRoomHandle, type WorkbookOtRoomOptions, type WorkbookOtRoomsKnob, applyDocsOp, asLoadedDocsSnapshot, canonicalDocsSnapshot, canonicalDocsString, canonicalKeys, canonicalSheet, canonicalSheetString, composeDocsOps, createSheetsOtAdapter, decodeSheetOp, docsStateHash, documentOtFactory, documentUsesOrderedRoom, dropEmptyStyleRetains, editorBridgeCell, encodeSheetOp, filterServiceRange, invertDocsOp, isCellEditorScratch, isNoopDocsOp, joiningAwareness, moveSelectionsThrough, normalizeDocsOp, offlineTextOfGroups, openDocsOtRoom, openSheetsOtRoom, rebaseSheetUndoStack, rebaseUndoStack, restoreDocumentSnapshot, sheetsStateHash, stampCovered, stampDeterministicIds, startWorkbookOtRoom, stripSenderView, takeCovered, touchesEditedCell, transformDocsOp, transformSheetOp, transformTextX, undoStacksOf, univerSheetsOtPort, workbookUsesOrderedRoom };
1039
+ export { COLLAB_COVERED_KEY, DOCS_COLLAB_PROTO, DOCS_TRANSFORM_VERSION, DOC_LOCAL_KEYS, REDO_COMMAND, RICH_TEXT_EDITING, SENDER_VIEW_PARAMS, SHEETS_COLLAB_PROTO, SHEETS_EDIT_GROUP, SHEETS_READABLE_PROTOS, SHEET_ROOM_EDITOR_PRESETS, SHEET_ROOM_PLUGIN_PACKAGES, UNDO_COMMAND, WorkbookCollabSession, applyDocsOp, asLoadedDocsSnapshot, canonicalDocsSnapshot, canonicalDocsString, canonicalKeys, canonicalSheet, canonicalSheetString, composeDocsOps, createSheetsOtAdapter, decodeSheetOp, docsStateHash, documentOtFactory, documentUsesOrderedRoom, dropEmptyStyleRetains, editorBridgeCell, encodeSheetOp, filterServiceRange, invertDocsOp, isCellEditorScratch, isNoopDocsOp, joiningAwareness, moveSelectionsThrough, normalizeDocsOp, offlineTextOfGroups, openDocsOtRoom, openSheetsOtRoom, rebaseSheetUndoStack, rebaseUndoStack, restoreDocumentSnapshot, sheetsStateHash, stampCovered, stampDeterministicIds, startWorkbookOtRoom, stripSenderView, takeCovered, touchesEditedCell, transformDocsOp, transformSheetOp, transformTextX, undoStacksOf, univerSheetsOtPort, workbookUsesOrderedRoom };
1040
+ export type { CollabBase, CollabMutationInfo, CollabProviderLike, CommandServiceLike, DocsLocalMutation, DocsLost, DocsOp, DocsOtNotice, DocsOtPort, DocsOtRoom, DocsTransformResult, DocumentOtFactoryOptions, DocumentRestoreDeps, DocumentRestoreResult, EditedCell, EditorBridgeLike, FilterRangeLike, FilterServiceLike, OpenDocsOtRoomOptions, OpenSheetsOtRoomOptions, OtRoomsKnob, SheetOp, SheetSelection, SheetsCommandService, SheetsLocalEvent, SheetsLocalGroup, SheetsNotShared, SheetsOtAdapter, SheetsOtAdapterHooks, SheetsOtNotice, SheetsOtPort, SheetsOtRoom, SheetsWorkbookLike, SheetsWorksheetLike, UniverSheetsOtPortOptions, WorkbookCollabSessionOptions, WorkbookOtRoomHandle, WorkbookOtRoomOptions, WorkbookOtRoomsKnob };
@@ -29,4 +29,5 @@ declare function readHistoryTab(data: unknown): HistoryTabData | null;
29
29
  declare function documentHistoryToggleInput(documentId: string, editable: boolean, documentName?: string | null): HistoryToggleInput;
30
30
  declare function workbookHistoryToggleInput(workbookId: string, editable: boolean, workbookName?: string | null): HistoryToggleInput;
31
31
 
32
- export { DOCUMENT_HISTORY_KIND, type HistoryTabData, type HistoryToggleInput, WORKBOOK_HISTORY_KIND, documentHistoryToggleInput, readHistoryTab, workbookHistoryToggleInput };
32
+ export { DOCUMENT_HISTORY_KIND, WORKBOOK_HISTORY_KIND, documentHistoryToggleInput, readHistoryTab, workbookHistoryToggleInput };
33
+ export type { HistoryTabData, HistoryToggleInput };
@@ -29,4 +29,5 @@ declare function readHistoryTab(data: unknown): HistoryTabData | null;
29
29
  declare function documentHistoryToggleInput(documentId: string, editable: boolean, documentName?: string | null): HistoryToggleInput;
30
30
  declare function workbookHistoryToggleInput(workbookId: string, editable: boolean, workbookName?: string | null): HistoryToggleInput;
31
31
 
32
- export { DOCUMENT_HISTORY_KIND, type HistoryTabData, type HistoryToggleInput, WORKBOOK_HISTORY_KIND, documentHistoryToggleInput, readHistoryTab, workbookHistoryToggleInput };
32
+ export { DOCUMENT_HISTORY_KIND, WORKBOOK_HISTORY_KIND, documentHistoryToggleInput, readHistoryTab, workbookHistoryToggleInput };
33
+ export type { HistoryTabData, HistoryToggleInput };
@@ -12,4 +12,5 @@ declare function useWorkbookRealtime(workbookId: string | null | undefined, onSn
12
12
  enabled?: boolean;
13
13
  }): void;
14
14
 
15
- export { type SnapshotRow, type WorkbookRealtimeEvent, useWorkbookRealtime };
15
+ export { useWorkbookRealtime };
16
+ export type { SnapshotRow, WorkbookRealtimeEvent };
@@ -12,4 +12,5 @@ declare function useWorkbookRealtime(workbookId: string | null | undefined, onSn
12
12
  enabled?: boolean;
13
13
  }): void;
14
14
 
15
- export { type SnapshotRow, type WorkbookRealtimeEvent, useWorkbookRealtime };
15
+ export { useWorkbookRealtime };
16
+ export type { SnapshotRow, WorkbookRealtimeEvent };
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/univer/index.ts","../src/univer/ports.ts","../src/univer/history.ts","../src/univer/univerImageStore.ts","../src/univer/disposeUniverInstance.ts","../src/univer/identifyUniverUser.ts","../src/univer/isSnapshotMutation.ts","../src/univer/matrxImagePorts.ts","../src/univer/openEditorContent.ts","../src/univer/registerMissingUniverIcons.ts","../src/univer/registerUniverFacadeDependencies.ts","../src/univer/routeUniverNotificationsToApp.ts","../src/univer/univer-theme-token-color.ts","../src/univer/useUniverDarkModeSync.ts","../src/univer/collab/covered.ts"],"sourcesContent":["\"use client\";\n\n/**\n * The Univer glue shared by `/sheets` and `/docs` (was matrx-frontend `lib/univer`). A transitional\n * subpath: matrx-frontend's two editors import it until they move into their sections, then this\n * entry goes internal again (BUILD-BOOK §1.3, Amendments W1-G2a1). Importing it loads `@univerjs/*`;\n * the pure history keys are their own entry (`./univer/history`) for code that must not.\n */\nexport * from \"./ports\";\nexport * from \"./history\";\nexport * from \"./disposeUniverInstance\";\nexport * from \"./identifyUniverUser\";\nexport * from \"./isSnapshotMutation\";\nexport * from \"./matrxImagePorts\";\nexport * from \"./openEditorContent\";\nexport * from \"./registerMissingUniverIcons\";\nexport * from \"./registerUniverFacadeDependencies\";\nexport * from \"./routeUniverNotificationsToApp\";\nexport * from \"./univer-theme-token-color\";\nexport * from \"./univerImageStore\";\nexport * from \"./useUniverDarkModeSync\";\nexport * from \"./collab/covered\";\n","/**\n * The host ports of the Univer glue.\n *\n * The glue belongs to the package, but four things belong to the app that mounts an editor: the\n * toast path, the signed-in person, the file store, the snapshot catch-up read and the painted theme. The host states them\n * once at start-up with `configureUniverHost`; the glue reads them here. State sits on a\n * `globalThis` slot so a dual-bundled copy of the package still sees one host (dual-bundle rule).\n * An unconfigured port THROWS naming the port (nothing fails silently).\n */\n\nexport type UniverToastId = string | number;\ntype ToastShow = (title: string, options?: { description?: string; duration?: number }) => UniverToastId;\n\nexport interface UniverHostPorts {\n /** The app's toast path (one toaster per page). */\n toast: {\n success: ToastShow;\n info: ToastShow;\n warning: ToastShow;\n error: ToastShow;\n message: ToastShow;\n dismiss(id: UniverToastId): void;\n };\n /** Who is typing, or null when signed out. `metadata` is the auth user's metadata bag. */\n getSignedInUser(): Promise<{ id: string; email?: string | null; metadata?: Record<string, unknown> | null } | null>;\n /** The file store behind pictures on a sheet or in a document. */\n files: {\n upload(file: File): Promise<{ fileId: string }>;\n getBlob(fileId: string): Promise<Blob>;\n };\n /** The newest snapshot row of a workbook (the realtime catch-up read), or `data: null` when it has none. */\n readNewestWorkbookSnapshot(\n workbookId: string,\n ): Promise<{ data: { id?: string; created_by?: string | null; created_at?: string } | null; error: { message: string } | null }>;\n /** Tell the person a picture did not upload. */\n notifyUploadError(error: unknown): void;\n /** The painted color mode, as a React hook (re-renders on a switch). */\n useThemeMode(): \"light\" | \"dark\";\n}\n\nconst SLOT = Symbol.for(\"ai-matrx.office.univer-host\");\ntype Slot = { ports?: UniverHostPorts };\nconst slot = (): Slot => {\n const g = globalThis as Record<symbol, Slot | undefined>;\n return (g[SLOT] ??= {});\n};\n\nexport function configureUniverHost(ports: UniverHostPorts): void {\n slot().ports = ports;\n}\n\nexport function getUniverHost(): UniverHostPorts {\n const ports = slot().ports;\n if (!ports) throw new Error(\"@ai-matrx/office/univer: configureUniverHost(ports) was not called before an editor mounted.\");\n return ports;\n}\n","/**\n * A document's or a workbook's snapshot history as a canvas tab — the keys and toggle inputs the\n * editors use, and the reader the two history views use. One tab per document (`document-history`,\n * keyed by the document id) and per workbook (`workbook-history`, keyed by the workbook id).\n *\n * Pure: no React, no canvas package, no Univer. The two `defineCanvasKind` registrations stay with\n * the host app (matrx-frontend `features/canvas/host`) and lazy-load the views, so this module never\n * imports a view (the cycle the old `lib/univer/historyKinds.ts` closed).\n */\n\nexport const DOCUMENT_HISTORY_KIND = \"document-history\";\nexport const WORKBOOK_HISTORY_KIND = \"workbook-history\";\n\nexport interface HistoryTabData {\n id: string;\n editable: boolean;\n}\n\n/** Structurally the host's `ToolToggleInput` (the canvas toggle the editor's History button presses). */\nexport interface HistoryToggleInput {\n kind: string;\n key: string;\n title: string;\n data: { id: string; editable: boolean };\n followTitle: true;\n}\n\n/** A tab's data as a history subject, or null when it names no subject. */\nexport function readHistoryTab(data: unknown): HistoryTabData | null {\n if (typeof data !== \"object\" || data === null || Array.isArray(data)) return null;\n const record = data as Record<string, unknown>;\n const id = typeof record.id === \"string\" && record.id ? record.id : null;\n if (!id) return null;\n return { id, editable: record.editable !== false };\n}\n\n/** \"<what> · <subject>\", or just \"<what>\" while the subject has no name. */\nfunction subjectTitle(what: string, subject: string | null | undefined): string {\n const name = subject?.trim();\n return name ? `${what} · ${name}` : what;\n}\n\n// The tab names its subject — two open history tabs never share a title, and\n// the editor that owns the toggle keeps it in step with a rename.\nexport function documentHistoryToggleInput(documentId: string, editable: boolean, documentName?: string | null): HistoryToggleInput {\n return {\n kind: DOCUMENT_HISTORY_KIND,\n key: documentId,\n title: subjectTitle(\"Document history\", documentName),\n data: { id: documentId, editable },\n followTitle: true,\n };\n}\n\nexport function workbookHistoryToggleInput(workbookId: string, editable: boolean, workbookName?: string | null): HistoryToggleInput {\n return {\n kind: WORKBOOK_HISTORY_KIND,\n key: workbookId,\n title: subjectTitle(\"Workbook history\", workbookName),\n data: { id: workbookId, editable },\n followTitle: true,\n };\n}\n","/**\n * univerImageStore — images on a sheet or in a document live in OUR file\n * store; the Univer snapshot holds only a reference (`matrx-file:<fileId>`).\n *\n * Why: Univer's stock image service inlines every picture as base64 into the\n * snapshot, so one 2 MB photo made every autosave, history row and collab\n * mutation ~2 MB. Here `saveImage` uploads the file and hands Univer a URL-type\n * source; Univer's URL-image downloader turns the reference back into bytes\n * (`getBlob` → object URL) when it paints. Images already inline (BASE64\n * sources) are untouched and keep rendering.\n */\n\nimport {\n IImageIoService,\n IURLImageService,\n ImageSourceType,\n ImageUploadStatusType,\n generateRandomId,\n} from \"@univerjs/core\";\n\nexport const MATRX_IMAGE_PREFIX = \"matrx-file:\";\n\nexport const isMatrxImageSource = (source: string): boolean =>\n source.startsWith(MATRX_IMAGE_PREFIX);\n\nexport const matrxImageFileId = (source: string): string =>\n source.slice(MATRX_IMAGE_PREFIX.length);\n\nexport type ImageStorePorts = {\n upload(file: File): Promise<{ fileId: string }>;\n getBlob(fileId: string): Promise<Blob>;\n /** Called when an upload fails, so the person is told (never silent). */\n onUploadError(error: unknown): void;\n};\n\nconst ALLOWED = [\"image/png\", \"image/jpeg\", \"image/jpg\", \"image/gif\", \"image/bmp\", \"image/webp\"];\n\ntype ImageIo = {\n saveImage(file: File): Promise<unknown>;\n};\ntype UrlImages = {\n registerURLImageDownloader(d: (url: string) => Promise<string>): { dispose(): void };\n};\ntype InjectorLike = { get(id: unknown): unknown };\n\n/** Pure core: the two replacements, given ports. */\nexport function createMatrxImageStore(ports: ImageStorePorts) {\n const blobUrls = new Map<string, Promise<string>>();\n return {\n /** Revoke every object URL this store made (the editor is going away). */\n dispose() {\n for (const pending of blobUrls.values()) void pending.then((url) => URL.revokeObjectURL(url), () => undefined);\n blobUrls.clear();\n },\n async saveImage(file: File) {\n if (!ALLOWED.includes(file.type)) throw new Error(\"ERROR_IMAGE_TYPE\");\n let fileId: string;\n try {\n ({ fileId } = await ports.upload(file));\n } catch (error) {\n ports.onUploadError(error);\n throw error;\n }\n const source = MATRX_IMAGE_PREFIX + fileId;\n // Univer measures the picture from base64Cache before it inserts (an empty one throws, nothing is\n // inserted). A blob URL of the file just chosen serves that and paints it; it is never saved.\n const localUrl = URL.createObjectURL(file);\n blobUrls.set(fileId, Promise.resolve(localUrl));\n return {\n imageId: generateRandomId(6),\n imageSourceType: ImageSourceType.URL,\n source,\n base64Cache: localUrl,\n status: ImageUploadStatusType.SUCCUSS,\n };\n },\n async download(url: string): Promise<string> {\n if (!isMatrxImageSource(url)) return url;\n const fileId = matrxImageFileId(url);\n let pending = blobUrls.get(fileId);\n if (!pending) {\n pending = ports.getBlob(fileId).then((blob) => URL.createObjectURL(blob));\n blobUrls.set(fileId, pending);\n pending.catch(() => blobUrls.delete(fileId));\n }\n return pending;\n },\n };\n}\n\nconst stores = new WeakMap<object, { dispose(): void }>();\n\n/** Release the object URLs of the store wired into this Univer instance (call as the instance is disposed). */\nexport function releaseMatrxImageStore(injector: object | null | undefined): void {\n if (!injector) return;\n stores.get(injector)?.dispose();\n stores.delete(injector);\n}\n\n/** Wire the store into one Univer instance's image services. */\nexport function registerMatrxImageStore(injector: InjectorLike, ports: ImageStorePorts): void {\n const store = createMatrxImageStore(ports);\n stores.set(injector, store);\n const io = injector.get(IImageIoService) as ImageIo;\n io.saveImage = store.saveImage as ImageIo[\"saveImage\"];\n const urls = injector.get(IURLImageService) as UrlImages;\n urls.registerURLImageDownloader(store.download);\n}\n","import { releaseMatrxImageStore } from \"./univerImageStore\";\n\n/** Univer owns React roots; synchronous dispose during React commit causes races. */\nexport function disposeUniverInstance(\n instance: { dispose(): void } | null | undefined,\n): void {\n const target = instance;\n if (!target) return;\n const injector = (target as { __getInjector?: () => object }).__getInjector?.();\n queueMicrotask(() => {\n releaseMatrxImageStore(injector);\n try {\n target.dispose();\n } catch {\n // Instance may already be torn down by a concurrent unmount.\n }\n });\n}\n","import { UserManagerService } from \"@univerjs/core\";\nimport { getUniverHost } from \"./ports\";\n\ntype InjectorLike = { get(id: unknown): unknown };\n\n/**\n * Tell Univer who is typing, so a comment thread is attributed to the\n * signed-in person instead of Univer's placeholder owner.\n *\n * The userID MUST keep the `Owner_` prefix: Univer's built-in local\n * permission service grants unit roles by user-id prefix (`isDevRole`), so a\n * bare uuid gets no role and every edit is refused as \"range is protected\".\n * Our own access (canActOn) decides editability; Univer must always see an\n * owner. Guarded by identify-univer-user-keeps-owner-role.test.ts.\n */\nexport async function identifyUniverUser(injector: InjectorLike): Promise<void> {\n const user = await getUniverHost().getSignedInUser();\n if (!user?.id) return;\n const meta = (user.metadata ?? {}) as Record<string, unknown>;\n const name = String(meta.full_name ?? meta.name ?? user.email ?? \"You\");\n const users = injector.get(UserManagerService) as {\n setCurrentUser(u: { userID: string; name: string; avatar: string }): void;\n };\n users.setCurrentUser({ userID: univerOwnerId(user.id), name, avatar: String(meta.avatar_url ?? \"\") });\n}\n\n/** Univer's local permission service reads the role from this prefix. */\nexport function univerOwnerId(userId: string): string {\n return `Owner_${userId}`;\n}\n","/**\n * isSnapshotMutation — the autosave dirty-filter for the Univer editors.\n *\n * D97: `onCommandExecuted` fires for EVERY command — including viewport\n * scrolls and selection moves — so an unfiltered listener marked the doc\n * dirty on mere scrolling and wrote a new snapshot row (version history +\n * collab broadcast) 2.5s later. Only CommandType.MUTATION changes the data\n * that a snapshot persists (Univer's own docs: OPERATION = \"not saved to\n * snapshot, such as modifying scroll position\"). We therefore accept ONLY\n * mutations, and additionally deny-list any mutation whose id marks it as\n * scroll / selection / viewport bookkeeping, belt-and-braces.\n */\nimport type { ICommandInfo } from \"@univerjs/core\";\n\n/**\n * Univer's `CommandType.MUTATION`. A literal, so this filter (and the document\n * model that uses it outside the editor chunk) never pulls Univer's runtime —\n * which touches `window` at import — into a server-rendered chunk.\n */\nconst MUTATION = 2;\n\n/** Non-content command ids that must never mark the document dirty. */\nconst NON_CONTENT_ID_PATTERN =\n /(scroll|selection|set-selections|viewport|zoom|hover|cursor|focus|activate)/i;\n\nexport function isSnapshotMutation(command: ICommandInfo): boolean {\n if (command.type !== MUTATION) return false;\n if (NON_CONTENT_ID_PATTERN.test(command.id)) return false;\n return true;\n}\n\n/**\n * Mutations a SPREADSHEET fires on its own while it opens and recalculates —\n * they change nothing the person typed, so they must never mark the workbook\n * dirty. Observed on a plain open of a workbook with formulas (2026-10-10):\n * `formula.mutation.set-trigger-formula-calculation-start`,\n * `...set-formula-calculation-start`, `...set-formula-calculation-notification`\n * and a `doc.mutation.rich-text-editing` from the internal cell-editor document.\n * Each open then wrote a new snapshot (history bloat, and a false \"both changed\"\n * against Google). A real edit always arrives as a `sheet.mutation.*`.\n */\nconst WORKBOOK_SELF_MUTATION_PATTERN =\n /^(formula\\.mutation\\.[a-z-]*(calculation|trigger)[a-z-]*|doc\\.mutation\\.)/;\n\nexport function isWorkbookSnapshotMutation(command: ICommandInfo): boolean {\n if (!isSnapshotMutation(command)) return false;\n return !WORKBOOK_SELF_MUTATION_PATTERN.test(command.id);\n}\n","import { getUniverHost } from \"./ports\";\nimport { isMatrxImageSource, matrxImageFileId, type ImageStorePorts } from \"./univerImageStore\";\n\n/** The real file-store ports (the host's): upload, read back as a blob, tell the person on failure. */\nexport const matrxImagePorts: ImageStorePorts = {\n async upload(file) {\n return getUniverHost().files.upload(file);\n },\n getBlob(fileId) {\n return getUniverHost().files.getBlob(fileId);\n },\n onUploadError(error) {\n getUniverHost().notifyUploadError(error);\n },\n};\n\n/** Export: a snapshot picture source (`matrx-file:<id>` or a URL) as bytes + type, or null if unreadable. */\nexport async function resolveExportImage(\n source: string,\n): Promise<{ bytes: Uint8Array; extension: \"png\" | \"jpeg\" | \"gif\" } | null> {\n let blob: Blob;\n if (isMatrxImageSource(source)) {\n blob = await getUniverHost().files.getBlob(matrxImageFileId(source));\n } else {\n const res = await fetch(source);\n if (!res.ok) return null;\n blob = await res.blob();\n }\n const extension = blob.type.includes(\"gif\") ? \"gif\" : blob.type.includes(\"png\") ? \"png\" : \"jpeg\";\n return { bytes: new Uint8Array(await blob.arrayBuffer()), extension };\n}\n\n/** Import: store a picture from a file, return its file id. */\nexport async function uploadImportedImage(bytes: Uint8Array, extension: string): Promise<string> {\n const mime = extension === \"jpg\" ? \"image/jpeg\" : `image/${extension}`;\n const { fileId } = await getUniverHost().files.upload(new File([bytes as BlobPart], `image.${extension}`, { type: mime }));\n return fileId;\n}\n","/**\n * THE ONE way to replace the whole content of an open Univer editor\n * (workbook or document) with a snapshot that is already SAVED: a history\n * restore, \"Update from Google\" / \"Use Google's\", and a collaborator's\n * replacement all arrive here.\n *\n * Callers save first, then call `showSavedSnapshot`. The open editor for that\n * record (registered below) swaps its content in place, drops its pending\n * autosave (it would write the old content back over the new one), and — in\n * a collab room — tells every peer to reload the same snapshot. A caller\n * never touches Univer units itself: disposing the current unit by hand left\n * Univer's selection observers pointing at nothing (`getUnitId` of null).\n *\n * Pure registry (no Univer import), so it is testable without booting Univer.\n */\n\nexport type EditorRecordKind = \"workbook\" | \"document\";\n\n/** A snapshot row as stored: its id and the Univer body. */\nexport type SavedEditorSnapshot = { id: string; snapshot: unknown };\n\nexport type EditorContentReplacer = (row: SavedEditorSnapshot) => void | Promise<void>;\n\nconst replacers = new Map<string, EditorContentReplacer>();\n\nconst keyOf = (kind: EditorRecordKind, recordId: string) => `${kind}:${recordId}`;\n\n/**\n * The open editor of a record lends its replacer while it is mounted. The\n * newest registration wins; the returned release only removes its own.\n */\nexport function registerOpenEditorContent(\n kind: EditorRecordKind,\n recordId: string,\n replace: EditorContentReplacer,\n): () => void {\n const key = keyOf(kind, recordId);\n replacers.set(key, replace);\n return () => {\n if (replacers.get(key) === replace) replacers.delete(key);\n };\n}\n\n/** Whether an editor of this record is open in this tab. */\nexport function hasOpenEditorContent(kind: EditorRecordKind, recordId: string): boolean {\n return replacers.has(keyOf(kind, recordId));\n}\n\n/**\n * Show a saved snapshot in the record's open editor (and its collab peers).\n * Returns false when no editor of the record is open in this tab — the saved\n * row then simply is the content the next open loads.\n */\nexport async function showSavedSnapshot(\n kind: EditorRecordKind,\n recordId: string,\n row: SavedEditorSnapshot,\n): Promise<boolean> {\n const replace = replacers.get(keyOf(kind, recordId));\n if (!replace) return false;\n await replace(row);\n return true;\n}\n\n/**\n * THE CONTENT-SWAP GUARD. A swap is dispose-then-create; if the create throws, the unit is gone and\n * the grid would stay blank. `swap(snapshot)` is the editor's own dispose+create (it disposes\n * whatever unit is open, if any). On a throw this puts the content that was open before straight\n * back (synchronously — never a blank grid) and says so; the editor then reloads the latest SAVED\n * version and still raises the original error, so the person is told.\n */\nexport function swapContentGuarded(args: {\n swap: (snapshot: unknown) => void;\n next: unknown;\n /** What was open before (`workbook.save()` taken before the swap), or null when nothing was. */\n previous: unknown | null;\n}): { ok: true } | { ok: false; error: unknown; previousRestored: boolean } {\n try {\n args.swap(args.next);\n return { ok: true };\n } catch (error) {\n let previousRestored = false;\n if (args.previous) {\n try {\n args.swap(args.previous);\n previousRestored = true;\n } catch {\n /* the latest saved version is tried next, by the caller */\n }\n }\n return { ok: false, error, previousRestored };\n }\n}\n","\"use client\";\n\n/**\n * Univer's drawing UI names `AddImageIcon` on its Insert-image menu items but\n * never registers it (upstream gap), so the icon manager logs \"Icon AddImageIcon\n * does not exist\" on every editor load. Register it ourselves, right after\n * `createUniver`, so the toolbar draws a real icon and the console stays clean.\n */\n\nimport { IconManager } from \"@univerjs/ui\";\nimport { AddImageIcon } from \"@univerjs/icons\";\n\ntype InjectorLike = { get(id: unknown): unknown };\n\n/** Icons Univer's own plugins reference but do not register. */\nexport const MISSING_UNIVER_ICONS = { AddImageIcon } as const;\n\nexport function registerMissingUniverIcons(injector: InjectorLike): void {\n const icons = injector.get(IconManager) as {\n register(icons: Record<string, unknown>): unknown;\n };\n icons.register({ ...MISSING_UNIVER_ICONS });\n}\n","type UniverDependency = new (...args: never[]) => unknown;\n\ntype UniverInjector = {\n has(dependency: UniverDependency): boolean;\n add(dependency: [UniverDependency]): void;\n};\n\n/**\n * Register services required by process-global Univer Facade observers.\n *\n * Facade modules can outlive the editor type that first imported them, so a\n * later Univer instance may receive their lifecycle callbacks without loading\n * that type's plugins. Registration is intentionally narrow: callers name only\n * the observer dependencies that are safe for their instance.\n */\nexport function registerUniverFacadeDependencies(\n injector: UniverInjector,\n dependencies: readonly UniverDependency[],\n): void {\n for (const dependency of dependencies) {\n if (!injector.has(dependency)) injector.add([dependency]);\n }\n}\n","\"use client\";\n\n/**\n * Univer's notifications go through the APP's toast path — one toaster per page.\n *\n * Univer's own `DesktopNotificationService` mounts a second sonner `<Toaster>`\n * into its workbench the moment it is created. sonner's toast store is global,\n * so with the app's Toaster also mounted every toast (ours and Univer's) showed\n * twice on a workbook or document page. Replacing the service before anything\n * resolves it means Univer never mounts that Toaster, and what Univer has to\n * say (clipboard permission, paste limits) reaches the person through\n * the host's toast port like every other message (tracked, Error Inspector, Alchemy).\n *\n * Call right after `createUniver`, before the first unit is created.\n */\n\nimport { toDisposable, type IDisposable } from \"@univerjs/core\";\nimport { INotificationService } from \"@univerjs/ui\";\n\nimport { getUniverHost } from \"./ports\";\n\ntype UniverNotification = {\n title: unknown;\n content?: string;\n type?: \"success\" | \"info\" | \"warning\" | \"error\" | \"message\" | \"loading\";\n duration?: number;\n};\n\nexport interface NotificationReplaceableInjector {\n replace?: (dependency: [unknown, unknown]) => void;\n}\n\n/** Show one Univer notification as an app toast; dismissing the disposable removes it. */\nexport function showUniverNotification(params: UniverNotification): IDisposable {\n const title = typeof params.title === \"string\" ? params.title : String(params.title ?? \"\");\n const options = {\n ...(params.content ? { description: params.content } : {}),\n ...(params.duration !== undefined ? { duration: params.duration } : {}),\n };\n const kind = params.type ?? \"message\";\n const { toast } = getUniverHost();\n const show = kind === \"loading\" ? toast.message : toast[kind];\n const id = show(title, options) as string | number;\n return toDisposable(() => toast.dismiss(id));\n}\n\nexport function routeUniverNotificationsToApp(\n injector: NotificationReplaceableInjector | null | undefined,\n): { applied: boolean; reason?: string } {\n if (!injector || typeof injector.replace !== \"function\") {\n return { applied: false, reason: \"injector has no replace()\" };\n }\n try {\n injector.replace([INotificationService, { useValue: { show: showUniverNotification } }]);\n return { applied: true };\n } catch (err) {\n return { applied: false, reason: err instanceof Error ? err.message : String(err) };\n }\n}\n","/**\n * Resolve a color Univer hands its canvas — WITHOUT the dark-mode inversion.\n *\n * Univer 1.0 writes many of its own fills as THEME TOKENS, not colors: the\n * page is `\"gray.0\"`, the desk `\"gray.100\"`, the page outline `\"gray.200\"`,\n * default ink `\"gray.900\"` (engine-render 1.0.2 `DocBackground`, docs-ui\n * `resolveDocRenderBackground`). Its `CanvasColorService` turns a token into a\n * color before anything reaches `ctx.fillStyle`; its `DumbCanvasColorService`\n * does NOT — it returns `\"gray.0\"` as-is. A canvas IGNORES a `fillStyle` it\n * cannot parse and keeps the previous one, which starts as `#000000`, so with\n * the dumb service every page came out solid black and the canvas element's\n * CSS background (`style.backgroundColor = \"gray.100\"`, also ignored) stayed\n * transparent — in every browser, headed or headless, light or dark.\n *\n * Pure (no Univer import) so the jest test and `check:univer-doc-theme` drive\n * the same function the editor installs.\n */\n\n/** `palette.shade` — the shape Univer's theme tokens take (`gray.0`, `primary.600`). */\nconst THEME_TOKEN = /^[a-zA-Z]+\\.[a-zA-Z0-9]+$/;\n\n/**\n * @param color What Univer is about to paint: a theme token or a real color.\n * @param lookup The live theme (`ThemeService.getColorFromTheme`).\n * @returns the token's color from the current theme; anything else unchanged.\n */\nexport function resolveUniverCanvasColor(\n color: string,\n lookup: (token: string) => unknown,\n): string {\n if (!THEME_TOKEN.test(color)) return color;\n const resolved = lookup(color);\n return typeof resolved === \"string\" && resolved.length > 0 ? resolved : color;\n}\n","/**\n * useUniverDarkModeSync — keep a Univer instance's dark mode in lockstep with\n * the app's painted theme (`<html class=\"dark\">` via `useThemeMode`).\n *\n * Univer owns its own theming (see https://docs.univer.ai/guides/docs/ui/themes):\n * you boot it with `theme` + `darkMode`, then flip dark mode at runtime via the\n * Facade API `univerAPI.toggleDarkMode(isDark)`. This is the ONLY supported way\n * to theme Univer — do NOT try to force it with a `colorScheme` CSS override on\n * a wrapper (that just fights Univer's own popups/portals and breaks dark mode).\n *\n * Shared by every Univer surface (DocumentEditor, WorkbookEditor) so the\n * theme→Univer bridge lives in exactly one place.\n */\n\"use client\";\n\nimport { useEffect } from \"react\";\nimport type { FUniver } from \"@univerjs/presets\";\n\nimport { getUniverHost } from \"./ports\";\n\n/**\n * @param apiRef Ref holding the Univer Facade API (set once the instance boots).\n * @param ready True once the instance is booted and the API is usable.\n */\nexport function useUniverDarkModeSync(\n apiRef: React.RefObject<FUniver | null>,\n ready: boolean,\n): void {\n const mode = getUniverHost().useThemeMode();\n\n useEffect(() => {\n if (!ready || !apiRef.current) return;\n apiRef.current.toggleDarkMode(mode === \"dark\");\n }, [apiRef, ready, mode]);\n}\n","/**\n * A saved snapshot names the collab-room entries it already holds, so a seat that boots from it never\n * replays them (2026-10-16: a reload showed the text twice). Pure — no Yjs — so the editors' model can\n * stamp and read it without loading the room.\n */\n\n/** The key a saved snapshot carries its covered room entries under (`stampCovered` / `takeCovered`). */\nexport const COLLAB_COVERED_KEY = \"__matrxCollabCovered\";\n\n/** The snapshot to SAVE: `snapshot` plus the room entries it holds (`WorkbookCollabSession.coveredNow`). */\nexport function stampCovered<T extends object>(snapshot: T, covered: readonly string[]): T {\n return { ...snapshot, [COLLAB_COVERED_KEY]: [...covered] };\n}\n\n/** A LOADED snapshot split into the content to mount and the room entries it already holds. */\nexport function takeCovered<T>(snapshot: T): { snapshot: T; covered: Set<string> } {\n if (!snapshot || typeof snapshot !== \"object\" || !(COLLAB_COVERED_KEY in (snapshot as object))) {\n return { snapshot, covered: new Set() };\n }\n const { [COLLAB_COVERED_KEY]: list, ...rest } = snapshot as Record<string, unknown>;\n return {\n snapshot: rest as T,\n covered: new Set(Array.isArray(list) ? list.filter((e): e is string => typeof e === \"string\") : []),\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACwCA,IAAM,OAAO,uBAAO,IAAI,6BAA6B;AAErD,IAAM,OAAO,MAAY;AACvB,QAAM,IAAI;AACV,SAAQ,E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AAG,CAAC,GAAG,OAAO,EAAE;AAC3D;AAGO,SAAS,YAAe,UAAoD;AACjF,MAAI,CAAC,YAAY,OAAO,aAAa,YAAY,EAAE,sBAAuB,WAAsB;AAC9F,WAAO,EAAE,UAAU,SAAS,oBAAI,IAAI,EAAE;AAAA,EACxC;AACA,QAAM,EAAE,CAAC,kBAAkB,GAAG,MAAM,GAAG,KAAK,IAAI;AAChD,SAAO;AAAA,IACL,UAAU;AAAA,IACV,SAAS,IAAI,IAAI,MAAM,QAAQ,IAAI,IAAI,KAAK,OAAO,CAAC,MAAmB,OAAO,MAAM,QAAQ,IAAI,CAAC,CAAC;AAAA,EACpG;AACF;","names":["import_core","import_core","import_ui"]}
1
+ {"version":3,"sources":["../src/univer/index.ts","../src/univer/ports.ts","../src/univer/history.ts","../src/univer/univerImageStore.ts","../src/univer/disposeUniverInstance.ts","../src/univer/identifyUniverUser.ts","../src/univer/isSnapshotMutation.ts","../src/univer/matrxImagePorts.ts","../src/univer/openEditorContent.ts","../src/univer/registerMissingUniverIcons.ts","../src/univer/registerUniverFacadeDependencies.ts","../src/univer/routeUniverNotificationsToApp.ts","../src/univer/univer-theme-token-color.ts","../src/univer/useUniverDarkModeSync.ts","../src/univer/collab/covered.ts"],"sourcesContent":["\"use client\";\n\n/**\n * The Univer glue shared by `/sheets` and `/docs` (was matrx-frontend `lib/univer`). A transitional\n * subpath: matrx-frontend's two editors import it until they move into their sections, then this\n * entry goes internal again (BUILD-BOOK §1.3, Amendments W1-G2a1). Importing it loads `@univerjs/*`;\n * the pure history keys are their own entry (`./univer/history`) for code that must not.\n */\nexport * from \"./ports\";\nexport * from \"./history\";\nexport * from \"./disposeUniverInstance\";\nexport * from \"./identifyUniverUser\";\nexport * from \"./isSnapshotMutation\";\nexport * from \"./matrxImagePorts\";\nexport * from \"./openEditorContent\";\nexport * from \"./registerMissingUniverIcons\";\nexport * from \"./registerUniverFacadeDependencies\";\nexport * from \"./routeUniverNotificationsToApp\";\nexport * from \"./univer-theme-token-color\";\nexport * from \"./univerImageStore\";\nexport * from \"./useUniverDarkModeSync\";\nexport * from \"./collab/covered\";\n","/**\n * The host ports of the Univer glue.\n *\n * The glue belongs to the package, but four things belong to the app that mounts an editor: the\n * toast path, the signed-in person, the file store, the snapshot catch-up read and the painted theme. The host states them\n * once at start-up with `configureUniverHost`; the glue reads them here. State sits on a\n * `globalThis` slot so a dual-bundled copy of the package still sees one host (dual-bundle rule).\n * An unconfigured port THROWS naming the port (nothing fails silently).\n */\n\nexport type UniverToastId = string | number;\ntype ToastShow = (title: string, options?: { description?: string; duration?: number }) => UniverToastId;\n\nexport interface UniverHostPorts {\n /** The app's toast path (one toaster per page). */\n toast: {\n success: ToastShow;\n info: ToastShow;\n warning: ToastShow;\n error: ToastShow;\n message: ToastShow;\n dismiss(id: UniverToastId): void;\n };\n /** Who is typing, or null when signed out. `metadata` is the auth user's metadata bag. */\n getSignedInUser(): Promise<{ id: string; email?: string | null; metadata?: Record<string, unknown> | null } | null>;\n /** The file store behind pictures on a sheet or in a document. */\n files: {\n upload(file: File): Promise<{ fileId: string }>;\n getBlob(fileId: string): Promise<Blob>;\n };\n /** The newest snapshot row of a workbook (the realtime catch-up read), or `data: null` when it has none. */\n readNewestWorkbookSnapshot(\n workbookId: string,\n ): Promise<{ data: { id?: string; created_by?: string | null; created_at?: string } | null; error: { message: string } | null }>;\n /** Tell the person a picture did not upload. */\n notifyUploadError(error: unknown): void;\n /** The painted color mode, as a React hook (re-renders on a switch). */\n useThemeMode(): \"light\" | \"dark\";\n}\n\nconst SLOT = Symbol.for(\"ai-matrx.office.univer-host\");\ntype Slot = { ports?: UniverHostPorts };\nconst slot = (): Slot => {\n const g = globalThis as Record<symbol, Slot | undefined>;\n return (g[SLOT] ??= {});\n};\n\nexport function configureUniverHost(ports: UniverHostPorts): void {\n slot().ports = ports;\n}\n\nexport function getUniverHost(): UniverHostPorts {\n const ports = slot().ports;\n if (!ports) throw new Error(\"@ai-matrx/office/univer: configureUniverHost(ports) was not called before an editor mounted.\");\n return ports;\n}\n","/**\n * A document's or a workbook's snapshot history as a canvas tab — the keys and toggle inputs the\n * editors use, and the reader the two history views use. One tab per document (`document-history`,\n * keyed by the document id) and per workbook (`workbook-history`, keyed by the workbook id).\n *\n * Pure: no React, no canvas package, no Univer. The two `defineCanvasKind` registrations stay with\n * the host app (matrx-frontend `features/canvas/host`) and lazy-load the views, so this module never\n * imports a view (the cycle the old `lib/univer/historyKinds.ts` closed).\n */\n\nexport const DOCUMENT_HISTORY_KIND = \"document-history\";\nexport const WORKBOOK_HISTORY_KIND = \"workbook-history\";\n\nexport interface HistoryTabData {\n id: string;\n editable: boolean;\n}\n\n/** Structurally the host's `ToolToggleInput` (the canvas toggle the editor's History button presses). */\nexport interface HistoryToggleInput {\n kind: string;\n key: string;\n title: string;\n data: { id: string; editable: boolean };\n followTitle: true;\n}\n\n/** A tab's data as a history subject, or null when it names no subject. */\nexport function readHistoryTab(data: unknown): HistoryTabData | null {\n if (typeof data !== \"object\" || data === null || Array.isArray(data)) return null;\n const record = data as Record<string, unknown>;\n const id = typeof record.id === \"string\" && record.id ? record.id : null;\n if (!id) return null;\n return { id, editable: record.editable !== false };\n}\n\n/** \"<what> · <subject>\", or just \"<what>\" while the subject has no name. */\nfunction subjectTitle(what: string, subject: string | null | undefined): string {\n const name = subject?.trim();\n return name ? `${what} · ${name}` : what;\n}\n\n// The tab names its subject — two open history tabs never share a title, and\n// the editor that owns the toggle keeps it in step with a rename.\nexport function documentHistoryToggleInput(documentId: string, editable: boolean, documentName?: string | null): HistoryToggleInput {\n return {\n kind: DOCUMENT_HISTORY_KIND,\n key: documentId,\n title: subjectTitle(\"Document history\", documentName),\n data: { id: documentId, editable },\n followTitle: true,\n };\n}\n\nexport function workbookHistoryToggleInput(workbookId: string, editable: boolean, workbookName?: string | null): HistoryToggleInput {\n return {\n kind: WORKBOOK_HISTORY_KIND,\n key: workbookId,\n title: subjectTitle(\"Workbook history\", workbookName),\n data: { id: workbookId, editable },\n followTitle: true,\n };\n}\n","/**\n * univerImageStore — images on a sheet or in a document live in OUR file\n * store; the Univer snapshot holds only a reference (`matrx-file:<fileId>`).\n *\n * Why: Univer's stock image service inlines every picture as base64 into the\n * snapshot, so one 2 MB photo made every autosave, history row and collab\n * mutation ~2 MB. Here `saveImage` uploads the file and hands Univer a URL-type\n * source; Univer's URL-image downloader turns the reference back into bytes\n * (`getBlob` → object URL) when it paints. Images already inline (BASE64\n * sources) are untouched and keep rendering.\n */\n\nimport {\n IImageIoService,\n IURLImageService,\n ImageSourceType,\n ImageUploadStatusType,\n generateRandomId,\n} from \"@univerjs/core\";\n\nexport const MATRX_IMAGE_PREFIX = \"matrx-file:\";\n\nexport const isMatrxImageSource = (source: string): boolean =>\n source.startsWith(MATRX_IMAGE_PREFIX);\n\nexport const matrxImageFileId = (source: string): string =>\n source.slice(MATRX_IMAGE_PREFIX.length);\n\nexport type ImageStorePorts = {\n upload(file: File): Promise<{ fileId: string }>;\n getBlob(fileId: string): Promise<Blob>;\n /** Called when an upload fails, so the person is told (never silent). */\n onUploadError(error: unknown): void;\n};\n\nconst ALLOWED = [\"image/png\", \"image/jpeg\", \"image/jpg\", \"image/gif\", \"image/bmp\", \"image/webp\"];\n\ntype ImageIo = {\n saveImage(file: File): Promise<unknown>;\n};\ntype UrlImages = {\n registerURLImageDownloader(d: (url: string) => Promise<string>): { dispose(): void };\n};\ntype InjectorLike = { get(id: unknown): unknown };\n\n/** Pure core: the two replacements, given ports. */\nexport function createMatrxImageStore(ports: ImageStorePorts) {\n const blobUrls = new Map<string, Promise<string>>();\n return {\n /** Revoke every object URL this store made (the editor is going away). */\n dispose() {\n for (const pending of blobUrls.values()) void pending.then((url) => URL.revokeObjectURL(url), () => undefined);\n blobUrls.clear();\n },\n async saveImage(file: File) {\n if (!ALLOWED.includes(file.type)) throw new Error(\"ERROR_IMAGE_TYPE\");\n let fileId: string;\n try {\n ({ fileId } = await ports.upload(file));\n } catch (error) {\n ports.onUploadError(error);\n throw error;\n }\n const source = MATRX_IMAGE_PREFIX + fileId;\n // Univer measures the picture from base64Cache before it inserts (an empty one throws, nothing is\n // inserted). A blob URL of the file just chosen serves that and paints it; it is never saved.\n const localUrl = URL.createObjectURL(file);\n blobUrls.set(fileId, Promise.resolve(localUrl));\n return {\n imageId: generateRandomId(6),\n imageSourceType: ImageSourceType.URL,\n source,\n base64Cache: localUrl,\n status: ImageUploadStatusType.SUCCUSS,\n };\n },\n async download(url: string): Promise<string> {\n if (!isMatrxImageSource(url)) return url;\n const fileId = matrxImageFileId(url);\n let pending = blobUrls.get(fileId);\n if (!pending) {\n pending = ports.getBlob(fileId).then((blob) => URL.createObjectURL(blob));\n blobUrls.set(fileId, pending);\n pending.catch(() => blobUrls.delete(fileId));\n }\n return pending;\n },\n };\n}\n\nconst stores = new WeakMap<object, { dispose(): void }>();\n\n/** Release the object URLs of the store wired into this Univer instance (call as the instance is disposed). */\nexport function releaseMatrxImageStore(injector: object | null | undefined): void {\n if (!injector) return;\n stores.get(injector)?.dispose();\n stores.delete(injector);\n}\n\n/** Wire the store into one Univer instance's image services. */\nexport function registerMatrxImageStore(injector: InjectorLike, ports: ImageStorePorts): void {\n const store = createMatrxImageStore(ports);\n stores.set(injector, store);\n const io = injector.get(IImageIoService) as ImageIo;\n io.saveImage = store.saveImage as ImageIo[\"saveImage\"];\n const urls = injector.get(IURLImageService) as UrlImages;\n urls.registerURLImageDownloader(store.download);\n}\n","import { releaseMatrxImageStore } from \"./univerImageStore\";\n\n/** Univer owns React roots; synchronous dispose during React commit causes races. */\nexport function disposeUniverInstance(\n instance: { dispose(): void } | null | undefined,\n): void {\n const target = instance;\n if (!target) return;\n const injector = (target as { __getInjector?: () => object }).__getInjector?.();\n queueMicrotask(() => {\n releaseMatrxImageStore(injector);\n try {\n target.dispose();\n } catch {\n // Instance may already be torn down by a concurrent unmount.\n }\n });\n}\n","import { UserManagerService } from \"@univerjs/core\";\nimport { getUniverHost } from \"./ports\";\n\ntype InjectorLike = { get(id: unknown): unknown };\n\n/**\n * Tell Univer who is typing, so a comment thread is attributed to the\n * signed-in person instead of Univer's placeholder owner.\n *\n * The userID MUST keep the `Owner_` prefix: Univer's built-in local\n * permission service grants unit roles by user-id prefix (`isDevRole`), so a\n * bare uuid gets no role and every edit is refused as \"range is protected\".\n * Our own access (canActOn) decides editability; Univer must always see an\n * owner. Guarded by identify-univer-user-keeps-owner-role.test.ts.\n */\nexport async function identifyUniverUser(injector: InjectorLike): Promise<void> {\n const user = await getUniverHost().getSignedInUser();\n if (!user?.id) return;\n const meta = (user.metadata ?? {}) as Record<string, unknown>;\n const name = String(meta.full_name ?? meta.name ?? user.email ?? \"You\");\n const users = injector.get(UserManagerService) as {\n setCurrentUser(u: { userID: string; name: string; avatar: string }): void;\n };\n users.setCurrentUser({ userID: univerOwnerId(user.id), name, avatar: String(meta.avatar_url ?? \"\") });\n}\n\n/** Univer's local permission service reads the role from this prefix. */\nexport function univerOwnerId(userId: string): string {\n return `Owner_${userId}`;\n}\n","/**\n * isSnapshotMutation — the autosave dirty-filter for the Univer editors.\n *\n * D97: `onCommandExecuted` fires for EVERY command — including viewport\n * scrolls and selection moves — so an unfiltered listener marked the doc\n * dirty on mere scrolling and wrote a new snapshot row (version history +\n * collab broadcast) 2.5s later. Only CommandType.MUTATION changes the data\n * that a snapshot persists (Univer's own docs: OPERATION = \"not saved to\n * snapshot, such as modifying scroll position\"). We therefore accept ONLY\n * mutations, and additionally deny-list any mutation whose id marks it as\n * scroll / selection / viewport bookkeeping, belt-and-braces.\n */\nimport type { ICommandInfo } from \"@univerjs/core\";\n\n/**\n * Univer's `CommandType.MUTATION`. A literal, so this filter (and the document\n * model that uses it outside the editor chunk) never pulls Univer's runtime —\n * which touches `window` at import — into a server-rendered chunk.\n */\nconst MUTATION = 2;\n\n/** Non-content command ids that must never mark the document dirty. */\nconst NON_CONTENT_ID_PATTERN =\n /(scroll|selection|set-selections|viewport|zoom|hover|cursor|focus|activate)/i;\n\nexport function isSnapshotMutation(command: ICommandInfo): boolean {\n if (command.type !== MUTATION) return false;\n if (NON_CONTENT_ID_PATTERN.test(command.id)) return false;\n return true;\n}\n\n/**\n * Mutations a SPREADSHEET fires on its own while it opens and recalculates —\n * they change nothing the person typed, so they must never mark the workbook\n * dirty. Observed on a plain open of a workbook with formulas (2026-10-10):\n * `formula.mutation.set-trigger-formula-calculation-start`,\n * `...set-formula-calculation-start`, `...set-formula-calculation-notification`\n * and a `doc.mutation.rich-text-editing` from the internal cell-editor document.\n * Each open then wrote a new snapshot (history bloat, and a false \"both changed\"\n * against Google). A real edit always arrives as a `sheet.mutation.*`.\n */\nconst WORKBOOK_SELF_MUTATION_PATTERN =\n /^(formula\\.mutation\\.[a-z-]*(calculation|trigger)[a-z-]*|doc\\.mutation\\.)/;\n\nexport function isWorkbookSnapshotMutation(command: ICommandInfo): boolean {\n if (!isSnapshotMutation(command)) return false;\n return !WORKBOOK_SELF_MUTATION_PATTERN.test(command.id);\n}\n","import { getUniverHost } from \"./ports\";\nimport { isMatrxImageSource, matrxImageFileId, type ImageStorePorts } from \"./univerImageStore\";\n\n/** The real file-store ports (the host's): upload, read back as a blob, tell the person on failure. */\nexport const matrxImagePorts: ImageStorePorts = {\n async upload(file) {\n return getUniverHost().files.upload(file);\n },\n getBlob(fileId) {\n return getUniverHost().files.getBlob(fileId);\n },\n onUploadError(error) {\n getUniverHost().notifyUploadError(error);\n },\n};\n\n/** Export: a snapshot picture source (`matrx-file:<id>` or a URL) as bytes + type, or null if unreadable. */\nexport async function resolveExportImage(\n source: string,\n): Promise<{ bytes: Uint8Array; extension: \"png\" | \"jpeg\" | \"gif\" } | null> {\n let blob: Blob;\n if (isMatrxImageSource(source)) {\n blob = await getUniverHost().files.getBlob(matrxImageFileId(source));\n } else {\n const res = await fetch(source);\n if (!res.ok) return null;\n blob = await res.blob();\n }\n const extension = blob.type.includes(\"gif\") ? \"gif\" : blob.type.includes(\"png\") ? \"png\" : \"jpeg\";\n return { bytes: new Uint8Array(await blob.arrayBuffer()), extension };\n}\n\n/** Import: store a picture from a file, return its file id. */\nexport async function uploadImportedImage(bytes: Uint8Array, extension: string): Promise<string> {\n const mime = extension === \"jpg\" ? \"image/jpeg\" : `image/${extension}`;\n const { fileId } = await getUniverHost().files.upload(new File([bytes as BlobPart], `image.${extension}`, { type: mime }));\n return fileId;\n}\n","/**\n * THE ONE way to replace the whole content of an open Univer editor\n * (workbook or document) with a snapshot that is already SAVED: a history\n * restore, \"Update from Google\" / \"Use Google's\", and a collaborator's\n * replacement all arrive here.\n *\n * Callers save first, then call `showSavedSnapshot`. The open editor for that\n * record (registered below) swaps its content in place, drops its pending\n * autosave (it would write the old content back over the new one), and — in\n * a collab room — tells every peer to reload the same snapshot. A caller\n * never touches Univer units itself: disposing the current unit by hand left\n * Univer's selection observers pointing at nothing (`getUnitId` of null).\n *\n * Pure registry (no Univer import), so it is testable without booting Univer.\n */\n\nexport type EditorRecordKind = \"workbook\" | \"document\";\n\n/** A snapshot row as stored: its id and the Univer body. */\nexport type SavedEditorSnapshot = { id: string; snapshot: unknown };\n\nexport type EditorContentReplacer = (row: SavedEditorSnapshot) => void | Promise<void>;\n\nconst replacers = new Map<string, EditorContentReplacer>();\n\nconst keyOf = (kind: EditorRecordKind, recordId: string) => `${kind}:${recordId}`;\n\n/**\n * The open editor of a record lends its replacer while it is mounted. The\n * newest registration wins; the returned release only removes its own.\n */\nexport function registerOpenEditorContent(\n kind: EditorRecordKind,\n recordId: string,\n replace: EditorContentReplacer,\n): () => void {\n const key = keyOf(kind, recordId);\n replacers.set(key, replace);\n return () => {\n if (replacers.get(key) === replace) replacers.delete(key);\n };\n}\n\n/** Whether an editor of this record is open in this tab. */\nexport function hasOpenEditorContent(kind: EditorRecordKind, recordId: string): boolean {\n return replacers.has(keyOf(kind, recordId));\n}\n\n/**\n * Show a saved snapshot in the record's open editor (and its collab peers).\n * Returns false when no editor of the record is open in this tab — the saved\n * row then simply is the content the next open loads.\n */\nexport async function showSavedSnapshot(\n kind: EditorRecordKind,\n recordId: string,\n row: SavedEditorSnapshot,\n): Promise<boolean> {\n const replace = replacers.get(keyOf(kind, recordId));\n if (!replace) return false;\n await replace(row);\n return true;\n}\n\n/**\n * THE CONTENT-SWAP GUARD. A swap is dispose-then-create; if the create throws, the unit is gone and\n * the grid would stay blank. `swap(snapshot)` is the editor's own dispose+create (it disposes\n * whatever unit is open, if any). On a throw this puts the content that was open before straight\n * back (synchronously — never a blank grid) and says so; the editor then reloads the latest SAVED\n * version and still raises the original error, so the person is told.\n */\nexport function swapContentGuarded(args: {\n swap: (snapshot: unknown) => void;\n next: unknown;\n /** What was open before (`workbook.save()` taken before the swap), or null when nothing was. */\n previous: unknown | null;\n}): { ok: true } | { ok: false; error: unknown; previousRestored: boolean } {\n try {\n args.swap(args.next);\n return { ok: true };\n } catch (error) {\n let previousRestored = false;\n if (args.previous) {\n try {\n args.swap(args.previous);\n previousRestored = true;\n } catch {\n /* the latest saved version is tried next, by the caller */\n }\n }\n return { ok: false, error, previousRestored };\n }\n}\n","\"use client\";\n\n/**\n * Univer's drawing UI names `AddImageIcon` on its Insert-image menu items but\n * never registers it (upstream gap), so the icon manager logs \"Icon AddImageIcon\n * does not exist\" on every editor load. Register it ourselves, right after\n * `createUniver`, so the toolbar draws a real icon and the console stays clean.\n */\n\nimport { IconManager } from \"@univerjs/ui\";\nimport { AddImageIcon } from \"@univerjs/icons\";\n\ntype InjectorLike = { get(id: unknown): unknown };\n\n/** Icons Univer's own plugins reference but do not register. */\n// Annotated: the inferred type names Univer's internal `IIconProps`, which a declaration build\n// cannot reference portably (TS2883 under tsup 9's dts, which no longer injects `baseUrl`).\nexport const MISSING_UNIVER_ICONS: { readonly AddImageIcon: typeof AddImageIcon } = { AddImageIcon };\n\nexport function registerMissingUniverIcons(injector: InjectorLike): void {\n const icons = injector.get(IconManager) as {\n register(icons: Record<string, unknown>): unknown;\n };\n icons.register({ ...MISSING_UNIVER_ICONS });\n}\n","type UniverDependency = new (...args: never[]) => unknown;\n\ntype UniverInjector = {\n has(dependency: UniverDependency): boolean;\n add(dependency: [UniverDependency]): void;\n};\n\n/**\n * Register services required by process-global Univer Facade observers.\n *\n * Facade modules can outlive the editor type that first imported them, so a\n * later Univer instance may receive their lifecycle callbacks without loading\n * that type's plugins. Registration is intentionally narrow: callers name only\n * the observer dependencies that are safe for their instance.\n */\nexport function registerUniverFacadeDependencies(\n injector: UniverInjector,\n dependencies: readonly UniverDependency[],\n): void {\n for (const dependency of dependencies) {\n if (!injector.has(dependency)) injector.add([dependency]);\n }\n}\n","\"use client\";\n\n/**\n * Univer's notifications go through the APP's toast path — one toaster per page.\n *\n * Univer's own `DesktopNotificationService` mounts a second sonner `<Toaster>`\n * into its workbench the moment it is created. sonner's toast store is global,\n * so with the app's Toaster also mounted every toast (ours and Univer's) showed\n * twice on a workbook or document page. Replacing the service before anything\n * resolves it means Univer never mounts that Toaster, and what Univer has to\n * say (clipboard permission, paste limits) reaches the person through\n * the host's toast port like every other message (tracked, Error Inspector, Alchemy).\n *\n * Call right after `createUniver`, before the first unit is created.\n */\n\nimport { toDisposable, type IDisposable } from \"@univerjs/core\";\nimport { INotificationService } from \"@univerjs/ui\";\n\nimport { getUniverHost } from \"./ports\";\n\ntype UniverNotification = {\n title: unknown;\n content?: string;\n type?: \"success\" | \"info\" | \"warning\" | \"error\" | \"message\" | \"loading\";\n duration?: number;\n};\n\nexport interface NotificationReplaceableInjector {\n replace?: (dependency: [unknown, unknown]) => void;\n}\n\n/** Show one Univer notification as an app toast; dismissing the disposable removes it. */\nexport function showUniverNotification(params: UniverNotification): IDisposable {\n const title = typeof params.title === \"string\" ? params.title : String(params.title ?? \"\");\n const options = {\n ...(params.content ? { description: params.content } : {}),\n ...(params.duration !== undefined ? { duration: params.duration } : {}),\n };\n const kind = params.type ?? \"message\";\n const { toast } = getUniverHost();\n const show = kind === \"loading\" ? toast.message : toast[kind];\n const id = show(title, options) as string | number;\n return toDisposable(() => toast.dismiss(id));\n}\n\nexport function routeUniverNotificationsToApp(\n injector: NotificationReplaceableInjector | null | undefined,\n): { applied: boolean; reason?: string } {\n if (!injector || typeof injector.replace !== \"function\") {\n return { applied: false, reason: \"injector has no replace()\" };\n }\n try {\n injector.replace([INotificationService, { useValue: { show: showUniverNotification } }]);\n return { applied: true };\n } catch (err) {\n return { applied: false, reason: err instanceof Error ? err.message : String(err) };\n }\n}\n","/**\n * Resolve a color Univer hands its canvas — WITHOUT the dark-mode inversion.\n *\n * Univer 1.0 writes many of its own fills as THEME TOKENS, not colors: the\n * page is `\"gray.0\"`, the desk `\"gray.100\"`, the page outline `\"gray.200\"`,\n * default ink `\"gray.900\"` (engine-render 1.0.2 `DocBackground`, docs-ui\n * `resolveDocRenderBackground`). Its `CanvasColorService` turns a token into a\n * color before anything reaches `ctx.fillStyle`; its `DumbCanvasColorService`\n * does NOT — it returns `\"gray.0\"` as-is. A canvas IGNORES a `fillStyle` it\n * cannot parse and keeps the previous one, which starts as `#000000`, so with\n * the dumb service every page came out solid black and the canvas element's\n * CSS background (`style.backgroundColor = \"gray.100\"`, also ignored) stayed\n * transparent — in every browser, headed or headless, light or dark.\n *\n * Pure (no Univer import) so the jest test and `check:univer-doc-theme` drive\n * the same function the editor installs.\n */\n\n/** `palette.shade` — the shape Univer's theme tokens take (`gray.0`, `primary.600`). */\nconst THEME_TOKEN = /^[a-zA-Z]+\\.[a-zA-Z0-9]+$/;\n\n/**\n * @param color What Univer is about to paint: a theme token or a real color.\n * @param lookup The live theme (`ThemeService.getColorFromTheme`).\n * @returns the token's color from the current theme; anything else unchanged.\n */\nexport function resolveUniverCanvasColor(\n color: string,\n lookup: (token: string) => unknown,\n): string {\n if (!THEME_TOKEN.test(color)) return color;\n const resolved = lookup(color);\n return typeof resolved === \"string\" && resolved.length > 0 ? resolved : color;\n}\n","/**\n * useUniverDarkModeSync — keep a Univer instance's dark mode in lockstep with\n * the app's painted theme (`<html class=\"dark\">` via `useThemeMode`).\n *\n * Univer owns its own theming (see https://docs.univer.ai/guides/docs/ui/themes):\n * you boot it with `theme` + `darkMode`, then flip dark mode at runtime via the\n * Facade API `univerAPI.toggleDarkMode(isDark)`. This is the ONLY supported way\n * to theme Univer — do NOT try to force it with a `colorScheme` CSS override on\n * a wrapper (that just fights Univer's own popups/portals and breaks dark mode).\n *\n * Shared by every Univer surface (DocumentEditor, WorkbookEditor) so the\n * theme→Univer bridge lives in exactly one place.\n */\n\"use client\";\n\nimport { useEffect } from \"react\";\nimport type { FUniver } from \"@univerjs/presets\";\n\nimport { getUniverHost } from \"./ports\";\n\n/**\n * @param apiRef Ref holding the Univer Facade API (set once the instance boots).\n * @param ready True once the instance is booted and the API is usable.\n */\nexport function useUniverDarkModeSync(\n apiRef: React.RefObject<FUniver | null>,\n ready: boolean,\n): void {\n const mode = getUniverHost().useThemeMode();\n\n useEffect(() => {\n if (!ready || !apiRef.current) return;\n apiRef.current.toggleDarkMode(mode === \"dark\");\n }, [apiRef, ready, mode]);\n}\n","/**\n * A saved snapshot names the collab-room entries it already holds, so a seat that boots from it never\n * replays them (2026-10-16: a reload showed the text twice). Pure — no Yjs — so the editors' model can\n * stamp and read it without loading the room.\n */\n\n/** The key a saved snapshot carries its covered room entries under (`stampCovered` / `takeCovered`). */\nexport const COLLAB_COVERED_KEY = \"__matrxCollabCovered\";\n\n/** The snapshot to SAVE: `snapshot` plus the room entries it holds (`WorkbookCollabSession.coveredNow`). */\nexport function stampCovered<T extends object>(snapshot: T, covered: readonly string[]): T {\n return { ...snapshot, [COLLAB_COVERED_KEY]: [...covered] };\n}\n\n/** A LOADED snapshot split into the content to mount and the room entries it already holds. */\nexport function takeCovered<T>(snapshot: T): { snapshot: T; covered: Set<string> } {\n if (!snapshot || typeof snapshot !== \"object\" || !(COLLAB_COVERED_KEY in (snapshot as object))) {\n return { snapshot, covered: new Set() };\n }\n const { [COLLAB_COVERED_KEY]: list, ...rest } = snapshot as Record<string, unknown>;\n return {\n snapshot: rest as T,\n covered: new Set(Array.isArray(list) ? list.filter((e): e is string => typeof e === \"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aAAa,YAAY,SAAS,SAAS,IAAI,WAAW;AAC1E;;;AClBA,mBAA0B;AASnB,SAAS,sBACd,QACA,OACM;AACN,QAAM,OAAO,cAAc,EAAE,aAAa;AAE1C,8BAAU,MAAM;AACd,QAAI,CAAC,SAAS,CAAC,OAAO,QAAS;AAC/B,WAAO,QAAQ,eAAe,SAAS,MAAM;AAAA,EAC/C,GAAG,CAAC,QAAQ,OAAO,IAAI,CAAC;AAC1B;;;AC3BO,IAAM,qBAAqB;AAG3B,SAAS,aAA+B,UAAa,SAA+B;AACzF,SAAO,EAAE,GAAG,UAAU,CAAC,kBAAkB,GAAG,CAAC,GAAG,OAAO,EAAE;AAC3D;AAGO,SAAS,YAAe,UAAoD;AACjF,MAAI,CAAC,YAAY,OAAO,aAAa,YAAY,EAAE,sBAAuB,WAAsB;AAC9F,WAAO,EAAE,UAAU,SAAS,oBAAI,IAAI,EAAE;AAAA,EACxC;AACA,QAAM,EAAE,CAAC,kBAAkB,GAAG,MAAM,GAAG,KAAK,IAAI;AAChD,SAAO;AAAA,IACL,UAAU;AAAA,IACV,SAAS,IAAI,IAAI,MAAM,QAAQ,IAAI,IAAI,KAAK,OAAO,CAAC,MAAmB,OAAO,MAAM,QAAQ,IAAI,CAAC,CAAC;AAAA,EACpG;AACF;","names":["import_core","import_core","import_ui"]}
package/dist/univer.d.cts CHANGED
@@ -1,6 +1,5 @@
1
1
  import { ICommandInfo, ImageSourceType, ImageUploadStatusType, IDisposable } from '@univerjs/core';
2
- import * as react from 'react';
3
- import { SVGAttributes } from 'react';
2
+ import { AddImageIcon } from '@univerjs/icons';
4
3
  import { FUniver } from '@univerjs/presets';
5
4
 
6
5
  /**
@@ -237,21 +236,12 @@ declare function swapContentGuarded(args: {
237
236
  previousRestored: boolean;
238
237
  };
239
238
 
240
- interface IIconProps extends SVGAttributes<SVGSVGElement> {
241
- /** Preserve scalable stroke widths relative to a 16×16 baseline. */
242
- preserveStrokeWidth?: boolean;
243
- extend?: IExtendProps;
244
- }
245
- interface IExtendProps {
246
- colorChannel1?: string;
247
- }
248
-
249
239
  type InjectorLike = {
250
240
  get(id: unknown): unknown;
251
241
  };
252
242
  /** Icons Univer's own plugins reference but do not register. */
253
243
  declare const MISSING_UNIVER_ICONS: {
254
- readonly AddImageIcon: react.ForwardRefExoticComponent<IIconProps & react.RefAttributes<SVGElement>>;
244
+ readonly AddImageIcon: typeof AddImageIcon;
255
245
  };
256
246
  declare function registerMissingUniverIcons(injector: InjectorLike): void;
257
247
 
@@ -345,4 +335,5 @@ declare function takeCovered<T>(snapshot: T): {
345
335
  covered: Set<string>;
346
336
  };
347
337
 
348
- export { COLLAB_COVERED_KEY, DOCUMENT_HISTORY_KIND, type EditorContentReplacer, type EditorRecordKind, type HistoryTabData, type HistoryToggleInput, type ImageStorePorts, MATRX_IMAGE_PREFIX, MISSING_UNIVER_ICONS, type NotificationReplaceableInjector, type SavedEditorSnapshot, type UniverHostPorts, type UniverToastId, WORKBOOK_HISTORY_KIND, configureUniverHost, createMatrxImageStore, disposeUniverInstance, documentHistoryToggleInput, getUniverHost, hasOpenEditorContent, identifyUniverUser, isMatrxImageSource, isSnapshotMutation, isWorkbookSnapshotMutation, matrxImageFileId, matrxImagePorts, readHistoryTab, registerMatrxImageStore, registerMissingUniverIcons, registerOpenEditorContent, registerUniverFacadeDependencies, releaseMatrxImageStore, resolveExportImage, resolveUniverCanvasColor, routeUniverNotificationsToApp, showSavedSnapshot, showUniverNotification, stampCovered, swapContentGuarded, takeCovered, univerOwnerId, uploadImportedImage, useUniverDarkModeSync, workbookHistoryToggleInput };
338
+ export { COLLAB_COVERED_KEY, DOCUMENT_HISTORY_KIND, MATRX_IMAGE_PREFIX, MISSING_UNIVER_ICONS, WORKBOOK_HISTORY_KIND, configureUniverHost, createMatrxImageStore, disposeUniverInstance, documentHistoryToggleInput, getUniverHost, hasOpenEditorContent, identifyUniverUser, isMatrxImageSource, isSnapshotMutation, isWorkbookSnapshotMutation, matrxImageFileId, matrxImagePorts, readHistoryTab, registerMatrxImageStore, registerMissingUniverIcons, registerOpenEditorContent, registerUniverFacadeDependencies, releaseMatrxImageStore, resolveExportImage, resolveUniverCanvasColor, routeUniverNotificationsToApp, showSavedSnapshot, showUniverNotification, stampCovered, swapContentGuarded, takeCovered, univerOwnerId, uploadImportedImage, useUniverDarkModeSync, workbookHistoryToggleInput };
339
+ export type { EditorContentReplacer, EditorRecordKind, HistoryTabData, HistoryToggleInput, ImageStorePorts, NotificationReplaceableInjector, SavedEditorSnapshot, UniverHostPorts, UniverToastId };
package/dist/univer.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import { ICommandInfo, ImageSourceType, ImageUploadStatusType, IDisposable } from '@univerjs/core';
2
- import * as react from 'react';
3
- import { SVGAttributes } from 'react';
2
+ import { AddImageIcon } from '@univerjs/icons';
4
3
  import { FUniver } from '@univerjs/presets';
5
4
 
6
5
  /**
@@ -237,21 +236,12 @@ declare function swapContentGuarded(args: {
237
236
  previousRestored: boolean;
238
237
  };
239
238
 
240
- interface IIconProps extends SVGAttributes<SVGSVGElement> {
241
- /** Preserve scalable stroke widths relative to a 16×16 baseline. */
242
- preserveStrokeWidth?: boolean;
243
- extend?: IExtendProps;
244
- }
245
- interface IExtendProps {
246
- colorChannel1?: string;
247
- }
248
-
249
239
  type InjectorLike = {
250
240
  get(id: unknown): unknown;
251
241
  };
252
242
  /** Icons Univer's own plugins reference but do not register. */
253
243
  declare const MISSING_UNIVER_ICONS: {
254
- readonly AddImageIcon: react.ForwardRefExoticComponent<IIconProps & react.RefAttributes<SVGElement>>;
244
+ readonly AddImageIcon: typeof AddImageIcon;
255
245
  };
256
246
  declare function registerMissingUniverIcons(injector: InjectorLike): void;
257
247
 
@@ -345,4 +335,5 @@ declare function takeCovered<T>(snapshot: T): {
345
335
  covered: Set<string>;
346
336
  };
347
337
 
348
- export { COLLAB_COVERED_KEY, DOCUMENT_HISTORY_KIND, type EditorContentReplacer, type EditorRecordKind, type HistoryTabData, type HistoryToggleInput, type ImageStorePorts, MATRX_IMAGE_PREFIX, MISSING_UNIVER_ICONS, type NotificationReplaceableInjector, type SavedEditorSnapshot, type UniverHostPorts, type UniverToastId, WORKBOOK_HISTORY_KIND, configureUniverHost, createMatrxImageStore, disposeUniverInstance, documentHistoryToggleInput, getUniverHost, hasOpenEditorContent, identifyUniverUser, isMatrxImageSource, isSnapshotMutation, isWorkbookSnapshotMutation, matrxImageFileId, matrxImagePorts, readHistoryTab, registerMatrxImageStore, registerMissingUniverIcons, registerOpenEditorContent, registerUniverFacadeDependencies, releaseMatrxImageStore, resolveExportImage, resolveUniverCanvasColor, routeUniverNotificationsToApp, showSavedSnapshot, showUniverNotification, stampCovered, swapContentGuarded, takeCovered, univerOwnerId, uploadImportedImage, useUniverDarkModeSync, workbookHistoryToggleInput };
338
+ export { COLLAB_COVERED_KEY, DOCUMENT_HISTORY_KIND, MATRX_IMAGE_PREFIX, MISSING_UNIVER_ICONS, WORKBOOK_HISTORY_KIND, configureUniverHost, createMatrxImageStore, disposeUniverInstance, documentHistoryToggleInput, getUniverHost, hasOpenEditorContent, identifyUniverUser, isMatrxImageSource, isSnapshotMutation, isWorkbookSnapshotMutation, matrxImageFileId, matrxImagePorts, readHistoryTab, registerMatrxImageStore, registerMissingUniverIcons, registerOpenEditorContent, registerUniverFacadeDependencies, releaseMatrxImageStore, resolveExportImage, resolveUniverCanvasColor, routeUniverNotificationsToApp, showSavedSnapshot, showUniverNotification, stampCovered, swapContentGuarded, takeCovered, univerOwnerId, uploadImportedImage, useUniverDarkModeSync, workbookHistoryToggleInput };
339
+ export type { EditorContentReplacer, EditorRecordKind, HistoryTabData, HistoryToggleInput, ImageStorePorts, NotificationReplaceableInjector, SavedEditorSnapshot, UniverHostPorts, UniverToastId };
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/univer/ports.ts","../src/univer/history.ts","../src/univer/univerImageStore.ts","../src/univer/disposeUniverInstance.ts","../src/univer/identifyUniverUser.ts","../src/univer/isSnapshotMutation.ts","../src/univer/matrxImagePorts.ts","../src/univer/openEditorContent.ts","../src/univer/registerMissingUniverIcons.ts","../src/univer/registerUniverFacadeDependencies.ts","../src/univer/routeUniverNotificationsToApp.ts","../src/univer/univer-theme-token-color.ts","../src/univer/useUniverDarkModeSync.ts","../src/univer/collab/covered.ts"],"sourcesContent":["/**\n * The host ports of the Univer glue.\n *\n * The glue belongs to the package, but four things belong to the app that mounts an editor: the\n * toast path, the signed-in person, the file store, the snapshot catch-up read and the painted theme. The host states them\n * once at start-up with `configureUniverHost`; the glue reads them here. State sits on a\n * `globalThis` slot so a dual-bundled copy of the package still sees one host (dual-bundle rule).\n * An unconfigured port THROWS naming the port (nothing fails silently).\n */\n\nexport type UniverToastId = string | number;\ntype ToastShow = (title: string, options?: { description?: string; duration?: number }) => UniverToastId;\n\nexport interface UniverHostPorts {\n /** The app's toast path (one toaster per page). */\n toast: {\n success: ToastShow;\n info: ToastShow;\n warning: ToastShow;\n error: ToastShow;\n message: ToastShow;\n dismiss(id: UniverToastId): void;\n };\n /** Who is typing, or null when signed out. `metadata` is the auth user's metadata bag. */\n getSignedInUser(): Promise<{ id: string; email?: string | null; metadata?: Record<string, unknown> | null } | null>;\n /** The file store behind pictures on a sheet or in a document. */\n files: {\n upload(file: File): Promise<{ fileId: string }>;\n getBlob(fileId: string): Promise<Blob>;\n };\n /** The newest snapshot row of a workbook (the realtime catch-up read), or `data: null` when it has none. */\n readNewestWorkbookSnapshot(\n workbookId: string,\n ): Promise<{ data: { id?: string; created_by?: string | null; created_at?: string } | null; error: { message: string } | null }>;\n /** Tell the person a picture did not upload. */\n notifyUploadError(error: unknown): void;\n /** The painted color mode, as a React hook (re-renders on a switch). */\n useThemeMode(): \"light\" | \"dark\";\n}\n\nconst SLOT = Symbol.for(\"ai-matrx.office.univer-host\");\ntype Slot = { ports?: UniverHostPorts };\nconst slot = (): Slot => {\n const g = globalThis as Record<symbol, Slot | undefined>;\n return (g[SLOT] ??= {});\n};\n\nexport function configureUniverHost(ports: UniverHostPorts): void {\n slot().ports = ports;\n}\n\nexport function getUniverHost(): UniverHostPorts {\n const ports = slot().ports;\n if (!ports) throw new Error(\"@ai-matrx/office/univer: configureUniverHost(ports) was not called before an editor mounted.\");\n return ports;\n}\n","/**\n * A document's or a workbook's snapshot history as a canvas tab — the keys and toggle inputs the\n * editors use, and the reader the two history views use. One tab per document (`document-history`,\n * keyed by the document id) and per workbook (`workbook-history`, keyed by the workbook id).\n *\n * Pure: no React, no canvas package, no Univer. The two `defineCanvasKind` registrations stay with\n * the host app (matrx-frontend `features/canvas/host`) and lazy-load the views, so this module never\n * imports a view (the cycle the old `lib/univer/historyKinds.ts` closed).\n */\n\nexport const DOCUMENT_HISTORY_KIND = \"document-history\";\nexport const WORKBOOK_HISTORY_KIND = \"workbook-history\";\n\nexport interface HistoryTabData {\n id: string;\n editable: boolean;\n}\n\n/** Structurally the host's `ToolToggleInput` (the canvas toggle the editor's History button presses). */\nexport interface HistoryToggleInput {\n kind: string;\n key: string;\n title: string;\n data: { id: string; editable: boolean };\n followTitle: true;\n}\n\n/** A tab's data as a history subject, or null when it names no subject. */\nexport function readHistoryTab(data: unknown): HistoryTabData | null {\n if (typeof data !== \"object\" || data === null || Array.isArray(data)) return null;\n const record = data as Record<string, unknown>;\n const id = typeof record.id === \"string\" && record.id ? record.id : null;\n if (!id) return null;\n return { id, editable: record.editable !== false };\n}\n\n/** \"<what> · <subject>\", or just \"<what>\" while the subject has no name. */\nfunction subjectTitle(what: string, subject: string | null | undefined): string {\n const name = subject?.trim();\n return name ? `${what} · ${name}` : what;\n}\n\n// The tab names its subject — two open history tabs never share a title, and\n// the editor that owns the toggle keeps it in step with a rename.\nexport function documentHistoryToggleInput(documentId: string, editable: boolean, documentName?: string | null): HistoryToggleInput {\n return {\n kind: DOCUMENT_HISTORY_KIND,\n key: documentId,\n title: subjectTitle(\"Document history\", documentName),\n data: { id: documentId, editable },\n followTitle: true,\n };\n}\n\nexport function workbookHistoryToggleInput(workbookId: string, editable: boolean, workbookName?: string | null): HistoryToggleInput {\n return {\n kind: WORKBOOK_HISTORY_KIND,\n key: workbookId,\n title: subjectTitle(\"Workbook history\", workbookName),\n data: { id: workbookId, editable },\n followTitle: true,\n };\n}\n","/**\n * univerImageStore — images on a sheet or in a document live in OUR file\n * store; the Univer snapshot holds only a reference (`matrx-file:<fileId>`).\n *\n * Why: Univer's stock image service inlines every picture as base64 into the\n * snapshot, so one 2 MB photo made every autosave, history row and collab\n * mutation ~2 MB. Here `saveImage` uploads the file and hands Univer a URL-type\n * source; Univer's URL-image downloader turns the reference back into bytes\n * (`getBlob` → object URL) when it paints. Images already inline (BASE64\n * sources) are untouched and keep rendering.\n */\n\nimport {\n IImageIoService,\n IURLImageService,\n ImageSourceType,\n ImageUploadStatusType,\n generateRandomId,\n} from \"@univerjs/core\";\n\nexport const MATRX_IMAGE_PREFIX = \"matrx-file:\";\n\nexport const isMatrxImageSource = (source: string): boolean =>\n source.startsWith(MATRX_IMAGE_PREFIX);\n\nexport const matrxImageFileId = (source: string): string =>\n source.slice(MATRX_IMAGE_PREFIX.length);\n\nexport type ImageStorePorts = {\n upload(file: File): Promise<{ fileId: string }>;\n getBlob(fileId: string): Promise<Blob>;\n /** Called when an upload fails, so the person is told (never silent). */\n onUploadError(error: unknown): void;\n};\n\nconst ALLOWED = [\"image/png\", \"image/jpeg\", \"image/jpg\", \"image/gif\", \"image/bmp\", \"image/webp\"];\n\ntype ImageIo = {\n saveImage(file: File): Promise<unknown>;\n};\ntype UrlImages = {\n registerURLImageDownloader(d: (url: string) => Promise<string>): { dispose(): void };\n};\ntype InjectorLike = { get(id: unknown): unknown };\n\n/** Pure core: the two replacements, given ports. */\nexport function createMatrxImageStore(ports: ImageStorePorts) {\n const blobUrls = new Map<string, Promise<string>>();\n return {\n /** Revoke every object URL this store made (the editor is going away). */\n dispose() {\n for (const pending of blobUrls.values()) void pending.then((url) => URL.revokeObjectURL(url), () => undefined);\n blobUrls.clear();\n },\n async saveImage(file: File) {\n if (!ALLOWED.includes(file.type)) throw new Error(\"ERROR_IMAGE_TYPE\");\n let fileId: string;\n try {\n ({ fileId } = await ports.upload(file));\n } catch (error) {\n ports.onUploadError(error);\n throw error;\n }\n const source = MATRX_IMAGE_PREFIX + fileId;\n // Univer measures the picture from base64Cache before it inserts (an empty one throws, nothing is\n // inserted). A blob URL of the file just chosen serves that and paints it; it is never saved.\n const localUrl = URL.createObjectURL(file);\n blobUrls.set(fileId, Promise.resolve(localUrl));\n return {\n imageId: generateRandomId(6),\n imageSourceType: ImageSourceType.URL,\n source,\n base64Cache: localUrl,\n status: ImageUploadStatusType.SUCCUSS,\n };\n },\n async download(url: string): Promise<string> {\n if (!isMatrxImageSource(url)) return url;\n const fileId = matrxImageFileId(url);\n let pending = blobUrls.get(fileId);\n if (!pending) {\n pending = ports.getBlob(fileId).then((blob) => URL.createObjectURL(blob));\n blobUrls.set(fileId, pending);\n pending.catch(() => blobUrls.delete(fileId));\n }\n return pending;\n },\n };\n}\n\nconst stores = new WeakMap<object, { dispose(): void }>();\n\n/** Release the object URLs of the store wired into this Univer instance (call as the instance is disposed). */\nexport function releaseMatrxImageStore(injector: object | null | undefined): void {\n if (!injector) return;\n stores.get(injector)?.dispose();\n stores.delete(injector);\n}\n\n/** Wire the store into one Univer instance's image services. */\nexport function registerMatrxImageStore(injector: InjectorLike, ports: ImageStorePorts): void {\n const store = createMatrxImageStore(ports);\n stores.set(injector, store);\n const io = injector.get(IImageIoService) as ImageIo;\n io.saveImage = store.saveImage as ImageIo[\"saveImage\"];\n const urls = injector.get(IURLImageService) as UrlImages;\n urls.registerURLImageDownloader(store.download);\n}\n","import { releaseMatrxImageStore } from \"./univerImageStore\";\n\n/** Univer owns React roots; synchronous dispose during React commit causes races. */\nexport function disposeUniverInstance(\n instance: { dispose(): void } | null | undefined,\n): void {\n const target = instance;\n if (!target) return;\n const injector = (target as { __getInjector?: () => object }).__getInjector?.();\n queueMicrotask(() => {\n releaseMatrxImageStore(injector);\n try {\n target.dispose();\n } catch {\n // Instance may already be torn down by a concurrent unmount.\n }\n });\n}\n","import { UserManagerService } from \"@univerjs/core\";\nimport { getUniverHost } from \"./ports\";\n\ntype InjectorLike = { get(id: unknown): unknown };\n\n/**\n * Tell Univer who is typing, so a comment thread is attributed to the\n * signed-in person instead of Univer's placeholder owner.\n *\n * The userID MUST keep the `Owner_` prefix: Univer's built-in local\n * permission service grants unit roles by user-id prefix (`isDevRole`), so a\n * bare uuid gets no role and every edit is refused as \"range is protected\".\n * Our own access (canActOn) decides editability; Univer must always see an\n * owner. Guarded by identify-univer-user-keeps-owner-role.test.ts.\n */\nexport async function identifyUniverUser(injector: InjectorLike): Promise<void> {\n const user = await getUniverHost().getSignedInUser();\n if (!user?.id) return;\n const meta = (user.metadata ?? {}) as Record<string, unknown>;\n const name = String(meta.full_name ?? meta.name ?? user.email ?? \"You\");\n const users = injector.get(UserManagerService) as {\n setCurrentUser(u: { userID: string; name: string; avatar: string }): void;\n };\n users.setCurrentUser({ userID: univerOwnerId(user.id), name, avatar: String(meta.avatar_url ?? \"\") });\n}\n\n/** Univer's local permission service reads the role from this prefix. */\nexport function univerOwnerId(userId: string): string {\n return `Owner_${userId}`;\n}\n","/**\n * isSnapshotMutation — the autosave dirty-filter for the Univer editors.\n *\n * D97: `onCommandExecuted` fires for EVERY command — including viewport\n * scrolls and selection moves — so an unfiltered listener marked the doc\n * dirty on mere scrolling and wrote a new snapshot row (version history +\n * collab broadcast) 2.5s later. Only CommandType.MUTATION changes the data\n * that a snapshot persists (Univer's own docs: OPERATION = \"not saved to\n * snapshot, such as modifying scroll position\"). We therefore accept ONLY\n * mutations, and additionally deny-list any mutation whose id marks it as\n * scroll / selection / viewport bookkeeping, belt-and-braces.\n */\nimport type { ICommandInfo } from \"@univerjs/core\";\n\n/**\n * Univer's `CommandType.MUTATION`. A literal, so this filter (and the document\n * model that uses it outside the editor chunk) never pulls Univer's runtime —\n * which touches `window` at import — into a server-rendered chunk.\n */\nconst MUTATION = 2;\n\n/** Non-content command ids that must never mark the document dirty. */\nconst NON_CONTENT_ID_PATTERN =\n /(scroll|selection|set-selections|viewport|zoom|hover|cursor|focus|activate)/i;\n\nexport function isSnapshotMutation(command: ICommandInfo): boolean {\n if (command.type !== MUTATION) return false;\n if (NON_CONTENT_ID_PATTERN.test(command.id)) return false;\n return true;\n}\n\n/**\n * Mutations a SPREADSHEET fires on its own while it opens and recalculates —\n * they change nothing the person typed, so they must never mark the workbook\n * dirty. Observed on a plain open of a workbook with formulas (2026-10-10):\n * `formula.mutation.set-trigger-formula-calculation-start`,\n * `...set-formula-calculation-start`, `...set-formula-calculation-notification`\n * and a `doc.mutation.rich-text-editing` from the internal cell-editor document.\n * Each open then wrote a new snapshot (history bloat, and a false \"both changed\"\n * against Google). A real edit always arrives as a `sheet.mutation.*`.\n */\nconst WORKBOOK_SELF_MUTATION_PATTERN =\n /^(formula\\.mutation\\.[a-z-]*(calculation|trigger)[a-z-]*|doc\\.mutation\\.)/;\n\nexport function isWorkbookSnapshotMutation(command: ICommandInfo): boolean {\n if (!isSnapshotMutation(command)) return false;\n return !WORKBOOK_SELF_MUTATION_PATTERN.test(command.id);\n}\n","import { getUniverHost } from \"./ports\";\nimport { isMatrxImageSource, matrxImageFileId, type ImageStorePorts } from \"./univerImageStore\";\n\n/** The real file-store ports (the host's): upload, read back as a blob, tell the person on failure. */\nexport const matrxImagePorts: ImageStorePorts = {\n async upload(file) {\n return getUniverHost().files.upload(file);\n },\n getBlob(fileId) {\n return getUniverHost().files.getBlob(fileId);\n },\n onUploadError(error) {\n getUniverHost().notifyUploadError(error);\n },\n};\n\n/** Export: a snapshot picture source (`matrx-file:<id>` or a URL) as bytes + type, or null if unreadable. */\nexport async function resolveExportImage(\n source: string,\n): Promise<{ bytes: Uint8Array; extension: \"png\" | \"jpeg\" | \"gif\" } | null> {\n let blob: Blob;\n if (isMatrxImageSource(source)) {\n blob = await getUniverHost().files.getBlob(matrxImageFileId(source));\n } else {\n const res = await fetch(source);\n if (!res.ok) return null;\n blob = await res.blob();\n }\n const extension = blob.type.includes(\"gif\") ? \"gif\" : blob.type.includes(\"png\") ? \"png\" : \"jpeg\";\n return { bytes: new Uint8Array(await blob.arrayBuffer()), extension };\n}\n\n/** Import: store a picture from a file, return its file id. */\nexport async function uploadImportedImage(bytes: Uint8Array, extension: string): Promise<string> {\n const mime = extension === \"jpg\" ? \"image/jpeg\" : `image/${extension}`;\n const { fileId } = await getUniverHost().files.upload(new File([bytes as BlobPart], `image.${extension}`, { type: mime }));\n return fileId;\n}\n","/**\n * THE ONE way to replace the whole content of an open Univer editor\n * (workbook or document) with a snapshot that is already SAVED: a history\n * restore, \"Update from Google\" / \"Use Google's\", and a collaborator's\n * replacement all arrive here.\n *\n * Callers save first, then call `showSavedSnapshot`. The open editor for that\n * record (registered below) swaps its content in place, drops its pending\n * autosave (it would write the old content back over the new one), and — in\n * a collab room — tells every peer to reload the same snapshot. A caller\n * never touches Univer units itself: disposing the current unit by hand left\n * Univer's selection observers pointing at nothing (`getUnitId` of null).\n *\n * Pure registry (no Univer import), so it is testable without booting Univer.\n */\n\nexport type EditorRecordKind = \"workbook\" | \"document\";\n\n/** A snapshot row as stored: its id and the Univer body. */\nexport type SavedEditorSnapshot = { id: string; snapshot: unknown };\n\nexport type EditorContentReplacer = (row: SavedEditorSnapshot) => void | Promise<void>;\n\nconst replacers = new Map<string, EditorContentReplacer>();\n\nconst keyOf = (kind: EditorRecordKind, recordId: string) => `${kind}:${recordId}`;\n\n/**\n * The open editor of a record lends its replacer while it is mounted. The\n * newest registration wins; the returned release only removes its own.\n */\nexport function registerOpenEditorContent(\n kind: EditorRecordKind,\n recordId: string,\n replace: EditorContentReplacer,\n): () => void {\n const key = keyOf(kind, recordId);\n replacers.set(key, replace);\n return () => {\n if (replacers.get(key) === replace) replacers.delete(key);\n };\n}\n\n/** Whether an editor of this record is open in this tab. */\nexport function hasOpenEditorContent(kind: EditorRecordKind, recordId: string): boolean {\n return replacers.has(keyOf(kind, recordId));\n}\n\n/**\n * Show a saved snapshot in the record's open editor (and its collab peers).\n * Returns false when no editor of the record is open in this tab — the saved\n * row then simply is the content the next open loads.\n */\nexport async function showSavedSnapshot(\n kind: EditorRecordKind,\n recordId: string,\n row: SavedEditorSnapshot,\n): Promise<boolean> {\n const replace = replacers.get(keyOf(kind, recordId));\n if (!replace) return false;\n await replace(row);\n return true;\n}\n\n/**\n * THE CONTENT-SWAP GUARD. A swap is dispose-then-create; if the create throws, the unit is gone and\n * the grid would stay blank. `swap(snapshot)` is the editor's own dispose+create (it disposes\n * whatever unit is open, if any). On a throw this puts the content that was open before straight\n * back (synchronously — never a blank grid) and says so; the editor then reloads the latest SAVED\n * version and still raises the original error, so the person is told.\n */\nexport function swapContentGuarded(args: {\n swap: (snapshot: unknown) => void;\n next: unknown;\n /** What was open before (`workbook.save()` taken before the swap), or null when nothing was. */\n previous: unknown | null;\n}): { ok: true } | { ok: false; error: unknown; previousRestored: boolean } {\n try {\n args.swap(args.next);\n return { ok: true };\n } catch (error) {\n let previousRestored = false;\n if (args.previous) {\n try {\n args.swap(args.previous);\n previousRestored = true;\n } catch {\n /* the latest saved version is tried next, by the caller */\n }\n }\n return { ok: false, error, previousRestored };\n }\n}\n","\"use client\";\n\n/**\n * Univer's drawing UI names `AddImageIcon` on its Insert-image menu items but\n * never registers it (upstream gap), so the icon manager logs \"Icon AddImageIcon\n * does not exist\" on every editor load. Register it ourselves, right after\n * `createUniver`, so the toolbar draws a real icon and the console stays clean.\n */\n\nimport { IconManager } from \"@univerjs/ui\";\nimport { AddImageIcon } from \"@univerjs/icons\";\n\ntype InjectorLike = { get(id: unknown): unknown };\n\n/** Icons Univer's own plugins reference but do not register. */\nexport const MISSING_UNIVER_ICONS = { AddImageIcon } as const;\n\nexport function registerMissingUniverIcons(injector: InjectorLike): void {\n const icons = injector.get(IconManager) as {\n register(icons: Record<string, unknown>): unknown;\n };\n icons.register({ ...MISSING_UNIVER_ICONS });\n}\n","type UniverDependency = new (...args: never[]) => unknown;\n\ntype UniverInjector = {\n has(dependency: UniverDependency): boolean;\n add(dependency: [UniverDependency]): void;\n};\n\n/**\n * Register services required by process-global Univer Facade observers.\n *\n * Facade modules can outlive the editor type that first imported them, so a\n * later Univer instance may receive their lifecycle callbacks without loading\n * that type's plugins. Registration is intentionally narrow: callers name only\n * the observer dependencies that are safe for their instance.\n */\nexport function registerUniverFacadeDependencies(\n injector: UniverInjector,\n dependencies: readonly UniverDependency[],\n): void {\n for (const dependency of dependencies) {\n if (!injector.has(dependency)) injector.add([dependency]);\n }\n}\n","\"use client\";\n\n/**\n * Univer's notifications go through the APP's toast path — one toaster per page.\n *\n * Univer's own `DesktopNotificationService` mounts a second sonner `<Toaster>`\n * into its workbench the moment it is created. sonner's toast store is global,\n * so with the app's Toaster also mounted every toast (ours and Univer's) showed\n * twice on a workbook or document page. Replacing the service before anything\n * resolves it means Univer never mounts that Toaster, and what Univer has to\n * say (clipboard permission, paste limits) reaches the person through\n * the host's toast port like every other message (tracked, Error Inspector, Alchemy).\n *\n * Call right after `createUniver`, before the first unit is created.\n */\n\nimport { toDisposable, type IDisposable } from \"@univerjs/core\";\nimport { INotificationService } from \"@univerjs/ui\";\n\nimport { getUniverHost } from \"./ports\";\n\ntype UniverNotification = {\n title: unknown;\n content?: string;\n type?: \"success\" | \"info\" | \"warning\" | \"error\" | \"message\" | \"loading\";\n duration?: number;\n};\n\nexport interface NotificationReplaceableInjector {\n replace?: (dependency: [unknown, unknown]) => void;\n}\n\n/** Show one Univer notification as an app toast; dismissing the disposable removes it. */\nexport function showUniverNotification(params: UniverNotification): IDisposable {\n const title = typeof params.title === \"string\" ? params.title : String(params.title ?? \"\");\n const options = {\n ...(params.content ? { description: params.content } : {}),\n ...(params.duration !== undefined ? { duration: params.duration } : {}),\n };\n const kind = params.type ?? \"message\";\n const { toast } = getUniverHost();\n const show = kind === \"loading\" ? toast.message : toast[kind];\n const id = show(title, options) as string | number;\n return toDisposable(() => toast.dismiss(id));\n}\n\nexport function routeUniverNotificationsToApp(\n injector: NotificationReplaceableInjector | null | undefined,\n): { applied: boolean; reason?: string } {\n if (!injector || typeof injector.replace !== \"function\") {\n return { applied: false, reason: \"injector has no replace()\" };\n }\n try {\n injector.replace([INotificationService, { useValue: { show: showUniverNotification } }]);\n return { applied: true };\n } catch (err) {\n return { applied: false, reason: err instanceof Error ? err.message : String(err) };\n }\n}\n","/**\n * Resolve a color Univer hands its canvas — WITHOUT the dark-mode inversion.\n *\n * Univer 1.0 writes many of its own fills as THEME TOKENS, not colors: the\n * page is `\"gray.0\"`, the desk `\"gray.100\"`, the page outline `\"gray.200\"`,\n * default ink `\"gray.900\"` (engine-render 1.0.2 `DocBackground`, docs-ui\n * `resolveDocRenderBackground`). Its `CanvasColorService` turns a token into a\n * color before anything reaches `ctx.fillStyle`; its `DumbCanvasColorService`\n * does NOT — it returns `\"gray.0\"` as-is. A canvas IGNORES a `fillStyle` it\n * cannot parse and keeps the previous one, which starts as `#000000`, so with\n * the dumb service every page came out solid black and the canvas element's\n * CSS background (`style.backgroundColor = \"gray.100\"`, also ignored) stayed\n * transparent — in every browser, headed or headless, light or dark.\n *\n * Pure (no Univer import) so the jest test and `check:univer-doc-theme` drive\n * the same function the editor installs.\n */\n\n/** `palette.shade` — the shape Univer's theme tokens take (`gray.0`, `primary.600`). */\nconst THEME_TOKEN = /^[a-zA-Z]+\\.[a-zA-Z0-9]+$/;\n\n/**\n * @param color What Univer is about to paint: a theme token or a real color.\n * @param lookup The live theme (`ThemeService.getColorFromTheme`).\n * @returns the token's color from the current theme; anything else unchanged.\n */\nexport function resolveUniverCanvasColor(\n color: string,\n lookup: (token: string) => unknown,\n): string {\n if (!THEME_TOKEN.test(color)) return color;\n const resolved = lookup(color);\n return typeof resolved === \"string\" && resolved.length > 0 ? resolved : color;\n}\n","/**\n * useUniverDarkModeSync — keep a Univer instance's dark mode in lockstep with\n * the app's painted theme (`<html class=\"dark\">` via `useThemeMode`).\n *\n * Univer owns its own theming (see https://docs.univer.ai/guides/docs/ui/themes):\n * you boot it with `theme` + `darkMode`, then flip dark mode at runtime via the\n * Facade API `univerAPI.toggleDarkMode(isDark)`. This is the ONLY supported way\n * to theme Univer — do NOT try to force it with a `colorScheme` CSS override on\n * a wrapper (that just fights Univer's own popups/portals and breaks dark mode).\n *\n * Shared by every Univer surface (DocumentEditor, WorkbookEditor) so the\n * theme→Univer bridge lives in exactly one place.\n */\n\"use client\";\n\nimport { useEffect } from \"react\";\nimport type { FUniver } from \"@univerjs/presets\";\n\nimport { getUniverHost } from \"./ports\";\n\n/**\n * @param apiRef Ref holding the Univer Facade API (set once the instance boots).\n * @param ready True once the instance is booted and the API is usable.\n */\nexport function useUniverDarkModeSync(\n apiRef: React.RefObject<FUniver | null>,\n ready: boolean,\n): void {\n const mode = getUniverHost().useThemeMode();\n\n useEffect(() => {\n if (!ready || !apiRef.current) return;\n apiRef.current.toggleDarkMode(mode === \"dark\");\n }, [apiRef, ready, mode]);\n}\n","/**\n * A saved snapshot names the collab-room entries it already holds, so a seat that boots from it never\n * replays them (2026-10-16: a reload showed the text twice). Pure — no Yjs — so the editors' model can\n * stamp and read it without loading the room.\n */\n\n/** The key a saved snapshot carries its covered room entries under (`stampCovered` / `takeCovered`). */\nexport const COLLAB_COVERED_KEY = \"__matrxCollabCovered\";\n\n/** The snapshot to SAVE: `snapshot` plus the room entries it holds (`WorkbookCollabSession.coveredNow`). */\nexport function stampCovered<T extends object>(snapshot: T, covered: readonly string[]): T {\n return { ...snapshot, [COLLAB_COVERED_KEY]: [...covered] };\n}\n\n/** A LOADED snapshot split into the content to mount and the room entries it already holds. */\nexport function takeCovered<T>(snapshot: T): { snapshot: T; covered: Set<string> } {\n if (!snapshot || typeof snapshot !== \"object\" || !(COLLAB_COVERED_KEY in (snapshot as object))) {\n return { snapshot, covered: new Set() };\n }\n const { [COLLAB_COVERED_KEY]: list, ...rest } = snapshot as Record<string, unknown>;\n return {\n snapshot: rest as T,\n covered: new Set(Array.isArray(list) ? list.filter((e): e is string => typeof e ===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C/B,WAAO,QAAQ,eAAe,SAAS,MAAM;AAAA,EAC/C,GAAG,CAAC,QAAQ,OAAO,IAAI,CAAC;AAC1B;;;AC3BO,IAAM,qBAAqB;AAG3B,SAAS,aAA+B,UAAa,SAA+B;AACzF,SAAO,EAAE,GAAG,UAAU,CAAC,kBAAkB,GAAG,CAAC,GAAG,OAAO,EAAE;AAC3D;AAGO,SAAS,YAAe,UAAoD;AACjF,MAAI,CAAC,YAAY,OAAO,aAAa,YAAY,EAAE,sBAAuB,WAAsB;AAC9F,WAAO,EAAE,UAAU,SAAS,oBAAI,IAAI,EAAE;AAAA,EACxC;AACA,QAAM,EAAE,CAAC,kBAAkB,GAAG,MAAM,GAAG,KAAK,IAAI;AAChD,SAAO;AAAA,IACL,UAAU;AAAA,IACV,SAAS,IAAI,IAAI,MAAM,QAAQ,IAAI,IAAI,KAAK,OAAO,CAAC,MAAmB,OAAO,MAAM,QAAQ,IAAI,CAAC,CAAC;AAAA,EACpG;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/univer/ports.ts","../src/univer/history.ts","../src/univer/univerImageStore.ts","../src/univer/disposeUniverInstance.ts","../src/univer/identifyUniverUser.ts","../src/univer/isSnapshotMutation.ts","../src/univer/matrxImagePorts.ts","../src/univer/openEditorContent.ts","../src/univer/registerMissingUniverIcons.ts","../src/univer/registerUniverFacadeDependencies.ts","../src/univer/routeUniverNotificationsToApp.ts","../src/univer/univer-theme-token-color.ts","../src/univer/useUniverDarkModeSync.ts","../src/univer/collab/covered.ts"],"sourcesContent":["/**\n * The host ports of the Univer glue.\n *\n * The glue belongs to the package, but four things belong to the app that mounts an editor: the\n * toast path, the signed-in person, the file store, the snapshot catch-up read and the painted theme. The host states them\n * once at start-up with `configureUniverHost`; the glue reads them here. State sits on a\n * `globalThis` slot so a dual-bundled copy of the package still sees one host (dual-bundle rule).\n * An unconfigured port THROWS naming the port (nothing fails silently).\n */\n\nexport type UniverToastId = string | number;\ntype ToastShow = (title: string, options?: { description?: string; duration?: number }) => UniverToastId;\n\nexport interface UniverHostPorts {\n /** The app's toast path (one toaster per page). */\n toast: {\n success: ToastShow;\n info: ToastShow;\n warning: ToastShow;\n error: ToastShow;\n message: ToastShow;\n dismiss(id: UniverToastId): void;\n };\n /** Who is typing, or null when signed out. `metadata` is the auth user's metadata bag. */\n getSignedInUser(): Promise<{ id: string; email?: string | null; metadata?: Record<string, unknown> | null } | null>;\n /** The file store behind pictures on a sheet or in a document. */\n files: {\n upload(file: File): Promise<{ fileId: string }>;\n getBlob(fileId: string): Promise<Blob>;\n };\n /** The newest snapshot row of a workbook (the realtime catch-up read), or `data: null` when it has none. */\n readNewestWorkbookSnapshot(\n workbookId: string,\n ): Promise<{ data: { id?: string; created_by?: string | null; created_at?: string } | null; error: { message: string } | null }>;\n /** Tell the person a picture did not upload. */\n notifyUploadError(error: unknown): void;\n /** The painted color mode, as a React hook (re-renders on a switch). */\n useThemeMode(): \"light\" | \"dark\";\n}\n\nconst SLOT = Symbol.for(\"ai-matrx.office.univer-host\");\ntype Slot = { ports?: UniverHostPorts };\nconst slot = (): Slot => {\n const g = globalThis as Record<symbol, Slot | undefined>;\n return (g[SLOT] ??= {});\n};\n\nexport function configureUniverHost(ports: UniverHostPorts): void {\n slot().ports = ports;\n}\n\nexport function getUniverHost(): UniverHostPorts {\n const ports = slot().ports;\n if (!ports) throw new Error(\"@ai-matrx/office/univer: configureUniverHost(ports) was not called before an editor mounted.\");\n return ports;\n}\n","/**\n * A document's or a workbook's snapshot history as a canvas tab — the keys and toggle inputs the\n * editors use, and the reader the two history views use. One tab per document (`document-history`,\n * keyed by the document id) and per workbook (`workbook-history`, keyed by the workbook id).\n *\n * Pure: no React, no canvas package, no Univer. The two `defineCanvasKind` registrations stay with\n * the host app (matrx-frontend `features/canvas/host`) and lazy-load the views, so this module never\n * imports a view (the cycle the old `lib/univer/historyKinds.ts` closed).\n */\n\nexport const DOCUMENT_HISTORY_KIND = \"document-history\";\nexport const WORKBOOK_HISTORY_KIND = \"workbook-history\";\n\nexport interface HistoryTabData {\n id: string;\n editable: boolean;\n}\n\n/** Structurally the host's `ToolToggleInput` (the canvas toggle the editor's History button presses). */\nexport interface HistoryToggleInput {\n kind: string;\n key: string;\n title: string;\n data: { id: string; editable: boolean };\n followTitle: true;\n}\n\n/** A tab's data as a history subject, or null when it names no subject. */\nexport function readHistoryTab(data: unknown): HistoryTabData | null {\n if (typeof data !== \"object\" || data === null || Array.isArray(data)) return null;\n const record = data as Record<string, unknown>;\n const id = typeof record.id === \"string\" && record.id ? record.id : null;\n if (!id) return null;\n return { id, editable: record.editable !== false };\n}\n\n/** \"<what> · <subject>\", or just \"<what>\" while the subject has no name. */\nfunction subjectTitle(what: string, subject: string | null | undefined): string {\n const name = subject?.trim();\n return name ? `${what} · ${name}` : what;\n}\n\n// The tab names its subject — two open history tabs never share a title, and\n// the editor that owns the toggle keeps it in step with a rename.\nexport function documentHistoryToggleInput(documentId: string, editable: boolean, documentName?: string | null): HistoryToggleInput {\n return {\n kind: DOCUMENT_HISTORY_KIND,\n key: documentId,\n title: subjectTitle(\"Document history\", documentName),\n data: { id: documentId, editable },\n followTitle: true,\n };\n}\n\nexport function workbookHistoryToggleInput(workbookId: string, editable: boolean, workbookName?: string | null): HistoryToggleInput {\n return {\n kind: WORKBOOK_HISTORY_KIND,\n key: workbookId,\n title: subjectTitle(\"Workbook history\", workbookName),\n data: { id: workbookId, editable },\n followTitle: true,\n };\n}\n","/**\n * univerImageStore — images on a sheet or in a document live in OUR file\n * store; the Univer snapshot holds only a reference (`matrx-file:<fileId>`).\n *\n * Why: Univer's stock image service inlines every picture as base64 into the\n * snapshot, so one 2 MB photo made every autosave, history row and collab\n * mutation ~2 MB. Here `saveImage` uploads the file and hands Univer a URL-type\n * source; Univer's URL-image downloader turns the reference back into bytes\n * (`getBlob` → object URL) when it paints. Images already inline (BASE64\n * sources) are untouched and keep rendering.\n */\n\nimport {\n IImageIoService,\n IURLImageService,\n ImageSourceType,\n ImageUploadStatusType,\n generateRandomId,\n} from \"@univerjs/core\";\n\nexport const MATRX_IMAGE_PREFIX = \"matrx-file:\";\n\nexport const isMatrxImageSource = (source: string): boolean =>\n source.startsWith(MATRX_IMAGE_PREFIX);\n\nexport const matrxImageFileId = (source: string): string =>\n source.slice(MATRX_IMAGE_PREFIX.length);\n\nexport type ImageStorePorts = {\n upload(file: File): Promise<{ fileId: string }>;\n getBlob(fileId: string): Promise<Blob>;\n /** Called when an upload fails, so the person is told (never silent). */\n onUploadError(error: unknown): void;\n};\n\nconst ALLOWED = [\"image/png\", \"image/jpeg\", \"image/jpg\", \"image/gif\", \"image/bmp\", \"image/webp\"];\n\ntype ImageIo = {\n saveImage(file: File): Promise<unknown>;\n};\ntype UrlImages = {\n registerURLImageDownloader(d: (url: string) => Promise<string>): { dispose(): void };\n};\ntype InjectorLike = { get(id: unknown): unknown };\n\n/** Pure core: the two replacements, given ports. */\nexport function createMatrxImageStore(ports: ImageStorePorts) {\n const blobUrls = new Map<string, Promise<string>>();\n return {\n /** Revoke every object URL this store made (the editor is going away). */\n dispose() {\n for (const pending of blobUrls.values()) void pending.then((url) => URL.revokeObjectURL(url), () => undefined);\n blobUrls.clear();\n },\n async saveImage(file: File) {\n if (!ALLOWED.includes(file.type)) throw new Error(\"ERROR_IMAGE_TYPE\");\n let fileId: string;\n try {\n ({ fileId } = await ports.upload(file));\n } catch (error) {\n ports.onUploadError(error);\n throw error;\n }\n const source = MATRX_IMAGE_PREFIX + fileId;\n // Univer measures the picture from base64Cache before it inserts (an empty one throws, nothing is\n // inserted). A blob URL of the file just chosen serves that and paints it; it is never saved.\n const localUrl = URL.createObjectURL(file);\n blobUrls.set(fileId, Promise.resolve(localUrl));\n return {\n imageId: generateRandomId(6),\n imageSourceType: ImageSourceType.URL,\n source,\n base64Cache: localUrl,\n status: ImageUploadStatusType.SUCCUSS,\n };\n },\n async download(url: string): Promise<string> {\n if (!isMatrxImageSource(url)) return url;\n const fileId = matrxImageFileId(url);\n let pending = blobUrls.get(fileId);\n if (!pending) {\n pending = ports.getBlob(fileId).then((blob) => URL.createObjectURL(blob));\n blobUrls.set(fileId, pending);\n pending.catch(() => blobUrls.delete(fileId));\n }\n return pending;\n },\n };\n}\n\nconst stores = new WeakMap<object, { dispose(): void }>();\n\n/** Release the object URLs of the store wired into this Univer instance (call as the instance is disposed). */\nexport function releaseMatrxImageStore(injector: object | null | undefined): void {\n if (!injector) return;\n stores.get(injector)?.dispose();\n stores.delete(injector);\n}\n\n/** Wire the store into one Univer instance's image services. */\nexport function registerMatrxImageStore(injector: InjectorLike, ports: ImageStorePorts): void {\n const store = createMatrxImageStore(ports);\n stores.set(injector, store);\n const io = injector.get(IImageIoService) as ImageIo;\n io.saveImage = store.saveImage as ImageIo[\"saveImage\"];\n const urls = injector.get(IURLImageService) as UrlImages;\n urls.registerURLImageDownloader(store.download);\n}\n","import { releaseMatrxImageStore } from \"./univerImageStore\";\n\n/** Univer owns React roots; synchronous dispose during React commit causes races. */\nexport function disposeUniverInstance(\n instance: { dispose(): void } | null | undefined,\n): void {\n const target = instance;\n if (!target) return;\n const injector = (target as { __getInjector?: () => object }).__getInjector?.();\n queueMicrotask(() => {\n releaseMatrxImageStore(injector);\n try {\n target.dispose();\n } catch {\n // Instance may already be torn down by a concurrent unmount.\n }\n });\n}\n","import { UserManagerService } from \"@univerjs/core\";\nimport { getUniverHost } from \"./ports\";\n\ntype InjectorLike = { get(id: unknown): unknown };\n\n/**\n * Tell Univer who is typing, so a comment thread is attributed to the\n * signed-in person instead of Univer's placeholder owner.\n *\n * The userID MUST keep the `Owner_` prefix: Univer's built-in local\n * permission service grants unit roles by user-id prefix (`isDevRole`), so a\n * bare uuid gets no role and every edit is refused as \"range is protected\".\n * Our own access (canActOn) decides editability; Univer must always see an\n * owner. Guarded by identify-univer-user-keeps-owner-role.test.ts.\n */\nexport async function identifyUniverUser(injector: InjectorLike): Promise<void> {\n const user = await getUniverHost().getSignedInUser();\n if (!user?.id) return;\n const meta = (user.metadata ?? {}) as Record<string, unknown>;\n const name = String(meta.full_name ?? meta.name ?? user.email ?? \"You\");\n const users = injector.get(UserManagerService) as {\n setCurrentUser(u: { userID: string; name: string; avatar: string }): void;\n };\n users.setCurrentUser({ userID: univerOwnerId(user.id), name, avatar: String(meta.avatar_url ?? \"\") });\n}\n\n/** Univer's local permission service reads the role from this prefix. */\nexport function univerOwnerId(userId: string): string {\n return `Owner_${userId}`;\n}\n","/**\n * isSnapshotMutation — the autosave dirty-filter for the Univer editors.\n *\n * D97: `onCommandExecuted` fires for EVERY command — including viewport\n * scrolls and selection moves — so an unfiltered listener marked the doc\n * dirty on mere scrolling and wrote a new snapshot row (version history +\n * collab broadcast) 2.5s later. Only CommandType.MUTATION changes the data\n * that a snapshot persists (Univer's own docs: OPERATION = \"not saved to\n * snapshot, such as modifying scroll position\"). We therefore accept ONLY\n * mutations, and additionally deny-list any mutation whose id marks it as\n * scroll / selection / viewport bookkeeping, belt-and-braces.\n */\nimport type { ICommandInfo } from \"@univerjs/core\";\n\n/**\n * Univer's `CommandType.MUTATION`. A literal, so this filter (and the document\n * model that uses it outside the editor chunk) never pulls Univer's runtime —\n * which touches `window` at import — into a server-rendered chunk.\n */\nconst MUTATION = 2;\n\n/** Non-content command ids that must never mark the document dirty. */\nconst NON_CONTENT_ID_PATTERN =\n /(scroll|selection|set-selections|viewport|zoom|hover|cursor|focus|activate)/i;\n\nexport function isSnapshotMutation(command: ICommandInfo): boolean {\n if (command.type !== MUTATION) return false;\n if (NON_CONTENT_ID_PATTERN.test(command.id)) return false;\n return true;\n}\n\n/**\n * Mutations a SPREADSHEET fires on its own while it opens and recalculates —\n * they change nothing the person typed, so they must never mark the workbook\n * dirty. Observed on a plain open of a workbook with formulas (2026-10-10):\n * `formula.mutation.set-trigger-formula-calculation-start`,\n * `...set-formula-calculation-start`, `...set-formula-calculation-notification`\n * and a `doc.mutation.rich-text-editing` from the internal cell-editor document.\n * Each open then wrote a new snapshot (history bloat, and a false \"both changed\"\n * against Google). A real edit always arrives as a `sheet.mutation.*`.\n */\nconst WORKBOOK_SELF_MUTATION_PATTERN =\n /^(formula\\.mutation\\.[a-z-]*(calculation|trigger)[a-z-]*|doc\\.mutation\\.)/;\n\nexport function isWorkbookSnapshotMutation(command: ICommandInfo): boolean {\n if (!isSnapshotMutation(command)) return false;\n return !WORKBOOK_SELF_MUTATION_PATTERN.test(command.id);\n}\n","import { getUniverHost } from \"./ports\";\nimport { isMatrxImageSource, matrxImageFileId, type ImageStorePorts } from \"./univerImageStore\";\n\n/** The real file-store ports (the host's): upload, read back as a blob, tell the person on failure. */\nexport const matrxImagePorts: ImageStorePorts = {\n async upload(file) {\n return getUniverHost().files.upload(file);\n },\n getBlob(fileId) {\n return getUniverHost().files.getBlob(fileId);\n },\n onUploadError(error) {\n getUniverHost().notifyUploadError(error);\n },\n};\n\n/** Export: a snapshot picture source (`matrx-file:<id>` or a URL) as bytes + type, or null if unreadable. */\nexport async function resolveExportImage(\n source: string,\n): Promise<{ bytes: Uint8Array; extension: \"png\" | \"jpeg\" | \"gif\" } | null> {\n let blob: Blob;\n if (isMatrxImageSource(source)) {\n blob = await getUniverHost().files.getBlob(matrxImageFileId(source));\n } else {\n const res = await fetch(source);\n if (!res.ok) return null;\n blob = await res.blob();\n }\n const extension = blob.type.includes(\"gif\") ? \"gif\" : blob.type.includes(\"png\") ? \"png\" : \"jpeg\";\n return { bytes: new Uint8Array(await blob.arrayBuffer()), extension };\n}\n\n/** Import: store a picture from a file, return its file id. */\nexport async function uploadImportedImage(bytes: Uint8Array, extension: string): Promise<string> {\n const mime = extension === \"jpg\" ? \"image/jpeg\" : `image/${extension}`;\n const { fileId } = await getUniverHost().files.upload(new File([bytes as BlobPart], `image.${extension}`, { type: mime }));\n return fileId;\n}\n","/**\n * THE ONE way to replace the whole content of an open Univer editor\n * (workbook or document) with a snapshot that is already SAVED: a history\n * restore, \"Update from Google\" / \"Use Google's\", and a collaborator's\n * replacement all arrive here.\n *\n * Callers save first, then call `showSavedSnapshot`. The open editor for that\n * record (registered below) swaps its content in place, drops its pending\n * autosave (it would write the old content back over the new one), and — in\n * a collab room — tells every peer to reload the same snapshot. A caller\n * never touches Univer units itself: disposing the current unit by hand left\n * Univer's selection observers pointing at nothing (`getUnitId` of null).\n *\n * Pure registry (no Univer import), so it is testable without booting Univer.\n */\n\nexport type EditorRecordKind = \"workbook\" | \"document\";\n\n/** A snapshot row as stored: its id and the Univer body. */\nexport type SavedEditorSnapshot = { id: string; snapshot: unknown };\n\nexport type EditorContentReplacer = (row: SavedEditorSnapshot) => void | Promise<void>;\n\nconst replacers = new Map<string, EditorContentReplacer>();\n\nconst keyOf = (kind: EditorRecordKind, recordId: string) => `${kind}:${recordId}`;\n\n/**\n * The open editor of a record lends its replacer while it is mounted. The\n * newest registration wins; the returned release only removes its own.\n */\nexport function registerOpenEditorContent(\n kind: EditorRecordKind,\n recordId: string,\n replace: EditorContentReplacer,\n): () => void {\n const key = keyOf(kind, recordId);\n replacers.set(key, replace);\n return () => {\n if (replacers.get(key) === replace) replacers.delete(key);\n };\n}\n\n/** Whether an editor of this record is open in this tab. */\nexport function hasOpenEditorContent(kind: EditorRecordKind, recordId: string): boolean {\n return replacers.has(keyOf(kind, recordId));\n}\n\n/**\n * Show a saved snapshot in the record's open editor (and its collab peers).\n * Returns false when no editor of the record is open in this tab — the saved\n * row then simply is the content the next open loads.\n */\nexport async function showSavedSnapshot(\n kind: EditorRecordKind,\n recordId: string,\n row: SavedEditorSnapshot,\n): Promise<boolean> {\n const replace = replacers.get(keyOf(kind, recordId));\n if (!replace) return false;\n await replace(row);\n return true;\n}\n\n/**\n * THE CONTENT-SWAP GUARD. A swap is dispose-then-create; if the create throws, the unit is gone and\n * the grid would stay blank. `swap(snapshot)` is the editor's own dispose+create (it disposes\n * whatever unit is open, if any). On a throw this puts the content that was open before straight\n * back (synchronously — never a blank grid) and says so; the editor then reloads the latest SAVED\n * version and still raises the original error, so the person is told.\n */\nexport function swapContentGuarded(args: {\n swap: (snapshot: unknown) => void;\n next: unknown;\n /** What was open before (`workbook.save()` taken before the swap), or null when nothing was. */\n previous: unknown | null;\n}): { ok: true } | { ok: false; error: unknown; previousRestored: boolean } {\n try {\n args.swap(args.next);\n return { ok: true };\n } catch (error) {\n let previousRestored = false;\n if (args.previous) {\n try {\n args.swap(args.previous);\n previousRestored = true;\n } catch {\n /* the latest saved version is tried next, by the caller */\n }\n }\n return { ok: false, error, previousRestored };\n }\n}\n","\"use client\";\n\n/**\n * Univer's drawing UI names `AddImageIcon` on its Insert-image menu items but\n * never registers it (upstream gap), so the icon manager logs \"Icon AddImageIcon\n * does not exist\" on every editor load. Register it ourselves, right after\n * `createUniver`, so the toolbar draws a real icon and the console stays clean.\n */\n\nimport { IconManager } from \"@univerjs/ui\";\nimport { AddImageIcon } from \"@univerjs/icons\";\n\ntype InjectorLike = { get(id: unknown): unknown };\n\n/** Icons Univer's own plugins reference but do not register. */\n// Annotated: the inferred type names Univer's internal `IIconProps`, which a declaration build\n// cannot reference portably (TS2883 under tsup 9's dts, which no longer injects `baseUrl`).\nexport const MISSING_UNIVER_ICONS: { readonly AddImageIcon: typeof AddImageIcon } = { AddImageIcon };\n\nexport function registerMissingUniverIcons(injector: InjectorLike): void {\n const icons = injector.get(IconManager) as {\n register(icons: Record<string, unknown>): unknown;\n };\n icons.register({ ...MISSING_UNIVER_ICONS });\n}\n","type UniverDependency = new (...args: never[]) => unknown;\n\ntype UniverInjector = {\n has(dependency: UniverDependency): boolean;\n add(dependency: [UniverDependency]): void;\n};\n\n/**\n * Register services required by process-global Univer Facade observers.\n *\n * Facade modules can outlive the editor type that first imported them, so a\n * later Univer instance may receive their lifecycle callbacks without loading\n * that type's plugins. Registration is intentionally narrow: callers name only\n * the observer dependencies that are safe for their instance.\n */\nexport function registerUniverFacadeDependencies(\n injector: UniverInjector,\n dependencies: readonly UniverDependency[],\n): void {\n for (const dependency of dependencies) {\n if (!injector.has(dependency)) injector.add([dependency]);\n }\n}\n","\"use client\";\n\n/**\n * Univer's notifications go through the APP's toast path — one toaster per page.\n *\n * Univer's own `DesktopNotificationService` mounts a second sonner `<Toaster>`\n * into its workbench the moment it is created. sonner's toast store is global,\n * so with the app's Toaster also mounted every toast (ours and Univer's) showed\n * twice on a workbook or document page. Replacing the service before anything\n * resolves it means Univer never mounts that Toaster, and what Univer has to\n * say (clipboard permission, paste limits) reaches the person through\n * the host's toast port like every other message (tracked, Error Inspector, Alchemy).\n *\n * Call right after `createUniver`, before the first unit is created.\n */\n\nimport { toDisposable, type IDisposable } from \"@univerjs/core\";\nimport { INotificationService } from \"@univerjs/ui\";\n\nimport { getUniverHost } from \"./ports\";\n\ntype UniverNotification = {\n title: unknown;\n content?: string;\n type?: \"success\" | \"info\" | \"warning\" | \"error\" | \"message\" | \"loading\";\n duration?: number;\n};\n\nexport interface NotificationReplaceableInjector {\n replace?: (dependency: [unknown, unknown]) => void;\n}\n\n/** Show one Univer notification as an app toast; dismissing the disposable removes it. */\nexport function showUniverNotification(params: UniverNotification): IDisposable {\n const title = typeof params.title === \"string\" ? params.title : String(params.title ?? \"\");\n const options = {\n ...(params.content ? { description: params.content } : {}),\n ...(params.duration !== undefined ? { duration: params.duration } : {}),\n };\n const kind = params.type ?? \"message\";\n const { toast } = getUniverHost();\n const show = kind === \"loading\" ? toast.message : toast[kind];\n const id = show(title, options) as string | number;\n return toDisposable(() => toast.dismiss(id));\n}\n\nexport function routeUniverNotificationsToApp(\n injector: NotificationReplaceableInjector | null | undefined,\n): { applied: boolean; reason?: string } {\n if (!injector || typeof injector.replace !== \"function\") {\n return { applied: false, reason: \"injector has no replace()\" };\n }\n try {\n injector.replace([INotificationService, { useValue: { show: showUniverNotification } }]);\n return { applied: true };\n } catch (err) {\n return { applied: false, reason: err instanceof Error ? err.message : String(err) };\n }\n}\n","/**\n * Resolve a color Univer hands its canvas — WITHOUT the dark-mode inversion.\n *\n * Univer 1.0 writes many of its own fills as THEME TOKENS, not colors: the\n * page is `\"gray.0\"`, the desk `\"gray.100\"`, the page outline `\"gray.200\"`,\n * default ink `\"gray.900\"` (engine-render 1.0.2 `DocBackground`, docs-ui\n * `resolveDocRenderBackground`). Its `CanvasColorService` turns a token into a\n * color before anything reaches `ctx.fillStyle`; its `DumbCanvasColorService`\n * does NOT — it returns `\"gray.0\"` as-is. A canvas IGNORES a `fillStyle` it\n * cannot parse and keeps the previous one, which starts as `#000000`, so with\n * the dumb service every page came out solid black and the canvas element's\n * CSS background (`style.backgroundColor = \"gray.100\"`, also ignored) stayed\n * transparent — in every browser, headed or headless, light or dark.\n *\n * Pure (no Univer import) so the jest test and `check:univer-doc-theme` drive\n * the same function the editor installs.\n */\n\n/** `palette.shade` — the shape Univer's theme tokens take (`gray.0`, `primary.600`). */\nconst THEME_TOKEN = /^[a-zA-Z]+\\.[a-zA-Z0-9]+$/;\n\n/**\n * @param color What Univer is about to paint: a theme token or a real color.\n * @param lookup The live theme (`ThemeService.getColorFromTheme`).\n * @returns the token's color from the current theme; anything else unchanged.\n */\nexport function resolveUniverCanvasColor(\n color: string,\n lookup: (token: string) => unknown,\n): string {\n if (!THEME_TOKEN.test(color)) return color;\n const resolved = lookup(color);\n return typeof resolved === \"string\" && resolved.length > 0 ? resolved : color;\n}\n","/**\n * useUniverDarkModeSync — keep a Univer instance's dark mode in lockstep with\n * the app's painted theme (`<html class=\"dark\">` via `useThemeMode`).\n *\n * Univer owns its own theming (see https://docs.univer.ai/guides/docs/ui/themes):\n * you boot it with `theme` + `darkMode`, then flip dark mode at runtime via the\n * Facade API `univerAPI.toggleDarkMode(isDark)`. This is the ONLY supported way\n * to theme Univer — do NOT try to force it with a `colorScheme` CSS override on\n * a wrapper (that just fights Univer's own popups/portals and breaks dark mode).\n *\n * Shared by every Univer surface (DocumentEditor, WorkbookEditor) so the\n * theme→Univer bridge lives in exactly one place.\n */\n\"use client\";\n\nimport { useEffect } from \"react\";\nimport type { FUniver } from \"@univerjs/presets\";\n\nimport { getUniverHost } from \"./ports\";\n\n/**\n * @param apiRef Ref holding the Univer Facade API (set once the instance boots).\n * @param ready True once the instance is booted and the API is usable.\n */\nexport function useUniverDarkModeSync(\n apiRef: React.RefObject<FUniver | null>,\n ready: boolean,\n): void {\n const mode = getUniverHost().useThemeMode();\n\n useEffect(() => {\n if (!ready || !apiRef.current) return;\n apiRef.current.toggleDarkMode(mode === \"dark\");\n }, [apiRef, ready, mode]);\n}\n","/**\n * A saved snapshot names the collab-room entries it already holds, so a seat that boots from it never\n * replays them (2026-10-16: a reload showed the text twice). Pure — no Yjs — so the editors' model can\n * stamp and read it without loading the room.\n */\n\n/** The key a saved snapshot carries its covered room entries under (`stampCovered` / `takeCovered`). */\nexport const COLLAB_COVERED_KEY = \"__matrxCollabCovered\";\n\n/** The snapshot to SAVE: `snapshot` plus the room entries it holds (`WorkbookCollabSession.coveredNow`). */\nexport function stampCovered<T extends object>(snapshot: T, covered: readonly string[]): T {\n return { ...snapshot, [COLLAB_COVERED_KEY]: [...covered] };\n}\n\n/** A LOADED snapshot split into the content to mount and the room entries it already holds. */\nexport function takeCovered<T>(snapshot: T): { snapshot: T; covered: Set<string> } {\n if (!snapshot || typeof snapshot !== \"object\" || !(COLLAB_COVERED_KEY in (snapshot as object))) {\n return { snapshot, covered: new Set() };\n }\n const { [COLLAB_COVERED_KEY]: list, ...rest } = snapshot as Record<string, unknown>;\n return {\n snapshot: rest as T,\n covered: new Set(Array.isArray(list) ? list.filter((e): e is string => typeof e === \"string\") : []),\n };\n}\n"],"mappings":";;;AAwCA,IAAM,OAAO,uBAAO,IAAI,6BAA6B;AAErD,IAAM,OAAO,MAAY;AACvB,QAAM,IAAI;AACV,SAAQ,EAAE,IAAI,MAAM,CAAC;AACvB;AAEO,SAAS,oBAAoB,OAA8B;AAChE,OAAK,EAAE,QAAQ;AACjB;AAEO,SAAS,gBAAiC;AAC/C,QAAM,QAAQ,KAAK,EAAE;AACrB,MAAI,CAAC,MAAO,OAAM,IAAI,MAAM,8FAA8F;AAC1H,SAAO;AACT;;;AC7CO,IAAM,wBAAwB;AA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AI,EAAE;AAAA,EACxC;AACA,QAAM,EAAE,CAAC,kBAAkB,GAAG,MAAM,GAAG,KAAK,IAAI;AAChD,SAAO;AAAA,IACL,UAAU;AAAA,IACV,SAAS,IAAI,IAAI,MAAM,QAAQ,IAAI,IAAI,KAAK,OAAO,CAAC,MAAmB,OAAO,MAAM,QAAQ,IAAI,CAAC,CAAC;AAAA,EACpG;AACF;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-matrx/office",
3
- "version": "0.8.66",
3
+ "version": "0.8.68",
4
4
  "description": "The AI Matrx Office layer: the editors' shared command and menu model, the Google and Microsoft ribbon model, page setup, the Office record types and the configured product hosts. The Univer glue shared by Sheets and Docs. Sheets, Docs and the other products arrive as sections of this one package.",
5
5
  "type": "module",
6
6
  "main": "./dist/core.cjs",
@@ -219,33 +219,6 @@
219
219
  "@supabase/supabase-js": ">=2.0.0",
220
220
  "react": ">=18.0.0"
221
221
  },
222
- "devDependencies": {
223
- "@ai-matrx/media": "0.15.1",
224
- "@ai-matrx/records-ui": "0.116.0",
225
- "@arethetypeswrong/cli": "^0.18.5",
226
- "@supabase/supabase-js": "^2.117.0",
227
- "@types/node": "^26.6.2",
228
- "@types/react": "19.3.0",
229
- "@univerjs/data-validation": "1.2.0",
230
- "@univerjs/drawing": "1.2.0",
231
- "@univerjs/engine-render": "1.2.0",
232
- "@univerjs/preset-sheets-core": "1.2.0",
233
- "@univerjs/sheets-conditional-formatting": "1.2.0",
234
- "@univerjs/sheets-data-validation": "1.2.0",
235
- "@univerjs/sheets-drawing": "1.2.0",
236
- "@univerjs/sheets-filter": "1.2.0",
237
- "@univerjs/sheets-formula": "1.2.0",
238
- "@univerjs/sheets-hyper-link": "1.2.0",
239
- "@univerjs/sheets-note": "1.2.0",
240
- "@univerjs/sheets-table": "1.2.0",
241
- "jsdom": "^30.1.1",
242
- "publint": "^0.3.24",
243
- "react": "^19.3.0",
244
- "react-dom": "^19.3.0",
245
- "tsup": "^8.5.1",
246
- "typescript": "^6.0.3",
247
- "vitest": "^5.0.1"
248
- },
249
222
  "publishConfig": {
250
223
  "access": "public",
251
224
  "registry": "https://registry.npmjs.org/"
@@ -271,18 +244,5 @@
271
244
  ],
272
245
  "layer": 8
273
246
  },
274
- "scripts": {
275
- "build": "pnpm clean && tsup && node ../scripts/guard-exit.mjs ../scripts/check-node-env-not-inlined.mjs",
276
- "clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\"",
277
- "check:package": "pnpm build && node ../scripts/check-exports-agreement.mjs && publint && pnpm verify:tarball && node ../scripts/check-tarball-relative-imports.mjs --self-test && node ../scripts/check-tarball-relative-imports.mjs --pack . && node ../scripts/check-package-rules.mjs --self-test && node ../scripts/check-package-rules.mjs .",
278
- "typecheck": "tsc -p tsconfig.json --noEmit",
279
- "test": "vitest run",
280
- "demo": "../playground/node_modules/.bin/vite --config demo/vite.config.ts",
281
- "demo:build": "../playground/node_modules/.bin/vite build --config demo/vite.config.ts",
282
- "demo:preview": "../playground/node_modules/.bin/vite preview --config demo/vite.config.ts",
283
- "test:watch": "vitest",
284
- "fuzz:sheets": "SHEET_FUZZ_SEEDS=${SHEET_FUZZ_SEEDS:-4000} CHAIN_FUZZ_SEEDS=${CHAIN_FUZZ_SEEDS:-4000} SHEET_FUZZ_HEAP_MB=${SHEET_FUZZ_HEAP_MB:-12288} NODE_OPTIONS=--max-old-space-size=16384 vitest run src/collab/sheets/transform/sheet-transform-fuzz.test.ts src/collab/sheets/transform/sheet-transform-chain-fuzz.test.ts",
285
- "verify:tarball": "node ./scripts/verify-tarball.mjs"
286
- },
287
- "gitHead": "00cdf507e063aaedba00e776712cb3a339e4f95c"
247
+ "gitHead": "5b7c48a99c8d209284a96f989c5fdbc74187940c"
288
248
  }