@ai-matrx/office 0.8.19 → 0.8.21
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.
- package/CHANGELOG.md +23 -0
- package/dist/collab-sheets-transform.cjs +354 -16
- package/dist/collab-sheets-transform.cjs.map +1 -1
- package/dist/collab-sheets-transform.d.cts +32 -4
- package/dist/collab-sheets-transform.d.ts +32 -4
- package/dist/collab-sheets-transform.js +354 -16
- package/dist/collab-sheets-transform.js.map +1 -1
- package/dist/univer-collab.cjs +420 -64
- package/dist/univer-collab.cjs.map +1 -1
- package/dist/univer-collab.d.cts +7 -1
- package/dist/univer-collab.d.ts +7 -1
- package/dist/univer-collab.js +424 -67
- package/dist/univer-collab.js.map +1 -1
- package/package.json +4 -4
|
@@ -45,7 +45,7 @@ interface SheetRange {
|
|
|
45
45
|
* column width, worksheet name. C5b: formula text in cells (`f`, array `ref`) and defined names. Shared
|
|
46
46
|
* formulas (`si`) stay barriers (see transform.ts cellBarrier); ranged resources are C5c.
|
|
47
47
|
*/
|
|
48
|
-
type SheetFamily = "cell" | "structure" | "merge" | "size" | "name" | "defname";
|
|
48
|
+
type SheetFamily = "cell" | "structure" | "merge" | "size" | "name" | "defname" | "numfmt" | "count" | "sheet";
|
|
49
49
|
interface CoveredEntry {
|
|
50
50
|
readonly kind: "covered";
|
|
51
51
|
readonly family: SheetFamily;
|
|
@@ -103,7 +103,7 @@ declare function mapIndex(op: AxisOp, i: number): number | null;
|
|
|
103
103
|
*/
|
|
104
104
|
declare function transformAxis(x: AxisOp, y: AxisOp, side: Side): AxisOp[] | null;
|
|
105
105
|
|
|
106
|
-
declare const SHEET_TRANSFORMER_VERSION = "
|
|
106
|
+
declare const SHEET_TRANSFORMER_VERSION = "c5c-1";
|
|
107
107
|
/**
|
|
108
108
|
* Pairs the fuzz proved divergent (or that have no transform yet), as unordered mutation-id pairs, with the
|
|
109
109
|
* failing seed. Each returns a Barrier until it has its own correct transform under a new proto.
|
|
@@ -125,6 +125,24 @@ declare function mergeThrough(s: Structural, m: SheetRange): {
|
|
|
125
125
|
range: SheetRange | null;
|
|
126
126
|
fixup: boolean;
|
|
127
127
|
};
|
|
128
|
+
/**
|
|
129
|
+
* The merge fixups a structural mutation is owed but Univer's command did not make (C5c). The transform's model
|
|
130
|
+
* (`mergeThrough`) is "every merge the change cuts through is moved by the command"; Univer 1.0.4 only fixes the
|
|
131
|
+
* merges that intersect the COMMAND's range on the other axis (a `-by-range` call with a partial range, an API
|
|
132
|
+
* call) and only when its ref-range registration is current (it is refreshed on sheet activation, add-merge and
|
|
133
|
+
* structural mutations, never after a content load or a remove-merge). A cut merge it skipped stays where it was on
|
|
134
|
+
* the sender, while every transform moves it: chains of such ops diverged by a column (the session fuzz's
|
|
135
|
+
* column -1 vs 0). Capture therefore completes the command: right BEFORE the structural mutation it removes the
|
|
136
|
+
* cut merges still on the sheet (`remove`, exact, at their pre-change positions), and right AFTER it adds their
|
|
137
|
+
* model positions (`add`). The same shape as Univer's own remove/move fixups, so every transform rule applies.
|
|
138
|
+
* `mergesBefore` = the sheet's merges right before the mutation runs (after the command's own pre-removals).
|
|
139
|
+
*/
|
|
140
|
+
declare function mergeFixupsOwed(m: SheetMutation, mergesBefore: readonly SheetRange[]): {
|
|
141
|
+
remove: SheetRange[];
|
|
142
|
+
add: SheetRange[];
|
|
143
|
+
} | null;
|
|
144
|
+
/** True for the six row/column structural mutation ids. */
|
|
145
|
+
declare const isStructuralMutation: (m: SheetMutation) => boolean;
|
|
128
146
|
/**
|
|
129
147
|
* Rewrites every remove-merge in a group to name the exact merges it removes. Univer removes every merge a
|
|
130
148
|
* range intersects, and the unmerge command sends the SELECTION; a selection does not move the way the
|
|
@@ -142,7 +160,7 @@ declare const CONTENT_KEYS: readonly ["v", "t", "p", "f", "si", "custom", "ref",
|
|
|
142
160
|
*/
|
|
143
161
|
declare function completeCellContent(entry: Cell, post: Record<string, unknown> | null | undefined): Cell;
|
|
144
162
|
/** Params that travel for the transformer only; `forApply` strips them before Univer sees the mutation. */
|
|
145
|
-
declare const SIDE_CAR_PARAMS: readonly ["refSheets", "previousName", "derived"];
|
|
163
|
+
declare const SIDE_CAR_PARAMS: readonly ["refSheets", "previousName", "derived", "sheetIndex", "sheetsLeft"];
|
|
146
164
|
declare function forApply(m: SheetMutation): SheetMutation;
|
|
147
165
|
/**
|
|
148
166
|
* Capture-time annotation (C6 calls it per group, like completeCellContent): every op whose formula text
|
|
@@ -152,6 +170,16 @@ declare function forApply(m: SheetMutation): SheetMutation;
|
|
|
152
170
|
* `definedNames` defined-name id → name, both read right before the command ran.
|
|
153
171
|
*/
|
|
154
172
|
declare function annotateFormulas(group: SheetGroup, sheets: Readonly<Record<string, string>>, definedNames: Readonly<Record<string, string>>): SheetMutation[];
|
|
173
|
+
/** Where a span [lo, hi] of one axis lands after an axis op: the pieces that survive, merged. */
|
|
174
|
+
declare function spanThrough(op: AxisOp, lo: number, hi: number): Array<[number, number]>;
|
|
175
|
+
/**
|
|
176
|
+
* Capture-time annotation for sheet ops (the port calls it per group, like annotateFormulas): a remove-sheet gets
|
|
177
|
+
* `sheetIndex` (the removed sheet's index right before it) and `sheetsLeft` (sheets after it), an insert-sheet without `index` gets its append index.
|
|
178
|
+
* `sheetOrder` = the workbook's sheet order right before the command.
|
|
179
|
+
*/
|
|
180
|
+
declare function annotateSheetOps(group: SheetGroup, sheetOrder: readonly string[]): SheetMutation[];
|
|
181
|
+
/** Style ids inside a sheet's data replaced by their objects (style ids are seat-local, C0 surprise 4). */
|
|
182
|
+
declare function inlineSheetStyles(sheet: Record<string, unknown>, styleOf: (id: string) => unknown): Record<string, unknown>;
|
|
155
183
|
/** x over y for single mutations. */
|
|
156
184
|
declare function transformMutation(x: SheetMutation, y: SheetMutation, side: Side): TransformResult;
|
|
157
185
|
/** Command group x rewritten to apply after command group y. One Barrier makes the whole group a barrier. */
|
|
@@ -214,4 +242,4 @@ declare function refSheetsAfter(refSheets: RefSheets | undefined, change: RefCha
|
|
|
214
242
|
/** `refSheets` for the given formula texts: every sheet name they qualify a reference with, resolved now. */
|
|
215
243
|
declare function refSheetsFor(texts: Iterable<string>, sheets: Readonly<Record<string, string>>): RefSheets | undefined;
|
|
216
244
|
|
|
217
|
-
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, cellRef, completeCellContent, exactMergeRemovals, forApply, formulaBarrier, isBarrier, isFormulaText, mapIndex, mergeThrough, refSheetsAfter, refSheetsFor, rewriteFormula, sheetTransformer, transformAxis, transformGroup, transformMutation };
|
|
245
|
+
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 };
|
|
@@ -45,7 +45,7 @@ interface SheetRange {
|
|
|
45
45
|
* column width, worksheet name. C5b: formula text in cells (`f`, array `ref`) and defined names. Shared
|
|
46
46
|
* formulas (`si`) stay barriers (see transform.ts cellBarrier); ranged resources are C5c.
|
|
47
47
|
*/
|
|
48
|
-
type SheetFamily = "cell" | "structure" | "merge" | "size" | "name" | "defname";
|
|
48
|
+
type SheetFamily = "cell" | "structure" | "merge" | "size" | "name" | "defname" | "numfmt" | "count" | "sheet";
|
|
49
49
|
interface CoveredEntry {
|
|
50
50
|
readonly kind: "covered";
|
|
51
51
|
readonly family: SheetFamily;
|
|
@@ -103,7 +103,7 @@ declare function mapIndex(op: AxisOp, i: number): number | null;
|
|
|
103
103
|
*/
|
|
104
104
|
declare function transformAxis(x: AxisOp, y: AxisOp, side: Side): AxisOp[] | null;
|
|
105
105
|
|
|
106
|
-
declare const SHEET_TRANSFORMER_VERSION = "
|
|
106
|
+
declare const SHEET_TRANSFORMER_VERSION = "c5c-1";
|
|
107
107
|
/**
|
|
108
108
|
* Pairs the fuzz proved divergent (or that have no transform yet), as unordered mutation-id pairs, with the
|
|
109
109
|
* failing seed. Each returns a Barrier until it has its own correct transform under a new proto.
|
|
@@ -125,6 +125,24 @@ declare function mergeThrough(s: Structural, m: SheetRange): {
|
|
|
125
125
|
range: SheetRange | null;
|
|
126
126
|
fixup: boolean;
|
|
127
127
|
};
|
|
128
|
+
/**
|
|
129
|
+
* The merge fixups a structural mutation is owed but Univer's command did not make (C5c). The transform's model
|
|
130
|
+
* (`mergeThrough`) is "every merge the change cuts through is moved by the command"; Univer 1.0.4 only fixes the
|
|
131
|
+
* merges that intersect the COMMAND's range on the other axis (a `-by-range` call with a partial range, an API
|
|
132
|
+
* call) and only when its ref-range registration is current (it is refreshed on sheet activation, add-merge and
|
|
133
|
+
* structural mutations, never after a content load or a remove-merge). A cut merge it skipped stays where it was on
|
|
134
|
+
* the sender, while every transform moves it: chains of such ops diverged by a column (the session fuzz's
|
|
135
|
+
* column -1 vs 0). Capture therefore completes the command: right BEFORE the structural mutation it removes the
|
|
136
|
+
* cut merges still on the sheet (`remove`, exact, at their pre-change positions), and right AFTER it adds their
|
|
137
|
+
* model positions (`add`). The same shape as Univer's own remove/move fixups, so every transform rule applies.
|
|
138
|
+
* `mergesBefore` = the sheet's merges right before the mutation runs (after the command's own pre-removals).
|
|
139
|
+
*/
|
|
140
|
+
declare function mergeFixupsOwed(m: SheetMutation, mergesBefore: readonly SheetRange[]): {
|
|
141
|
+
remove: SheetRange[];
|
|
142
|
+
add: SheetRange[];
|
|
143
|
+
} | null;
|
|
144
|
+
/** True for the six row/column structural mutation ids. */
|
|
145
|
+
declare const isStructuralMutation: (m: SheetMutation) => boolean;
|
|
128
146
|
/**
|
|
129
147
|
* Rewrites every remove-merge in a group to name the exact merges it removes. Univer removes every merge a
|
|
130
148
|
* range intersects, and the unmerge command sends the SELECTION; a selection does not move the way the
|
|
@@ -142,7 +160,7 @@ declare const CONTENT_KEYS: readonly ["v", "t", "p", "f", "si", "custom", "ref",
|
|
|
142
160
|
*/
|
|
143
161
|
declare function completeCellContent(entry: Cell, post: Record<string, unknown> | null | undefined): Cell;
|
|
144
162
|
/** Params that travel for the transformer only; `forApply` strips them before Univer sees the mutation. */
|
|
145
|
-
declare const SIDE_CAR_PARAMS: readonly ["refSheets", "previousName", "derived"];
|
|
163
|
+
declare const SIDE_CAR_PARAMS: readonly ["refSheets", "previousName", "derived", "sheetIndex", "sheetsLeft"];
|
|
146
164
|
declare function forApply(m: SheetMutation): SheetMutation;
|
|
147
165
|
/**
|
|
148
166
|
* Capture-time annotation (C6 calls it per group, like completeCellContent): every op whose formula text
|
|
@@ -152,6 +170,16 @@ declare function forApply(m: SheetMutation): SheetMutation;
|
|
|
152
170
|
* `definedNames` defined-name id → name, both read right before the command ran.
|
|
153
171
|
*/
|
|
154
172
|
declare function annotateFormulas(group: SheetGroup, sheets: Readonly<Record<string, string>>, definedNames: Readonly<Record<string, string>>): SheetMutation[];
|
|
173
|
+
/** Where a span [lo, hi] of one axis lands after an axis op: the pieces that survive, merged. */
|
|
174
|
+
declare function spanThrough(op: AxisOp, lo: number, hi: number): Array<[number, number]>;
|
|
175
|
+
/**
|
|
176
|
+
* Capture-time annotation for sheet ops (the port calls it per group, like annotateFormulas): a remove-sheet gets
|
|
177
|
+
* `sheetIndex` (the removed sheet's index right before it) and `sheetsLeft` (sheets after it), an insert-sheet without `index` gets its append index.
|
|
178
|
+
* `sheetOrder` = the workbook's sheet order right before the command.
|
|
179
|
+
*/
|
|
180
|
+
declare function annotateSheetOps(group: SheetGroup, sheetOrder: readonly string[]): SheetMutation[];
|
|
181
|
+
/** Style ids inside a sheet's data replaced by their objects (style ids are seat-local, C0 surprise 4). */
|
|
182
|
+
declare function inlineSheetStyles(sheet: Record<string, unknown>, styleOf: (id: string) => unknown): Record<string, unknown>;
|
|
155
183
|
/** x over y for single mutations. */
|
|
156
184
|
declare function transformMutation(x: SheetMutation, y: SheetMutation, side: Side): TransformResult;
|
|
157
185
|
/** Command group x rewritten to apply after command group y. One Barrier makes the whole group a barrier. */
|
|
@@ -214,4 +242,4 @@ declare function refSheetsAfter(refSheets: RefSheets | undefined, change: RefCha
|
|
|
214
242
|
/** `refSheets` for the given formula texts: every sheet name they qualify a reference with, resolved now. */
|
|
215
243
|
declare function refSheetsFor(texts: Iterable<string>, sheets: Readonly<Record<string, string>>): RefSheets | undefined;
|
|
216
244
|
|
|
217
|
-
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, cellRef, completeCellContent, exactMergeRemovals, forApply, formulaBarrier, isBarrier, isFormulaText, mapIndex, mergeThrough, refSheetsAfter, refSheetsFor, rewriteFormula, sheetTransformer, transformAxis, transformGroup, transformMutation };
|
|
245
|
+
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 };
|