@remit/ui 0.0.114 → 0.0.115

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,25 @@
1
+ import { useEffect, useState } from "react";
2
+
3
+ /**
4
+ * A media query read from JS and kept in step with the browser's answer. The
5
+ * same conditions the CSS gates on — the desktop query above all — decide
6
+ * behaviour that has no CSS form: which surface a menu opens in, whether a
7
+ * gesture is bound at all.
8
+ */
9
+ export const useMatchMedia = (query: string): boolean => {
10
+ const [matches, setMatches] = useState(() => {
11
+ if (typeof window === "undefined" || !window.matchMedia) return false;
12
+ return window.matchMedia(query).matches;
13
+ });
14
+
15
+ useEffect(() => {
16
+ if (typeof window === "undefined" || !window.matchMedia) return;
17
+ const media = window.matchMedia(query);
18
+ setMatches(media.matches);
19
+ const handler = (event: MediaQueryListEvent) => setMatches(event.matches);
20
+ media.addEventListener("change", handler);
21
+ return () => media.removeEventListener("change", handler);
22
+ }, [query]);
23
+
24
+ return matches;
25
+ };
package/src/rich-text.ts CHANGED
@@ -24,6 +24,11 @@ export {
24
24
  PlainTextEditor,
25
25
  type PlainTextEditorProps,
26
26
  } from "./components/plain-text-editor.js";
27
+ export {
28
+ type CorrectionMenuAnchor,
29
+ RichTextCorrectionMenu,
30
+ type RichTextCorrectionMenuProps,
31
+ } from "./components/rich-text-correction-menu.js";
27
32
  export {
28
33
  htmlToMarkdown,
29
34
  markdownToHtml,
@@ -42,11 +47,18 @@ export type {
42
47
  ProviderStatus,
43
48
  SpellcheckOptions,
44
49
  SpellProvider,
50
+ SuggestRequest,
51
+ SuggestResponse,
45
52
  } from "./components/rich-text-spellcheck.js";
46
53
  export {
47
54
  openSpellProvider,
48
55
  type SpellWorkerPort,
49
56
  } from "./components/rich-text-spellcheck-provider.js";
57
+ export {
58
+ normaliseWord,
59
+ SUGGESTION_LIMIT,
60
+ suggestionsFor,
61
+ } from "./components/rich-text-spellcheck-words.js";
50
62
  export {
51
63
  type ComposeCaret,
52
64
  EMPTY_RICH_TEXT,