flow-mindmap 0.4.0 → 0.4.1

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.
@@ -0,0 +1,43 @@
1
+ export interface BranchPalette {
2
+ id: string;
3
+ name: string;
4
+ /** Hex colors cycled across top-level branches, in display order. */
5
+ colors: string[];
6
+ }
7
+ export declare const BUILTIN_PALETTES: readonly BranchPalette[];
8
+ /**
9
+ * Resolve a palette by id from a combined list of built-ins and
10
+ * user-defined custom palettes. Falls back to the default palette
11
+ * if `id` is missing or points at a deleted custom palette. Pure
12
+ * — no DOM, no reactive deps — so it can be called from a computed
13
+ * or a watch.
14
+ */
15
+ export declare function resolvePalette(id: string, customPalettes?: readonly BranchPalette[]): BranchPalette;
16
+ /**
17
+ * Parse a free-form text blob into a cleaned color array. Accepts:
18
+ *
19
+ * 1. **Hex codes** — `#rgb` / `#rgba` / `#rrggbb` / `#rrggbbaa`,
20
+ * with or without the leading `#`. The alpha channel on
21
+ * 4- or 8-digit hex is silently dropped.
22
+ * 2. **`rgb()` / `rgba()` functions** — `rgb(255, 99, 71)`,
23
+ * `rgba(255,99,71,0.5)`. Whitespace and percentage values
24
+ * are both accepted (matches CSS rules). Alpha dropped.
25
+ * 3. **CSS named colors** — the 30 most common (`red`, `tomato`,
26
+ * `coral`, `teal`, …). A small curated set keeps the parser
27
+ * from silently accepting typos that look color-ish
28
+ * (`tan`, `peru` are in; `chartreuse1` is not).
29
+ * 4. **JSON / JS array** — `['#f87171', 'red']`,
30
+ * `["#f87171","rgb(0,0,255)"]`, even a single-line
31
+ * `["red","blue"]`. Bracket and quote chars are tolerated
32
+ * so a copy-pasted `[…]` round-trips cleanly.
33
+ * 5. **Any-delimiter blob** — the parser scans the raw text for
34
+ * color-shaped substrings rather than splitting on commas,
35
+ * so a user can paste `rgb(255, 0, 0), #0f0, blue` and every
36
+ * piece lands.
37
+ *
38
+ * Malformed tokens are dropped silently (consistent with the
39
+ * rest of the canvas's "paste messy text" UX). Returns at most
40
+ * `maxColors` entries; output is lowercased `#rrggbb` for stable
41
+ * dedup and direct comparison with `BUILTIN_PALETTES`.
42
+ */
43
+ export declare function parsePaletteInput(text: string, maxColors?: number): string[];
@@ -0,0 +1,11 @@
1
+ import MindMap from './components/MindMap.vue';
2
+ import type { App } from 'vue';
3
+ import type { MindMapNode, MindMapOptions, MindMapTheme, MindMapExpose, MindMapSettings, NodeStyle, LineStyle, LayoutMode, BranchPalette, BranchPaletteId, RichContent } from './types';
4
+ import { uid, clone, findNode, findParent, removeNode, addChild, addSibling, markdownToMindMap, mindMapToMarkdown, markdownToRichMindMap, richBlockToMarkdown } from './tree';
5
+ export type { MindMapNode, MindMapOptions, MindMapTheme, MindMapExpose, MindMapSettings, NodeStyle, LineStyle, LayoutMode, BranchPalette, BranchPaletteId, RichContent };
6
+ export { MindMap };
7
+ export { uid, clone, findNode, findParent, removeNode, addChild, addSibling, markdownToMindMap, mindMapToMarkdown, markdownToRichMindMap, richBlockToMarkdown };
8
+ declare const plugin: {
9
+ install(app: App): void;
10
+ };
11
+ export default plugin;