@daasboard/editor 0.0.0-stage → 0.1.0
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/LICENSE +5 -0
- package/README.md +6 -2
- package/dist/camera/CameraInput.d.ts +106 -0
- package/dist/camera/CameraInput.js +398 -0
- package/dist/clipboard/ObjectClipboard.d.ts +40 -0
- package/dist/clipboard/ObjectClipboard.js +243 -0
- package/dist/clipboard/PasteCommitError.d.ts +4 -0
- package/dist/clipboard/PasteCommitError.js +7 -0
- package/dist/clipboard/carrier.d.ts +5 -0
- package/dist/clipboard/carrier.js +59 -0
- package/dist/clipboard/objects.d.ts +21 -0
- package/dist/clipboard/objects.js +362 -0
- package/dist/clipboard/placement.d.ts +11 -0
- package/dist/clipboard/placement.js +21 -0
- package/dist/clipboard/systemImages.d.ts +1 -0
- package/dist/clipboard/systemImages.js +24 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +22 -0
- package/dist/input/TouchInput.d.ts +159 -0
- package/dist/input/TouchInput.js +656 -0
- package/dist/input/visiblePart.d.ts +8 -0
- package/dist/input/visiblePart.js +15 -0
- package/dist/interaction/InteractionLayer.d.ts +83 -0
- package/dist/interaction/InteractionLayer.js +520 -0
- package/dist/props/PropertyController.d.ts +130 -0
- package/dist/props/PropertyController.js +1448 -0
- package/dist/props/PropertyRegistry.d.ts +38 -0
- package/dist/props/PropertyRegistry.js +21 -0
- package/dist/props/builtinProperties.d.ts +23 -0
- package/dist/props/builtinProperties.js +350 -0
- package/dist/props/defaults.d.ts +6 -0
- package/dist/props/defaults.js +29 -0
- package/dist/selection/SelectionModel.d.ts +25 -0
- package/dist/selection/SelectionModel.js +79 -0
- package/dist/text/CanvasEditorView.d.ts +99 -0
- package/dist/text/CanvasEditorView.js +308 -0
- package/dist/text/InputSink.d.ts +157 -0
- package/dist/text/InputSink.js +841 -0
- package/dist/text/TextEditSession.d.ts +173 -0
- package/dist/text/TextEditSession.js +1328 -0
- package/dist/text/clipboard.d.ts +11 -0
- package/dist/text/clipboard.js +489 -0
- package/dist/text/commands.d.ts +48 -0
- package/dist/text/commands.js +329 -0
- package/dist/text/contextMirror.d.ts +51 -0
- package/dist/text/contextMirror.js +292 -0
- package/dist/text/flat.d.ts +35 -0
- package/dist/text/flat.js +556 -0
- package/dist/text/graphemes.d.ts +16 -0
- package/dist/text/graphemes.js +219 -0
- package/dist/text/index.d.ts +13 -0
- package/dist/text/index.js +13 -0
- package/dist/text/inputReducer.d.ts +24 -0
- package/dist/text/inputReducer.js +44 -0
- package/dist/text/keymap.d.ts +17 -0
- package/dist/text/keymap.js +148 -0
- package/dist/text/schema.d.ts +12 -0
- package/dist/text/schema.js +44 -0
- package/dist/text/sessionFocus.d.ts +20 -0
- package/dist/text/sessionFocus.js +51 -0
- package/dist/text/types.d.ts +114 -0
- package/dist/text/types.js +1 -0
- package/dist/tools/CreateTool.d.ts +78 -0
- package/dist/tools/CreateTool.js +258 -0
- package/dist/tools/SelectTool.d.ts +155 -0
- package/dist/tools/SelectTool.js +808 -0
- package/dist/tools/ToolManager.d.ts +63 -0
- package/dist/tools/ToolManager.js +146 -0
- package/dist/tools/connectorEndpoints.d.ts +17 -0
- package/dist/tools/connectorEndpoints.js +53 -0
- package/dist/tools/frameRotation.d.ts +8 -0
- package/dist/tools/frameRotation.js +66 -0
- package/dist/tools/gradientHandles.d.ts +67 -0
- package/dist/tools/gradientHandles.js +110 -0
- package/dist/tools/presetPaths.d.ts +5 -0
- package/dist/tools/presetPaths.js +49 -0
- package/dist/tools/snapResize.d.ts +7 -0
- package/dist/tools/snapResize.js +65 -0
- package/dist/tools/snapping.d.ts +30 -0
- package/dist/tools/snapping.js +280 -0
- package/dist/tools/transform.d.ts +52 -0
- package/dist/tools/transform.js +277 -0
- package/package.json +36 -3
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import type { ImageRef, Point, Rect, SceneObject } from "@daasboard/render-core";
|
|
2
|
+
import type { DocumentAdapter } from "@daasboard/doc";
|
|
3
|
+
import { getPath } from "@daasboard/doc";
|
|
4
|
+
import type { SelectionModel } from "../selection/SelectionModel.js";
|
|
5
|
+
import type { TextPropertyTarget } from "../text/types.js";
|
|
6
|
+
import { type PasteOptions } from "../clipboard/placement.js";
|
|
7
|
+
import type { PropertyDescriptor, PropertyRegistry } from "./PropertyRegistry.js";
|
|
8
|
+
export interface PropertyValue {
|
|
9
|
+
value?: unknown;
|
|
10
|
+
mixed?: true;
|
|
11
|
+
values?: unknown[];
|
|
12
|
+
applicable: number;
|
|
13
|
+
descriptor: PropertyDescriptor;
|
|
14
|
+
}
|
|
15
|
+
export type Patch = Record<string, unknown>;
|
|
16
|
+
export type PatchFn = (o: SceneObject) => Patch;
|
|
17
|
+
export interface CommandSpec {
|
|
18
|
+
label: string;
|
|
19
|
+
canRun(): boolean;
|
|
20
|
+
run(): void;
|
|
21
|
+
}
|
|
22
|
+
export type NewObject = Pick<SceneObject, "kind" | "x" | "y" | "w" | "h"> & Partial<Omit<SceneObject, "kind" | "x" | "y" | "w" | "h" | "id" | "version">>;
|
|
23
|
+
export interface CreateOptions {
|
|
24
|
+
parent?: string | null;
|
|
25
|
+
select?: boolean;
|
|
26
|
+
label?: string;
|
|
27
|
+
adopt?: readonly string[];
|
|
28
|
+
}
|
|
29
|
+
export interface InsertImagesOptions {
|
|
30
|
+
select?: boolean;
|
|
31
|
+
at: Point;
|
|
32
|
+
visible: Rect;
|
|
33
|
+
parent?: string | null;
|
|
34
|
+
label?: string;
|
|
35
|
+
}
|
|
36
|
+
export interface CommitPreviewOptions {
|
|
37
|
+
dropTarget?: string | null | undefined;
|
|
38
|
+
}
|
|
39
|
+
type ZOrderMove = "front" | "back" | "forward" | "backward";
|
|
40
|
+
export declare function planZOrder(sibs: readonly string[], selected: ReadonlySet<string>, how: ZOrderMove): string[] | null;
|
|
41
|
+
export declare class PropertyController {
|
|
42
|
+
readonly doc: DocumentAdapter;
|
|
43
|
+
readonly registry: PropertyRegistry;
|
|
44
|
+
readonly selection: SelectionModel;
|
|
45
|
+
private readonly fixedIds?;
|
|
46
|
+
private listeners;
|
|
47
|
+
private overlay;
|
|
48
|
+
private previewLabel;
|
|
49
|
+
private absolutePreview;
|
|
50
|
+
private rotationIds;
|
|
51
|
+
private rotationExcludedId;
|
|
52
|
+
private rotationRequest;
|
|
53
|
+
private unsubs;
|
|
54
|
+
private textTarget_;
|
|
55
|
+
private textPreview;
|
|
56
|
+
private readCache;
|
|
57
|
+
private readTargets;
|
|
58
|
+
private readVersions;
|
|
59
|
+
private readRegistry;
|
|
60
|
+
private readDescriptors;
|
|
61
|
+
private readOverlay;
|
|
62
|
+
private readPaths;
|
|
63
|
+
private readAbsolute;
|
|
64
|
+
private readInvalidation;
|
|
65
|
+
readonly commands: Record<string, CommandSpec>;
|
|
66
|
+
constructor(doc: DocumentAdapter, registry: PropertyRegistry, selection: SelectionModel, fixedIds?: readonly string[] | undefined);
|
|
67
|
+
for(ids: readonly string[]): PropertyController;
|
|
68
|
+
targetIds(): string[];
|
|
69
|
+
targets(): SceneObject[];
|
|
70
|
+
descriptors(): PropertyDescriptor[];
|
|
71
|
+
setTextTarget(t: TextPropertyTarget | null): void;
|
|
72
|
+
textTarget(): TextPropertyTarget | null;
|
|
73
|
+
private activeTextTarget;
|
|
74
|
+
targetsFor(key: string): SceneObject[];
|
|
75
|
+
private applicablePatch;
|
|
76
|
+
read(keys?: readonly string[]): Record<string, PropertyValue>;
|
|
77
|
+
private readFull;
|
|
78
|
+
private pathOf;
|
|
79
|
+
private underMovedContainer;
|
|
80
|
+
private applyPatches;
|
|
81
|
+
private resolveBoundsPatch;
|
|
82
|
+
private sanitizeGeometry;
|
|
83
|
+
private patchesFor;
|
|
84
|
+
private rotationTargets;
|
|
85
|
+
private captureRotation;
|
|
86
|
+
private sanitizeRotation;
|
|
87
|
+
private expandedRotation;
|
|
88
|
+
private locked;
|
|
89
|
+
private applyAbsolutePatches;
|
|
90
|
+
set(patch: Patch | PatchFn, opts?: {
|
|
91
|
+
label?: string;
|
|
92
|
+
}): void;
|
|
93
|
+
create(spec: NewObject, opts?: CreateOptions): string;
|
|
94
|
+
insertImages(images: readonly ImageRef[], opts: InsertImagesOptions): string[];
|
|
95
|
+
preview(patch: Patch | PatchFn, label?: string): void;
|
|
96
|
+
private previewText;
|
|
97
|
+
private dropTextPreview;
|
|
98
|
+
private commitText;
|
|
99
|
+
beginRotation(excludedId?: string): void;
|
|
100
|
+
previewRotation(delta: number, centre?: Point, label?: string): void;
|
|
101
|
+
private refreshRotationAtCommit;
|
|
102
|
+
previewOverlay(): ReadonlyMap<string, Patch>;
|
|
103
|
+
hasPreview(): boolean;
|
|
104
|
+
commitPreview(opts?: CommitPreviewOptions): void;
|
|
105
|
+
private recordWrites;
|
|
106
|
+
private reparentPlan;
|
|
107
|
+
private hasAncestorIn;
|
|
108
|
+
cancelPreview(): void;
|
|
109
|
+
subtreeDelta(o: SceneObject): {
|
|
110
|
+
dx: number;
|
|
111
|
+
dy: number;
|
|
112
|
+
} | null;
|
|
113
|
+
private carrierDelta;
|
|
114
|
+
effective(o: SceneObject): SceneObject;
|
|
115
|
+
private commandBlocked;
|
|
116
|
+
private selectAllIds;
|
|
117
|
+
copyObjects(): SceneObject[];
|
|
118
|
+
private pasteParent;
|
|
119
|
+
paste(objects: readonly SceneObject[], options?: PasteOptions): string[];
|
|
120
|
+
private duplicate;
|
|
121
|
+
private insertCopies;
|
|
122
|
+
private layoutTargets;
|
|
123
|
+
private static retainedDistributionPlans;
|
|
124
|
+
private layoutCommand;
|
|
125
|
+
private buildCommands;
|
|
126
|
+
subscribe(l: () => void): () => void;
|
|
127
|
+
private emit;
|
|
128
|
+
dispose(): void;
|
|
129
|
+
}
|
|
130
|
+
export { getPath };
|