@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.
Files changed (66) hide show
  1. package/dist/_pkgs/affine-block-surface/element-model/index.d.ts +5 -2
  2. package/dist/_pkgs/affine-block-surface/element-model/index.js +4 -2
  3. package/dist/_pkgs/affine-gfx-ddd/core-domain/consts.d.ts +32 -0
  4. package/dist/_pkgs/affine-gfx-ddd/core-domain/consts.js +30 -0
  5. package/dist/_pkgs/affine-gfx-ddd/core-domain/element-renderer.d.ts +12 -0
  6. package/dist/_pkgs/affine-gfx-ddd/core-domain/element-renderer.js +93 -0
  7. package/dist/_pkgs/affine-gfx-ddd/core-domain/element-view.d.ts +11 -0
  8. package/dist/_pkgs/affine-gfx-ddd/core-domain/element-view.js +20 -0
  9. package/dist/_pkgs/affine-gfx-ddd/core-domain/legend.d.ts +18 -0
  10. package/dist/_pkgs/affine-gfx-ddd/core-domain/legend.js +69 -0
  11. package/dist/_pkgs/affine-gfx-ddd/core-domain/toolbar-config.d.ts +1 -0
  12. package/dist/_pkgs/affine-gfx-ddd/core-domain/toolbar-config.js +45 -0
  13. package/dist/_pkgs/affine-gfx-ddd/effects.d.ts +17 -0
  14. package/dist/_pkgs/affine-gfx-ddd/effects.js +21 -0
  15. package/dist/_pkgs/affine-gfx-ddd/index.d.ts +2 -0
  16. package/dist/_pkgs/affine-gfx-ddd/index.js +2 -0
  17. package/dist/_pkgs/affine-gfx-ddd/shared/consts.d.ts +180 -0
  18. package/dist/_pkgs/affine-gfx-ddd/shared/consts.js +92 -0
  19. package/dist/_pkgs/affine-gfx-ddd/shared/prefabs.d.ts +71 -0
  20. package/dist/_pkgs/affine-gfx-ddd/shared/prefabs.js +214 -0
  21. package/dist/_pkgs/affine-gfx-ddd/shared/utils.d.ts +10 -0
  22. package/dist/_pkgs/affine-gfx-ddd/shared/utils.js +9 -0
  23. package/dist/_pkgs/affine-gfx-ddd/templates/components.d.ts +7 -0
  24. package/dist/_pkgs/affine-gfx-ddd/templates/components.js +158 -0
  25. package/dist/_pkgs/affine-gfx-ddd/templates/index.d.ts +11 -0
  26. package/dist/_pkgs/affine-gfx-ddd/templates/index.js +108 -0
  27. package/dist/_pkgs/affine-gfx-ddd/toolbar/context-map-menu.d.ts +10 -0
  28. package/dist/_pkgs/affine-gfx-ddd/toolbar/context-map-menu.js +109 -0
  29. package/dist/_pkgs/affine-gfx-ddd/toolbar/core-domain-menu.d.ts +11 -0
  30. package/dist/_pkgs/affine-gfx-ddd/toolbar/core-domain-menu.js +118 -0
  31. package/dist/_pkgs/affine-gfx-ddd/toolbar/event-storming-menu.d.ts +9 -0
  32. package/dist/_pkgs/affine-gfx-ddd/toolbar/event-storming-menu.js +78 -0
  33. package/dist/_pkgs/affine-gfx-ddd/toolbar/icons.d.ts +6 -0
  34. package/dist/_pkgs/affine-gfx-ddd/toolbar/icons.js +20 -0
  35. package/dist/_pkgs/affine-gfx-ddd/toolbar/menu-base.d.ts +23 -0
  36. package/dist/_pkgs/affine-gfx-ddd/toolbar/menu-base.js +62 -0
  37. package/dist/_pkgs/affine-gfx-ddd/toolbar/senior-buttons.d.ts +34 -0
  38. package/dist/_pkgs/affine-gfx-ddd/toolbar/senior-buttons.js +114 -0
  39. package/dist/_pkgs/affine-gfx-ddd/toolbar/senior-tool.d.ts +6 -0
  40. package/dist/_pkgs/affine-gfx-ddd/toolbar/senior-tool.js +23 -0
  41. package/dist/_pkgs/affine-gfx-ddd/view.d.ts +35 -0
  42. package/dist/_pkgs/affine-gfx-ddd/view.js +95 -0
  43. package/dist/_pkgs/affine-gfx-mindmap/index.d.ts +1 -0
  44. package/dist/_pkgs/affine-gfx-mindmap/index.js +1 -0
  45. package/dist/_pkgs/affine-gfx-mindmap/templates/index.d.ts +2 -0
  46. package/dist/_pkgs/affine-gfx-mindmap/templates/index.js +28 -0
  47. package/dist/_pkgs/affine-gfx-mindmap/toolbar/mindmap-menu.d.ts +3 -0
  48. package/dist/_pkgs/affine-gfx-mindmap/toolbar/mindmap-menu.js +105 -87
  49. package/dist/_pkgs/affine-gfx-mindmap/toolbar/mindmap-tool-button.d.ts +3 -1
  50. package/dist/_pkgs/affine-gfx-mindmap/toolbar/mindmap-tool-button.js +97 -146
  51. package/dist/_pkgs/affine-gfx-mindmap/toolbar/senior-tool.d.ts +2 -0
  52. package/dist/_pkgs/affine-gfx-mindmap/toolbar/senior-tool.js +12 -0
  53. package/dist/_pkgs/affine-gfx-mindmap/view.d.ts +17 -1
  54. package/dist/_pkgs/affine-gfx-mindmap/view.js +38 -4
  55. package/dist/_pkgs/affine-gfx-template/services/template-middlewares.js +16 -1
  56. package/dist/_pkgs/affine-model/elements/core-domain/core-domain.d.ts +36 -0
  57. package/dist/_pkgs/affine-model/elements/core-domain/core-domain.js +122 -0
  58. package/dist/_pkgs/affine-model/elements/core-domain/index.d.ts +1 -0
  59. package/dist/_pkgs/affine-model/elements/core-domain/index.js +1 -0
  60. package/dist/_pkgs/affine-model/elements/index.d.ts +3 -0
  61. package/dist/_pkgs/affine-model/elements/index.js +1 -0
  62. package/dist/_pkgs/affine-shared/services/telemetry-service/lifecycle.d.ts +1 -1
  63. package/dist/extensions/view.js +12 -2
  64. package/dist/flags.d.ts +1 -1
  65. package/dist/flags.js +5 -0
  66. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { BpmnNodeElementModel, BpmnPoolElementModel, BrushElementModel, ConnectorElementModel, CynefinElementModel, EdgyFacetsElementModel, EdgyNodeElementModel, EstuarineElementModel, GroupElementModel, HighlighterElementModel, MindmapElementModel, ShapeElementModel, TextElementModel, WardleyBackgroundElementModel, WardleyNodeElementModel } from '../../affine-model/index.js';
1
+ import { BpmnNodeElementModel, BpmnPoolElementModel, BrushElementModel, ConnectorElementModel, CoreDomainChartElementModel, CynefinElementModel, EdgyFacetsElementModel, EdgyNodeElementModel, EstuarineElementModel, GroupElementModel, HighlighterElementModel, MindmapElementModel, ShapeElementModel, TextElementModel, WardleyBackgroundElementModel, WardleyNodeElementModel } from '../../affine-model/index.js';
2
2
  import { SurfaceElementModel } from './base.js';
3
3
  export declare const elementsCtorMap: {
4
4
  group: typeof GroupElementModel;
@@ -14,10 +14,11 @@ export declare const elementsCtorMap: {
14
14
  edgyNode: typeof EdgyNodeElementModel;
15
15
  cynefin: typeof CynefinElementModel;
16
16
  estuarine: typeof EstuarineElementModel;
17
+ coreDomain: typeof CoreDomainChartElementModel;
17
18
  bpmnNode: typeof BpmnNodeElementModel;
18
19
  bpmnPool: typeof BpmnPoolElementModel;
19
20
  };
20
- export { BpmnNodeElementModel, BpmnPoolElementModel, BrushElementModel, ConnectorElementModel, CynefinElementModel, EdgyFacetsElementModel, EdgyNodeElementModel, EstuarineElementModel, GroupElementModel, HighlighterElementModel, MindmapElementModel, ShapeElementModel, SurfaceElementModel, TextElementModel, WardleyBackgroundElementModel, WardleyNodeElementModel, };
21
+ export { BpmnNodeElementModel, BpmnPoolElementModel, BrushElementModel, ConnectorElementModel, CoreDomainChartElementModel, CynefinElementModel, EdgyFacetsElementModel, EdgyNodeElementModel, EstuarineElementModel, GroupElementModel, HighlighterElementModel, MindmapElementModel, ShapeElementModel, SurfaceElementModel, TextElementModel, WardleyBackgroundElementModel, WardleyNodeElementModel, };
21
22
  export declare enum CanvasElementType {
22
23
  BRUSH = "brush",
23
24
  CONNECTOR = "connector",
@@ -32,6 +33,7 @@ export declare enum CanvasElementType {
32
33
  EDGYNODE = "edgyNode",
33
34
  CYNEFIN = "cynefin",
34
35
  ESTUARINE = "estuarine",
36
+ COREDOMAIN = "coreDomain",
35
37
  BPMNNODE = "bpmnNode",
36
38
  BPMNPOOL = "bpmnPool"
37
39
  }
@@ -49,6 +51,7 @@ export type ElementModelMap = {
49
51
  ['edgyNode']: EdgyNodeElementModel;
50
52
  ['cynefin']: CynefinElementModel;
51
53
  ['estuarine']: EstuarineElementModel;
54
+ ['coreDomain']: CoreDomainChartElementModel;
52
55
  ['bpmnNode']: BpmnNodeElementModel;
53
56
  ['bpmnPool']: BpmnPoolElementModel;
54
57
  };
@@ -1,4 +1,4 @@
1
- import { BpmnNodeElementModel, BpmnPoolElementModel, BrushElementModel, ConnectorElementModel, CynefinElementModel, EdgyFacetsElementModel, EdgyNodeElementModel, EstuarineElementModel, GroupElementModel, HighlighterElementModel, MindmapElementModel, ShapeElementModel, TextElementModel, WardleyBackgroundElementModel, WardleyNodeElementModel, } from '../../affine-model/index.js';
1
+ import { BpmnNodeElementModel, BpmnPoolElementModel, BrushElementModel, ConnectorElementModel, CoreDomainChartElementModel, CynefinElementModel, EdgyFacetsElementModel, EdgyNodeElementModel, EstuarineElementModel, GroupElementModel, HighlighterElementModel, MindmapElementModel, ShapeElementModel, TextElementModel, WardleyBackgroundElementModel, WardleyNodeElementModel, } from '../../affine-model/index.js';
2
2
  import { SurfaceElementModel } from './base.js';
3
3
  export const elementsCtorMap = {
4
4
  group: GroupElementModel,
@@ -14,10 +14,11 @@ export const elementsCtorMap = {
14
14
  edgyNode: EdgyNodeElementModel,
15
15
  cynefin: CynefinElementModel,
16
16
  estuarine: EstuarineElementModel,
17
+ coreDomain: CoreDomainChartElementModel,
17
18
  bpmnNode: BpmnNodeElementModel,
18
19
  bpmnPool: BpmnPoolElementModel,
19
20
  };
20
- export { BpmnNodeElementModel, BpmnPoolElementModel, BrushElementModel, ConnectorElementModel, CynefinElementModel, EdgyFacetsElementModel, EdgyNodeElementModel, EstuarineElementModel, GroupElementModel, HighlighterElementModel, MindmapElementModel, ShapeElementModel, SurfaceElementModel, TextElementModel, WardleyBackgroundElementModel, WardleyNodeElementModel, };
21
+ export { BpmnNodeElementModel, BpmnPoolElementModel, BrushElementModel, ConnectorElementModel, CoreDomainChartElementModel, CynefinElementModel, EdgyFacetsElementModel, EdgyNodeElementModel, EstuarineElementModel, GroupElementModel, HighlighterElementModel, MindmapElementModel, ShapeElementModel, SurfaceElementModel, TextElementModel, WardleyBackgroundElementModel, WardleyNodeElementModel, };
21
22
  export var CanvasElementType;
22
23
  (function (CanvasElementType) {
23
24
  CanvasElementType["BRUSH"] = "brush";
@@ -33,6 +34,7 @@ export var CanvasElementType;
33
34
  CanvasElementType["EDGYNODE"] = "edgyNode";
34
35
  CanvasElementType["CYNEFIN"] = "cynefin";
35
36
  CanvasElementType["ESTUARINE"] = "estuarine";
37
+ CanvasElementType["COREDOMAIN"] = "coreDomain";
36
38
  CanvasElementType["BPMNNODE"] = "bpmnNode";
37
39
  CanvasElementType["BPMNPOOL"] = "bpmnPool";
38
40
  })(CanvasElementType || (CanvasElementType = {}));
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Visual constants for the Core Domain Chart background (DDD Crew). Authored in
3
+ * a fixed reference space (900 × 820) and scaled uniformly to the element bounds
4
+ * by the renderer. Reproduces the supplied template: two axes (Complexity ×
5
+ * Business differentiation), Low/High ticks and the translucent Generic /
6
+ * Supporting / Core zone bands. The "Notation" legend is a separate prefab group.
7
+ */
8
+ export declare const REF_W = 900;
9
+ export declare const REF_H = 820;
10
+ export declare const COLORS: {
11
+ readonly axis: "#000000";
12
+ readonly zoneLabel: "#ffffff";
13
+ readonly tick: "#777777";
14
+ readonly title: "#000000";
15
+ };
16
+ /** Translucent zone bands (drawn at 0.6 alpha), back-to-front. */
17
+ export declare const ZONES: ReadonlyArray<{
18
+ x: number;
19
+ y: number;
20
+ w: number;
21
+ h: number;
22
+ fill: string;
23
+ }>;
24
+ /** Zone names (centred): [text, x, y, fontSize]. */
25
+ export declare const ZONE_LABELS: ReadonlyArray<readonly [string, number, number, number]>;
26
+ /** Axis frame: origin (ox, oy) bottom-left, up to `top`, right to `right`. */
27
+ export declare const AXIS: {
28
+ readonly ox: 60;
29
+ readonly oy: 770;
30
+ readonly top: 24;
31
+ readonly right: 846;
32
+ };
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Visual constants for the Core Domain Chart background (DDD Crew). Authored in
3
+ * a fixed reference space (900 × 820) and scaled uniformly to the element bounds
4
+ * by the renderer. Reproduces the supplied template: two axes (Complexity ×
5
+ * Business differentiation), Low/High ticks and the translucent Generic /
6
+ * Supporting / Core zone bands. The "Notation" legend is a separate prefab group.
7
+ */
8
+ export const REF_W = 900;
9
+ export const REF_H = 820;
10
+ export const COLORS = {
11
+ axis: '#000000',
12
+ zoneLabel: '#ffffff',
13
+ tick: '#777777',
14
+ title: '#000000',
15
+ };
16
+ /** Translucent zone bands (drawn at 0.6 alpha), back-to-front. */
17
+ export const ZONES = [
18
+ { x: 70, y: 30, w: 150, h: 720, fill: '#b3b3b3' },
19
+ { x: 220, y: 30, w: 220, h: 720, fill: '#9933ff' },
20
+ { x: 440, y: 30, w: 400, h: 360, fill: '#4d9900' },
21
+ { x: 440, y: 390, w: 400, h: 360, fill: '#9933ff' },
22
+ ];
23
+ /** Zone names (centred): [text, x, y, fontSize]. */
24
+ export const ZONE_LABELS = [
25
+ ['Core', 640, 214, 26],
26
+ ['Supporting', 340, 474, 20],
27
+ ['Generic', 150, 474, 20],
28
+ ];
29
+ /** Axis frame: origin (ox, oy) bottom-left, up to `top`, right to `right`. */
30
+ export const AXIS = { ox: 60, oy: 770, top: 24, right: 846 };
@@ -0,0 +1,12 @@
1
+ import { type ElementRenderer } from '../../affine-block-surface/index.js';
2
+ import type { CoreDomainChartElementModel } from '../../affine-model/index.js';
3
+ /**
4
+ * Canvas renderer for the Core Domain Chart background — the translucent
5
+ * Generic / Supporting / Core zone bands, the two axes with arrow heads and the
6
+ * Low/High ticks + zone names. Drawn in the fixed reference space and scaled
7
+ * uniformly to the element bounds.
8
+ */
9
+ export declare const coreDomain: ElementRenderer<CoreDomainChartElementModel>;
10
+ export declare const CoreDomainRendererExtension: import("../../store/index.js").ExtensionType & {
11
+ identifier: import("../../global/di/types.js").ServiceIdentifier<ElementRenderer<CoreDomainChartElementModel>>;
12
+ };
@@ -0,0 +1,93 @@
1
+ import { ElementRendererExtension, } from '../../affine-block-surface/index.js';
2
+ import { FONT_FAMILY, refScale } from '../shared/utils';
3
+ import { AXIS, COLORS, REF_H, REF_W, ZONE_LABELS, ZONES } from './consts';
4
+ /**
5
+ * Canvas renderer for the Core Domain Chart background — the translucent
6
+ * Generic / Supporting / Core zone bands, the two axes with arrow heads and the
7
+ * Low/High ticks + zone names. Drawn in the fixed reference space and scaled
8
+ * uniformly to the element bounds.
9
+ */
10
+ export const coreDomain = (model, ctx, matrix) => {
11
+ const [, , w, h] = model.deserializedXYWH;
12
+ const cx = w / 2;
13
+ const cy = h / 2;
14
+ ctx.setTransform(matrix.translateSelf(cx, cy).rotateSelf(model.rotate).translateSelf(-cx, -cy));
15
+ const { s, ox, oy } = refScale(w, h, REF_W, REF_H);
16
+ ctx.translate(ox, oy);
17
+ ctx.scale(s, s);
18
+ // ── Translucent zone bands ──────────────────────────────────────────
19
+ if (model.showZones) {
20
+ ctx.globalAlpha = 0.6;
21
+ for (const z of ZONES) {
22
+ ctx.fillStyle = z.fill;
23
+ ctx.fillRect(z.x, z.y, z.w, z.h);
24
+ }
25
+ ctx.globalAlpha = 1;
26
+ }
27
+ // ── Axes with arrow heads ───────────────────────────────────────────
28
+ ctx.strokeStyle = COLORS.axis;
29
+ ctx.fillStyle = COLORS.axis;
30
+ ctx.lineWidth = 2;
31
+ ctx.lineJoin = 'round';
32
+ // Y axis (up)
33
+ ctx.beginPath();
34
+ ctx.moveTo(AXIS.ox, AXIS.oy);
35
+ ctx.lineTo(AXIS.ox, AXIS.top + 6);
36
+ ctx.stroke();
37
+ arrow(ctx, AXIS.ox, AXIS.top, 0);
38
+ // X axis (right)
39
+ ctx.beginPath();
40
+ ctx.moveTo(AXIS.ox, AXIS.oy);
41
+ ctx.lineTo(AXIS.right - 6, AXIS.oy);
42
+ ctx.stroke();
43
+ arrow(ctx, AXIS.right, AXIS.oy, 90);
44
+ ctx.textBaseline = 'alphabetic';
45
+ // ── Zone names ──────────────────────────────────────────────────────
46
+ ctx.textAlign = 'center';
47
+ for (const [text, x, y, size] of ZONE_LABELS) {
48
+ ctx.fillStyle = COLORS.zoneLabel;
49
+ ctx.font = `700 ${size}px ${FONT_FAMILY}`;
50
+ ctx.fillText(text, x, y);
51
+ }
52
+ // ── Axis titles + Low/High ticks ────────────────────────────────────
53
+ if (model.showLabels) {
54
+ ctx.fillStyle = COLORS.title;
55
+ ctx.font = `600 14px ${FONT_FAMILY}`;
56
+ ctx.save();
57
+ ctx.translate(28, 400);
58
+ ctx.rotate(-Math.PI / 2);
59
+ ctx.fillText('Complexity', 0, 0);
60
+ ctx.restore();
61
+ ctx.fillText('Business differentiation', 450, 800);
62
+ ctx.fillStyle = COLORS.tick;
63
+ ctx.font = `12px ${FONT_FAMILY}`;
64
+ // X ticks
65
+ ctx.fillText('Low', 84, 792);
66
+ ctx.fillText('High', 838, 792);
67
+ // Y ticks
68
+ ctx.save();
69
+ ctx.translate(48, 758);
70
+ ctx.rotate(-Math.PI / 2);
71
+ ctx.fillText('Low', 0, 0);
72
+ ctx.restore();
73
+ ctx.save();
74
+ ctx.translate(38, 44);
75
+ ctx.rotate(-Math.PI / 2);
76
+ ctx.fillText('High', 0, 0);
77
+ ctx.restore();
78
+ }
79
+ };
80
+ /** Filled triangular arrow head at (x, y); `deg` rotates it (0 = pointing up). */
81
+ function arrow(ctx, x, y, deg) {
82
+ ctx.save();
83
+ ctx.translate(x, y);
84
+ ctx.rotate((deg * Math.PI) / 180);
85
+ ctx.beginPath();
86
+ ctx.moveTo(0, 0);
87
+ ctx.lineTo(-5, 9);
88
+ ctx.lineTo(5, 9);
89
+ ctx.closePath();
90
+ ctx.fill();
91
+ ctx.restore();
92
+ }
93
+ export const CoreDomainRendererExtension = ElementRendererExtension('coreDomain', coreDomain);
@@ -0,0 +1,11 @@
1
+ import type { CoreDomainChartElementModel } from '../../affine-model/index.js';
2
+ import { GfxElementModelView } from '../../std/gfx/index.js';
3
+ /**
4
+ * View for the Core Domain Chart background. Registering it ensures
5
+ * `gfx.view.get(model)` returns a view (required so move / select work).
6
+ */
7
+ export declare class CoreDomainView extends GfxElementModelView<CoreDomainChartElementModel> {
8
+ static type: string;
9
+ }
10
+ /** Resize gating: handles hidden unless `model.resizeEnabled` (toolbar toggle). */
11
+ export declare const CoreDomainInteraction: import("../../store/index.js").ExtensionType;
@@ -0,0 +1,20 @@
1
+ import { GfxElementModelView, GfxViewInteractionExtension, } from '../../std/gfx/index.js';
2
+ /**
3
+ * View for the Core Domain Chart background. Registering it ensures
4
+ * `gfx.view.get(model)` returns a view (required so move / select work).
5
+ */
6
+ export class CoreDomainView extends GfxElementModelView {
7
+ static { this.type = 'coreDomain'; }
8
+ }
9
+ /** Resize gating: handles hidden unless `model.resizeEnabled` (toolbar toggle). */
10
+ export const CoreDomainInteraction = GfxViewInteractionExtension(CoreDomainView.type, {
11
+ handleResize({ model }) {
12
+ return {
13
+ beforeResize({ set }) {
14
+ if (!model.resizeEnabled) {
15
+ set({ allowedHandlers: [] });
16
+ }
17
+ },
18
+ };
19
+ },
20
+ });
@@ -0,0 +1,18 @@
1
+ import { type CoreDomainChartElementModel } from '../../affine-model/index.js';
2
+ import type { BlockStdScope } from '../../std/index.js';
3
+ import { type LegendSection } from '../shared/prefabs';
4
+ /**
5
+ * Build the Notation legend sections. When `present` is given (a content-aware
6
+ * scan of the background), only the sub-domain types / team-topology modes /
7
+ * movement actually used are listed; otherwise the full notation is shown.
8
+ */
9
+ export declare function coreDomainLegendSections(present?: {
10
+ fills: Set<string>;
11
+ movement: boolean;
12
+ }): LegendSection[];
13
+ /**
14
+ * Insert a content-aware legend next to a Core Domain background: scans the
15
+ * shapes/connectors inside the background's perimeter and lists only the
16
+ * notation actually present. Triggered from the element's contextual toolbar.
17
+ */
18
+ export declare function createCoreDomainLegend(std: BlockStdScope, bg: CoreDomainChartElementModel): void;
@@ -0,0 +1,69 @@
1
+ import { ConnectorElementModel, ShapeElementModel, StrokeStyle, } from '../../affine-model/index.js';
2
+ import { Bound } from '../../global/gfx/index.js';
3
+ import { GfxControllerIdentifier } from '../../std/gfx/index.js';
4
+ import { CD_SUBDOMAINS, MOVEMENT_COLOR, TEAM_TOPOLOGIES, } from '../shared/consts';
5
+ import { addLegend } from '../shared/prefabs';
6
+ /**
7
+ * Build the Notation legend sections. When `present` is given (a content-aware
8
+ * scan of the background), only the sub-domain types / team-topology modes /
9
+ * movement actually used are listed; otherwise the full notation is shown.
10
+ */
11
+ export function coreDomainLegendSections(present) {
12
+ const has = (c) => !present || present.fills.has(c.toLowerCase());
13
+ const subRows = CD_SUBDOMAINS.filter(s => has(s.fill)).map(s => ({
14
+ swatch: 'dot',
15
+ color: s.fill,
16
+ label: s.label,
17
+ }));
18
+ const ttRows = TEAM_TOPOLOGIES.filter(t => has(t.fill)).map(t => ({
19
+ swatch: 'square',
20
+ color: t.fill,
21
+ letter: t.letter,
22
+ label: t.label,
23
+ }));
24
+ const sections = [];
25
+ if (subRows.length)
26
+ sections.push({ title: 'Sub-domains', rows: subRows });
27
+ if (ttRows.length)
28
+ sections.push({ title: 'Team topologies', rows: ttRows });
29
+ if (!present || present.movement) {
30
+ sections.push({
31
+ title: 'Movement',
32
+ rows: [{ swatch: 'line', color: MOVEMENT_COLOR, label: 'Movement over time' }],
33
+ });
34
+ }
35
+ // Content-aware scan found nothing recognizable → fall back to the full legend.
36
+ if (present && sections.length === 0)
37
+ return coreDomainLegendSections();
38
+ return sections;
39
+ }
40
+ /**
41
+ * Insert a content-aware legend next to a Core Domain background: scans the
42
+ * shapes/connectors inside the background's perimeter and lists only the
43
+ * notation actually present. Triggered from the element's contextual toolbar.
44
+ */
45
+ export function createCoreDomainLegend(std, bg) {
46
+ const gfx = std.get(GfxControllerIdentifier);
47
+ const surface = gfx.surface;
48
+ if (!surface)
49
+ return;
50
+ const fills = new Set();
51
+ let movement = false;
52
+ for (const el of gfx.getElementsByBound(Bound.deserialize(bg.xywh), {
53
+ type: 'canvas',
54
+ })) {
55
+ if (el instanceof ConnectorElementModel) {
56
+ if (el.strokeStyle === StrokeStyle.Dash)
57
+ movement = true;
58
+ }
59
+ else if (el instanceof ShapeElementModel) {
60
+ if (typeof el.fillColor === 'string')
61
+ fills.add(el.fillColor.toLowerCase());
62
+ }
63
+ }
64
+ const [bx, by, bw] = bg.deserializedXYWH;
65
+ addLegend(surface, std, bx + bw + 30, by, {
66
+ title: 'Légende',
67
+ sections: coreDomainLegendSections({ fills, movement }),
68
+ });
69
+ }
@@ -0,0 +1 @@
1
+ export declare const coreDomainToolbarExtension: import("../../store/index.js").ExtensionType;
@@ -0,0 +1,45 @@
1
+ import { CoreDomainChartElementModel } from '../../affine-model/index.js';
2
+ import { TelemetryProvider, ToolbarModuleExtension, } from '../../affine-shared/services/index.js';
3
+ import { BlockFlavourIdentifier } from '../../std/index.js';
4
+ import { html } from 'lit';
5
+ import { createCoreDomainLegend } from './legend';
6
+ const legendIcon = html `<svg
7
+ width="24"
8
+ height="24"
9
+ viewBox="0 0 24 24"
10
+ fill="none"
11
+ xmlns="http://www.w3.org/2000/svg"
12
+ >
13
+ <rect x="3" y="4" width="18" height="16" rx="2" stroke="currentColor" stroke-width="1.6" />
14
+ <circle cx="7" cy="9" r="1.6" fill="currentColor" />
15
+ <circle cx="7" cy="14" r="1.6" fill="currentColor" />
16
+ <path d="M11 9 H18 M11 14 H18" stroke="currentColor" stroke-width="1.4" />
17
+ </svg>`;
18
+ /** Contextual toolbar for a selected Core Domain background: insert its legend. */
19
+ const coreDomainToolbarConfig = {
20
+ actions: [
21
+ {
22
+ id: 'a.legend',
23
+ tooltip: 'Insert legend (notation present in the chart)',
24
+ icon: legendIcon,
25
+ run(ctx) {
26
+ const bg = ctx.getSurfaceModelsByType(CoreDomainChartElementModel)[0];
27
+ if (!bg)
28
+ return;
29
+ createCoreDomainLegend(ctx.std, bg);
30
+ ctx.std.getOptional(TelemetryProvider)?.track('FrameworkLegendCreated', {
31
+ framework: 'core-domain',
32
+ element: 'legend',
33
+ page: 'whiteboard editor',
34
+ segment: 'element toolbar',
35
+ module: 'core-domain toolbar',
36
+ });
37
+ },
38
+ },
39
+ ],
40
+ when: ctx => ctx.getSurfaceModelsByType(CoreDomainChartElementModel).length > 0,
41
+ };
42
+ export const coreDomainToolbarExtension = ToolbarModuleExtension({
43
+ id: BlockFlavourIdentifier('affine:surface:coreDomain'),
44
+ config: coreDomainToolbarConfig,
45
+ });
@@ -0,0 +1,17 @@
1
+ import { EdgelessDddContextMapMenu } from './toolbar/context-map-menu';
2
+ import { EdgelessDddCoreDomainMenu } from './toolbar/core-domain-menu';
3
+ import { EdgelessDddEventStormingMenu } from './toolbar/event-storming-menu';
4
+ import { EdgelessDddContextMapSeniorButton, EdgelessDddCoreDomainSeniorButton, EdgelessDddEventStormingSeniorButton } from './toolbar/senior-buttons';
5
+ export declare function eventStormingEffects(): void;
6
+ export declare function coreDomainEffects(): void;
7
+ export declare function contextMapEffects(): void;
8
+ declare global {
9
+ interface HTMLElementTagNameMap {
10
+ 'edgeless-ddd-event-storming-menu': EdgelessDddEventStormingMenu;
11
+ 'edgeless-ddd-event-storming-senior-button': EdgelessDddEventStormingSeniorButton;
12
+ 'edgeless-ddd-core-domain-menu': EdgelessDddCoreDomainMenu;
13
+ 'edgeless-ddd-core-domain-senior-button': EdgelessDddCoreDomainSeniorButton;
14
+ 'edgeless-ddd-context-map-menu': EdgelessDddContextMapMenu;
15
+ 'edgeless-ddd-context-map-senior-button': EdgelessDddContextMapSeniorButton;
16
+ }
17
+ }
@@ -0,0 +1,21 @@
1
+ import { EdgelessDddContextMapMenu } from './toolbar/context-map-menu';
2
+ import { EdgelessDddCoreDomainMenu } from './toolbar/core-domain-menu';
3
+ import { EdgelessDddEventStormingMenu } from './toolbar/event-storming-menu';
4
+ import { EdgelessDddContextMapSeniorButton, EdgelessDddCoreDomainSeniorButton, EdgelessDddEventStormingSeniorButton, } from './toolbar/senior-buttons';
5
+ /** Define a custom element once (each tool's effect may run more than once). */
6
+ function define(tag, ctor) {
7
+ if (!customElements.get(tag))
8
+ customElements.define(tag, ctor);
9
+ }
10
+ export function eventStormingEffects() {
11
+ define('edgeless-ddd-event-storming-menu', EdgelessDddEventStormingMenu);
12
+ define('edgeless-ddd-event-storming-senior-button', EdgelessDddEventStormingSeniorButton);
13
+ }
14
+ export function coreDomainEffects() {
15
+ define('edgeless-ddd-core-domain-menu', EdgelessDddCoreDomainMenu);
16
+ define('edgeless-ddd-core-domain-senior-button', EdgelessDddCoreDomainSeniorButton);
17
+ }
18
+ export function contextMapEffects() {
19
+ define('edgeless-ddd-context-map-menu', EdgelessDddContextMapMenu);
20
+ define('edgeless-ddd-context-map-senior-button', EdgelessDddContextMapSeniorButton);
21
+ }
@@ -0,0 +1,2 @@
1
+ export { aggregateTemplateCategory, contextMapTemplateCategory, coreDomainTemplateCategory, eventStormingTemplateCategory, } from './templates/index.js';
2
+ export { DddContextMapViewExtension, DddCoreDomainRenderViewExtension, DddCoreDomainViewExtension, DddEventStormingViewExtension, DddTemplatesViewExtension, } from './view.js';
@@ -0,0 +1,2 @@
1
+ export { aggregateTemplateCategory, contextMapTemplateCategory, coreDomainTemplateCategory, eventStormingTemplateCategory, } from './templates/index.js';
2
+ export { DddContextMapViewExtension, DddCoreDomainRenderViewExtension, DddCoreDomainViewExtension, DddEventStormingViewExtension, DddTemplatesViewExtension, } from './view.js';
@@ -0,0 +1,180 @@
1
+ /**
2
+ * Shared DDD palette and sizes. Every tool composes the same irreducible units
3
+ * (sticky, dot, bubble, connector, label) from these presets — no duplicated
4
+ * component definitions across the Event Storming / Context Map / Core Domain
5
+ * sub-menus.
6
+ */
7
+ /** Square sticky side (px, canvas reference). */
8
+ export declare const STICKY_SIZE = 120;
9
+ /** Faux drop-shadow offset + colour (a plain offset rect behind the sticky). */
10
+ export declare const SHADOW_OFFSET = 7;
11
+ export declare const SHADOW_COLOR = "#0000002e";
12
+ /** Handwriting marker font, already shipped in the canvas font set. */
13
+ export declare const STICKY_FONT = "blocksuite:surface:Kalam";
14
+ export declare const STICKY_FONT_SIZE = 20;
15
+ export declare const STICKY_RADIUS = 6;
16
+ /** Event Storming sticky palette — DDD Crew / Brandolini colour code. */
17
+ export declare const ES_STICKIES: readonly [{
18
+ readonly kind: "domainEvent";
19
+ readonly label: "Domain event";
20
+ readonly fill: "#F5963B";
21
+ readonly text: "#5a3000";
22
+ }, {
23
+ readonly kind: "command";
24
+ readonly label: "Command";
25
+ readonly fill: "#5BA3DB";
26
+ readonly text: "#06304d";
27
+ }, {
28
+ readonly kind: "actor";
29
+ readonly label: "Actor";
30
+ readonly fill: "#FFF1A8";
31
+ readonly text: "#5a4b00";
32
+ }, {
33
+ readonly kind: "constraint";
34
+ readonly label: "Constraint";
35
+ readonly fill: "#FFD84D";
36
+ readonly text: "#5a4b00";
37
+ }, {
38
+ readonly kind: "policy";
39
+ readonly label: "Policy";
40
+ readonly fill: "#C9A8E0";
41
+ readonly text: "#3d1f57";
42
+ }, {
43
+ readonly kind: "readModel";
44
+ readonly label: "Read model";
45
+ readonly fill: "#7ED38A";
46
+ readonly text: "#14502a";
47
+ }, {
48
+ readonly kind: "system";
49
+ readonly label: "External system";
50
+ readonly fill: "#F6A6C0";
51
+ readonly text: "#5e1230";
52
+ }];
53
+ /** Hotspot — neon-pink diamond. */
54
+ export declare const ES_HOTSPOT: {
55
+ label: string;
56
+ fill: string;
57
+ text: string;
58
+ };
59
+ /** Context Map bounded-context bubble. */
60
+ export declare const CM_BUBBLE: {
61
+ fill: string;
62
+ stroke: string;
63
+ text: string;
64
+ w: number;
65
+ h: number;
66
+ radius: number;
67
+ };
68
+ /**
69
+ * Context Map relationship presets (DDD Crew notation). Each is the SAME
70
+ * connector unit + an abbreviation tag; `upDown` adds U/D markers (upstream →
71
+ * downstream); `dashed` marks the "no real integration" patterns (Separate
72
+ * Ways, Big Ball of Mud).
73
+ */
74
+ export declare const CM_RELATIONSHIPS: readonly [{
75
+ readonly kind: "partnership";
76
+ readonly label: "Partnership";
77
+ readonly abbrev: "PS";
78
+ readonly upDown: false;
79
+ readonly dashed: false;
80
+ }, {
81
+ readonly kind: "sharedKernel";
82
+ readonly label: "Shared Kernel";
83
+ readonly abbrev: "SK";
84
+ readonly upDown: false;
85
+ readonly dashed: false;
86
+ }, {
87
+ readonly kind: "customerSupplier";
88
+ readonly label: "Customer / Supplier";
89
+ readonly abbrev: "C/S";
90
+ readonly upDown: true;
91
+ readonly dashed: false;
92
+ }, {
93
+ readonly kind: "conformist";
94
+ readonly label: "Conformist";
95
+ readonly abbrev: "CF";
96
+ readonly upDown: true;
97
+ readonly dashed: false;
98
+ }, {
99
+ readonly kind: "acl";
100
+ readonly label: "Anticorruption Layer";
101
+ readonly abbrev: "ACL";
102
+ readonly upDown: true;
103
+ readonly dashed: false;
104
+ }, {
105
+ readonly kind: "ohs";
106
+ readonly label: "Open Host Service";
107
+ readonly abbrev: "OHS";
108
+ readonly upDown: true;
109
+ readonly dashed: false;
110
+ }, {
111
+ readonly kind: "publishedLanguage";
112
+ readonly label: "Published Language";
113
+ readonly abbrev: "PL";
114
+ readonly upDown: true;
115
+ readonly dashed: false;
116
+ }, {
117
+ readonly kind: "separateWays";
118
+ readonly label: "Separate Ways";
119
+ readonly abbrev: "SW";
120
+ readonly upDown: false;
121
+ readonly dashed: true;
122
+ }, {
123
+ readonly kind: "bbom";
124
+ readonly label: "Big Ball of Mud";
125
+ readonly abbrev: "BBoM";
126
+ readonly upDown: false;
127
+ readonly dashed: true;
128
+ }];
129
+ export declare const CLOUD_VERTICES: number[][];
130
+ export declare const CLOUD: {
131
+ w: number;
132
+ h: number;
133
+ fill: string;
134
+ stroke: string;
135
+ };
136
+ /** Team Topologies interaction modes (placeable markers + Notation legend). */
137
+ export declare const TEAM_TOPOLOGIES: readonly [{
138
+ readonly kind: "collaboration";
139
+ readonly label: "Collaboration";
140
+ readonly letter: "C";
141
+ readonly fill: "#99ff99";
142
+ }, {
143
+ readonly kind: "xaas";
144
+ readonly label: "X-as-a-Service";
145
+ readonly letter: "X";
146
+ readonly fill: "#66b2ff";
147
+ }, {
148
+ readonly kind: "facilitating";
149
+ readonly label: "Facilitating";
150
+ readonly letter: "F";
151
+ readonly fill: "#ffd84d";
152
+ }];
153
+ export declare const MARKER_SIZE = 30;
154
+ /** Core Domain sub-domain / bounded-context dot presets (colours from template). */
155
+ export declare const CD_SUBDOMAINS: readonly [{
156
+ readonly kind: "bigBet";
157
+ readonly label: "Big-bet sub-domain";
158
+ readonly fill: "#9933ff";
159
+ }, {
160
+ readonly kind: "platform";
161
+ readonly label: "Platform sub-domain";
162
+ readonly fill: "#66b2ff";
163
+ }, {
164
+ readonly kind: "outsourced";
165
+ readonly label: "Outsourced / purchased";
166
+ readonly fill: "#99ff99";
167
+ }, {
168
+ readonly kind: "bcCurrent";
169
+ readonly label: "Bounded context";
170
+ readonly fill: "#ff3333";
171
+ }, {
172
+ readonly kind: "bcFuture";
173
+ readonly label: "Future position";
174
+ readonly fill: "#cccccc";
175
+ }];
176
+ export declare const DOT_SIZE = 26;
177
+ export declare const MOVEMENT_COLOR = "#ff3333";
178
+ export declare const LABEL_COLOR = "#1f2328";
179
+ export declare const LABEL_FONT = "blocksuite:surface:Inter";
180
+ export declare const LABEL_FONT_SIZE = 14;