@nil-/doc 0.2.40 → 0.2.41

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @nil-/doc
2
2
 
3
+ ## 0.2.41
4
+
5
+ ### Patch Changes
6
+
7
+ - [doc][docu] added page for fuzzy matching ([#65](https://github.com/njaldea/mono/pull/65))
8
+
3
9
  ## 0.2.40
4
10
 
5
11
  ### Patch Changes
@@ -16,14 +16,16 @@
16
16
  grid-template-columns: 15px 1fr;
17
17
  align-items: center;
18
18
  cursor: pointer;
19
+ gap: 5px;
20
+ box-sizing: border-box;
19
21
  }
20
22
 
21
23
  .header:hover {
22
- background-color: rgba(2, 156, 253, 0.07);
24
+ background-color: hsla(203, 98%, 50%, 0.07);
23
25
  }
24
26
 
25
27
  .header.selected {
26
- background-color: rgba(2, 157, 253, 0.822);
28
+ background-color: hsla(203, 98%, 50%, 0.822);
27
29
  color: black;
28
30
  }
29
31
 
@@ -31,6 +33,7 @@
31
33
  justify-content: center;
32
34
  height: 15px;
33
35
  width: 15px;
36
+ transition: transform 350ms;
34
37
  }
35
38
 
36
39
  .icon.expanded {
@@ -1 +1,2 @@
1
+ export declare const score: (target: string, query: string) => readonly [number, number[]];
1
2
  export declare const fuzz: (target: string, query: string) => boolean;
@@ -107,13 +107,16 @@ const doScoreFuzzy = (query, queryLower, queryLength, target, targetLower, targe
107
107
  targetIndex--;
108
108
  }
109
109
  }
110
- return [scores[queryLength * targetLength - 1], positions.reverse()];
110
+ return [scores[queryLength * targetLength - 1] ?? 0, positions.reverse()];
111
111
  };
112
- export const fuzz = (target, query) => {
112
+ export const score = (target, query) => {
113
113
  const targetLength = target.length;
114
114
  const queryLength = query.length;
115
115
  if (targetLength < queryLength) {
116
- return false;
116
+ return [0, []];
117
117
  }
118
- return (doScoreFuzzy(query, query.toLowerCase(), queryLength, target, target.toLowerCase(), targetLength)[0] > 0);
118
+ return doScoreFuzzy(query, query.toLowerCase(), queryLength, target, target.toLowerCase(), targetLength);
119
+ };
120
+ export const fuzz = (target, query) => {
121
+ return score(target, query)[0] > 0;
119
122
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nil-/doc",
3
- "version": "0.2.40",
3
+ "version": "0.2.41",
4
4
  "author": {
5
5
  "email": "njaldea@gmail.com",
6
6
  "name": "Neil Aldea"