thaizip 0.7.4 → 0.7.6

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/data.d.cts CHANGED
@@ -42,6 +42,19 @@ type TrigramIndex = {
42
42
  };
43
43
 
44
44
  declare function clearDefaultIndex(): void;
45
+ /**
46
+ * The already-built default index, or `null` if it has not finished building.
47
+ *
48
+ * Purely synchronous: it never starts a build and never touches the in-flight
49
+ * promise. It exists so a consumer can seed its initial state without waiting a
50
+ * microtask — `loadDefaultIndex()` is async even on a cache hit, which otherwise
51
+ * forces a one-frame loading state on every remount of an already-warm page.
52
+ *
53
+ * Returns `null` on a cold start and after `clearDefaultIndex()`, so callers must
54
+ * still call `loadDefaultIndex()` — this only lets them skip the visible flash
55
+ * when the answer is already known.
56
+ */
57
+ declare function getDefaultIndexIfLoaded(): TrigramIndex | null;
45
58
  declare function loadDefaultIndex(): Promise<TrigramIndex>;
46
59
 
47
- export { clearDefaultIndex, loadDefaultIndex };
60
+ export { clearDefaultIndex, getDefaultIndexIfLoaded, loadDefaultIndex };
package/dist/data.d.ts CHANGED
@@ -42,6 +42,19 @@ type TrigramIndex = {
42
42
  };
43
43
 
44
44
  declare function clearDefaultIndex(): void;
45
+ /**
46
+ * The already-built default index, or `null` if it has not finished building.
47
+ *
48
+ * Purely synchronous: it never starts a build and never touches the in-flight
49
+ * promise. It exists so a consumer can seed its initial state without waiting a
50
+ * microtask — `loadDefaultIndex()` is async even on a cache hit, which otherwise
51
+ * forces a one-frame loading state on every remount of an already-warm page.
52
+ *
53
+ * Returns `null` on a cold start and after `clearDefaultIndex()`, so callers must
54
+ * still call `loadDefaultIndex()` — this only lets them skip the visible flash
55
+ * when the answer is already known.
56
+ */
57
+ declare function getDefaultIndexIfLoaded(): TrigramIndex | null;
45
58
  declare function loadDefaultIndex(): Promise<TrigramIndex>;
46
59
 
47
- export { clearDefaultIndex, loadDefaultIndex };
60
+ export { clearDefaultIndex, getDefaultIndexIfLoaded, loadDefaultIndex };