@sequent-org/moodboard 1.2.119 → 1.3.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 (122) hide show
  1. package/package.json +11 -1
  2. package/src/assets/icons/rotate-icon.svg +1 -1
  3. package/src/core/HistoryManager.js +16 -16
  4. package/src/core/KeyboardManager.js +48 -539
  5. package/src/core/PixiEngine.js +9 -9
  6. package/src/core/SaveManager.js +56 -31
  7. package/src/core/bootstrap/CoreInitializer.js +65 -0
  8. package/src/core/commands/DeleteObjectCommand.js +8 -0
  9. package/src/core/commands/GroupDeleteCommand.js +75 -0
  10. package/src/core/commands/GroupRotateCommand.js +6 -0
  11. package/src/core/commands/UpdateContentCommand.js +52 -0
  12. package/src/core/commands/UpdateFramePropertiesCommand.js +98 -0
  13. package/src/core/commands/UpdateFrameTypeCommand.js +85 -0
  14. package/src/core/commands/UpdateNoteStyleCommand.js +88 -0
  15. package/src/core/commands/UpdateTextStyleCommand.js +90 -0
  16. package/src/core/commands/index.js +6 -0
  17. package/src/core/events/Events.js +6 -0
  18. package/src/core/flows/ClipboardFlow.js +553 -0
  19. package/src/core/flows/LayerAndViewportFlow.js +283 -0
  20. package/src/core/flows/ObjectLifecycleFlow.js +336 -0
  21. package/src/core/flows/SaveFlow.js +34 -0
  22. package/src/core/flows/TransformFlow.js +277 -0
  23. package/src/core/flows/TransformFlowResizeHelpers.js +83 -0
  24. package/src/core/index.js +41 -1773
  25. package/src/core/keyboard/KeyboardClipboardImagePaste.js +190 -0
  26. package/src/core/keyboard/KeyboardContextGuards.js +35 -0
  27. package/src/core/keyboard/KeyboardEventRouter.js +92 -0
  28. package/src/core/keyboard/KeyboardSelectionActions.js +103 -0
  29. package/src/core/keyboard/KeyboardShortcutMap.js +31 -0
  30. package/src/core/keyboard/KeyboardToolSwitching.js +26 -0
  31. package/src/core/rendering/ObjectRenderer.js +3 -7
  32. package/src/grid/BaseGrid.js +26 -0
  33. package/src/grid/CrossGrid.js +7 -6
  34. package/src/grid/DotGrid.js +89 -33
  35. package/src/grid/DotGridZoomPhases.js +42 -0
  36. package/src/grid/LineGrid.js +22 -21
  37. package/src/moodboard/MoodBoard.js +31 -532
  38. package/src/moodboard/bootstrap/MoodBoardInitializer.js +47 -0
  39. package/src/moodboard/bootstrap/MoodBoardManagersFactory.js +38 -0
  40. package/src/moodboard/bootstrap/MoodBoardUiFactory.js +109 -0
  41. package/src/moodboard/integration/MoodBoardEventBindings.js +65 -0
  42. package/src/moodboard/integration/MoodBoardLoadApi.js +82 -0
  43. package/src/moodboard/integration/MoodBoardScreenshotApi.js +33 -0
  44. package/src/moodboard/integration/MoodBoardScreenshotCanvas.js +98 -0
  45. package/src/moodboard/lifecycle/MoodBoardDestroyer.js +97 -0
  46. package/src/objects/FileObject.js +17 -6
  47. package/src/objects/FrameObject.js +50 -10
  48. package/src/objects/NoteObject.js +5 -4
  49. package/src/services/BoardService.js +42 -2
  50. package/src/services/FrameService.js +83 -42
  51. package/src/services/ResizePolicyService.js +152 -0
  52. package/src/services/SettingsApplier.js +7 -2
  53. package/src/services/ZoomPanController.js +35 -9
  54. package/src/tools/ToolManager.js +30 -537
  55. package/src/tools/board-tools/PanTool.js +5 -11
  56. package/src/tools/manager/ToolActivationController.js +49 -0
  57. package/src/tools/manager/ToolEventRouter.js +396 -0
  58. package/src/tools/manager/ToolManagerGuards.js +33 -0
  59. package/src/tools/manager/ToolManagerLifecycle.js +110 -0
  60. package/src/tools/manager/ToolRegistry.js +33 -0
  61. package/src/tools/object-tools/DrawingTool.js +48 -14
  62. package/src/tools/object-tools/PlacementTool.js +50 -1049
  63. package/src/tools/object-tools/PlacementToolV2.js +88 -0
  64. package/src/tools/object-tools/SelectTool.js +174 -2681
  65. package/src/tools/object-tools/placement/GhostController.js +504 -0
  66. package/src/tools/object-tools/placement/PlacementCoordinateResolver.js +20 -0
  67. package/src/tools/object-tools/placement/PlacementEventsBridge.js +91 -0
  68. package/src/tools/object-tools/placement/PlacementInputRouter.js +267 -0
  69. package/src/tools/object-tools/placement/PlacementPayloadFactory.js +111 -0
  70. package/src/tools/object-tools/placement/PlacementSessionStore.js +18 -0
  71. package/src/tools/object-tools/selection/BoxSelectController.js +0 -5
  72. package/src/tools/object-tools/selection/CloneFlowController.js +71 -0
  73. package/src/tools/object-tools/selection/CoordinateMapper.js +10 -0
  74. package/src/tools/object-tools/selection/CursorController.js +78 -0
  75. package/src/tools/object-tools/selection/FileNameInlineEditorController.js +184 -0
  76. package/src/tools/object-tools/selection/HitTestService.js +102 -0
  77. package/src/tools/object-tools/selection/InlineEditorController.js +24 -0
  78. package/src/tools/object-tools/selection/InlineEditorDomFactory.js +50 -0
  79. package/src/tools/object-tools/selection/InlineEditorListenersRegistry.js +14 -0
  80. package/src/tools/object-tools/selection/InlineEditorPositioningService.js +25 -0
  81. package/src/tools/object-tools/selection/NoteInlineEditorController.js +113 -0
  82. package/src/tools/object-tools/selection/SelectInputRouter.js +267 -0
  83. package/src/tools/object-tools/selection/SelectToolLifecycleController.js +128 -0
  84. package/src/tools/object-tools/selection/SelectToolSetup.js +134 -0
  85. package/src/tools/object-tools/selection/SelectionOverlayService.js +81 -0
  86. package/src/tools/object-tools/selection/SelectionStateController.js +91 -0
  87. package/src/tools/object-tools/selection/TextEditorDomFactory.js +65 -0
  88. package/src/tools/object-tools/selection/TextEditorInteractionController.js +266 -0
  89. package/src/tools/object-tools/selection/TextEditorLifecycleRegistry.js +90 -0
  90. package/src/tools/object-tools/selection/TextEditorPositioningService.js +158 -0
  91. package/src/tools/object-tools/selection/TextEditorSyncService.js +110 -0
  92. package/src/tools/object-tools/selection/TextInlineEditorController.js +457 -0
  93. package/src/tools/object-tools/selection/TransformInteractionController.js +466 -0
  94. package/src/ui/FilePropertiesPanel.js +61 -32
  95. package/src/ui/FramePropertiesPanel.js +176 -101
  96. package/src/ui/HtmlHandlesLayer.js +121 -999
  97. package/src/ui/MapPanel.js +12 -7
  98. package/src/ui/NotePropertiesPanel.js +17 -2
  99. package/src/ui/TextPropertiesPanel.js +124 -738
  100. package/src/ui/Toolbar.js +71 -1180
  101. package/src/ui/Topbar.js +23 -25
  102. package/src/ui/ZoomPanel.js +16 -5
  103. package/src/ui/handles/GroupSelectionHandlesController.js +29 -0
  104. package/src/ui/handles/HandlesDomRenderer.js +278 -0
  105. package/src/ui/handles/HandlesEventBridge.js +102 -0
  106. package/src/ui/handles/HandlesInteractionController.js +772 -0
  107. package/src/ui/handles/HandlesPositioningService.js +206 -0
  108. package/src/ui/handles/SingleSelectionHandlesController.js +22 -0
  109. package/src/ui/styles/toolbar.css +2 -0
  110. package/src/ui/styles/workspace.css +13 -6
  111. package/src/ui/text-properties/TextPropertiesPanelBindings.js +92 -0
  112. package/src/ui/text-properties/TextPropertiesPanelEventBridge.js +77 -0
  113. package/src/ui/text-properties/TextPropertiesPanelMapper.js +173 -0
  114. package/src/ui/text-properties/TextPropertiesPanelRenderer.js +434 -0
  115. package/src/ui/text-properties/TextPropertiesPanelState.js +39 -0
  116. package/src/ui/toolbar/ToolbarActionRouter.js +193 -0
  117. package/src/ui/toolbar/ToolbarDialogsController.js +186 -0
  118. package/src/ui/toolbar/ToolbarPopupsController.js +662 -0
  119. package/src/ui/toolbar/ToolbarRenderer.js +97 -0
  120. package/src/ui/toolbar/ToolbarStateController.js +79 -0
  121. package/src/ui/toolbar/ToolbarTooltipController.js +52 -0
  122. package/src/utils/emojiLoaderNoBundler.js +1 -1
@@ -0,0 +1,88 @@
1
+ /**
2
+ * Команда изменения стиля записки (шрифт, размер, цвет текста, фон) для системы Undo/Redo.
3
+ * Поддерживает: fontFamily, fontSize, textColor, backgroundColor (все в object.properties).
4
+ */
5
+ import { BaseCommand } from './BaseCommand.js';
6
+ import { Events } from '../events/Events.js';
7
+
8
+ const NOTE_STYLE_PROPS = ['fontFamily', 'fontSize', 'textColor', 'backgroundColor'];
9
+
10
+ export class UpdateNoteStyleCommand extends BaseCommand {
11
+ /**
12
+ * @param {Object} coreMoodboard — ядро доски
13
+ * @param {string} objectId — id объекта записки
14
+ * @param {string} property — имя свойства (fontFamily | fontSize | textColor | backgroundColor)
15
+ * @param {*} oldValue — прежнее значение
16
+ * @param {*} newValue — новое значение
17
+ */
18
+ constructor(coreMoodboard, objectId, property, oldValue, newValue) {
19
+ super('update_note_style', `Изменить ${_propertyLabel(property)}`);
20
+ this.coreMoodboard = coreMoodboard;
21
+ this.objectId = objectId;
22
+ this.property = property;
23
+ this.oldValue = oldValue;
24
+ this.newValue = newValue;
25
+ }
26
+
27
+ execute() {
28
+ this._apply(this.newValue);
29
+ }
30
+
31
+ undo() {
32
+ this._apply(this.oldValue);
33
+ }
34
+
35
+ canMergeWith(otherCommand) {
36
+ return otherCommand instanceof UpdateNoteStyleCommand &&
37
+ otherCommand.objectId === this.objectId &&
38
+ otherCommand.property === this.property;
39
+ }
40
+
41
+ mergeWith(otherCommand) {
42
+ if (!this.canMergeWith(otherCommand)) {
43
+ throw new Error('Cannot merge commands');
44
+ }
45
+ this.newValue = otherCommand.newValue;
46
+ this.timestamp = otherCommand.timestamp;
47
+ }
48
+
49
+ _apply(value) {
50
+ const { coreMoodboard, objectId, property } = this;
51
+ const objects = coreMoodboard.state.getObjects();
52
+ const object = objects.find((obj) => obj.id === objectId);
53
+ if (!object) return;
54
+
55
+ if (!object.properties) object.properties = {};
56
+ object.properties[property] = value;
57
+ coreMoodboard.state.markDirty();
58
+
59
+ const pixiObject = coreMoodboard.pixi?.objects?.get(objectId);
60
+ if (pixiObject?._mb?.instance) {
61
+ const instance = pixiObject._mb.instance;
62
+ if (instance.setStyle) {
63
+ const styleUpdates = { [property]: value };
64
+ instance.setStyle(styleUpdates);
65
+ }
66
+ }
67
+
68
+ if (pixiObject?._mb) {
69
+ if (!pixiObject._mb.properties) pixiObject._mb.properties = {};
70
+ pixiObject._mb.properties[property] = value;
71
+ }
72
+
73
+ coreMoodboard.eventBus.emit(Events.Object.StateChanged, {
74
+ objectId,
75
+ updates: { properties: { [property]: value } },
76
+ });
77
+ }
78
+ }
79
+
80
+ function _propertyLabel(property) {
81
+ const labels = {
82
+ fontFamily: 'шрифт',
83
+ fontSize: 'размер шрифта',
84
+ textColor: 'цвет текста',
85
+ backgroundColor: 'фон',
86
+ };
87
+ return labels[property] || property;
88
+ }
@@ -0,0 +1,90 @@
1
+ /**
2
+ * Команда изменения свойств текста (шрифт, размер, цвет, фон) для системы Undo/Redo.
3
+ * Поддерживает: fontFamily, fontSize, color, backgroundColor.
4
+ */
5
+ import { BaseCommand } from './BaseCommand.js';
6
+ import { Events } from '../events/Events.js';
7
+ import { syncPixiTextProperties } from '../../ui/text-properties/TextPropertiesPanelMapper.js';
8
+
9
+ export class UpdateTextStyleCommand extends BaseCommand {
10
+ /**
11
+ * @param {Object} coreMoodboard — ядро доски
12
+ * @param {string} objectId — id объекта
13
+ * @param {string} property — имя свойства (fontFamily | fontSize | color | backgroundColor)
14
+ * @param {*} oldValue — прежнее значение
15
+ * @param {*} newValue — новое значение
16
+ */
17
+ constructor(coreMoodboard, objectId, property, oldValue, newValue) {
18
+ super('update_text_style', `Изменить ${_propertyLabel(property)}`);
19
+ this.coreMoodboard = coreMoodboard;
20
+ this.objectId = objectId;
21
+ this.property = property;
22
+ this.oldValue = oldValue;
23
+ this.newValue = newValue;
24
+ }
25
+
26
+ execute() {
27
+ this._apply(this.newValue);
28
+ }
29
+
30
+ undo() {
31
+ this._apply(this.oldValue);
32
+ }
33
+
34
+ canMergeWith(otherCommand) {
35
+ return otherCommand instanceof UpdateTextStyleCommand &&
36
+ otherCommand.objectId === this.objectId &&
37
+ otherCommand.property === this.property;
38
+ }
39
+
40
+ mergeWith(otherCommand) {
41
+ if (!this.canMergeWith(otherCommand)) {
42
+ throw new Error('Cannot merge commands');
43
+ }
44
+ this.newValue = otherCommand.newValue;
45
+ this.timestamp = otherCommand.timestamp;
46
+ }
47
+
48
+ _apply(value) {
49
+ const objects = this.coreMoodboard.state.getObjects();
50
+ const object = objects.find((obj) => obj.id === this.objectId);
51
+ if (!object) return;
52
+
53
+ const { property } = this;
54
+
55
+ if (property === 'fontFamily') {
56
+ if (!object.properties) object.properties = {};
57
+ object.properties.fontFamily = value;
58
+ } else {
59
+ object[property] = value;
60
+ }
61
+
62
+ this.coreMoodboard.state.markDirty();
63
+
64
+ const pixiObject = this.coreMoodboard.pixi?.objects?.get(this.objectId);
65
+ if (pixiObject && pixiObject._mb) {
66
+ if (!pixiObject._mb.properties) pixiObject._mb.properties = {};
67
+ pixiObject._mb.properties[property] = value;
68
+ }
69
+
70
+ syncPixiTextProperties(this.coreMoodboard.eventBus, this.objectId, { [property]: value });
71
+
72
+ const updates = property === 'fontFamily'
73
+ ? { properties: { fontFamily: value } }
74
+ : { [property]: value };
75
+ this.coreMoodboard.eventBus.emit(Events.Object.StateChanged, {
76
+ objectId: this.objectId,
77
+ updates,
78
+ });
79
+ }
80
+ }
81
+
82
+ function _propertyLabel(property) {
83
+ const labels = {
84
+ fontFamily: 'шрифт',
85
+ fontSize: 'размер шрифта',
86
+ color: 'цвет текста',
87
+ backgroundColor: 'фон текста',
88
+ };
89
+ return labels[property] || property;
90
+ }
@@ -2,6 +2,7 @@
2
2
  export { BaseCommand } from './BaseCommand.js';
3
3
  export { CreateObjectCommand } from './CreateObjectCommand.js';
4
4
  export { DeleteObjectCommand } from './DeleteObjectCommand.js';
5
+ export { GroupDeleteCommand } from './GroupDeleteCommand.js';
5
6
  export { MoveObjectCommand } from './MoveObjectCommand.js';
6
7
  export { ResizeObjectCommand } from './ResizeObjectCommand.js';
7
8
  export { CopyObjectCommand } from './CopyObjectCommand.js';
@@ -12,3 +13,8 @@ export { GroupResizeCommand } from './GroupResizeCommand.js';
12
13
  export { ReorderZCommand } from './ReorderZCommand.js';
13
14
  export { GroupReorderZCommand } from './GroupReorderZCommand.js';
14
15
  export { EditFileNameCommand } from './EditFileNameCommand.js';
16
+ export { UpdateContentCommand } from './UpdateContentCommand.js';
17
+ export { UpdateTextStyleCommand } from './UpdateTextStyleCommand.js';
18
+ export { UpdateNoteStyleCommand } from './UpdateNoteStyleCommand.js';
19
+ export { UpdateFramePropertiesCommand } from './UpdateFramePropertiesCommand.js';
20
+ export { UpdateFrameTypeCommand } from './UpdateFrameTypeCommand.js';
@@ -107,6 +107,7 @@ export const Events = {
107
107
  Pasted: 'object:pasted',
108
108
  StateChanged: 'state:changed',
109
109
  FileNameChange: 'object:filename:change',
110
+ ContentChange: 'object:content:change',
110
111
  },
111
112
 
112
113
  History: {
@@ -126,6 +127,9 @@ export const Events = {
126
127
  Grid: {
127
128
  BoardDataChanged: 'board:data-changed',
128
129
  },
130
+ Viewport: {
131
+ Changed: 'viewport:changed',
132
+ },
129
133
 
130
134
  Board: {
131
135
  Loaded: 'board:loaded',
@@ -137,6 +141,8 @@ export const Events = {
137
141
  FileCanceled: 'place:file:canceled',
138
142
  ImageSelected: 'place:image:selected',
139
143
  ImageCanceled: 'place:image:canceled',
144
+ ImageObject2Selected: 'place:image-object2:selected',
145
+ ImageObject2Canceled: 'place:image-object2:canceled',
140
146
  GhostShow: 'place:ghost:show',
141
147
  GhostHide: 'place:ghost:hide',
142
148
  GhostUpdate: 'place:ghost:update',