@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
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { DefaultTool } from '../../affine-block-surface/index.js';
|
|
2
|
+
import { EmptyTool } from '../../affine-gfx-pointer/index.js';
|
|
3
|
+
import { EdgelessToolbarToolMixin } from '../../affine-widget-edgeless-toolbar/index.js';
|
|
4
|
+
import { SignalWatcher } from '../../global/lit/index.js';
|
|
5
|
+
import { css, html, LitElement } from 'lit';
|
|
6
|
+
import { contextMapToolbarIcon, coreDomainToolbarIcon, eventStormingToolbarIcon, } from './icons';
|
|
7
|
+
/**
|
|
8
|
+
* Shared base for the three DDD senior buttons. Each subclass only differs by
|
|
9
|
+
* the popover menu it opens, its tooltip and its glyph — the toggle / popper
|
|
10
|
+
* wiring is identical (mirrors the Cynefin senior button).
|
|
11
|
+
*/
|
|
12
|
+
class DddSeniorButtonBase extends EdgelessToolbarToolMixin(SignalWatcher(LitElement)) {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments);
|
|
15
|
+
this.enableActiveBackground = true;
|
|
16
|
+
this.type = EmptyTool;
|
|
17
|
+
}
|
|
18
|
+
static { this.styles = css `
|
|
19
|
+
:host,
|
|
20
|
+
.ddd-button {
|
|
21
|
+
display: block;
|
|
22
|
+
width: 100%;
|
|
23
|
+
height: 100%;
|
|
24
|
+
}
|
|
25
|
+
:host {
|
|
26
|
+
position: relative;
|
|
27
|
+
}
|
|
28
|
+
.ddd-root {
|
|
29
|
+
width: 100%;
|
|
30
|
+
height: 64px;
|
|
31
|
+
cursor: pointer;
|
|
32
|
+
display: flex;
|
|
33
|
+
align-items: flex-end;
|
|
34
|
+
justify-content: center;
|
|
35
|
+
}
|
|
36
|
+
.ddd-card {
|
|
37
|
+
--y: -4px;
|
|
38
|
+
--s: 1;
|
|
39
|
+
width: 50px;
|
|
40
|
+
height: 50px;
|
|
41
|
+
margin-bottom: 4px;
|
|
42
|
+
transform: translateY(var(--y)) scale(var(--s));
|
|
43
|
+
transition: transform 0.3s ease;
|
|
44
|
+
}
|
|
45
|
+
.ddd-card svg {
|
|
46
|
+
display: block;
|
|
47
|
+
width: 100%;
|
|
48
|
+
height: 100%;
|
|
49
|
+
}
|
|
50
|
+
.ddd-root:hover .ddd-card {
|
|
51
|
+
--y: -10px;
|
|
52
|
+
--s: 1.07;
|
|
53
|
+
}
|
|
54
|
+
`; }
|
|
55
|
+
_toggleMenu() {
|
|
56
|
+
if (this.popper) {
|
|
57
|
+
this.popper.dispose();
|
|
58
|
+
this.popper = null;
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
this.setEdgelessTool(DefaultTool);
|
|
62
|
+
const menu = this.createPopper(this.menuTag, this);
|
|
63
|
+
menu.element.edgeless = this.edgeless;
|
|
64
|
+
const el = menu.element;
|
|
65
|
+
const wrap = el.parentElement;
|
|
66
|
+
if (wrap) {
|
|
67
|
+
wrap.style.overflow = 'visible';
|
|
68
|
+
wrap.style.justifyContent = 'flex-end';
|
|
69
|
+
}
|
|
70
|
+
Object.assign(el.style, {
|
|
71
|
+
position: 'static',
|
|
72
|
+
width: 'max-content',
|
|
73
|
+
maxWidth: 'calc(100vw - 16px)',
|
|
74
|
+
marginLeft: '0',
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
render() {
|
|
78
|
+
return html `<edgeless-toolbar-button
|
|
79
|
+
class="ddd-button"
|
|
80
|
+
.tooltip=${this.popper ? '' : this.label}
|
|
81
|
+
.tooltipOffset=${4}
|
|
82
|
+
.active=${!!this.popper}
|
|
83
|
+
@click=${this._toggleMenu}
|
|
84
|
+
>
|
|
85
|
+
<div class="ddd-root">
|
|
86
|
+
<div class="ddd-card">${this.icon}</div>
|
|
87
|
+
</div>
|
|
88
|
+
</edgeless-toolbar-button>`;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
export class EdgelessDddEventStormingSeniorButton extends DddSeniorButtonBase {
|
|
92
|
+
constructor() {
|
|
93
|
+
super(...arguments);
|
|
94
|
+
this.menuTag = 'edgeless-ddd-event-storming-menu';
|
|
95
|
+
this.label = 'Event Storming';
|
|
96
|
+
this.icon = eventStormingToolbarIcon;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
export class EdgelessDddCoreDomainSeniorButton extends DddSeniorButtonBase {
|
|
100
|
+
constructor() {
|
|
101
|
+
super(...arguments);
|
|
102
|
+
this.menuTag = 'edgeless-ddd-core-domain-menu';
|
|
103
|
+
this.label = 'Core Domain Chart';
|
|
104
|
+
this.icon = coreDomainToolbarIcon;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
export class EdgelessDddContextMapSeniorButton extends DddSeniorButtonBase {
|
|
108
|
+
constructor() {
|
|
109
|
+
super(...arguments);
|
|
110
|
+
this.menuTag = 'edgeless-ddd-context-map-menu';
|
|
111
|
+
this.label = 'Context Map';
|
|
112
|
+
this.icon = contextMapToolbarIcon;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Independent senior tool — Event Storming. */
|
|
2
|
+
export declare const eventStormingSeniorTool: import("../../store/index.js").ExtensionType;
|
|
3
|
+
/** Independent senior tool — Core Domain Chart. */
|
|
4
|
+
export declare const coreDomainSeniorTool: import("../../store/index.js").ExtensionType;
|
|
5
|
+
/** Independent senior tool — Context Map. */
|
|
6
|
+
export declare const contextMapSeniorTool: import("../../store/index.js").ExtensionType;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { SeniorToolExtension } from '../../affine-widget-edgeless-toolbar/index.js';
|
|
2
|
+
import { html } from 'lit';
|
|
3
|
+
/** Independent senior tool — Event Storming. */
|
|
4
|
+
export const eventStormingSeniorTool = SeniorToolExtension('ddd-event-storming', ({ block }) => ({
|
|
5
|
+
name: 'Event Storming',
|
|
6
|
+
content: html `<edgeless-ddd-event-storming-senior-button
|
|
7
|
+
.edgeless=${block}
|
|
8
|
+
></edgeless-ddd-event-storming-senior-button>`,
|
|
9
|
+
}));
|
|
10
|
+
/** Independent senior tool — Core Domain Chart. */
|
|
11
|
+
export const coreDomainSeniorTool = SeniorToolExtension('ddd-core-domain', ({ block }) => ({
|
|
12
|
+
name: 'Core Domain Chart',
|
|
13
|
+
content: html `<edgeless-ddd-core-domain-senior-button
|
|
14
|
+
.edgeless=${block}
|
|
15
|
+
></edgeless-ddd-core-domain-senior-button>`,
|
|
16
|
+
}));
|
|
17
|
+
/** Independent senior tool — Context Map. */
|
|
18
|
+
export const contextMapSeniorTool = SeniorToolExtension('ddd-context-map', ({ block }) => ({
|
|
19
|
+
name: 'Context Map',
|
|
20
|
+
content: html `<edgeless-ddd-context-map-senior-button
|
|
21
|
+
.edgeless=${block}
|
|
22
|
+
></edgeless-ddd-context-map-senior-button>`,
|
|
23
|
+
}));
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type ViewExtensionContext, ViewExtensionProvider } from '../affine-ext-loader/index.js';
|
|
2
|
+
/** Event Storming — independently flag-gated (`ddd-event-storming`). */
|
|
3
|
+
export declare class DddEventStormingViewExtension extends ViewExtensionProvider {
|
|
4
|
+
name: string;
|
|
5
|
+
effect(): void;
|
|
6
|
+
setup(context: ViewExtensionContext): void;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Core Domain Chart rendering — ALWAYS registered, independent of any flag.
|
|
10
|
+
* Disabling `ddd-core-domain` hides only the senior toolbar button (see
|
|
11
|
+
* {@link DddCoreDomainViewExtension}); placed `coreDomain` elements must still
|
|
12
|
+
* paint, stay selectable, and keep their contextual toolbar, and Templates-
|
|
13
|
+
* panel insertion must still render them.
|
|
14
|
+
*/
|
|
15
|
+
export declare class DddCoreDomainRenderViewExtension extends ViewExtensionProvider {
|
|
16
|
+
name: string;
|
|
17
|
+
setup(context: ViewExtensionContext): void;
|
|
18
|
+
}
|
|
19
|
+
/** Core Domain Chart senior button — independently flag-gated (`ddd-core-domain`). */
|
|
20
|
+
export declare class DddCoreDomainViewExtension extends ViewExtensionProvider {
|
|
21
|
+
name: string;
|
|
22
|
+
effect(): void;
|
|
23
|
+
setup(context: ViewExtensionContext): void;
|
|
24
|
+
}
|
|
25
|
+
/** Context Map — independently flag-gated (`ddd-context-map`). */
|
|
26
|
+
export declare class DddContextMapViewExtension extends ViewExtensionProvider {
|
|
27
|
+
name: string;
|
|
28
|
+
effect(): void;
|
|
29
|
+
setup(context: ViewExtensionContext): void;
|
|
30
|
+
}
|
|
31
|
+
/** DDD Templates section (Aggregate Design Canvas) — flag-gated (`ddd-templates`). */
|
|
32
|
+
export declare class DddTemplatesViewExtension extends ViewExtensionProvider {
|
|
33
|
+
name: string;
|
|
34
|
+
effect(): void;
|
|
35
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { ViewExtensionProvider, } from '../affine-ext-loader/index.js';
|
|
2
|
+
import { extendTemplateCategory } from '../affine-gfx-template/index.js';
|
|
3
|
+
import { CoreDomainRendererExtension } from './core-domain/element-renderer';
|
|
4
|
+
import { CoreDomainInteraction, CoreDomainView } from './core-domain/element-view';
|
|
5
|
+
import { coreDomainToolbarExtension } from './core-domain/toolbar-config';
|
|
6
|
+
import { contextMapEffects, coreDomainEffects, eventStormingEffects, } from './effects';
|
|
7
|
+
import { aggregateTemplateCategory, contextMapTemplateCategory, coreDomainTemplateCategory, eventStormingTemplateCategory, } from './templates';
|
|
8
|
+
import { contextMapSeniorTool, coreDomainSeniorTool, eventStormingSeniorTool, } from './toolbar/senior-tool';
|
|
9
|
+
/** Event Storming — independently flag-gated (`ddd-event-storming`). */
|
|
10
|
+
export class DddEventStormingViewExtension extends ViewExtensionProvider {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
|
+
this.name = 'affine-ddd-event-storming-gfx';
|
|
14
|
+
}
|
|
15
|
+
effect() {
|
|
16
|
+
super.effect();
|
|
17
|
+
eventStormingEffects();
|
|
18
|
+
}
|
|
19
|
+
setup(context) {
|
|
20
|
+
super.setup(context);
|
|
21
|
+
if (this.isEdgeless(context.scope)) {
|
|
22
|
+
context.register(eventStormingSeniorTool);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Core Domain Chart rendering — ALWAYS registered, independent of any flag.
|
|
28
|
+
* Disabling `ddd-core-domain` hides only the senior toolbar button (see
|
|
29
|
+
* {@link DddCoreDomainViewExtension}); placed `coreDomain` elements must still
|
|
30
|
+
* paint, stay selectable, and keep their contextual toolbar, and Templates-
|
|
31
|
+
* panel insertion must still render them.
|
|
32
|
+
*/
|
|
33
|
+
export class DddCoreDomainRenderViewExtension extends ViewExtensionProvider {
|
|
34
|
+
constructor() {
|
|
35
|
+
super(...arguments);
|
|
36
|
+
this.name = 'affine-ddd-core-domain-render-gfx';
|
|
37
|
+
}
|
|
38
|
+
setup(context) {
|
|
39
|
+
super.setup(context);
|
|
40
|
+
context.register(CoreDomainView);
|
|
41
|
+
context.register(CoreDomainRendererExtension);
|
|
42
|
+
if (this.isEdgeless(context.scope)) {
|
|
43
|
+
context.register(CoreDomainInteraction);
|
|
44
|
+
context.register(coreDomainToolbarExtension);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/** Core Domain Chart senior button — independently flag-gated (`ddd-core-domain`). */
|
|
49
|
+
export class DddCoreDomainViewExtension extends ViewExtensionProvider {
|
|
50
|
+
constructor() {
|
|
51
|
+
super(...arguments);
|
|
52
|
+
this.name = 'affine-ddd-core-domain-gfx';
|
|
53
|
+
}
|
|
54
|
+
effect() {
|
|
55
|
+
super.effect();
|
|
56
|
+
coreDomainEffects();
|
|
57
|
+
}
|
|
58
|
+
setup(context) {
|
|
59
|
+
super.setup(context);
|
|
60
|
+
if (this.isEdgeless(context.scope)) {
|
|
61
|
+
context.register(coreDomainSeniorTool);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/** Context Map — independently flag-gated (`ddd-context-map`). */
|
|
66
|
+
export class DddContextMapViewExtension extends ViewExtensionProvider {
|
|
67
|
+
constructor() {
|
|
68
|
+
super(...arguments);
|
|
69
|
+
this.name = 'affine-ddd-context-map-gfx';
|
|
70
|
+
}
|
|
71
|
+
effect() {
|
|
72
|
+
super.effect();
|
|
73
|
+
contextMapEffects();
|
|
74
|
+
}
|
|
75
|
+
setup(context) {
|
|
76
|
+
super.setup(context);
|
|
77
|
+
if (this.isEdgeless(context.scope)) {
|
|
78
|
+
context.register(contextMapSeniorTool);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/** DDD Templates section (Aggregate Design Canvas) — flag-gated (`ddd-templates`). */
|
|
83
|
+
export class DddTemplatesViewExtension extends ViewExtensionProvider {
|
|
84
|
+
constructor() {
|
|
85
|
+
super(...arguments);
|
|
86
|
+
this.name = 'affine-ddd-templates';
|
|
87
|
+
}
|
|
88
|
+
effect() {
|
|
89
|
+
super.effect();
|
|
90
|
+
extendTemplateCategory(eventStormingTemplateCategory);
|
|
91
|
+
extendTemplateCategory(coreDomainTemplateCategory);
|
|
92
|
+
extendTemplateCategory(contextMapTemplateCategory);
|
|
93
|
+
extendTemplateCategory(aggregateTemplateCategory);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -2,6 +2,7 @@ export * from './adapter';
|
|
|
2
2
|
export * from './element-renderer';
|
|
3
3
|
export * from './indicator-overlay';
|
|
4
4
|
export * from './interactivity';
|
|
5
|
+
export * from './templates';
|
|
5
6
|
export * from './toolbar/config';
|
|
6
7
|
export * from './toolbar/senior-tool';
|
|
7
8
|
export * from './utils';
|
|
@@ -2,6 +2,7 @@ export * from './adapter';
|
|
|
2
2
|
export * from './element-renderer';
|
|
3
3
|
export * from './indicator-overlay';
|
|
4
4
|
export * from './interactivity';
|
|
5
|
+
export * from './templates';
|
|
5
6
|
export * from './toolbar/config';
|
|
6
7
|
export * from './toolbar/senior-tool';
|
|
7
8
|
export * from './utils';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { makeTemplateSnapshot, } from '../../affine-gfx-template/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Mindmap starter templates — one per built-in style. Captured as real
|
|
4
|
+
* serialized mindmaps (the element plus its node shapes) so they round-trip
|
|
5
|
+
* through the Templates-panel insert path; the id-regeneration middleware
|
|
6
|
+
* (replaceIdMiddleware) remaps the mindmap node-id references on insert.
|
|
7
|
+
*/
|
|
8
|
+
function tpl(name, preview, elements) {
|
|
9
|
+
return {
|
|
10
|
+
name,
|
|
11
|
+
type: 'template',
|
|
12
|
+
preview,
|
|
13
|
+
content: makeTemplateSnapshot(elements, name),
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
const STYLE_1 = { "1Y2vfnrsLJ": { "index": "a0", "seed": 1700105571, "fillColor": "#ffffff", "filled": true, "fontFamily": "blocksuite:surface:Poppins", "fontWeight": "600", "maxWidth": false, "padding": [11, 22], "radius": 8, "rotate": 0, "roughness": 1.4, "shadow": { "offsetX": 0, "offsetY": 6, "blur": 12, "color": "rgba(0, 0, 0, 0.14)" }, "shapeStyle": "General", "shapeType": "rect", "strokeColor": "#53b2ef", "strokeStyle": "solid", "strokeWidth": 4, "text": { "affine:surface:text": true, "delta": [{ "insert": "Mind Map" }] }, "textResizing": 0, "vertices": null, "isClosed": true, "smoothFlags": null, "controlPoints": null, "xywh": "[0,0,136.20703125,45]", "type": "shape", "id": "1Y2vfnrsLJ" }, "K_WWv7xJKi": { "index": "a0", "seed": 1580354321, "fillColor": "#ffffff", "filled": true, "fontFamily": "blocksuite:surface:Poppins", "fontSize": 16, "fontWeight": "500", "maxWidth": false, "padding": [6, 22], "radius": 8, "rotate": 0, "roughness": 1.4, "shadow": { "offsetX": 0, "offsetY": 6, "blur": 12, "color": "rgba(0, 0, 0, 0.14)" }, "shapeStyle": "General", "shapeType": "rect", "strokeColor": "#6e52df", "strokeStyle": "solid", "strokeWidth": 3, "text": { "affine:surface:text": true, "delta": [{ "insert": "Topic 1" }] }, "textResizing": 0, "vertices": null, "isClosed": true, "smoothFlags": null, "controlPoints": null, "xywh": "[336.20703125,-67.5,94.6953125,30]", "type": "shape", "id": "K_WWv7xJKi" }, "7fO_u4_Elm": { "index": "a0", "seed": 1196740856, "fillColor": "#ffffff", "filled": true, "fontFamily": "blocksuite:surface:Poppins", "fontSize": 16, "fontWeight": "500", "maxWidth": false, "padding": [6, 22], "radius": 8, "rotate": 0, "roughness": 1.4, "shadow": { "offsetX": 0, "offsetY": 6, "blur": 12, "color": "rgba(0, 0, 0, 0.14)" }, "shapeStyle": "General", "shapeType": "rect", "strokeColor": "#e96cab", "strokeStyle": "solid", "strokeWidth": 3, "text": { "affine:surface:text": true, "delta": [{ "insert": "Topic 2" }] }, "textResizing": 0, "vertices": null, "isClosed": true, "smoothFlags": null, "controlPoints": null, "xywh": "[336.20703125,7.5,94.6953125,30]", "type": "shape", "id": "7fO_u4_Elm" }, "Lza2YDXgkV": { "index": "a0", "seed": 981612871, "fillColor": "#ffffff", "filled": true, "fontFamily": "blocksuite:surface:Poppins", "fontSize": 16, "fontWeight": "500", "maxWidth": false, "padding": [6, 22], "radius": 8, "rotate": 0, "roughness": 1.4, "shadow": { "offsetX": 0, "offsetY": 6, "blur": 12, "color": "rgba(0, 0, 0, 0.14)" }, "shapeStyle": "General", "shapeType": "rect", "strokeColor": "#ff8c38", "strokeStyle": "solid", "strokeWidth": 3, "text": { "affine:surface:text": true, "delta": [{ "insert": "Topic 3" }] }, "textResizing": 0, "vertices": null, "isClosed": true, "smoothFlags": null, "controlPoints": null, "xywh": "[336.20703125,82.5,94.6953125,30]", "type": "shape", "id": "Lza2YDXgkV" }, "Gsko87TmXj": { "index": "a0", "seed": 871727345, "children": { "affine:surface:ymap": true, "json": { "1Y2vfnrsLJ": { "index": "a0" }, "K_WWv7xJKi": { "index": "a0", "parent": "1Y2vfnrsLJ" }, "7fO_u4_Elm": { "index": "a1", "parent": "1Y2vfnrsLJ" }, "Lza2YDXgkV": { "index": "a2", "parent": "1Y2vfnrsLJ" } } }, "layoutType": 0, "style": 1, "type": "mindmap", "id": "Gsko87TmXj" } };
|
|
17
|
+
const STYLE_2 = { "kPwf_uD4jZ": { "index": "a0", "seed": 1047170436, "fillColor": "#fcd34d", "filled": true, "fontFamily": "blocksuite:surface:Poppins", "fontSize": 18, "fontWeight": "600", "maxWidth": false, "padding": [11, 22], "radius": 3, "rotate": 0, "roughness": 1.4, "shadow": { "blur": 0, "offsetX": 3, "offsetY": 3, "color": { "dark": "#ffffff", "light": "#000000" } }, "shapeStyle": "General", "shapeType": "rect", "strokeColor": { "dark": "#ffffff", "light": "#000000" }, "strokeStyle": "solid", "strokeWidth": 3, "text": { "affine:surface:text": true, "delta": [{ "insert": "Mind Map" }] }, "textResizing": 0, "vertices": null, "isClosed": true, "smoothFlags": null, "controlPoints": null, "xywh": "[0,0,126.986328125,42.7]", "type": "shape", "id": "kPwf_uD4jZ" }, "zwZHwYXnAG": { "index": "a0", "seed": 79321525, "fillColor": "#84cfff", "filled": true, "fontFamily": "blocksuite:surface:Poppins", "fontSize": 16, "fontWeight": "600", "maxWidth": false, "padding": [6, 22], "radius": 3, "rotate": 0, "roughness": 1.4, "shadow": { "blur": 0, "offsetX": 3, "offsetY": 3, "color": { "dark": "#ffffff", "light": "#000000" } }, "shapeStyle": "General", "shapeType": "rect", "strokeColor": { "dark": "#ffffff", "light": "#000000" }, "strokeStyle": "solid", "strokeWidth": 3, "text": { "affine:surface:text": true, "delta": [{ "insert": "Topic 1" }] }, "textResizing": 0, "vertices": null, "isClosed": true, "smoothFlags": null, "controlPoints": null, "xywh": "[326.986328125,-69.25,98.8203125,30.400000000000002]", "type": "shape", "id": "zwZHwYXnAG" }, "VIz858biOY": { "index": "a0", "seed": 1187771384, "fillColor": "#84cfff", "filled": true, "fontFamily": "blocksuite:surface:Poppins", "fontSize": 16, "fontWeight": "600", "maxWidth": false, "padding": [6, 22], "radius": 3, "rotate": 0, "roughness": 1.4, "shadow": { "blur": 0, "offsetX": 3, "offsetY": 3, "color": { "dark": "#ffffff", "light": "#000000" } }, "shapeStyle": "General", "shapeType": "rect", "strokeColor": { "dark": "#ffffff", "light": "#000000" }, "strokeStyle": "solid", "strokeWidth": 3, "text": { "affine:surface:text": true, "delta": [{ "insert": "Topic 2" }] }, "textResizing": 0, "vertices": null, "isClosed": true, "smoothFlags": null, "controlPoints": null, "xywh": "[326.986328125,6.150000000000006,98.8203125,30.400000000000002]", "type": "shape", "id": "VIz858biOY" }, "DPMWxLX_cs": { "index": "a0", "seed": 1192286986, "fillColor": "#84cfff", "filled": true, "fontFamily": "blocksuite:surface:Poppins", "fontSize": 16, "fontWeight": "600", "maxWidth": false, "padding": [6, 22], "radius": 3, "rotate": 0, "roughness": 1.4, "shadow": { "blur": 0, "offsetX": 3, "offsetY": 3, "color": { "dark": "#ffffff", "light": "#000000" } }, "shapeStyle": "General", "shapeType": "rect", "strokeColor": { "dark": "#ffffff", "light": "#000000" }, "strokeStyle": "solid", "strokeWidth": 3, "text": { "affine:surface:text": true, "delta": [{ "insert": "Topic 3" }] }, "textResizing": 0, "vertices": null, "isClosed": true, "smoothFlags": null, "controlPoints": null, "xywh": "[326.986328125,81.55000000000001,98.8203125,30.400000000000002]", "type": "shape", "id": "DPMWxLX_cs" }, "nMfQ2gc-O2": { "index": "a0", "seed": 1612961410, "children": { "affine:surface:ymap": true, "json": { "kPwf_uD4jZ": { "index": "a0" }, "zwZHwYXnAG": { "index": "a0", "parent": "kPwf_uD4jZ" }, "VIz858biOY": { "index": "a1", "parent": "kPwf_uD4jZ" }, "DPMWxLX_cs": { "index": "a2", "parent": "kPwf_uD4jZ" } } }, "layoutType": 0, "style": 2, "type": "mindmap", "id": "nMfQ2gc-O2" } };
|
|
18
|
+
const STYLE_3 = { "ZIw4rmcVBn": { "index": "a0", "seed": 880670515, "fillColor": "#fcd34d", "filled": true, "fontFamily": "blocksuite:surface:Poppins", "fontSize": 16, "fontWeight": "500", "maxWidth": false, "padding": [10, 22], "radius": 10, "rotate": 0, "roughness": 1.4, "shadow": { "blur": 12, "offsetX": 0, "offsetY": 0, "color": "rgba(66, 65, 73, 0.18)" }, "shapeStyle": "General", "shapeType": "rect", "strokeColor": "transparent", "strokeStyle": "solid", "strokeWidth": 0, "text": { "affine:surface:text": true, "delta": [{ "insert": "Mind Map" }] }, "textResizing": 0, "vertices": null, "isClosed": true, "smoothFlags": null, "controlPoints": null, "xywh": "[0,0,114.25,38]", "type": "shape", "id": "ZIw4rmcVBn" }, "dwRkKPG-3B": { "index": "a0", "seed": 125208616, "fillColor": "#ffffff", "filled": true, "fontFamily": "blocksuite:surface:Poppins", "fontSize": 16, "fontWeight": "500", "maxWidth": false, "padding": [6, 22], "radius": 10, "rotate": 0, "roughness": 1.4, "shadow": { "blur": 12, "offsetX": 0, "offsetY": 0, "color": "rgba(66, 65, 73, 0.18)" }, "shapeStyle": "General", "shapeType": "rect", "strokeColor": "#fcd34d", "strokeStyle": "solid", "strokeWidth": 2, "text": { "affine:surface:text": true, "delta": [{ "insert": "Topic 1" }] }, "textResizing": 0, "vertices": null, "isClosed": true, "smoothFlags": null, "controlPoints": null, "xywh": "[314.25,-71,94.6953125,30]", "type": "shape", "id": "dwRkKPG-3B" }, "c7LOmcZzw5": { "index": "a0", "seed": 1361083332, "fillColor": "#ffffff", "filled": true, "fontFamily": "blocksuite:surface:Poppins", "fontSize": 16, "fontWeight": "500", "maxWidth": false, "padding": [6, 22], "radius": 10, "rotate": 0, "roughness": 1.4, "shadow": { "blur": 12, "offsetX": 0, "offsetY": 0, "color": "rgba(66, 65, 73, 0.18)" }, "shapeStyle": "General", "shapeType": "rect", "strokeColor": "#fcd34d", "strokeStyle": "solid", "strokeWidth": 2, "text": { "affine:surface:text": true, "delta": [{ "insert": "Topic 2" }] }, "textResizing": 0, "vertices": null, "isClosed": true, "smoothFlags": null, "controlPoints": null, "xywh": "[314.25,4,94.6953125,30]", "type": "shape", "id": "c7LOmcZzw5" }, "FE0kD_GYHx": { "index": "a0", "seed": 774157552, "fillColor": "#ffffff", "filled": true, "fontFamily": "blocksuite:surface:Poppins", "fontSize": 16, "fontWeight": "500", "maxWidth": false, "padding": [6, 22], "radius": 10, "rotate": 0, "roughness": 1.4, "shadow": { "blur": 12, "offsetX": 0, "offsetY": 0, "color": "rgba(66, 65, 73, 0.18)" }, "shapeStyle": "General", "shapeType": "rect", "strokeColor": "#fcd34d", "strokeStyle": "solid", "strokeWidth": 2, "text": { "affine:surface:text": true, "delta": [{ "insert": "Topic 3" }] }, "textResizing": 0, "vertices": null, "isClosed": true, "smoothFlags": null, "controlPoints": null, "xywh": "[314.25,79,94.6953125,30]", "type": "shape", "id": "FE0kD_GYHx" }, "wR3Bc0vWc_": { "index": "a0", "seed": 660798577, "children": { "affine:surface:ymap": true, "json": { "ZIw4rmcVBn": { "index": "a0" }, "dwRkKPG-3B": { "index": "a0", "parent": "ZIw4rmcVBn" }, "c7LOmcZzw5": { "index": "a1", "parent": "ZIw4rmcVBn" }, "FE0kD_GYHx": { "index": "a2", "parent": "ZIw4rmcVBn" } } }, "layoutType": 0, "style": 3, "type": "mindmap", "id": "wR3Bc0vWc_" } };
|
|
19
|
+
const STYLE_4 = { "EyUas98ZAK": { "index": "a0", "seed": 1433519934, "color": { "dark": "#ffffff", "light": "#000000" }, "fillColor": "transparent", "filled": true, "fontFamily": "blocksuite:surface:Kalam", "fontSize": 22, "fontWeight": "700", "maxWidth": false, "padding": [0, 10], "radius": 0, "rotate": 0, "roughness": 1.4, "shadow": null, "shapeStyle": "General", "shapeType": "rect", "strokeColor": "transparent", "strokeStyle": "solid", "strokeWidth": 0, "text": { "affine:surface:text": true, "delta": [{ "insert": "Mind Map" }] }, "textResizing": 0, "vertices": null, "isClosed": true, "smoothFlags": null, "controlPoints": null, "xywh": "[0,0,121.427734375,26]", "type": "shape", "id": "EyUas98ZAK" }, "8AX6hJveTK": { "index": "a0", "seed": 1032075934, "color": { "dark": "#ffffff", "light": "#000000" }, "fillColor": "transparent", "filled": true, "fontFamily": "blocksuite:surface:Kalam", "fontSize": 18, "fontWeight": "700", "maxWidth": false, "padding": [1.5, 10], "radius": 0, "rotate": 0, "roughness": 1.4, "shadow": null, "shapeStyle": "General", "shapeType": "rect", "strokeColor": "transparent", "strokeStyle": "solid", "strokeWidth": 0, "text": { "affine:surface:text": true, "delta": [{ "insert": "Topic 1" }] }, "textResizing": 0, "vertices": null, "isClosed": true, "smoothFlags": null, "controlPoints": null, "xywh": "[321.427734375,-68.40909090909092,81.6728515625,24.272727272727273]", "type": "shape", "id": "8AX6hJveTK" }, "sk6jIhglvv": { "index": "a0", "seed": 1054014636, "color": { "dark": "#ffffff", "light": "#000000" }, "fillColor": "transparent", "filled": true, "fontFamily": "blocksuite:surface:Kalam", "fontSize": 18, "fontWeight": "700", "maxWidth": false, "padding": [1.5, 10], "radius": 0, "rotate": 0, "roughness": 1.4, "shadow": null, "shapeStyle": "General", "shapeType": "rect", "strokeColor": "transparent", "strokeStyle": "solid", "strokeWidth": 0, "text": { "affine:surface:text": true, "delta": [{ "insert": "Topic 2" }] }, "textResizing": 0, "vertices": null, "isClosed": true, "smoothFlags": null, "controlPoints": null, "xywh": "[321.427734375,0.8636363636363598,81.6728515625,24.272727272727273]", "type": "shape", "id": "sk6jIhglvv" }, "ua9jCGGYRE": { "index": "a0", "seed": 2140202745, "color": { "dark": "#ffffff", "light": "#000000" }, "fillColor": "transparent", "filled": true, "fontFamily": "blocksuite:surface:Kalam", "fontSize": 18, "fontWeight": "700", "maxWidth": false, "padding": [1.5, 10], "radius": 0, "rotate": 0, "roughness": 1.4, "shadow": null, "shapeStyle": "General", "shapeType": "rect", "strokeColor": "transparent", "strokeStyle": "solid", "strokeWidth": 0, "text": { "affine:surface:text": true, "delta": [{ "insert": "Topic 3" }] }, "textResizing": 0, "vertices": null, "isClosed": true, "smoothFlags": null, "controlPoints": null, "xywh": "[321.427734375,70.13636363636364,81.6728515625,24.272727272727273]", "type": "shape", "id": "ua9jCGGYRE" }, "nqaFHOZEOd": { "index": "a0", "seed": 664701650, "children": { "affine:surface:ymap": true, "json": { "EyUas98ZAK": { "index": "a0" }, "8AX6hJveTK": { "index": "a0", "parent": "EyUas98ZAK" }, "sk6jIhglvv": { "index": "a1", "parent": "EyUas98ZAK" }, "ua9jCGGYRE": { "index": "a2", "parent": "EyUas98ZAK" } } }, "layoutType": 0, "style": 4, "type": "mindmap", "id": "nqaFHOZEOd" } };
|
|
20
|
+
export const mindmapTemplateCategory = {
|
|
21
|
+
name: 'Mind Map',
|
|
22
|
+
templates: [
|
|
23
|
+
tpl('Mind Map — Style 1', `<svg width="100%" height="100%" viewBox="0 0 135 80" xmlns="http://www.w3.org/2000/svg" fill="none"><rect x="8" y="33" width="40" height="16" rx="5" fill="#53b2ef" fill-opacity="0.18" stroke="#53b2ef" stroke-width="1.6"/><g stroke="#53b2ef" stroke-width="1.4"><path d="M48 41 H72 M72 41 V20 M72 41 V62 M72 20 H96 M72 62 H96"/></g><g fill="#fff" stroke="#53b2ef" stroke-width="1.4"><rect x="96" y="13" width="31" height="13" rx="4"/><rect x="96" y="34" width="31" height="13" rx="4"/><rect x="96" y="55" width="31" height="13" rx="4"/></g></svg>`, STYLE_1),
|
|
24
|
+
tpl('Mind Map — Style 2', `<svg width="100%" height="100%" viewBox="0 0 135 80" xmlns="http://www.w3.org/2000/svg" fill="none"><rect x="8" y="33" width="40" height="16" rx="5" fill="#53b2ef" fill-opacity="0.18" stroke="#53b2ef" stroke-width="1.6"/><g stroke="#53b2ef" stroke-width="1.4"><path d="M48 41 H72 M72 41 V20 M72 41 V62 M72 20 H96 M72 62 H96"/></g><g fill="#fff" stroke="#53b2ef" stroke-width="1.4"><rect x="96" y="13" width="31" height="13" rx="4"/><rect x="96" y="34" width="31" height="13" rx="4"/><rect x="96" y="55" width="31" height="13" rx="4"/></g></svg>`, STYLE_2),
|
|
25
|
+
tpl('Mind Map — Style 3', `<svg width="100%" height="100%" viewBox="0 0 135 80" xmlns="http://www.w3.org/2000/svg" fill="none"><rect x="8" y="33" width="40" height="16" rx="5" fill="#53b2ef" fill-opacity="0.18" stroke="#53b2ef" stroke-width="1.6"/><g stroke="#53b2ef" stroke-width="1.4"><path d="M48 41 H72 M72 41 V20 M72 41 V62 M72 20 H96 M72 62 H96"/></g><g fill="#fff" stroke="#53b2ef" stroke-width="1.4"><rect x="96" y="13" width="31" height="13" rx="4"/><rect x="96" y="34" width="31" height="13" rx="4"/><rect x="96" y="55" width="31" height="13" rx="4"/></g></svg>`, STYLE_3),
|
|
26
|
+
tpl('Mind Map — Style 4', `<svg width="100%" height="100%" viewBox="0 0 135 80" xmlns="http://www.w3.org/2000/svg" fill="none"><rect x="8" y="33" width="40" height="16" rx="5" fill="#53b2ef" fill-opacity="0.18" stroke="#53b2ef" stroke-width="1.6"/><g stroke="#53b2ef" stroke-width="1.4"><path d="M48 41 H72 M72 41 V20 M72 41 V62 M72 20 H96 M72 62 H96"/></g><g fill="#fff" stroke="#53b2ef" stroke-width="1.4"><rect x="96" y="13" width="31" height="13" rx="4"/><rect x="96" y="34" width="31" height="13" rx="4"/><rect x="96" y="55" width="31" height="13" rx="4"/></g></svg>`, STYLE_4),
|
|
27
|
+
],
|
|
28
|
+
};
|
|
@@ -34,6 +34,9 @@ export declare class EdgelessMindmapMenu extends EdgelessMindmapMenu_base {
|
|
|
34
34
|
render(): TemplateResult<1>;
|
|
35
35
|
updated(changedProperties: Map<PropertyKey, unknown>): void;
|
|
36
36
|
accessor model: BlockModel;
|
|
37
|
+
/** Which sections to render: the "Others" button shows media + text, the
|
|
38
|
+
* dedicated "Mind Map" button shows the mindmap styles + import. */
|
|
39
|
+
accessor variant: 'mindmap' | 'other';
|
|
37
40
|
accessor onActiveStyleChange: (style: MindmapStyle) => void;
|
|
38
41
|
accessor onImportMindMap: (bound: Bound) => Promise<void>;
|
|
39
42
|
accessor std: BlockStdScope;
|
|
@@ -60,6 +60,9 @@ let EdgelessMindmapMenu = (() => {
|
|
|
60
60
|
let _model_decorators;
|
|
61
61
|
let _model_initializers = [];
|
|
62
62
|
let _model_extraInitializers = [];
|
|
63
|
+
let _variant_decorators;
|
|
64
|
+
let _variant_initializers = [];
|
|
65
|
+
let _variant_extraInitializers = [];
|
|
63
66
|
let _onActiveStyleChange_decorators;
|
|
64
67
|
let _onActiveStyleChange_initializers = [];
|
|
65
68
|
let _onActiveStyleChange_extraInitializers = [];
|
|
@@ -73,10 +76,12 @@ let EdgelessMindmapMenu = (() => {
|
|
|
73
76
|
static {
|
|
74
77
|
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
75
78
|
_model_decorators = [consume({ context: modelContext })];
|
|
79
|
+
_variant_decorators = [property({ attribute: false })];
|
|
76
80
|
_onActiveStyleChange_decorators = [property({ attribute: false })];
|
|
77
81
|
_onImportMindMap_decorators = [property({ attribute: false })];
|
|
78
82
|
_std_decorators = [consume({ context: stdContext })];
|
|
79
83
|
__esDecorate(this, null, _model_decorators, { kind: "accessor", name: "model", static: false, private: false, access: { has: obj => "model" in obj, get: obj => obj.model, set: (obj, value) => { obj.model = value; } }, metadata: _metadata }, _model_initializers, _model_extraInitializers);
|
|
84
|
+
__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);
|
|
80
85
|
__esDecorate(this, null, _onActiveStyleChange_decorators, { kind: "accessor", name: "onActiveStyleChange", static: false, private: false, access: { has: obj => "onActiveStyleChange" in obj, get: obj => obj.onActiveStyleChange, set: (obj, value) => { obj.onActiveStyleChange = value; } }, metadata: _metadata }, _onActiveStyleChange_initializers, _onActiveStyleChange_extraInitializers);
|
|
81
86
|
__esDecorate(this, null, _onImportMindMap_decorators, { kind: "accessor", name: "onImportMindMap", static: false, private: false, access: { has: obj => "onImportMindMap" in obj, get: obj => obj.onImportMindMap, set: (obj, value) => { obj.onImportMindMap = value; } }, metadata: _metadata }, _onImportMindMap_initializers, _onImportMindMap_extraInitializers);
|
|
82
87
|
__esDecorate(this, null, _std_decorators, { kind: "accessor", name: "std", static: false, private: false, access: { has: obj => "std" in obj, get: obj => obj.std, set: (obj, value) => { obj.std = value; } }, metadata: _metadata }, _std_initializers, _std_extraInitializers);
|
|
@@ -277,100 +282,104 @@ let EdgelessMindmapMenu = (() => {
|
|
|
277
282
|
const isDraggingMedia = draggingElement?.data?.type === 'media';
|
|
278
283
|
const isDraggingText = draggingElement?.data?.type === 'text';
|
|
279
284
|
const showNextText = dragOut && !cancelled;
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
285
|
+
// The menu is shared by two senior buttons: the "Others" button (media +
|
|
286
|
+
// text) and the dedicated "Mind Map" button (mindmap styles + import).
|
|
287
|
+
const otherSection = this.variant === 'other'
|
|
288
|
+
? html `
|
|
289
|
+
<div class="media-item">
|
|
290
|
+
${isDraggingMedia
|
|
291
|
+
? html `<button
|
|
292
|
+
class="next"
|
|
293
|
+
style="transform: translateY(${showNextText ? 0 : 64}px)"
|
|
294
|
+
>
|
|
295
|
+
${mediaItem.icon}
|
|
296
|
+
</button>`
|
|
297
|
+
: nothing}
|
|
298
|
+
<button
|
|
299
|
+
style="opacity: ${isDraggingMedia ? 0 : 1}"
|
|
300
|
+
@mousedown=${(e) => this.draggableController.onMouseDown(e, {
|
|
301
|
+
preview: mediaItem.icon,
|
|
302
|
+
data: mediaItem,
|
|
303
|
+
})}
|
|
304
|
+
@touchstart=${(e) => this.draggableController.onTouchStart(e, {
|
|
305
|
+
preview: mediaItem.icon,
|
|
306
|
+
data: mediaItem,
|
|
307
|
+
})}
|
|
287
308
|
>
|
|
288
309
|
${mediaItem.icon}
|
|
289
|
-
</button
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
310
|
+
</button>
|
|
311
|
+
<affine-tooltip tip-position="top" .offset=${12}>
|
|
312
|
+
<affine-tooltip-content-with-shortcut
|
|
313
|
+
data-tip="${'Add media'}"
|
|
314
|
+
></affine-tooltip-content-with-shortcut>
|
|
315
|
+
</affine-tooltip>
|
|
316
|
+
</div>
|
|
317
|
+
<div class="thin-divider"></div>
|
|
318
|
+
<div class="text-item">
|
|
319
|
+
${isDraggingText
|
|
320
|
+
? html `<button
|
|
321
|
+
class="next"
|
|
322
|
+
style="transform: translateY(${showNextText ? 0 : 64}px)"
|
|
323
|
+
>
|
|
324
|
+
${textItem.icon}
|
|
325
|
+
</button>`
|
|
326
|
+
: nothing}
|
|
327
|
+
<button
|
|
328
|
+
style="opacity: ${isDraggingText ? 0 : 1}"
|
|
329
|
+
@mousedown=${(e) => this.draggableController.onMouseDown(e, {
|
|
330
|
+
preview: textItem.icon,
|
|
331
|
+
data: textItem,
|
|
332
|
+
})}
|
|
333
|
+
@touchstart=${(e) => this.draggableController.onTouchStart(e, {
|
|
334
|
+
preview: textItem.icon,
|
|
335
|
+
data: textItem,
|
|
336
|
+
})}
|
|
316
337
|
>
|
|
317
338
|
${textItem.icon}
|
|
318
|
-
</button
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
></affine-tooltip-content-with-shortcut>
|
|
338
|
-
</affine-tooltip>
|
|
339
|
-
</div>
|
|
340
|
-
<div class="thin-divider"></div>
|
|
341
|
-
<!-- mind map -->
|
|
342
|
-
${repeat(this.mindMaps, mindMap => {
|
|
343
|
-
const isDraggingMindMap = draggingElement?.data?.type !== 'text';
|
|
344
|
-
const draggingEle = draggingElement?.data;
|
|
345
|
-
const isBeingDragged = isDraggingMindMap && draggingEle?.style === mindMap.style;
|
|
346
|
-
const showNext = dragOut && !cancelled;
|
|
347
|
-
const isActive = this._style$.value === mindMap.style;
|
|
348
|
-
return html `
|
|
339
|
+
</button>
|
|
340
|
+
<affine-tooltip tip-position="top" .offset=${12}>
|
|
341
|
+
<affine-tooltip-content-with-shortcut
|
|
342
|
+
data-tip="${'Edgeless Text'}"
|
|
343
|
+
data-shortcup="${'T'}"
|
|
344
|
+
></affine-tooltip-content-with-shortcut>
|
|
345
|
+
</affine-tooltip>
|
|
346
|
+
</div>
|
|
347
|
+
`
|
|
348
|
+
: nothing;
|
|
349
|
+
const mindmapSection = this.variant === 'mindmap'
|
|
350
|
+
? html `
|
|
351
|
+
${repeat(this.mindMaps, mindMap => {
|
|
352
|
+
const isDraggingMindMap = draggingElement?.data?.type !== 'text';
|
|
353
|
+
const draggingEle = draggingElement?.data;
|
|
354
|
+
const isBeingDragged = isDraggingMindMap && draggingEle?.style === mindMap.style;
|
|
355
|
+
const showNext = dragOut && !cancelled;
|
|
356
|
+
const isActive = this._style$.value === mindMap.style;
|
|
357
|
+
return html `
|
|
349
358
|
<div class="mindmap-item" data-is-active=${isActive}>
|
|
350
359
|
${isBeingDragged
|
|
351
|
-
|
|
360
|
+
? html `<button
|
|
352
361
|
style="transform: translateY(${showNext ? 0 : 64}px)"
|
|
353
362
|
class="next"
|
|
354
363
|
>
|
|
355
364
|
${mindMap.icon}
|
|
356
365
|
</button>`
|
|
357
|
-
|
|
366
|
+
: nothing}
|
|
358
367
|
<button
|
|
359
368
|
style="opacity: ${isBeingDragged ? 0 : 1}"
|
|
360
369
|
@mousedown=${(e) => {
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
370
|
+
this.draggableController.onMouseDown(e, {
|
|
371
|
+
preview: mindMap.icon,
|
|
372
|
+
data: mindMap,
|
|
373
|
+
standardWidth: 350,
|
|
374
|
+
});
|
|
375
|
+
}}
|
|
367
376
|
@touchstart=${(e) => {
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
377
|
+
this.draggableController.onTouchStart(e, {
|
|
378
|
+
preview: mindMap.icon,
|
|
379
|
+
data: mindMap,
|
|
380
|
+
standardWidth: 350,
|
|
381
|
+
});
|
|
382
|
+
}}
|
|
374
383
|
@click=${() => this.onActiveStyleChange?.(mindMap.style)}
|
|
375
384
|
>
|
|
376
385
|
${mindMap.icon}
|
|
@@ -383,13 +392,16 @@ let EdgelessMindmapMenu = (() => {
|
|
|
383
392
|
</affine-tooltip>
|
|
384
393
|
</div>
|
|
385
394
|
`;
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
395
|
+
})}
|
|
396
|
+
${this.std.store
|
|
397
|
+
.get(FeatureFlagService)
|
|
398
|
+
.getFlag('enable_mind_map_import')
|
|
399
|
+
? this._importMindMapEntry()
|
|
400
|
+
: nothing}
|
|
401
|
+
`
|
|
402
|
+
: nothing;
|
|
403
|
+
return html `<edgeless-slide-menu .height=${'64px'}>
|
|
404
|
+
<div class="text-and-mindmap">${otherSection}${mindmapSection}</div>
|
|
393
405
|
</edgeless-slide-menu>`;
|
|
394
406
|
}
|
|
395
407
|
updated(changedProperties) {
|
|
@@ -400,6 +412,11 @@ let EdgelessMindmapMenu = (() => {
|
|
|
400
412
|
#model_accessor_storage;
|
|
401
413
|
get model() { return this.#model_accessor_storage; }
|
|
402
414
|
set model(value) { this.#model_accessor_storage = value; }
|
|
415
|
+
#variant_accessor_storage;
|
|
416
|
+
/** Which sections to render: the "Others" button shows media + text, the
|
|
417
|
+
* dedicated "Mind Map" button shows the mindmap styles + import. */
|
|
418
|
+
get variant() { return this.#variant_accessor_storage; }
|
|
419
|
+
set variant(value) { this.#variant_accessor_storage = value; }
|
|
403
420
|
#onActiveStyleChange_accessor_storage;
|
|
404
421
|
get onActiveStyleChange() { return this.#onActiveStyleChange_accessor_storage; }
|
|
405
422
|
set onActiveStyleChange(value) { this.#onActiveStyleChange_accessor_storage = value; }
|
|
@@ -417,7 +434,8 @@ let EdgelessMindmapMenu = (() => {
|
|
|
417
434
|
});
|
|
418
435
|
this.type = EmptyTool;
|
|
419
436
|
this.#model_accessor_storage = __runInitializers(this, _model_initializers, void 0);
|
|
420
|
-
this.#
|
|
437
|
+
this.#variant_accessor_storage = (__runInitializers(this, _model_extraInitializers), __runInitializers(this, _variant_initializers, 'mindmap'));
|
|
438
|
+
this.#onActiveStyleChange_accessor_storage = (__runInitializers(this, _variant_extraInitializers), __runInitializers(this, _onActiveStyleChange_initializers, void 0));
|
|
421
439
|
this.#onImportMindMap_accessor_storage = (__runInitializers(this, _onActiveStyleChange_extraInitializers), __runInitializers(this, _onImportMindMap_initializers, void 0));
|
|
422
440
|
this.#std_accessor_storage = (__runInitializers(this, _onImportMindMap_extraInitializers), __runInitializers(this, _std_initializers, void 0));
|
|
423
441
|
__runInitializers(this, _std_extraInitializers);
|