@netless/appliance-plugin 1.1.35 → 1.1.36-beta.1
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/READMA.zh-CN.md +36 -0
- package/README.md +6 -0
- package/cdn/cdn.js +1 -1
- package/cdn/{fullWorker-BBlLKX.js → fullWorker-uAwmRi.js} +110 -110
- package/cdn/{subWorker-CoPwom.js → subWorker-BVNpAC.js} +110 -110
- package/dist/appliance-plugin.js +1 -1
- package/dist/appliance-plugin.mjs +1 -1
- package/dist/assets/fullWorker-B_mvkoeW.js +593 -0
- package/dist/assets/subWorker-CRdsidWT.js +593 -0
- package/dist/{bridge-DUU4aNx2.mjs → bridge-DYkH1J6p.mjs} +6 -6
- package/dist/{bridge-28U3vx4e.js → bridge-enxPG6qf.js} +1 -1
- package/dist/bridge.js +1 -1
- package/dist/bridge.mjs +1 -1
- package/dist/collector/collector.d.ts +1 -0
- package/dist/collector/types.d.ts +5 -1
- package/dist/component/textEditor/manager.d.ts +9 -1
- package/dist/component/textEditor/types.d.ts +5 -0
- package/dist/component/textEditor/utils.d.ts +21 -0
- package/dist/component/textEditor/view.d.ts +0 -4
- package/dist/core/enum.d.ts +3 -1
- package/dist/core/mainEngine.d.ts +4 -1
- package/dist/core/msgEvent/copyNode/forMain.d.ts +3 -0
- package/dist/core/msgEvent/copyNode/utils.d.ts +9 -0
- package/dist/core/msgEvent/deleteNode/forMain.d.ts +1 -0
- package/dist/core/msgEvent/setColor/forMain.d.ts +2 -0
- package/dist/core/msgEvent/setFont/forMain.d.ts +1 -0
- package/dist/core/msgEvent/setLock/forMain.d.ts +1 -0
- package/dist/core/msgEvent/setShape/forMain.d.ts +1 -0
- package/dist/core/msgEvent/setZIndex/forMain.d.ts +2 -0
- package/dist/core/tools/pencil.d.ts +1 -0
- package/dist/core/tools/selector.d.ts +4 -0
- package/dist/core/types.d.ts +6 -0
- package/dist/core/worker/fullWorkerLocal.d.ts +4 -4
- package/dist/core/worker/simpleWorker.d.ts +2 -2
- package/dist/displayer/floatBar/dragBox/activateSelectorText.d.ts +13 -0
- package/dist/displayer/floatBar/dragBox/selectorSwitch.d.ts +19 -0
- package/dist/fullWorker.js +110 -110
- package/dist/index-2On9v0Ff.mjs +19693 -0
- package/dist/index-BSD0B_eV.js +1 -0
- package/dist/{index-0fHpKu9i.mjs → index-BZql6xgR.mjs} +1 -1
- package/dist/index-Bm90lQii.js +1 -0
- package/dist/{index-CJN2Kuo1.mjs → index-BrJL-fin.mjs} +3253 -3069
- package/dist/{index-DP9oeLip.js → index-CIjmeY9J.js} +1 -1
- package/dist/{index-MFIjYwT5.js → index-CcS9cKSp.js} +1 -1
- package/dist/index-D4z0hSjm.js +1 -0
- package/dist/{index-BXXQq9TJ.mjs → index-D8SnD90W.mjs} +1 -1
- package/dist/index-DbI0V6BY.mjs +19719 -0
- package/dist/{index-CZRunvvh.mjs → index-K9QVPOhV.mjs} +3253 -3069
- package/dist/index-W9Jz9E04.js +1 -0
- package/dist/plugin/baseApplianceManager.d.ts +7 -0
- package/dist/plugin/baseViewContainerManager.d.ts +23 -9
- package/dist/plugin/displayerView.d.ts +4 -1
- package/dist/plugin/elementCapability.d.ts +29 -0
- package/dist/plugin/multi/displayer/appViewDisplayerManager.d.ts +1 -0
- package/dist/plugin/multi/displayer/mainViewDisplayerManager.d.ts +1 -0
- package/dist/plugin/selectorApi.d.ts +135 -0
- package/dist/plugin/single/displayer/mainViewDisplayerManager.d.ts +1 -0
- package/dist/plugin/types.d.ts +334 -5
- package/dist/plugin/utils.d.ts +9 -0
- package/dist/style.css +1 -1
- package/dist/subWorker.js +110 -110
- package/dist/undo/index.d.ts +45 -4
- package/dist/undo/timing.d.ts +50 -0
- package/package.json +12 -1
- package/dist/assets/fullWorker-Cud7fwjG.js +0 -593
- package/dist/assets/subWorker-BL9l8peV.js +0 -593
- package/dist/index-BXh3eQEk.js +0 -1
- package/dist/index-BsHV7nh_.js +0 -1
- package/dist/index-Crnj0IHn.mjs +0 -16625
- package/dist/index-pEXetfdb.js +0 -1
- package/dist/index-vyNIKk26.js +0 -1
- package/dist/index-zUtKU6c_.mjs +0 -16599
package/dist/undo/index.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ import { BaseCollectorReducerAction, ISerializableUndoDataType, ISerializableUnd
|
|
|
3
3
|
import type { Room } from "../plugin/types";
|
|
4
4
|
import { BaseSubWorkModuleProps, ApplianceManagerLike } from "../plugin/types";
|
|
5
5
|
import { MasterController } from "../core/mainEngine";
|
|
6
|
+
import { Collector } from "../collector/collector";
|
|
7
|
+
import { AckMeta, ExpectedAcks } from "./timing";
|
|
6
8
|
export interface ILocalStorageDataItem extends ISerializableUndoDataType {
|
|
7
9
|
key: WorkId;
|
|
8
10
|
}
|
|
@@ -31,16 +33,53 @@ export declare class UndoRedoMethod {
|
|
|
31
33
|
private scenePath?;
|
|
32
34
|
private tickStartStorerCache?;
|
|
33
35
|
private excludeIds;
|
|
36
|
+
private pendingState;
|
|
37
|
+
private tickStartCaches;
|
|
38
|
+
private tickStartExcludeIds;
|
|
39
|
+
private readonly timingFix;
|
|
40
|
+
private readonly ackTimeout;
|
|
41
|
+
private readonly gracePeriodTimeout;
|
|
42
|
+
private readonly doingFallbackTimeout;
|
|
43
|
+
private isGlobalStackTransaction;
|
|
44
|
+
private pendingGlobalServiceData?;
|
|
45
|
+
private pendingArrayChanges;
|
|
34
46
|
constructor(props: UndoRedoMethodProps);
|
|
47
|
+
private reportStackLength;
|
|
48
|
+
private emitUndoStepsUpdate;
|
|
49
|
+
private emitRedoStepsUpdate;
|
|
50
|
+
private beginGlobalStackTransaction;
|
|
51
|
+
private flushPendingArrayChanges;
|
|
52
|
+
private endGlobalStackTransaction;
|
|
53
|
+
/** 主控侧(baseViewContainerManager)会调用 ackRender / ackStorage 把双脚事件路由到这里。 */
|
|
54
|
+
ackRender(id: number, scenePath: string, meta?: AckMeta): void;
|
|
55
|
+
ackStorage(id: number, scenePath: string, workId?: string, meta?: AckMeta): void;
|
|
56
|
+
collectExpectedWorkIds(id: number, scenePath: string, workIds: string[]): void;
|
|
57
|
+
reopenStorageAck(id: number, scenePath: string, workIds: string[]): void;
|
|
58
|
+
/**
|
|
59
|
+
* 标记当前 ticker 期望收到哪些 workId 的 storage ack;多元素入口(paste/delete/多选)应在 undoTickerStart 之后调用。
|
|
60
|
+
* 单元素入口可以不调;不调则退化为"任一 storage ack 即收尾"。
|
|
61
|
+
*/
|
|
62
|
+
finalizeRequested(id: number, scenePath: string, workIds: string[]): void;
|
|
63
|
+
private mergeMeta;
|
|
64
|
+
private armAckTimeout;
|
|
65
|
+
private tryEnd;
|
|
66
|
+
private forceFlushPending;
|
|
67
|
+
private hasAnyAck;
|
|
68
|
+
private clearPendingState;
|
|
69
|
+
cancelUndoTicker(id: number, viewId: string, scenePath: string): void;
|
|
70
|
+
private getStartCache;
|
|
71
|
+
private getExcludeIds;
|
|
72
|
+
private resetLegacyTicker;
|
|
35
73
|
private handleArrayChange;
|
|
36
|
-
get collector():
|
|
74
|
+
get collector(): Collector | undefined;
|
|
37
75
|
get undoTickerId(): number | undefined;
|
|
38
76
|
get tmpTickStartStorerCache(): Map<string, BaseCollectorReducerAction | undefined> | undefined;
|
|
39
77
|
get uid(): string;
|
|
40
78
|
addExcludeIds(ids: string[]): void;
|
|
41
|
-
undoTickerStart(id: number, scenePath: string): void;
|
|
42
|
-
|
|
43
|
-
|
|
79
|
+
undoTickerStart(id: number, scenePath: string, expectedAcks?: ExpectedAcks): void;
|
|
80
|
+
private legacyUndoTickerStart;
|
|
81
|
+
undoTickerEnd(id: number, scenePath: string, forceIds?: string[]): void;
|
|
82
|
+
undoTickerEndSync(id: number, viewId: string, scenePath: string, isEmit?: boolean, forceIds?: string[]): void;
|
|
44
83
|
private transformToUndoStackItem;
|
|
45
84
|
pullServiceData(serviceData?: ISerializableUndoRedoStackData): void;
|
|
46
85
|
undo(scenePath: string): number;
|
|
@@ -53,6 +92,8 @@ export declare class UndoRedoMethod {
|
|
|
53
92
|
onChangeScene: import("lodash").DebouncedFunc<() => void>;
|
|
54
93
|
onFocusView(): void;
|
|
55
94
|
private especialDiff;
|
|
95
|
+
private normalizeUndoSnapshotValue;
|
|
96
|
+
private getTextDebugOpt;
|
|
56
97
|
private diffFun;
|
|
57
98
|
private isDrawEffectiveScene;
|
|
58
99
|
private isDeleteEffectiveScene;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { BaseCollectorReducerAction } from "../collector/types";
|
|
2
|
+
export declare const UndoScope_ClearAll = "__undo_scope_clear_all__";
|
|
3
|
+
export type ExpectedAcks = {
|
|
4
|
+
render: boolean;
|
|
5
|
+
storage: boolean;
|
|
6
|
+
scopeMode?: "static" | "dynamic";
|
|
7
|
+
copyAck?: boolean;
|
|
8
|
+
isWritable?: boolean;
|
|
9
|
+
workIds?: Array<string | number>;
|
|
10
|
+
};
|
|
11
|
+
export type AckMeta = {
|
|
12
|
+
requestId?: string;
|
|
13
|
+
emitEventType?: string;
|
|
14
|
+
};
|
|
15
|
+
export type PendingUndoTickerState = {
|
|
16
|
+
viewId: string;
|
|
17
|
+
scenePath: string;
|
|
18
|
+
expectedRender: boolean;
|
|
19
|
+
expectedStorage: boolean;
|
|
20
|
+
gotRender: boolean;
|
|
21
|
+
gotStorage: boolean;
|
|
22
|
+
scopeMode: "static" | "dynamic";
|
|
23
|
+
finalizeRequested: boolean;
|
|
24
|
+
collectedScopeKeys: Set<string>;
|
|
25
|
+
scopeKeys: Set<string>;
|
|
26
|
+
ackedStorageKeys: Set<string>;
|
|
27
|
+
meta: AckMeta & Pick<ExpectedAcks, "copyAck" | "isWritable">;
|
|
28
|
+
ackTimer?: number;
|
|
29
|
+
graceTimer?: number;
|
|
30
|
+
fallbackTimer?: number;
|
|
31
|
+
};
|
|
32
|
+
export type ScopeCollector = {
|
|
33
|
+
isLocalId(id: string): boolean;
|
|
34
|
+
transformKey(id: string | number): string;
|
|
35
|
+
getLocalId(id: string): string | undefined;
|
|
36
|
+
getStorageData(viewId: string, scenePath: string): Record<string, Pick<BaseCollectorReducerAction, "selectIds"> | undefined> | undefined;
|
|
37
|
+
};
|
|
38
|
+
export declare function createPendingUndoTickerState(params: {
|
|
39
|
+
viewId: string;
|
|
40
|
+
scenePath: string;
|
|
41
|
+
expectedAcks: ExpectedAcks;
|
|
42
|
+
fallbackTimer?: number;
|
|
43
|
+
}): PendingUndoTickerState;
|
|
44
|
+
export declare function mergeAckMeta(state: PendingUndoTickerState, meta?: AckMeta): void;
|
|
45
|
+
export declare function isPendingStateComplete(state: PendingUndoTickerState): boolean;
|
|
46
|
+
export declare function shouldStartAckTimer(state: PendingUndoTickerState): boolean;
|
|
47
|
+
export declare function shouldAcceptStorageAck(scopeKeys: Set<string>, workId?: string): boolean;
|
|
48
|
+
export declare function normalizeStorageKey(collector: ScopeCollector, id: string | number): string;
|
|
49
|
+
export declare function buildScopeStorageKeys(collector: ScopeCollector | undefined, viewId: string, scenePath: string, ids: Array<string | number>): Set<string>;
|
|
50
|
+
export declare function shouldIncludeDiffKey(key: string, excludeIds: Set<string>, scopeKeys?: Set<string>): boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netless/appliance-plugin",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.36-beta.1",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist",
|
|
6
6
|
"cdn",
|
|
@@ -42,6 +42,11 @@
|
|
|
42
42
|
"ci:check": "pnpm lint && pnpm test:auto-shape && pnpm build && pnpm example:typecheck",
|
|
43
43
|
"test:text-editor-focus": "tsx scripts/textEditorFocus.test.ts",
|
|
44
44
|
"test:auto-shape": "tsx test/autoShape.test.ts",
|
|
45
|
+
"test:undo-timing": "tsx test/undoTiming.test.ts",
|
|
46
|
+
"test:undo-timing:coverage": "c8 --reporter=text --reporter=html --include=src/undo/timing.ts --check-coverage --statements 90 --lines 90 --branches 90 --functions 90 tsx test/undoTiming.test.ts",
|
|
47
|
+
"test:selector-api": "tsx test/selectorApi.test.ts",
|
|
48
|
+
"test:selector-api:coverage": "c8 --reporter=text --reporter=html --include=src/plugin/selectorApi.ts --check-coverage --statements 90 --lines 90 --functions 100 tsx test/selectorApi.test.ts",
|
|
49
|
+
"test:selector-api:coverage:context": "c8 --reporter=text --reporter=html --include=src/plugin/selectorApi.ts --include=src/core/mainEngine.ts --include=src/plugin/applianceSinglePlugin.ts --include=src/plugin/applianceMultiPlugin.ts tsx test/selectorApi.test.ts",
|
|
45
50
|
"types:bundler": "tsc --emitDeclarationOnly",
|
|
46
51
|
"build:bridge": "vite build --config vite.config.bridge.js",
|
|
47
52
|
"build:bundler": "vite build --config vite.config.bundler.js && yarn build:bridge && yarn types:bundler",
|
|
@@ -56,21 +61,27 @@
|
|
|
56
61
|
"@babel/plugin-transform-object-rest-spread": "^7.28.4",
|
|
57
62
|
"@babel/preset-env": "^7.24.7",
|
|
58
63
|
"@netless/window-manager": "^1.0.11",
|
|
64
|
+
"@playwright/test": "^1.61.0",
|
|
59
65
|
"@rollup/plugin-babel": "^6.0.4",
|
|
60
66
|
"@types/dom-to-image": "^2.6.7",
|
|
61
67
|
"@types/lodash": "^4.14.202",
|
|
68
|
+
"@types/node": "^26.0.0",
|
|
62
69
|
"@types/react": "^18.3.28",
|
|
63
70
|
"@types/react-dom": "^18.3.7",
|
|
64
71
|
"@typescript-eslint/eslint-plugin": "^8.39.0",
|
|
65
72
|
"@typescript-eslint/parser": "^8.39.0",
|
|
73
|
+
"@vitest/coverage-v8": "^4.1.9",
|
|
74
|
+
"c8": "^11.0.0",
|
|
66
75
|
"cross-env": "^7.0.3",
|
|
67
76
|
"eslint-plugin-react-hooks": "^5.2.0",
|
|
68
77
|
"eslint-plugin-react-refresh": "^0.4.20",
|
|
78
|
+
"jsdom": "^29.1.1",
|
|
69
79
|
"less": "^4.2.0",
|
|
70
80
|
"prettier": "^3.6.2",
|
|
71
81
|
"tsx": "^4.21.0",
|
|
72
82
|
"typescript": "^5.2.2",
|
|
73
83
|
"vite": "^5.0.0",
|
|
84
|
+
"vitest": "^4.1.9",
|
|
74
85
|
"white-web-sdk": "^2.16.54"
|
|
75
86
|
},
|
|
76
87
|
"peerDependencies": {
|