@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
@@ -0,0 +1,122 @@
1
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
2
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
3
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
4
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
5
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
6
+ var _, done = false;
7
+ for (var i = decorators.length - 1; i >= 0; i--) {
8
+ var context = {};
9
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
10
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
11
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
12
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
13
+ if (kind === "accessor") {
14
+ if (result === void 0) continue;
15
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
16
+ if (_ = accept(result.get)) descriptor.get = _;
17
+ if (_ = accept(result.set)) descriptor.set = _;
18
+ if (_ = accept(result.init)) initializers.unshift(_);
19
+ }
20
+ else if (_ = accept(result)) {
21
+ if (kind === "field") initializers.unshift(_);
22
+ else descriptor[key] = _;
23
+ }
24
+ }
25
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
26
+ done = true;
27
+ };
28
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
29
+ var useValue = arguments.length > 2;
30
+ for (var i = 0; i < initializers.length; i++) {
31
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
32
+ }
33
+ return useValue ? value : void 0;
34
+ };
35
+ import { Bound, getPointsFromBoundWithRotation, linePolygonIntersects, pointInPolygon, polygonNearestPoint, } from '../../../global/gfx/index.js';
36
+ import { field, GfxPrimitiveElementModel } from '../../../std/gfx/index.js';
37
+ /**
38
+ * The Core Domain Chart background (DDD Crew): the two axes (Complexity ×
39
+ * Business differentiation) with their Low/High ticks and the translucent
40
+ * Generic / Supporting / Core zone bands. The user places sub-domain dots,
41
+ * movement arrows and the Notation legend on top of it.
42
+ *
43
+ * Mirrors the Wardley / EDGY / Cynefin backgrounds: extends
44
+ * {@link GfxPrimitiveElementModel} so it inherits selection, move, copy/paste,
45
+ * duplicate, align and undo/redo. Authored in a fixed reference space and scaled
46
+ * uniformly to the element bounds by the renderer.
47
+ */
48
+ let CoreDomainChartElementModel = (() => {
49
+ let _classSuper = GfxPrimitiveElementModel;
50
+ let _resizeEnabled_decorators;
51
+ let _resizeEnabled_initializers = [];
52
+ let _resizeEnabled_extraInitializers = [];
53
+ let _showZones_decorators;
54
+ let _showZones_initializers = [];
55
+ let _showZones_extraInitializers = [];
56
+ let _showLabels_decorators;
57
+ let _showLabels_initializers = [];
58
+ let _showLabels_extraInitializers = [];
59
+ let _rotate_decorators;
60
+ let _rotate_initializers = [];
61
+ let _rotate_extraInitializers = [];
62
+ let _xywh_decorators;
63
+ let _xywh_initializers = [];
64
+ let _xywh_extraInitializers = [];
65
+ return class CoreDomainChartElementModel extends _classSuper {
66
+ static {
67
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
68
+ _resizeEnabled_decorators = [field(true)];
69
+ _showZones_decorators = [field(true)];
70
+ _showLabels_decorators = [field(true)];
71
+ _rotate_decorators = [field(0)];
72
+ _xywh_decorators = [field()];
73
+ __esDecorate(this, null, _resizeEnabled_decorators, { kind: "accessor", name: "resizeEnabled", static: false, private: false, access: { has: obj => "resizeEnabled" in obj, get: obj => obj.resizeEnabled, set: (obj, value) => { obj.resizeEnabled = value; } }, metadata: _metadata }, _resizeEnabled_initializers, _resizeEnabled_extraInitializers);
74
+ __esDecorate(this, null, _showZones_decorators, { kind: "accessor", name: "showZones", static: false, private: false, access: { has: obj => "showZones" in obj, get: obj => obj.showZones, set: (obj, value) => { obj.showZones = value; } }, metadata: _metadata }, _showZones_initializers, _showZones_extraInitializers);
75
+ __esDecorate(this, null, _showLabels_decorators, { kind: "accessor", name: "showLabels", static: false, private: false, access: { has: obj => "showLabels" in obj, get: obj => obj.showLabels, set: (obj, value) => { obj.showLabels = value; } }, metadata: _metadata }, _showLabels_initializers, _showLabels_extraInitializers);
76
+ __esDecorate(this, null, _rotate_decorators, { kind: "accessor", name: "rotate", static: false, private: false, access: { has: obj => "rotate" in obj, get: obj => obj.rotate, set: (obj, value) => { obj.rotate = value; } }, metadata: _metadata }, _rotate_initializers, _rotate_extraInitializers);
77
+ __esDecorate(this, null, _xywh_decorators, { kind: "accessor", name: "xywh", static: false, private: false, access: { has: obj => "xywh" in obj, get: obj => obj.xywh, set: (obj, value) => { obj.xywh = value; } }, metadata: _metadata }, _xywh_initializers, _xywh_extraInitializers);
78
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
79
+ }
80
+ get type() {
81
+ return 'coreDomain';
82
+ }
83
+ get connectable() {
84
+ return false;
85
+ }
86
+ containsBound(bounds) {
87
+ const points = getPointsFromBoundWithRotation(this);
88
+ return points.some(point => bounds.containsPoint(point));
89
+ }
90
+ getLineIntersections(start, end) {
91
+ const points = getPointsFromBoundWithRotation(this);
92
+ return linePolygonIntersects(start, end, points);
93
+ }
94
+ getNearestPoint(point) {
95
+ return polygonNearestPoint(Bound.deserialize(this.xywh).points, point);
96
+ }
97
+ includesPoint(x, y) {
98
+ const points = getPointsFromBoundWithRotation(this);
99
+ return pointInPolygon([x, y], points);
100
+ }
101
+ #resizeEnabled_accessor_storage = __runInitializers(this, _resizeEnabled_initializers, true);
102
+ get resizeEnabled() { return this.#resizeEnabled_accessor_storage; }
103
+ set resizeEnabled(value) { this.#resizeEnabled_accessor_storage = value; }
104
+ #showZones_accessor_storage = (__runInitializers(this, _resizeEnabled_extraInitializers), __runInitializers(this, _showZones_initializers, true));
105
+ get showZones() { return this.#showZones_accessor_storage; }
106
+ set showZones(value) { this.#showZones_accessor_storage = value; }
107
+ #showLabels_accessor_storage = (__runInitializers(this, _showZones_extraInitializers), __runInitializers(this, _showLabels_initializers, true));
108
+ get showLabels() { return this.#showLabels_accessor_storage; }
109
+ set showLabels(value) { this.#showLabels_accessor_storage = value; }
110
+ #rotate_accessor_storage = (__runInitializers(this, _showLabels_extraInitializers), __runInitializers(this, _rotate_initializers, 0));
111
+ get rotate() { return this.#rotate_accessor_storage; }
112
+ set rotate(value) { this.#rotate_accessor_storage = value; }
113
+ #xywh_accessor_storage = (__runInitializers(this, _rotate_extraInitializers), __runInitializers(this, _xywh_initializers, '[0,0,900,820]'));
114
+ get xywh() { return this.#xywh_accessor_storage; }
115
+ set xywh(value) { this.#xywh_accessor_storage = value; }
116
+ constructor() {
117
+ super(...arguments);
118
+ __runInitializers(this, _xywh_extraInitializers);
119
+ }
120
+ };
121
+ })();
122
+ export { CoreDomainChartElementModel };
@@ -0,0 +1 @@
1
+ export * from './core-domain.js';
@@ -0,0 +1 @@
1
+ export * from './core-domain.js';
@@ -2,6 +2,7 @@ import type { EdgelessTextBlockModel } from '../blocks/edgeless-text/edgeless-te
2
2
  import type { BpmnNodeElementModel, BpmnPoolElementModel } from './bpmn/index.js';
3
3
  import type { BrushElementModel } from './brush/index.js';
4
4
  import type { ConnectorElementModel } from './connector/index.js';
5
+ import type { CoreDomainChartElementModel } from './core-domain/index.js';
5
6
  import type { EdgyFacetsElementModel, EdgyNodeElementModel } from './edgy/index.js';
6
7
  import type { CynefinElementModel } from './cynefin/index.js';
7
8
  import type { EstuarineElementModel } from './estuarine/index.js';
@@ -14,6 +15,7 @@ import type { WardleyBackgroundElementModel, WardleyNodeElementModel } from './w
14
15
  export * from './bpmn/index.js';
15
16
  export * from './brush/index.js';
16
17
  export * from './connector/index.js';
18
+ export * from './core-domain/index.js';
17
19
  export * from './cynefin/index.js';
18
20
  export * from './edgy/index.js';
19
21
  export * from './estuarine/index.js';
@@ -39,6 +41,7 @@ export type SurfaceElementModelMap = {
39
41
  edgyNode: EdgyNodeElementModel;
40
42
  cynefin: CynefinElementModel;
41
43
  estuarine: EstuarineElementModel;
44
+ coreDomain: CoreDomainChartElementModel;
42
45
  };
43
46
  export type SurfaceTextModelMap = {
44
47
  text: TextElementModel;
@@ -1,6 +1,7 @@
1
1
  export * from './bpmn/index.js';
2
2
  export * from './brush/index.js';
3
3
  export * from './connector/index.js';
4
+ export * from './core-domain/index.js';
4
5
  export * from './cynefin/index.js';
5
6
  export * from './edgy/index.js';
6
7
  export * from './estuarine/index.js';
@@ -33,7 +33,7 @@ export type BlockLifecycleEvents = {
33
33
  * manipulated ('background:classic', 'node:market', 'connector:link'…).
34
34
  */
35
35
  export interface FrameworkElementEvent extends TelemetryEvent {
36
- framework: 'wardley' | 'edgy' | 'cynefin' | 'bpmn';
36
+ framework: 'wardley' | 'edgy' | 'cynefin' | 'bpmn' | 'event-storming' | 'core-domain' | 'context-map';
37
37
  element: string;
38
38
  }
39
39
  export type FrameworkDiagramEvents = {
@@ -25,9 +25,10 @@ import { FramePanelViewExtension } from '../_pkgs/affine-fragment-frame-panel/vi
25
25
  import { OutlineViewExtension } from '../_pkgs/affine-fragment-outline/view.js';
26
26
  import { BrushViewExtension } from '../_pkgs/affine-gfx-brush/view.js';
27
27
  import { ConnectorViewExtension } from '../_pkgs/affine-gfx-connector/view.js';
28
+ import { DddContextMapViewExtension, DddCoreDomainRenderViewExtension, DddCoreDomainViewExtension, DddEventStormingViewExtension, DddTemplatesViewExtension, } from '../_pkgs/affine-gfx-ddd/view.js';
28
29
  import { GroupViewExtension } from '../_pkgs/affine-gfx-group/view.js';
29
30
  import { LinkViewExtension as GfxLinkViewExtension } from '../_pkgs/affine-gfx-link/view.js';
30
- import { MindmapViewExtension } from '../_pkgs/affine-gfx-mindmap/view.js';
31
+ import { MindmapRenderViewExtension, MindmapToolViewExtension, OtherToolViewExtension, } from '../_pkgs/affine-gfx-mindmap/view.js';
31
32
  import { NoteViewExtension as GfxNoteViewExtension } from '../_pkgs/affine-gfx-note/view.js';
32
33
  import { PointerViewExtension } from '../_pkgs/affine-gfx-pointer/view.js';
33
34
  import { ShapeViewExtension } from '../_pkgs/affine-gfx-shape/view.js';
@@ -70,12 +71,21 @@ export function getInternalViewExtensions(flags) {
70
71
  GfxNoteViewExtension,
71
72
  ...(on('brush') ? [BrushViewExtension] : []),
72
73
  ShapeViewExtension,
73
- ...(on('mindmap') ? [MindmapViewExtension] : []),
74
+ // Mindmap rendering is always on; the flags gate only the senior buttons.
75
+ MindmapRenderViewExtension,
76
+ ...(on('mindmap') ? [MindmapToolViewExtension] : []),
77
+ ...(on('other') ? [OtherToolViewExtension] : []),
74
78
  ConnectorViewExtension,
75
79
  GroupViewExtension,
76
80
  TextViewExtension,
77
81
  ...(on('template') ? [TemplateViewExtension] : []),
78
82
  ...(on('link') ? [GfxLinkViewExtension] : []),
83
+ // Core Domain rendering is always on; the flag gates only the senior button.
84
+ DddCoreDomainRenderViewExtension,
85
+ ...(on('ddd-event-storming') ? [DddEventStormingViewExtension] : []),
86
+ ...(on('ddd-core-domain') ? [DddCoreDomainViewExtension] : []),
87
+ ...(on('ddd-context-map') ? [DddContextMapViewExtension] : []),
88
+ ...(on('ddd-templates') ? [DddTemplatesViewExtension] : []),
79
89
  // Block
80
90
  ...(on('attachment') ? [AttachmentViewExtension] : []),
81
91
  ...(on('bookmark') ? [BookmarkViewExtension] : []),
package/dist/flags.d.ts CHANGED
@@ -23,7 +23,7 @@
23
23
  * - `latex` controls both the latex block and inline latex.
24
24
  * - `frame` also controls the frame panel fragment.
25
25
  */
26
- export declare const OPTIONAL_BLOCKS: readonly ["attachment", "bookmark", "callout", "code", "data-view", "database", "divider", "edgeless-text", "embed", "embed-doc", "frame", "image", "latex", "list", "surface-ref", "table", "brush", "mindmap", "template", "link"];
26
+ export declare const OPTIONAL_BLOCKS: readonly ["attachment", "bookmark", "callout", "code", "data-view", "database", "divider", "edgeless-text", "embed", "embed-doc", "frame", "image", "latex", "list", "surface-ref", "table", "brush", "mindmap", "other", "template", "link", "ddd-event-storming", "ddd-core-domain", "ddd-context-map", "ddd-templates"];
27
27
  export type OptionalBlock = (typeof OPTIONAL_BLOCKS)[number];
28
28
  /** Map of optional block -> enabled. Missing keys default to enabled. */
29
29
  export type BlockFlags = Partial<Record<OptionalBlock, boolean>>;
package/dist/flags.js CHANGED
@@ -43,8 +43,13 @@ export const OPTIONAL_BLOCKS = [
43
43
  // gfx modules
44
44
  'brush',
45
45
  'mindmap',
46
+ 'other',
46
47
  'template',
47
48
  'link',
49
+ 'ddd-event-storming',
50
+ 'ddd-core-domain',
51
+ 'ddd-context-map',
52
+ 'ddd-templates',
48
53
  ];
49
54
  export function isBlockEnabled(flags, block) {
50
55
  return flags?.[block] !== false;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@formicoidea/labre-core",
3
3
  "description": "Labre editor — the full BlockSuite-derived editor as one package.",
4
- "version": "0.23.3",
4
+ "version": "0.24.0",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
7
  "author": "lajola",