flow-mindmap 0.4.7 → 0.5.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/App.vue.d.ts CHANGED
@@ -1,20 +1,2 @@
1
- type __VLS_Props = {
2
- /** Show the "显示大纲" button in the top bar. */
3
- showOutlineBtn?: boolean;
4
- /** Show the "显示数据" button in the top bar. */
5
- showDataBtn?: boolean;
6
- /** Show the "显示 Markdown" button in the top bar. */
7
- showMarkdownBtn?: boolean;
8
- /** Show the "显示设置" button in the top bar. */
9
- showSettingsBtn?: boolean;
10
- /** Show the "进入预览模式" button in the top bar. */
11
- showPreviewModeBtn?: boolean;
12
- };
13
- declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
14
- showOutlineBtn: boolean;
15
- showDataBtn: boolean;
16
- showMarkdownBtn: boolean;
17
- showSettingsBtn: boolean;
18
- showPreviewModeBtn: boolean;
19
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
1
+ declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
20
2
  export default _default;
@@ -12,10 +12,14 @@ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {
12
12
  openSettings: () => any;
13
13
  openData: () => any;
14
14
  openImport: (mode: "markdown" | "txt" | "json") => any;
15
+ exportPng: () => any;
16
+ exportSvg: () => any;
15
17
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
16
18
  onClose?: (() => any) | undefined;
17
19
  onOpenSettings?: (() => any) | undefined;
18
20
  onOpenData?: (() => any) | undefined;
19
21
  onOpenImport?: ((mode: "markdown" | "txt" | "json") => any) | undefined;
22
+ onExportPng?: (() => any) | undefined;
23
+ onExportSvg?: (() => any) | undefined;
20
24
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
21
25
  export default _default;
@@ -85,6 +85,17 @@ declare const _default: import("vue").DefineComponent<__VLS_Props, {
85
85
  getBranchPalettes: () => import("../types").BranchPalette[];
86
86
  lineWidthForDepth: (depth: number) => number;
87
87
  endWidthForDepth: (depth: number) => number;
88
+ addNodeMarker: (nodeId: string, marker: string) => void;
89
+ removeNodeMarker: (nodeId: string, marker: string) => void;
90
+ toggleNodeMarker: (nodeId: string, marker: string) => boolean;
91
+ getNodeMarkers: (nodeId: string) => string[];
92
+ setNodeTags: (nodeId: string, tags: string[]) => void;
93
+ getNodeTags: (nodeId: string) => string[];
94
+ exportPNG: (scale?: number) => void;
95
+ exportSVG: () => void;
96
+ searchNodes: (query: string) => string[];
97
+ getSearchResults: () => string[];
98
+ getSearchIndex: () => number;
88
99
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
89
100
  select: (nodes: MindMapNode[] | null) => any;
90
101
  change: (data: MindMapNode) => any;
@@ -24,6 +24,12 @@ type __VLS_Props = {
24
24
  /** Whether the node already has a table in its richContent.
25
25
  * Same role as hasCode for the table action. */
26
26
  hasTable?: boolean;
27
+ /** Markers currently on the node (ids). Used to show a
28
+ * checkmark on active markers in the picker. */
29
+ nodeMarkers?: string[];
30
+ /** Tags currently on the node. Used to show the
31
+ * "移除标签" action when non-empty. */
32
+ nodeTags?: string[];
27
33
  };
28
34
  declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
29
35
  close: () => any;
@@ -39,6 +45,10 @@ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {
39
45
  addTable: () => any;
40
46
  editTable: () => any;
41
47
  removeTable: () => any;
48
+ toggleMarker: (marker: string) => any;
49
+ clearMarkers: () => any;
50
+ addTag: () => any;
51
+ removeTags: () => any;
42
52
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
43
53
  onClose?: (() => any) | undefined;
44
54
  onPickImage?: (() => any) | undefined;
@@ -53,11 +63,17 @@ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {
53
63
  onAddTable?: (() => any) | undefined;
54
64
  onEditTable?: (() => any) | undefined;
55
65
  onRemoveTable?: (() => any) | undefined;
66
+ onToggleMarker?: ((marker: string) => any) | undefined;
67
+ onClearMarkers?: (() => any) | undefined;
68
+ onAddTag?: (() => any) | undefined;
69
+ onRemoveTags?: (() => any) | undefined;
56
70
  }>, {
57
71
  hasImage: boolean;
58
72
  hasLink: boolean;
59
73
  hasNote: boolean;
60
74
  hasCode: boolean;
61
75
  hasTable: boolean;
76
+ nodeMarkers: string[];
77
+ nodeTags: string[];
62
78
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
63
79
  export default _default;
@@ -1,23 +1,13 @@
1
- import type { MindMapSettings } from '../types';
1
+ import type { MindMapSettings, NodeStyle } from '../types';
2
2
  type __VLS_Props = {
3
3
  settings: MindMapSettings;
4
4
  /** true when a node is selected — the per-node panel is shown too. */
5
5
  hasSelection: boolean;
6
6
  selectedNodeText?: string;
7
+ /** Current per-node style, read from the canvas so the panel
8
+ * reflects the live state (immediate-apply model). */
9
+ nodeStyle?: NodeStyle;
7
10
  };
8
- /** Style overrides for a single node. Stored externally (App.vue
9
- * holds the map) so the per-node state is preserved across
10
- * selection changes. */
11
- export interface NodeStyle {
12
- /** Background colour. undefined = fall back to theme/branch. */
13
- bg?: string;
14
- /** Text colour. */
15
- textColor?: string;
16
- /** Border colour. */
17
- borderColor?: string;
18
- /** Font weight: 400 / 600. undefined = inherit. */
19
- fontWeight?: 400 | 600;
20
- }
21
11
  declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
22
12
  reset: () => any;
23
13
  "update:settings": (s: Partial<MindMapSettings>) => any;
@@ -43,4 +43,5 @@ export declare function usePanZoom(opts: PanZoomOptions): {
43
43
  marqueeVersion: Ref<number, number>;
44
44
  setOnMarqueeEnd: (cb: (() => void) | null) => void;
45
45
  resetView: (layoutWidth: number, layoutHeight: number, rootY: number, padding?: number) => void;
46
+ centerOn: (worldX: number, worldY: number, nodeW: number, nodeH: number, padding?: number) => void;
46
47
  };
@@ -50,6 +50,12 @@ export interface LayoutNode {
50
50
  * only — the default behaviour, unchanged from before this
51
51
  * field was introduced. */
52
52
  richContent?: RichContent;
53
+ /** Mirrored from MindMapNode.markers. Read by the renderer to
54
+ * show small marker icons before the node text. */
55
+ markers?: string[];
56
+ /** Mirrored from MindMapNode.tags. Read by the renderer to show
57
+ * small colored pills below the node title. */
58
+ tags?: string[];
53
59
  /** Inset (px) the SVG edge anchor should retreat from the
54
60
  * geometric box edge on the in-side, to land at the visible
55
61
  * content edge instead. Set to `.zm-node` padding +
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Marker library — defines the visual icon for each marker id.
3
+ *
4
+ * Markers are rendered as 14×14 SVG icons that sit to the LEFT of
5
+ * the node text. Each entry in `MARKER_LIB` maps a category to a
6
+ * list of markers, each with an id, a human-readable label, and
7
+ * an inline SVG string (the inner markup of a 24×24 viewBox).
8
+ *
9
+ * The renderer (MindMap.vue) uses `markerSvg(id)` to look up the
10
+ * icon markup; the context menu (NodeContextMenu.vue) iterates
11
+ * `MARKER_LIB` to build the picker grid.
12
+ */
13
+ export interface MarkerDef {
14
+ /** Stable id stored on the data tree, e.g. 'priority-1'. */
15
+ id: string;
16
+ /** Human-readable label shown in the picker tooltip. */
17
+ label: string;
18
+ /**
19
+ * Inner SVG markup for a 24×24 viewBox. The outer <svg> wrapper
20
+ * is added by the renderer. Use `fill` / `stroke` attributes
21
+ * directly so the icon is self-contained.
22
+ */
23
+ svg: string;
24
+ }
25
+ export interface MarkerGroup {
26
+ /** Group label shown as a section header in the picker. */
27
+ label: string;
28
+ markers: MarkerDef[];
29
+ }
30
+ export declare const MARKER_LIB: MarkerGroup[];
31
+ /** Look up a marker definition by id. Returns undefined if the
32
+ * id is not in the library. */
33
+ export declare function markerDef(id: string): MarkerDef | undefined;
34
+ /** Get the inner SVG markup for a marker id. Returns an empty
35
+ * string for unknown ids so the renderer can safely inline it. */
36
+ export declare function markerSvg(id: string): string;
37
+ /** Get the label for a marker id. */
38
+ export declare function markerLabel(id: string): string;
39
+ /** Derive a stable color from a tag string for tag pill rendering.
40
+ * Uses a simple hash → HSL so the same tag always gets the same
41
+ * color, and different tags get visually distinct hues.
42
+ * Returns an object with keys that are valid Vue `:style` / CSS
43
+ * property names so the result can be spread directly into a
44
+ * style binding. */
45
+ export declare function tagColor(tag: string): {
46
+ background: string;
47
+ borderColor: string;
48
+ color: string;
49
+ };
package/dist/entry.d.ts CHANGED
@@ -9,9 +9,12 @@ import MindMapApp from './App.vue';
9
9
  import type { App } from 'vue';
10
10
  import type { MindMapNode, MindMapOptions, MindMapTheme, MindMapExpose, MindMapSettings, NodeStyle, LineStyle, LayoutMode, BranchPalette, BranchPaletteId, RichContent } from './types';
11
11
  import { uid, clone, findNode, findParent, removeNode, addChild, addSibling, markdownToMindMap, mindMapToMarkdown, markdownToRichMindMap, richBlockToMarkdown } from './tree';
12
- export type { MindMapNode, MindMapOptions, MindMapTheme, MindMapExpose, MindMapSettings, NodeStyle, LineStyle, LayoutMode, BranchPalette, BranchPaletteId, RichContent };
12
+ import { MARKER_LIB, markerSvg, markerLabel, markerDef, tagColor } from './core/markers';
13
+ import type { MarkerGroup, MarkerDef } from './core/markers';
14
+ export type { MindMapNode, MindMapOptions, MindMapTheme, MindMapExpose, MindMapSettings, NodeStyle, LineStyle, LayoutMode, BranchPalette, BranchPaletteId, RichContent, MarkerGroup, MarkerDef };
13
15
  export { MindMap, Outline, Drawer, DataPanel, MarkdownPanel, SettingsPanel, NotePanel, MindMapApp };
14
16
  export { uid, clone, findNode, findParent, removeNode, addChild, addSibling, markdownToMindMap, mindMapToMarkdown, markdownToRichMindMap, richBlockToMarkdown };
17
+ export { MARKER_LIB, markerSvg, markerLabel, markerDef, tagColor };
15
18
  declare const plugin: {
16
19
  install(app: App): void;
17
20
  };