lucide-text-icon 0.1.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/README.md ADDED
@@ -0,0 +1,55 @@
1
+ # lucide-text-icon
2
+
3
+ Deterministic text-to-icon mapping for **lucide-react-native**. This package turns a free-text task title into a Lucide icon name string with a tiny, offline scoring algorithm.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install lucide-text-icon lucide-static lucide-react-native
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```ts
14
+ import { getLucideIconNameFromText } from "lucide-text-icon"
15
+ import * as Icons from "lucide-react-native"
16
+
17
+ const iconName = getLucideIconNameFromText("have a walk")
18
+ const Icon = Icons[iconName]
19
+ ```
20
+
21
+ ### Options
22
+
23
+ ```ts
24
+ getLucideIconNameFromText("plan trip", {
25
+ fallbackIcon: "circle",
26
+ minScore: 6
27
+ })
28
+ ```
29
+
30
+ ## How It Works
31
+
32
+ 1. A build-time script reads `lucide-static/tags.json` and creates a token index.
33
+ 2. Input text is normalized (lowercase, punctuation removed, stopwords filtered, light stemming).
34
+ 3. Synonyms are expanded and scored against the icon tokens.
35
+
36
+ **Scoring rules:**
37
+
38
+ - Exact token match: +10
39
+ - Synonym match: +6
40
+ - Partial match (substring): +3
41
+
42
+ The icon with the highest score is returned. If no icon reaches `minScore`, the `fallbackIcon` is returned.
43
+
44
+ ## Notes
45
+
46
+ - This library returns the **icon name string** only.
47
+ - The icon component must come from **lucide-react-native**.
48
+ - No network calls and no heavy NLP dependencies.
49
+
50
+ ## Development
51
+
52
+ ```bash
53
+ npm run test
54
+ npm run build
55
+ ```