@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.
Files changed (83) hide show
  1. package/LICENSE +5 -0
  2. package/README.md +6 -2
  3. package/dist/camera/CameraInput.d.ts +106 -0
  4. package/dist/camera/CameraInput.js +398 -0
  5. package/dist/clipboard/ObjectClipboard.d.ts +40 -0
  6. package/dist/clipboard/ObjectClipboard.js +243 -0
  7. package/dist/clipboard/PasteCommitError.d.ts +4 -0
  8. package/dist/clipboard/PasteCommitError.js +7 -0
  9. package/dist/clipboard/carrier.d.ts +5 -0
  10. package/dist/clipboard/carrier.js +59 -0
  11. package/dist/clipboard/objects.d.ts +21 -0
  12. package/dist/clipboard/objects.js +362 -0
  13. package/dist/clipboard/placement.d.ts +11 -0
  14. package/dist/clipboard/placement.js +21 -0
  15. package/dist/clipboard/systemImages.d.ts +1 -0
  16. package/dist/clipboard/systemImages.js +24 -0
  17. package/dist/index.d.ts +23 -0
  18. package/dist/index.js +22 -0
  19. package/dist/input/TouchInput.d.ts +159 -0
  20. package/dist/input/TouchInput.js +656 -0
  21. package/dist/input/visiblePart.d.ts +8 -0
  22. package/dist/input/visiblePart.js +15 -0
  23. package/dist/interaction/InteractionLayer.d.ts +83 -0
  24. package/dist/interaction/InteractionLayer.js +520 -0
  25. package/dist/props/PropertyController.d.ts +130 -0
  26. package/dist/props/PropertyController.js +1448 -0
  27. package/dist/props/PropertyRegistry.d.ts +38 -0
  28. package/dist/props/PropertyRegistry.js +21 -0
  29. package/dist/props/builtinProperties.d.ts +23 -0
  30. package/dist/props/builtinProperties.js +350 -0
  31. package/dist/props/defaults.d.ts +6 -0
  32. package/dist/props/defaults.js +29 -0
  33. package/dist/selection/SelectionModel.d.ts +25 -0
  34. package/dist/selection/SelectionModel.js +79 -0
  35. package/dist/text/CanvasEditorView.d.ts +99 -0
  36. package/dist/text/CanvasEditorView.js +308 -0
  37. package/dist/text/InputSink.d.ts +157 -0
  38. package/dist/text/InputSink.js +841 -0
  39. package/dist/text/TextEditSession.d.ts +173 -0
  40. package/dist/text/TextEditSession.js +1328 -0
  41. package/dist/text/clipboard.d.ts +11 -0
  42. package/dist/text/clipboard.js +489 -0
  43. package/dist/text/commands.d.ts +48 -0
  44. package/dist/text/commands.js +329 -0
  45. package/dist/text/contextMirror.d.ts +51 -0
  46. package/dist/text/contextMirror.js +292 -0
  47. package/dist/text/flat.d.ts +35 -0
  48. package/dist/text/flat.js +556 -0
  49. package/dist/text/graphemes.d.ts +16 -0
  50. package/dist/text/graphemes.js +219 -0
  51. package/dist/text/index.d.ts +13 -0
  52. package/dist/text/index.js +13 -0
  53. package/dist/text/inputReducer.d.ts +24 -0
  54. package/dist/text/inputReducer.js +44 -0
  55. package/dist/text/keymap.d.ts +17 -0
  56. package/dist/text/keymap.js +148 -0
  57. package/dist/text/schema.d.ts +12 -0
  58. package/dist/text/schema.js +44 -0
  59. package/dist/text/sessionFocus.d.ts +20 -0
  60. package/dist/text/sessionFocus.js +51 -0
  61. package/dist/text/types.d.ts +114 -0
  62. package/dist/text/types.js +1 -0
  63. package/dist/tools/CreateTool.d.ts +78 -0
  64. package/dist/tools/CreateTool.js +258 -0
  65. package/dist/tools/SelectTool.d.ts +155 -0
  66. package/dist/tools/SelectTool.js +808 -0
  67. package/dist/tools/ToolManager.d.ts +63 -0
  68. package/dist/tools/ToolManager.js +146 -0
  69. package/dist/tools/connectorEndpoints.d.ts +17 -0
  70. package/dist/tools/connectorEndpoints.js +53 -0
  71. package/dist/tools/frameRotation.d.ts +8 -0
  72. package/dist/tools/frameRotation.js +66 -0
  73. package/dist/tools/gradientHandles.d.ts +67 -0
  74. package/dist/tools/gradientHandles.js +110 -0
  75. package/dist/tools/presetPaths.d.ts +5 -0
  76. package/dist/tools/presetPaths.js +49 -0
  77. package/dist/tools/snapResize.d.ts +7 -0
  78. package/dist/tools/snapResize.js +65 -0
  79. package/dist/tools/snapping.d.ts +30 -0
  80. package/dist/tools/snapping.js +280 -0
  81. package/dist/tools/transform.d.ts +52 -0
  82. package/dist/tools/transform.js +277 -0
  83. package/package.json +36 -3
@@ -0,0 +1,173 @@
1
+ import { TextLayoutCache, type Rect, type Renderer, type SceneObject, type TextContent } from "@daasboard/render-core";
2
+ import { type DocumentAdapter, type PresenceCaret, type TextDelta, type Transaction as DocTransaction } from "@daasboard/doc";
3
+ import { EditorState } from "prosemirror-state";
4
+ import type { SelectionModel } from "../selection/SelectionModel.js";
5
+ import { CanvasEditorView } from "./CanvasEditorView.js";
6
+ import { type ClipboardContent } from "./clipboard.js";
7
+ import type { InputTarget, KeyInfo, TextMarks, TextMirror, TextPropertyTarget, TextSessionView } from "./types.js";
8
+ export declare const FROM_DOC = "textEditSession/fromDoc";
9
+ export declare const LABEL = "textEditSession/label";
10
+ export declare const BLINK_MS = 500;
11
+ export type PointerPhase = "down" | "move" | "up";
12
+ export interface TextEditSessionOptions {
13
+ objectId: string;
14
+ doc: DocumentAdapter;
15
+ renderer: Renderer;
16
+ texts?: TextLayoutCache;
17
+ fallbacks?: () => readonly string[];
18
+ selection: SelectionModel;
19
+ toClient?: (world: {
20
+ x: number;
21
+ y: number;
22
+ }) => {
23
+ x: number;
24
+ y: number;
25
+ };
26
+ onChange: () => void;
27
+ onEnd: () => void;
28
+ onPresenceCaret?: (caret: PresenceCaret | null) => void;
29
+ now?: () => number;
30
+ mac?: boolean;
31
+ windows?: boolean;
32
+ discardIfUntouched?: boolean;
33
+ }
34
+ export declare class TextEditSession implements InputTarget, TextPropertyTarget, TextSessionView {
35
+ readonly objectId: string;
36
+ readonly view: CanvasEditorView;
37
+ readonly texts: TextLayoutCache;
38
+ private readonly doc;
39
+ private readonly renderer;
40
+ private readonly selection;
41
+ private readonly toClient;
42
+ private readonly onChange;
43
+ private readonly onEnd;
44
+ private readonly onPresenceCaret;
45
+ private readonly now;
46
+ private readonly keymap;
47
+ private readonly windows;
48
+ private readonly ownsTexts;
49
+ private readonly unsubscribeDoc;
50
+ private readonly unsubscribeSelection;
51
+ private ended;
52
+ private writing;
53
+ private lastActivity;
54
+ private localVersion;
55
+ private live;
56
+ private liveContent;
57
+ private liveBase;
58
+ private liveBaseVersion;
59
+ private liveBaseTextVersion;
60
+ private liveDoc;
61
+ private livePreedit;
62
+ private liveFitted;
63
+ private previewing;
64
+ private previewed;
65
+ private drawn;
66
+ private lastBase;
67
+ private matchedText;
68
+ private preeditText;
69
+ private preeditFrom;
70
+ private preeditReplaceTo;
71
+ private dragAnchor;
72
+ private pressed;
73
+ private words;
74
+ private settledAffinity;
75
+ private deferRebuild;
76
+ private deferredDeltas;
77
+ private fresh;
78
+ readonly mirror: TextMirror;
79
+ private mirrorHooks;
80
+ constructor(opts: TextEditSessionOptions);
81
+ get state(): EditorState;
82
+ get active(): boolean;
83
+ get composing(): boolean;
84
+ private onTransaction;
85
+ private write;
86
+ private afterChange;
87
+ private syncMirror;
88
+ private syncSelection;
89
+ private onDocChange;
90
+ private docView;
91
+ private rebuildFromDoc;
92
+ private run;
93
+ private select;
94
+ liveObject(): SceneObject;
95
+ drawnAs(drawn: ((live: SceneObject) => SceneObject) | null): void;
96
+ private drawnObject;
97
+ private shown;
98
+ private fittedHeight;
99
+ private boxFor;
100
+ preedit(): {
101
+ from: number;
102
+ to: number;
103
+ } | null;
104
+ private reveal;
105
+ preeditRects(): Rect[];
106
+ caretRect(): Rect | null;
107
+ private preeditCaret;
108
+ selectionRects(): Rect[];
109
+ caretVisible(now: number): boolean;
110
+ insertText(text: string): void;
111
+ private replaceFlat;
112
+ deleteBackward(unit: "char" | "word" | "line"): void;
113
+ deleteForward(unit: "char" | "word" | "line"): void;
114
+ splitBlock(): void;
115
+ insertLineBreak(): void;
116
+ keydown(e: KeyInfo): boolean;
117
+ compositionStart(): void;
118
+ compositionUpdate(data: string): void;
119
+ compositionEnd(data: string): void;
120
+ private compose;
121
+ copyText(): string;
122
+ copyClipboard(): ClipboardContent | null;
123
+ pasteClipboard(content: ClipboardContent): boolean;
124
+ cut(): string;
125
+ undo(): void;
126
+ redo(): void;
127
+ private walkDoc;
128
+ blur(): void;
129
+ caretClientRect(): {
130
+ left: number;
131
+ top: number;
132
+ height: number;
133
+ } | null;
134
+ private objFrame;
135
+ private unrotate;
136
+ private rotatePoint;
137
+ readMark(name: string): {
138
+ value: unknown;
139
+ mixed: boolean;
140
+ values?: unknown[];
141
+ };
142
+ private objectDefault;
143
+ writeMark(name: string, value: unknown): void;
144
+ private markCommand;
145
+ private formatting;
146
+ previewMarks(marks: TextMarks | null): void;
147
+ commitMarks(marks: TextMarks, label: string, also?: (tx: DocTransaction) => void, text?: TextContent): void;
148
+ private replacing;
149
+ pointer(worldRaw: {
150
+ x: number;
151
+ y: number;
152
+ }, phase: PointerPhase, shift?: boolean, clicks?: number): boolean;
153
+ private extend;
154
+ private nearestPos;
155
+ private nearestHit;
156
+ private wordRange;
157
+ private paragraphRange;
158
+ selectWordAt(pos: number, affinity?: "upstream" | "downstream"): void;
159
+ moveSelectionEnd(end: "anchor" | "head" | "caret", worldRaw: {
160
+ x: number;
161
+ y: number;
162
+ }): void;
163
+ selectionEnds(): {
164
+ end: "anchor" | "head" | "caret";
165
+ rect: Rect;
166
+ }[];
167
+ selectParagraphAt(pos: number): void;
168
+ selectRange(from: number, to?: number): void;
169
+ selectAll(): void;
170
+ focus(): void;
171
+ end(): void;
172
+ }
173
+ export declare function mapOffsetThroughDelta(off: number, delta: TextDelta, bias: "before" | "after"): number;