@formicoidea/labre-core 0.23.3 → 0.24.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/dist/_pkgs/affine-block-surface/element-model/index.d.ts +5 -2
- package/dist/_pkgs/affine-block-surface/element-model/index.js +4 -2
- package/dist/_pkgs/affine-gfx-ddd/core-domain/consts.d.ts +32 -0
- package/dist/_pkgs/affine-gfx-ddd/core-domain/consts.js +30 -0
- package/dist/_pkgs/affine-gfx-ddd/core-domain/element-renderer.d.ts +12 -0
- package/dist/_pkgs/affine-gfx-ddd/core-domain/element-renderer.js +93 -0
- package/dist/_pkgs/affine-gfx-ddd/core-domain/element-view.d.ts +11 -0
- package/dist/_pkgs/affine-gfx-ddd/core-domain/element-view.js +20 -0
- package/dist/_pkgs/affine-gfx-ddd/core-domain/legend.d.ts +18 -0
- package/dist/_pkgs/affine-gfx-ddd/core-domain/legend.js +69 -0
- package/dist/_pkgs/affine-gfx-ddd/core-domain/toolbar-config.d.ts +1 -0
- package/dist/_pkgs/affine-gfx-ddd/core-domain/toolbar-config.js +45 -0
- package/dist/_pkgs/affine-gfx-ddd/effects.d.ts +17 -0
- package/dist/_pkgs/affine-gfx-ddd/effects.js +21 -0
- package/dist/_pkgs/affine-gfx-ddd/index.d.ts +2 -0
- package/dist/_pkgs/affine-gfx-ddd/index.js +2 -0
- package/dist/_pkgs/affine-gfx-ddd/shared/consts.d.ts +180 -0
- package/dist/_pkgs/affine-gfx-ddd/shared/consts.js +92 -0
- package/dist/_pkgs/affine-gfx-ddd/shared/prefabs.d.ts +71 -0
- package/dist/_pkgs/affine-gfx-ddd/shared/prefabs.js +214 -0
- package/dist/_pkgs/affine-gfx-ddd/shared/utils.d.ts +10 -0
- package/dist/_pkgs/affine-gfx-ddd/shared/utils.js +9 -0
- package/dist/_pkgs/affine-gfx-ddd/templates/components.d.ts +7 -0
- package/dist/_pkgs/affine-gfx-ddd/templates/components.js +158 -0
- package/dist/_pkgs/affine-gfx-ddd/templates/index.d.ts +11 -0
- package/dist/_pkgs/affine-gfx-ddd/templates/index.js +108 -0
- package/dist/_pkgs/affine-gfx-ddd/toolbar/context-map-menu.d.ts +10 -0
- package/dist/_pkgs/affine-gfx-ddd/toolbar/context-map-menu.js +109 -0
- package/dist/_pkgs/affine-gfx-ddd/toolbar/core-domain-menu.d.ts +11 -0
- package/dist/_pkgs/affine-gfx-ddd/toolbar/core-domain-menu.js +118 -0
- package/dist/_pkgs/affine-gfx-ddd/toolbar/event-storming-menu.d.ts +9 -0
- package/dist/_pkgs/affine-gfx-ddd/toolbar/event-storming-menu.js +78 -0
- package/dist/_pkgs/affine-gfx-ddd/toolbar/icons.d.ts +6 -0
- package/dist/_pkgs/affine-gfx-ddd/toolbar/icons.js +20 -0
- package/dist/_pkgs/affine-gfx-ddd/toolbar/menu-base.d.ts +23 -0
- package/dist/_pkgs/affine-gfx-ddd/toolbar/menu-base.js +62 -0
- package/dist/_pkgs/affine-gfx-ddd/toolbar/senior-buttons.d.ts +34 -0
- package/dist/_pkgs/affine-gfx-ddd/toolbar/senior-buttons.js +114 -0
- package/dist/_pkgs/affine-gfx-ddd/toolbar/senior-tool.d.ts +6 -0
- package/dist/_pkgs/affine-gfx-ddd/toolbar/senior-tool.js +23 -0
- package/dist/_pkgs/affine-gfx-ddd/view.d.ts +35 -0
- package/dist/_pkgs/affine-gfx-ddd/view.js +95 -0
- package/dist/_pkgs/affine-gfx-mindmap/index.d.ts +1 -0
- package/dist/_pkgs/affine-gfx-mindmap/index.js +1 -0
- package/dist/_pkgs/affine-gfx-mindmap/templates/index.d.ts +2 -0
- package/dist/_pkgs/affine-gfx-mindmap/templates/index.js +28 -0
- package/dist/_pkgs/affine-gfx-mindmap/toolbar/mindmap-menu.d.ts +3 -0
- package/dist/_pkgs/affine-gfx-mindmap/toolbar/mindmap-menu.js +105 -87
- package/dist/_pkgs/affine-gfx-mindmap/toolbar/mindmap-tool-button.d.ts +3 -1
- package/dist/_pkgs/affine-gfx-mindmap/toolbar/mindmap-tool-button.js +97 -146
- package/dist/_pkgs/affine-gfx-mindmap/toolbar/senior-tool.d.ts +2 -0
- package/dist/_pkgs/affine-gfx-mindmap/toolbar/senior-tool.js +12 -0
- package/dist/_pkgs/affine-gfx-mindmap/view.d.ts +17 -1
- package/dist/_pkgs/affine-gfx-mindmap/view.js +38 -4
- package/dist/_pkgs/affine-gfx-template/services/template-middlewares.js +16 -1
- package/dist/_pkgs/affine-model/elements/core-domain/core-domain.d.ts +36 -0
- package/dist/_pkgs/affine-model/elements/core-domain/core-domain.js +122 -0
- package/dist/_pkgs/affine-model/elements/core-domain/index.d.ts +1 -0
- package/dist/_pkgs/affine-model/elements/core-domain/index.js +1 -0
- package/dist/_pkgs/affine-model/elements/index.d.ts +3 -0
- package/dist/_pkgs/affine-model/elements/index.js +1 -0
- package/dist/_pkgs/affine-shared/services/telemetry-service/lifecycle.d.ts +1 -1
- package/dist/extensions/view.js +12 -2
- package/dist/flags.d.ts +1 -1
- package/dist/flags.js +5 -0
- package/package.json +1 -1
|
@@ -16,7 +16,9 @@ export declare class EdgelessMindmapToolButton extends EdgelessMindmapToolButton
|
|
|
16
16
|
initDragController(): void;
|
|
17
17
|
render(): import("lit-html").TemplateResult<1>;
|
|
18
18
|
updated(_changedProperties: Map<PropertyKey, unknown>): void;
|
|
19
|
-
|
|
19
|
+
/** `'mindmap'` → the dedicated Mind Map button; `'other'` → free-text +
|
|
20
|
+
* add-file ("Others"). Drives the tools, tooltip, `m` shortcut and menu. */
|
|
21
|
+
accessor variant: 'mindmap' | 'other';
|
|
20
22
|
accessor mindmapElement: HTMLElement;
|
|
21
23
|
accessor readyToDrop: boolean;
|
|
22
24
|
}
|
|
@@ -35,7 +35,7 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
|
|
|
35
35
|
import { DefaultTool, EdgelessCRUDIdentifier, } from '../../affine-block-surface/index.js';
|
|
36
36
|
import { EmptyTool } from '../../affine-gfx-pointer/index.js';
|
|
37
37
|
import { TextTool } from '../../affine-gfx-text/index.js';
|
|
38
|
-
import { EditPropsStore,
|
|
38
|
+
import { EditPropsStore, ViewportElementProvider, } from '../../affine-shared/services/index.js';
|
|
39
39
|
import { EdgelessDraggableElementController, EdgelessToolbarToolMixin, } from '../../affine-widget-edgeless-toolbar/index.js';
|
|
40
40
|
import { SignalWatcher } from '../../global/lit/index.js';
|
|
41
41
|
import { computed } from '@preact/signals-core';
|
|
@@ -46,13 +46,13 @@ import { repeat } from 'lit/directives/repeat.js';
|
|
|
46
46
|
import { styleMap } from 'lit/directives/style-map.js';
|
|
47
47
|
import { getMindMaps } from './assets.js';
|
|
48
48
|
import { getMindmapRender, mediaConfig, mediaRender, mindmapConfig, textConfig, textRender, toolConfig2StyleObj, } from './basket-elements.js';
|
|
49
|
-
import {
|
|
49
|
+
import { mindmapMenuMediaIcon, textIcon } from './icons.js';
|
|
50
50
|
import { importMindmap } from './utils/import-mindmap.js';
|
|
51
51
|
let EdgelessMindmapToolButton = (() => {
|
|
52
52
|
let _classSuper = EdgelessToolbarToolMixin(SignalWatcher(LitElement));
|
|
53
|
-
let
|
|
54
|
-
let
|
|
55
|
-
let
|
|
53
|
+
let _variant_decorators;
|
|
54
|
+
let _variant_initializers = [];
|
|
55
|
+
let _variant_extraInitializers = [];
|
|
56
56
|
let _mindmapElement_decorators;
|
|
57
57
|
let _mindmapElement_initializers = [];
|
|
58
58
|
let _mindmapElement_extraInitializers = [];
|
|
@@ -62,10 +62,10 @@ let EdgelessMindmapToolButton = (() => {
|
|
|
62
62
|
return class EdgelessMindmapToolButton extends _classSuper {
|
|
63
63
|
static {
|
|
64
64
|
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
65
|
-
|
|
65
|
+
_variant_decorators = [property({ attribute: false })];
|
|
66
66
|
_mindmapElement_decorators = [query('.basket-tool-item.mindmap')];
|
|
67
67
|
_readyToDrop_decorators = [state()];
|
|
68
|
-
__esDecorate(this, null,
|
|
68
|
+
__esDecorate(this, null, _variant_decorators, { kind: "accessor", name: "variant", static: false, private: false, access: { has: obj => "variant" in obj, get: obj => obj.variant, set: (obj, value) => { obj.variant = value; } }, metadata: _metadata }, _variant_initializers, _variant_extraInitializers);
|
|
69
69
|
__esDecorate(this, null, _mindmapElement_decorators, { kind: "accessor", name: "mindmapElement", static: false, private: false, access: { has: obj => "mindmapElement" in obj, get: obj => obj.mindmapElement, set: (obj, value) => { obj.mindmapElement = value; } }, metadata: _metadata }, _mindmapElement_initializers, _mindmapElement_extraInitializers);
|
|
70
70
|
__esDecorate(this, null, _readyToDrop_decorators, { kind: "accessor", name: "readyToDrop", static: false, private: false, access: { has: obj => "readyToDrop" in obj, get: obj => obj.readyToDrop, set: (obj, value) => { obj.readyToDrop = value; } }, metadata: _metadata }, _readyToDrop_initializers, _readyToDrop_extraInitializers);
|
|
71
71
|
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
@@ -77,6 +77,11 @@ let EdgelessMindmapToolButton = (() => {
|
|
|
77
77
|
display: flex;
|
|
78
78
|
justify-content: center;
|
|
79
79
|
align-items: center;
|
|
80
|
+
/* Make this button the containing block of the popup's clip wrapper so
|
|
81
|
+
the "Others" sub-menu anchors to THIS button (not the whole toolbar)
|
|
82
|
+
and can be right-aligned to it — mirrors the framework senior buttons.
|
|
83
|
+
Without this the menu drifts when senior buttons are hidden. */
|
|
84
|
+
position: relative;
|
|
80
85
|
}
|
|
81
86
|
.partial-clip {
|
|
82
87
|
flex-shrink: 0;
|
|
@@ -86,88 +91,57 @@ let EdgelessMindmapToolButton = (() => {
|
|
|
86
91
|
padding: 0 10px;
|
|
87
92
|
overflow: hidden;
|
|
88
93
|
}
|
|
94
|
+
/* Icons sit centered in the slot — no basket tray. */
|
|
89
95
|
.basket-wrapper {
|
|
90
96
|
pointer-events: auto;
|
|
91
97
|
height: 64px;
|
|
92
98
|
width: 96px;
|
|
93
99
|
display: flex;
|
|
94
100
|
justify-content: center;
|
|
95
|
-
align-items:
|
|
101
|
+
align-items: center;
|
|
102
|
+
gap: 4px;
|
|
96
103
|
position: relative;
|
|
97
104
|
}
|
|
98
|
-
.basket,
|
|
99
|
-
.basket-tool-item {
|
|
100
|
-
transition: transform 0.3s ease-in-out;
|
|
101
|
-
position: absolute;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
.basket {
|
|
105
|
-
bottom: 0;
|
|
106
|
-
height: 17px;
|
|
107
|
-
width: 76px;
|
|
108
|
-
}
|
|
109
|
-
.basket > div,
|
|
110
|
-
.basket > svg {
|
|
111
|
-
position: absolute;
|
|
112
|
-
}
|
|
113
|
-
.glass {
|
|
114
|
-
width: 76px;
|
|
115
|
-
height: 17px;
|
|
116
|
-
border-radius: 2px;
|
|
117
|
-
mask: url(#mindmap-basket-body-mask);
|
|
118
|
-
}
|
|
119
|
-
.glass.enabled {
|
|
120
|
-
backdrop-filter: blur(2px);
|
|
121
|
-
}
|
|
122
|
-
@-moz-document url-prefix() {
|
|
123
|
-
.glass.enabled {
|
|
124
|
-
backdrop-filter: none;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
.basket {
|
|
129
|
-
z-index: 3;
|
|
130
|
-
}
|
|
131
105
|
.basket-tool-item {
|
|
106
|
+
position: relative;
|
|
132
107
|
cursor: grab;
|
|
108
|
+
transition: transform 0.3s ease-in-out;
|
|
133
109
|
}
|
|
134
110
|
.basket-tool-item svg {
|
|
135
111
|
display: block;
|
|
112
|
+
max-width: 46px;
|
|
113
|
+
max-height: 46px;
|
|
114
|
+
width: auto;
|
|
115
|
+
height: auto;
|
|
136
116
|
}
|
|
137
|
-
|
|
138
|
-
transform: translate(var(--default-x, 0), var(--default-y, 0))
|
|
139
|
-
rotate(var(--default-r, 0)) scale(var(--default-s, 1));
|
|
140
|
-
z-index: var(--default-z, 0);
|
|
141
|
-
}
|
|
142
|
-
|
|
117
|
+
/* the drag clone flies in/out using its captured offsets */
|
|
143
118
|
.basket-tool-item.next {
|
|
119
|
+
position: absolute;
|
|
144
120
|
transform: translate(var(--next-x, 0), var(--next-y, 0))
|
|
145
121
|
rotate(var(--next-r, 0)) scale(var(--next-s, 1));
|
|
146
122
|
z-index: var(--next-z, 0);
|
|
147
123
|
}
|
|
148
|
-
|
|
149
|
-
/* active & hover */
|
|
150
|
-
.basket-wrapper:hover .basket,
|
|
151
|
-
.basket-wrapper.active .basket {
|
|
152
|
-
z-index: 0;
|
|
153
|
-
}
|
|
154
124
|
.basket-wrapper:hover .basket-tool-item.current,
|
|
155
125
|
.basket-wrapper.active .basket-tool-item.current {
|
|
156
|
-
transform:
|
|
157
|
-
rotate(var(--active-r, 0)) scale(var(--active-s, 1));
|
|
158
|
-
z-index: var(--active-z, 0);
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
.basket-tool-item.next.coming,
|
|
162
|
-
.basket-wrapper:hover .basket-tool-item.current:hover {
|
|
163
|
-
transform: translate(var(--hover-x, 0), var(--hover-y, 0))
|
|
164
|
-
rotate(var(--hover-r, 0)) scale(var(--hover-s, 1));
|
|
165
|
-
z-index: var(--hover-z, 0);
|
|
126
|
+
transform: translateY(-6px) scale(1.06);
|
|
166
127
|
}
|
|
167
128
|
`; }
|
|
168
129
|
get draggableTools() {
|
|
169
|
-
|
|
170
|
-
|
|
130
|
+
// The dedicated "Mind Map" button carries only the mindmap tool; the
|
|
131
|
+
// "Others" button keeps free-text + add-file.
|
|
132
|
+
if (this.variant === 'mindmap') {
|
|
133
|
+
const style = this._style$.value;
|
|
134
|
+
const mindmap = this.mindmaps.find(m => m.style === style) || this.mindmaps[0];
|
|
135
|
+
return [
|
|
136
|
+
{
|
|
137
|
+
name: 'mindmap',
|
|
138
|
+
icon: mindmap.icon,
|
|
139
|
+
config: mindmapConfig,
|
|
140
|
+
standardWidth: 350,
|
|
141
|
+
render: getMindmapRender(style),
|
|
142
|
+
},
|
|
143
|
+
];
|
|
144
|
+
}
|
|
171
145
|
return [
|
|
172
146
|
{
|
|
173
147
|
name: 'media',
|
|
@@ -183,13 +157,6 @@ let EdgelessMindmapToolButton = (() => {
|
|
|
183
157
|
standardWidth: 100,
|
|
184
158
|
render: textRender,
|
|
185
159
|
},
|
|
186
|
-
{
|
|
187
|
-
name: 'mindmap',
|
|
188
|
-
icon: mindmap.icon,
|
|
189
|
-
config: mindmapConfig,
|
|
190
|
-
standardWidth: 350,
|
|
191
|
-
render: getMindmapRender(style),
|
|
192
|
-
},
|
|
193
160
|
];
|
|
194
161
|
}
|
|
195
162
|
get mindmaps() {
|
|
@@ -205,6 +172,7 @@ let EdgelessMindmapToolButton = (() => {
|
|
|
205
172
|
const menu = this.createPopper('edgeless-mindmap-menu', this);
|
|
206
173
|
Object.assign(menu.element, {
|
|
207
174
|
edgeless: this.edgeless,
|
|
175
|
+
variant: this.variant,
|
|
208
176
|
onActiveStyleChange: (style) => {
|
|
209
177
|
this.edgeless.std.get(EditPropsStore).recordLastProps('mindmap', {
|
|
210
178
|
style,
|
|
@@ -228,6 +196,20 @@ let EdgelessMindmapToolButton = (() => {
|
|
|
228
196
|
});
|
|
229
197
|
},
|
|
230
198
|
});
|
|
199
|
+
// Right-align the menu's right edge to this button's right edge, like the
|
|
200
|
+
// framework senior buttons. Stays correct however many buttons are hidden.
|
|
201
|
+
const el = menu.element;
|
|
202
|
+
const wrap = el.parentElement;
|
|
203
|
+
if (wrap) {
|
|
204
|
+
wrap.style.overflow = 'visible';
|
|
205
|
+
wrap.style.justifyContent = 'flex-end';
|
|
206
|
+
}
|
|
207
|
+
Object.assign(el.style, {
|
|
208
|
+
position: 'static',
|
|
209
|
+
width: 'max-content',
|
|
210
|
+
maxWidth: 'calc(100vw - 16px)',
|
|
211
|
+
marginLeft: '0',
|
|
212
|
+
});
|
|
231
213
|
}
|
|
232
214
|
initDragController() {
|
|
233
215
|
if (!this.edgeless || !this.toolbarContainer)
|
|
@@ -291,38 +273,41 @@ let EdgelessMindmapToolButton = (() => {
|
|
|
291
273
|
.catch(console.error);
|
|
292
274
|
},
|
|
293
275
|
});
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
276
|
+
// The `m` shortcut belongs to the dedicated Mind Map button only.
|
|
277
|
+
if (this.variant === 'mindmap') {
|
|
278
|
+
this.edgeless.bindHotKey({
|
|
279
|
+
m: () => {
|
|
280
|
+
const gfx = this.gfx;
|
|
281
|
+
const locked = gfx.viewport.locked;
|
|
282
|
+
if (locked)
|
|
283
|
+
return;
|
|
284
|
+
if (gfx.selection.editing)
|
|
285
|
+
return;
|
|
286
|
+
if (this.readyToDrop) {
|
|
287
|
+
// change the style
|
|
288
|
+
const activeIndex = this.mindmaps.findIndex(m => m.style === this._style$.value);
|
|
289
|
+
const nextIndex = (activeIndex + 1) % this.mindmaps.length;
|
|
290
|
+
const next = this.mindmaps[nextIndex];
|
|
291
|
+
this.edgeless.std.get(EditPropsStore).recordLastProps('mindmap', {
|
|
292
|
+
style: next.style,
|
|
293
|
+
});
|
|
294
|
+
const tool = this.draggableTools.find(t => t.name === 'mindmap');
|
|
295
|
+
this.draggableController.updateElementInfo({
|
|
296
|
+
data: tool,
|
|
297
|
+
preview: next.icon,
|
|
298
|
+
});
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
this.setEdgelessTool(EmptyTool);
|
|
302
|
+
const icon = this.mindmapElement;
|
|
303
|
+
const { x, y } = gfx.tool.lastMouseViewPos$.peek();
|
|
304
|
+
const { viewport } = this.edgeless.std.get(ViewportElementProvider);
|
|
305
|
+
const { left, top } = viewport;
|
|
306
|
+
const clientPos = { x: x + left, y: y + top };
|
|
307
|
+
this.draggableController.dragAndMoveTo(icon, clientPos);
|
|
308
|
+
},
|
|
309
|
+
}, { global: true });
|
|
310
|
+
}
|
|
326
311
|
// since there is not a tool called mindmap, we need to cancel the drag when the tool is changed
|
|
327
312
|
this.disposables.add(this.gfx.tool.currentToolName$.subscribe(toolName => {
|
|
328
313
|
// FIXME: remove the assertion after gfx tool refactor
|
|
@@ -333,15 +318,12 @@ let EdgelessMindmapToolButton = (() => {
|
|
|
333
318
|
}
|
|
334
319
|
render() {
|
|
335
320
|
const { popper } = this;
|
|
336
|
-
const appTheme = this.edgeless.std.get(ThemeProvider).app$.value;
|
|
337
|
-
const basketIcon = appTheme === 'light' ? basketIconLight : basketIconDark;
|
|
338
|
-
const glassBg = appTheme === 'light' ? 'rgba(255,255,255,0.5)' : 'rgba(74, 74, 74, 0.6)';
|
|
339
321
|
const { cancelled, dragOut, draggingElement } = this.draggableController?.states || {};
|
|
340
322
|
const active = popper || draggingElement;
|
|
341
323
|
return html `<edgeless-toolbar-button
|
|
342
324
|
class="edgeless-mindmap-button"
|
|
343
325
|
?withHover=${true}
|
|
344
|
-
.tooltip=${popper ? '' : 'Others'}
|
|
326
|
+
.tooltip=${popper ? '' : this.variant === 'mindmap' ? 'Mind Map' : 'Others'}
|
|
345
327
|
.tooltipOffset=${4}
|
|
346
328
|
@click=${this._toggleMenu}
|
|
347
329
|
style="width: 100%; height: 100%; display: inline-block"
|
|
@@ -389,41 +371,8 @@ let EdgelessMindmapToolButton = (() => {
|
|
|
389
371
|
${tool.icon}
|
|
390
372
|
</div>`;
|
|
391
373
|
})}
|
|
392
|
-
|
|
393
|
-
<div class="basket">
|
|
394
|
-
<div
|
|
395
|
-
class="glass ${this.enableBlur ? 'enabled' : ''}"
|
|
396
|
-
style="background: ${glassBg}"
|
|
397
|
-
></div>
|
|
398
|
-
${basketIcon}
|
|
399
|
-
</div>
|
|
400
374
|
</div>
|
|
401
375
|
</div>
|
|
402
|
-
|
|
403
|
-
<svg width="0" height="0" style="opacity: 0; pointer-events: none">
|
|
404
|
-
<defs>
|
|
405
|
-
<mask id="mindmap-basket-body-mask">
|
|
406
|
-
<rect
|
|
407
|
-
x="2"
|
|
408
|
-
width="71.8"
|
|
409
|
-
y="2"
|
|
410
|
-
height="15"
|
|
411
|
-
rx="1.5"
|
|
412
|
-
ry="1.5"
|
|
413
|
-
fill="white"
|
|
414
|
-
/>
|
|
415
|
-
<rect
|
|
416
|
-
width="32"
|
|
417
|
-
height="6"
|
|
418
|
-
x="22"
|
|
419
|
-
y="5.9"
|
|
420
|
-
fill="black"
|
|
421
|
-
rx="3"
|
|
422
|
-
ry="3"
|
|
423
|
-
/>
|
|
424
|
-
</mask>
|
|
425
|
-
</defs>
|
|
426
|
-
</svg>
|
|
427
376
|
</edgeless-toolbar-button>`;
|
|
428
377
|
}
|
|
429
378
|
updated(_changedProperties) {
|
|
@@ -433,9 +382,11 @@ let EdgelessMindmapToolButton = (() => {
|
|
|
433
382
|
this.initDragController();
|
|
434
383
|
}
|
|
435
384
|
}
|
|
436
|
-
#
|
|
437
|
-
|
|
438
|
-
|
|
385
|
+
#variant_accessor_storage;
|
|
386
|
+
/** `'mindmap'` → the dedicated Mind Map button; `'other'` → free-text +
|
|
387
|
+
* add-file ("Others"). Drives the tools, tooltip, `m` shortcut and menu. */
|
|
388
|
+
get variant() { return this.#variant_accessor_storage; }
|
|
389
|
+
set variant(value) { this.#variant_accessor_storage = value; }
|
|
439
390
|
#mindmapElement_accessor_storage;
|
|
440
391
|
get mindmapElement() { return this.#mindmapElement_accessor_storage; }
|
|
441
392
|
set mindmapElement(value) { this.#mindmapElement_accessor_storage = value; }
|
|
@@ -450,8 +401,8 @@ let EdgelessMindmapToolButton = (() => {
|
|
|
450
401
|
});
|
|
451
402
|
this.enableActiveBackground = true;
|
|
452
403
|
this.type = [EmptyTool, TextTool];
|
|
453
|
-
this.#
|
|
454
|
-
this.#mindmapElement_accessor_storage = (__runInitializers(this,
|
|
404
|
+
this.#variant_accessor_storage = __runInitializers(this, _variant_initializers, 'other');
|
|
405
|
+
this.#mindmapElement_accessor_storage = (__runInitializers(this, _variant_extraInitializers), __runInitializers(this, _mindmapElement_initializers, void 0));
|
|
455
406
|
this.#readyToDrop_accessor_storage = (__runInitializers(this, _mindmapElement_extraInitializers), __runInitializers(this, _readyToDrop_initializers, false));
|
|
456
407
|
__runInitializers(this, _readyToDrop_extraInitializers);
|
|
457
408
|
}
|
|
@@ -6,6 +6,18 @@ export const mindMapSeniorTool = SeniorToolExtension('mindMap', ({ block, toolba
|
|
|
6
6
|
content: html `<edgeless-mindmap-tool-button
|
|
7
7
|
.edgeless=${block}
|
|
8
8
|
.toolbarContainer=${toolbarContainer}
|
|
9
|
+
.variant=${'mindmap'}
|
|
10
|
+
></edgeless-mindmap-tool-button>`,
|
|
11
|
+
};
|
|
12
|
+
});
|
|
13
|
+
/** The "Others" button: free-text + add-file (mindmap moved to its own tool). */
|
|
14
|
+
export const otherSeniorTool = SeniorToolExtension('other', ({ block, toolbarContainer }) => {
|
|
15
|
+
return {
|
|
16
|
+
name: 'Others',
|
|
17
|
+
content: html `<edgeless-mindmap-tool-button
|
|
18
|
+
.edgeless=${block}
|
|
19
|
+
.toolbarContainer=${toolbarContainer}
|
|
20
|
+
.variant=${'other'}
|
|
9
21
|
></edgeless-mindmap-tool-button>`,
|
|
10
22
|
};
|
|
11
23
|
});
|
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
import { type ViewExtensionContext, ViewExtensionProvider } from '../affine-ext-loader/index.js';
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Mindmap rendering — ALWAYS registered, independent of any flag. Disabling the
|
|
4
|
+
* `mindmap` / `other` flags hides only their senior buttons (see below); placed
|
|
5
|
+
* mindmaps must still paint, stay editable, and Templates-panel insertion must
|
|
6
|
+
* still render them.
|
|
7
|
+
*/
|
|
8
|
+
export declare class MindmapRenderViewExtension extends ViewExtensionProvider {
|
|
3
9
|
name: string;
|
|
4
10
|
effect(): void;
|
|
5
11
|
setup(context: ViewExtensionContext): void;
|
|
6
12
|
}
|
|
13
|
+
/** The dedicated "Mind Map" senior button — flag-gated (`mindmap`). */
|
|
14
|
+
export declare class MindmapToolViewExtension extends ViewExtensionProvider {
|
|
15
|
+
name: string;
|
|
16
|
+
setup(context: ViewExtensionContext): void;
|
|
17
|
+
}
|
|
18
|
+
/** The "Others" senior button (free-text + add-file) — flag-gated (`other`). */
|
|
19
|
+
export declare class OtherToolViewExtension extends ViewExtensionProvider {
|
|
20
|
+
name: string;
|
|
21
|
+
setup(context: ViewExtensionContext): void;
|
|
22
|
+
}
|
|
@@ -1,24 +1,32 @@
|
|
|
1
1
|
import { ViewExtensionProvider, } from '../affine-ext-loader/index.js';
|
|
2
|
+
import { extendTemplateCategory } from '../affine-gfx-template/index.js';
|
|
2
3
|
import { effects } from './effects';
|
|
3
4
|
import { MindmapElementRendererExtension } from './element-renderer';
|
|
4
5
|
import { MindMapIndicatorOverlay } from './indicator-overlay';
|
|
5
6
|
import { MindMapDragExtension } from './interactivity';
|
|
6
7
|
import { mindmapToolbarExtension, shapeMindmapToolbarExtension, } from './toolbar/config';
|
|
7
|
-
import { mindMapSeniorTool } from './toolbar/senior-tool';
|
|
8
|
+
import { mindMapSeniorTool, otherSeniorTool } from './toolbar/senior-tool';
|
|
9
|
+
import { mindmapTemplateCategory } from './templates';
|
|
8
10
|
import { MindMapInteraction, MindMapView } from './view/view';
|
|
9
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Mindmap rendering — ALWAYS registered, independent of any flag. Disabling the
|
|
13
|
+
* `mindmap` / `other` flags hides only their senior buttons (see below); placed
|
|
14
|
+
* mindmaps must still paint, stay editable, and Templates-panel insertion must
|
|
15
|
+
* still render them.
|
|
16
|
+
*/
|
|
17
|
+
export class MindmapRenderViewExtension extends ViewExtensionProvider {
|
|
10
18
|
constructor() {
|
|
11
19
|
super(...arguments);
|
|
12
|
-
this.name = 'affine-mindmap-gfx';
|
|
20
|
+
this.name = 'affine-mindmap-render-gfx';
|
|
13
21
|
}
|
|
14
22
|
effect() {
|
|
15
23
|
super.effect();
|
|
16
24
|
effects();
|
|
25
|
+
extendTemplateCategory(mindmapTemplateCategory);
|
|
17
26
|
}
|
|
18
27
|
setup(context) {
|
|
19
28
|
super.setup(context);
|
|
20
29
|
context.register(MindmapElementRendererExtension);
|
|
21
|
-
context.register(mindMapSeniorTool);
|
|
22
30
|
context.register(mindmapToolbarExtension);
|
|
23
31
|
context.register(shapeMindmapToolbarExtension);
|
|
24
32
|
context.register(MindMapView);
|
|
@@ -27,3 +35,29 @@ export class MindmapViewExtension extends ViewExtensionProvider {
|
|
|
27
35
|
context.register(MindMapInteraction);
|
|
28
36
|
}
|
|
29
37
|
}
|
|
38
|
+
/** The dedicated "Mind Map" senior button — flag-gated (`mindmap`). */
|
|
39
|
+
export class MindmapToolViewExtension extends ViewExtensionProvider {
|
|
40
|
+
constructor() {
|
|
41
|
+
super(...arguments);
|
|
42
|
+
this.name = 'affine-mindmap-gfx';
|
|
43
|
+
}
|
|
44
|
+
setup(context) {
|
|
45
|
+
super.setup(context);
|
|
46
|
+
if (this.isEdgeless(context.scope)) {
|
|
47
|
+
context.register(mindMapSeniorTool);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/** The "Others" senior button (free-text + add-file) — flag-gated (`other`). */
|
|
52
|
+
export class OtherToolViewExtension extends ViewExtensionProvider {
|
|
53
|
+
constructor() {
|
|
54
|
+
super(...arguments);
|
|
55
|
+
this.name = 'affine-other-gfx';
|
|
56
|
+
}
|
|
57
|
+
setup(context) {
|
|
58
|
+
super.setup(context);
|
|
59
|
+
if (this.isEdgeless(context.scope)) {
|
|
60
|
+
context.register(otherSeniorTool);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -35,7 +35,7 @@ export const replaceIdMiddleware = (job) => {
|
|
|
35
35
|
regeneratedIdMap.set(id, newId);
|
|
36
36
|
val.id = newId;
|
|
37
37
|
elements[newId] = val;
|
|
38
|
-
if (['connector', 'group'].includes(val['type'])) {
|
|
38
|
+
if (['connector', 'group', 'mindmap'].includes(val['type'])) {
|
|
39
39
|
defered.push(newId);
|
|
40
40
|
}
|
|
41
41
|
});
|
|
@@ -73,6 +73,21 @@ export const replaceIdMiddleware = (job) => {
|
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
break;
|
|
76
|
+
case 'mindmap':
|
|
77
|
+
{
|
|
78
|
+
const children = element['children'];
|
|
79
|
+
const newJson = {};
|
|
80
|
+
Object.entries(children.json).forEach(([key, val]) => {
|
|
81
|
+
const newVal = { ...val };
|
|
82
|
+
if (newVal.parent) {
|
|
83
|
+
newVal.parent =
|
|
84
|
+
regeneratedIdMap.get(newVal.parent) ?? newVal.parent;
|
|
85
|
+
}
|
|
86
|
+
newJson[regeneratedIdMap.get(key) ?? key] = newVal;
|
|
87
|
+
});
|
|
88
|
+
children.json = newJson;
|
|
89
|
+
}
|
|
90
|
+
break;
|
|
76
91
|
}
|
|
77
92
|
});
|
|
78
93
|
blockJson.props.elements = elements;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { IVec, SerializedXYWH } from '../../../global/gfx/index.js';
|
|
2
|
+
import { Bound } from '../../../global/gfx/index.js';
|
|
3
|
+
import type { BaseElementProps } from '../../../std/gfx/index.js';
|
|
4
|
+
import { GfxPrimitiveElementModel } from '../../../std/gfx/index.js';
|
|
5
|
+
export type CoreDomainChartProps = BaseElementProps & {
|
|
6
|
+
/** When false the resize handles are hidden — toggled from the toolbar. */
|
|
7
|
+
resizeEnabled?: boolean;
|
|
8
|
+
/** When false the translucent Core / Supporting / Generic zone bands are hidden. */
|
|
9
|
+
showZones?: boolean;
|
|
10
|
+
/** When false the axis titles, Low/High ticks and zone names are hidden. */
|
|
11
|
+
showLabels?: boolean;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* The Core Domain Chart background (DDD Crew): the two axes (Complexity ×
|
|
15
|
+
* Business differentiation) with their Low/High ticks and the translucent
|
|
16
|
+
* Generic / Supporting / Core zone bands. The user places sub-domain dots,
|
|
17
|
+
* movement arrows and the Notation legend on top of it.
|
|
18
|
+
*
|
|
19
|
+
* Mirrors the Wardley / EDGY / Cynefin backgrounds: extends
|
|
20
|
+
* {@link GfxPrimitiveElementModel} so it inherits selection, move, copy/paste,
|
|
21
|
+
* duplicate, align and undo/redo. Authored in a fixed reference space and scaled
|
|
22
|
+
* uniformly to the element bounds by the renderer.
|
|
23
|
+
*/
|
|
24
|
+
export declare class CoreDomainChartElementModel extends GfxPrimitiveElementModel<CoreDomainChartProps> {
|
|
25
|
+
get type(): string;
|
|
26
|
+
get connectable(): boolean;
|
|
27
|
+
containsBound(bounds: Bound): boolean;
|
|
28
|
+
getLineIntersections(start: IVec, end: IVec): import("../../../global/gfx/index.js").PointLocation[] | null;
|
|
29
|
+
getNearestPoint(point: IVec): IVec;
|
|
30
|
+
includesPoint(x: number, y: number): boolean;
|
|
31
|
+
accessor resizeEnabled: boolean;
|
|
32
|
+
accessor showZones: boolean;
|
|
33
|
+
accessor showLabels: boolean;
|
|
34
|
+
accessor rotate: number;
|
|
35
|
+
accessor xywh: SerializedXYWH;
|
|
36
|
+
}
|