@opendaw/lib-box 0.0.76 → 0.0.77
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/dist/editing.d.ts +3 -2
- package/dist/editing.d.ts.map +1 -1
- package/dist/editing.js +5 -16
- package/package.json +4 -4
package/dist/editing.d.ts
CHANGED
|
@@ -11,17 +11,18 @@ export declare class BoxEditing implements Editing {
|
|
|
11
11
|
subscribe(observer: Observer<void>): Subscription;
|
|
12
12
|
markSaved(): void;
|
|
13
13
|
hasUnsavedChanges(): boolean;
|
|
14
|
-
|
|
14
|
+
hasNoChanges(): boolean;
|
|
15
15
|
clear(): void;
|
|
16
16
|
undo(): boolean;
|
|
17
17
|
redo(): boolean;
|
|
18
18
|
canUndo(): boolean;
|
|
19
19
|
canRedo(): boolean;
|
|
20
|
+
/** @deprecated No longer needed — modify() now handles calls during undo/redo transparently. */
|
|
20
21
|
mustModify(): boolean;
|
|
21
22
|
modify<R>(modifier: SyncProvider<Maybe<R>>, mark?: boolean): Option<R>;
|
|
22
23
|
beginModification(): ModificationProcess;
|
|
23
24
|
mark(): void;
|
|
24
|
-
|
|
25
|
+
revertPending(): void;
|
|
25
26
|
disable(): void;
|
|
26
27
|
}
|
|
27
28
|
//# sourceMappingURL=editing.d.ts.map
|
package/dist/editing.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editing.d.ts","sourceRoot":"","sources":["../src/editing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,SAAS,CAAA;AAChC,OAAO,EAGH,OAAO,EAEP,KAAK,EAEL,QAAQ,EACR,MAAM,EACN,YAAY,EACZ,YAAY,EAEf,MAAM,kBAAkB,CAAA;AAiDzB,MAAM,WAAW,mBAAmB;IAChC,OAAO,IAAI,IAAI,CAAA;IACf,MAAM,IAAI,IAAI,CAAA;CACjB;AAED,qBAAa,UAAW,YAAW,OAAO;;gBAY1B,KAAK,EAA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|
78
78
|
}
|
|
79
79
|
return this.#historyIndex !== this.#savedHistoryIndex;
|
|
80
80
|
}
|
|
81
|
-
|
|
81
|
+
hasNoChanges() { return this.#marked.length === 0 && this.#pending.length === 0; }
|
|
82
82
|
clear() {
|
|
83
83
|
assert(!this.#modifying, "Already modifying");
|
|
84
84
|
Arrays.clear(this.#pending);
|
|
@@ -126,23 +126,12 @@ export class BoxEditing {
|
|
|
126
126
|
}
|
|
127
127
|
return this.#pending.length <= 0;
|
|
128
128
|
}
|
|
129
|
-
|
|
130
|
-
// Problem: When a Box field changes (e.g., during undo/redo), reactive subscriptions may fire
|
|
131
|
-
// and attempt to call modify() to sync the UI state back to the Box. But since undo/redo
|
|
132
|
-
// already has a transaction open (via Modification.inverse/forward calling beginTransaction
|
|
133
|
-
// directly), calling modify() would fail with "Transaction already in progress".
|
|
134
|
-
// Current workaround: Callers check mustModify() before calling modify(). If false (transaction
|
|
135
|
-
// already open), they either skip the call or call setValue directly without recording history.
|
|
136
|
-
// See: EditWrapper.forValue, EditWrapper.forAutomatableParameter, TransportGroup loop sync.
|
|
137
|
-
// Better solution: Consider having Modification.inverse/forward use the same #modifying flag
|
|
138
|
-
// as modify(), or introduce a unified "modification context" that both undo/redo and user
|
|
139
|
-
// actions share. This would allow modify() to detect it's being called reactively during
|
|
140
|
-
// undo/redo and handle it internally, rather than requiring all callers to guard with mustModify().
|
|
129
|
+
/** @deprecated No longer needed — modify() now handles calls during undo/redo transparently. */
|
|
141
130
|
mustModify() { return !this.#graph.inTransaction(); }
|
|
142
131
|
modify(modifier, mark = true) {
|
|
143
132
|
assert(!this.#inProcess, "Cannot call modify while a modification process is running");
|
|
144
|
-
if (this.#modifying) {
|
|
145
|
-
// Nested modify call
|
|
133
|
+
if (this.#modifying || this.#graph.inTransaction()) {
|
|
134
|
+
// Nested modify call or reactive call during undo/redo — just execute without separate recording
|
|
146
135
|
this.#notifier.notify();
|
|
147
136
|
return Option.wrap(modifier());
|
|
148
137
|
}
|
|
@@ -218,7 +207,7 @@ export class BoxEditing {
|
|
|
218
207
|
this.#marked.push(this.#pending.splice(0));
|
|
219
208
|
this.#historyIndex = this.#marked.length;
|
|
220
209
|
}
|
|
221
|
-
|
|
210
|
+
revertPending() {
|
|
222
211
|
if (this.#pending.length === 0) {
|
|
223
212
|
return;
|
|
224
213
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opendaw/lib-box",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.77",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -23,12 +23,12 @@
|
|
|
23
23
|
"test": "vitest run"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@opendaw/lib-runtime": "^0.0.
|
|
27
|
-
"@opendaw/lib-std": "^0.0.
|
|
26
|
+
"@opendaw/lib-runtime": "^0.0.72",
|
|
27
|
+
"@opendaw/lib-std": "^0.0.71"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@opendaw/eslint-config": "^0.0.27",
|
|
31
31
|
"@opendaw/typescript-config": "^0.0.29"
|
|
32
32
|
},
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "0b25229f66de4a59f75484d363b396dc1953b91c"
|
|
34
34
|
}
|