@bitvea/feedback-toolbar 0.0.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.
Files changed (176) hide show
  1. package/README.md +262 -0
  2. package/dist/FeedbackPanel.d.ts +117 -0
  3. package/dist/FeedbackPanel.d.ts.map +1 -0
  4. package/dist/FeedbackPanel.js +622 -0
  5. package/dist/FeedbackPanel.js.map +1 -0
  6. package/dist/FeedbackToolbar.d.ts +54 -0
  7. package/dist/FeedbackToolbar.d.ts.map +1 -0
  8. package/dist/FeedbackToolbar.js +1149 -0
  9. package/dist/FeedbackToolbar.js.map +1 -0
  10. package/dist/InboxSheet.d.ts +80 -0
  11. package/dist/InboxSheet.d.ts.map +1 -0
  12. package/dist/InboxSheet.js +580 -0
  13. package/dist/InboxSheet.js.map +1 -0
  14. package/dist/PinLayer.d.ts +59 -0
  15. package/dist/PinLayer.d.ts.map +1 -0
  16. package/dist/PinLayer.js +1702 -0
  17. package/dist/PinLayer.js.map +1 -0
  18. package/dist/RichText.d.ts +6 -0
  19. package/dist/RichText.d.ts.map +1 -0
  20. package/dist/RichText.js +135 -0
  21. package/dist/RichText.js.map +1 -0
  22. package/dist/browser/entry.d.ts +3 -0
  23. package/dist/browser/entry.d.ts.map +1 -0
  24. package/dist/browser/entry.js +13 -0
  25. package/dist/browser/entry.js.map +1 -0
  26. package/dist/browser/mount.d.ts +37 -0
  27. package/dist/browser/mount.d.ts.map +1 -0
  28. package/dist/browser/mount.js +150 -0
  29. package/dist/browser/mount.js.map +1 -0
  30. package/dist/browser/toolbar.js +38 -0
  31. package/dist/browser/toolbar.js.map +7 -0
  32. package/dist/capture.d.ts +58 -0
  33. package/dist/capture.d.ts.map +1 -0
  34. package/dist/capture.js +98 -0
  35. package/dist/capture.js.map +1 -0
  36. package/dist/cli/bin.d.ts +3 -0
  37. package/dist/cli/bin.d.ts.map +1 -0
  38. package/dist/cli/bin.js +196 -0
  39. package/dist/cli/bin.js.map +1 -0
  40. package/dist/cli/fs.d.ts +16 -0
  41. package/dist/cli/fs.d.ts.map +1 -0
  42. package/dist/cli/fs.js +33 -0
  43. package/dist/cli/fs.js.map +1 -0
  44. package/dist/cli/init.d.ts +75 -0
  45. package/dist/cli/init.d.ts.map +1 -0
  46. package/dist/cli/init.js +266 -0
  47. package/dist/cli/init.js.map +1 -0
  48. package/dist/cli/register.d.ts +55 -0
  49. package/dist/cli/register.d.ts.map +1 -0
  50. package/dist/cli/register.js +84 -0
  51. package/dist/cli/register.js.map +1 -0
  52. package/dist/cli/registration.d.ts +37 -0
  53. package/dist/cli/registration.d.ts.map +1 -0
  54. package/dist/cli/registration.js +69 -0
  55. package/dist/cli/registration.js.map +1 -0
  56. package/dist/cli/strategies.d.ts +98 -0
  57. package/dist/cli/strategies.d.ts.map +1 -0
  58. package/dist/cli/strategies.js +198 -0
  59. package/dist/cli/strategies.js.map +1 -0
  60. package/dist/client.d.ts +59 -0
  61. package/dist/client.d.ts.map +1 -0
  62. package/dist/client.js +113 -0
  63. package/dist/client.js.map +1 -0
  64. package/dist/config.d.ts +92 -0
  65. package/dist/config.d.ts.map +1 -0
  66. package/dist/config.js +65 -0
  67. package/dist/config.js.map +1 -0
  68. package/dist/deepLink.d.ts +86 -0
  69. package/dist/deepLink.d.ts.map +1 -0
  70. package/dist/deepLink.js +185 -0
  71. package/dist/deepLink.js.map +1 -0
  72. package/dist/fontFace.d.ts +70 -0
  73. package/dist/fontFace.d.ts.map +1 -0
  74. package/dist/fontFace.js +88 -0
  75. package/dist/fontFace.js.map +1 -0
  76. package/dist/gating.d.ts +32 -0
  77. package/dist/gating.d.ts.map +1 -0
  78. package/dist/gating.js +49 -0
  79. package/dist/gating.js.map +1 -0
  80. package/dist/icons.d.ts +68 -0
  81. package/dist/icons.d.ts.map +1 -0
  82. package/dist/icons.js +97 -0
  83. package/dist/icons.js.map +1 -0
  84. package/dist/index.d.ts +14 -0
  85. package/dist/index.d.ts.map +1 -0
  86. package/dist/index.js +68 -0
  87. package/dist/index.js.map +1 -0
  88. package/dist/markdown.d.ts +59 -0
  89. package/dist/markdown.d.ts.map +1 -0
  90. package/dist/markdown.js +130 -0
  91. package/dist/markdown.js.map +1 -0
  92. package/dist/motion.d.ts +178 -0
  93. package/dist/motion.d.ts.map +1 -0
  94. package/dist/motion.js +302 -0
  95. package/dist/motion.js.map +1 -0
  96. package/dist/preferences.d.ts +71 -0
  97. package/dist/preferences.d.ts.map +1 -0
  98. package/dist/preferences.js +195 -0
  99. package/dist/preferences.js.map +1 -0
  100. package/dist/rasterise.d.ts +45 -0
  101. package/dist/rasterise.d.ts.map +1 -0
  102. package/dist/rasterise.js +490 -0
  103. package/dist/rasterise.js.map +1 -0
  104. package/dist/selector.d.ts +19 -0
  105. package/dist/selector.d.ts.map +1 -0
  106. package/dist/selector.js +142 -0
  107. package/dist/selector.js.map +1 -0
  108. package/dist/session.d.ts +19 -0
  109. package/dist/session.d.ts.map +1 -0
  110. package/dist/session.js +36 -0
  111. package/dist/session.js.map +1 -0
  112. package/dist/shortcut.d.ts +88 -0
  113. package/dist/shortcut.d.ts.map +1 -0
  114. package/dist/shortcut.js +149 -0
  115. package/dist/shortcut.js.map +1 -0
  116. package/dist/tokens.d.ts +709 -0
  117. package/dist/tokens.d.ts.map +1 -0
  118. package/dist/tokens.js +749 -0
  119. package/dist/tokens.js.map +1 -0
  120. package/dist/vendor/types/account.d.ts +26 -0
  121. package/dist/vendor/types/account.d.ts.map +1 -0
  122. package/dist/vendor/types/account.js +23 -0
  123. package/dist/vendor/types/account.js.map +1 -0
  124. package/dist/vendor/types/apiKey.d.ts +38 -0
  125. package/dist/vendor/types/apiKey.d.ts.map +1 -0
  126. package/dist/vendor/types/apiKey.js +36 -0
  127. package/dist/vendor/types/apiKey.js.map +1 -0
  128. package/dist/vendor/types/auth.d.ts +10 -0
  129. package/dist/vendor/types/auth.d.ts.map +1 -0
  130. package/dist/vendor/types/auth.js +15 -0
  131. package/dist/vendor/types/auth.js.map +1 -0
  132. package/dist/vendor/types/entity.d.ts +74 -0
  133. package/dist/vendor/types/entity.d.ts.map +1 -0
  134. package/dist/vendor/types/entity.js +111 -0
  135. package/dist/vendor/types/entity.js.map +1 -0
  136. package/dist/vendor/types/feedback.d.ts +285 -0
  137. package/dist/vendor/types/feedback.d.ts.map +1 -0
  138. package/dist/vendor/types/feedback.js +286 -0
  139. package/dist/vendor/types/feedback.js.map +1 -0
  140. package/dist/vendor/types/index.d.ts +14 -0
  141. package/dist/vendor/types/index.d.ts.map +1 -0
  142. package/dist/vendor/types/index.js +16 -0
  143. package/dist/vendor/types/index.js.map +1 -0
  144. package/dist/vendor/types/invite.d.ts +42 -0
  145. package/dist/vendor/types/invite.d.ts.map +1 -0
  146. package/dist/vendor/types/invite.js +30 -0
  147. package/dist/vendor/types/invite.js.map +1 -0
  148. package/dist/vendor/types/mcpToken.d.ts +38 -0
  149. package/dist/vendor/types/mcpToken.d.ts.map +1 -0
  150. package/dist/vendor/types/mcpToken.js +39 -0
  151. package/dist/vendor/types/mcpToken.js.map +1 -0
  152. package/dist/vendor/types/organization.d.ts +13 -0
  153. package/dist/vendor/types/organization.d.ts.map +1 -0
  154. package/dist/vendor/types/organization.js +12 -0
  155. package/dist/vendor/types/organization.js.map +1 -0
  156. package/dist/vendor/types/project.d.ts +73 -0
  157. package/dist/vendor/types/project.d.ts.map +1 -0
  158. package/dist/vendor/types/project.js +117 -0
  159. package/dist/vendor/types/project.js.map +1 -0
  160. package/dist/vendor/types/role.d.ts +12 -0
  161. package/dist/vendor/types/role.d.ts.map +1 -0
  162. package/dist/vendor/types/role.js +20 -0
  163. package/dist/vendor/types/role.js.map +1 -0
  164. package/dist/vendor/types/roleDefinition.d.ts +61 -0
  165. package/dist/vendor/types/roleDefinition.d.ts.map +1 -0
  166. package/dist/vendor/types/roleDefinition.js +45 -0
  167. package/dist/vendor/types/roleDefinition.js.map +1 -0
  168. package/dist/vendor/types/team.d.ts +25 -0
  169. package/dist/vendor/types/team.d.ts.map +1 -0
  170. package/dist/vendor/types/team.js +17 -0
  171. package/dist/vendor/types/team.js.map +1 -0
  172. package/dist/vendor/types/util.d.ts +39 -0
  173. package/dist/vendor/types/util.d.ts.map +1 -0
  174. package/dist/vendor/types/util.js +31 -0
  175. package/dist/vendor/types/util.js.map +1 -0
  176. package/package.json +59 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selector.js","sourceRoot":"","sources":["../src/selector.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,EAAE;AACF,8EAA8E;AAC9E,4EAA4E;AAC5E,uCAAuC;AACvC,EAAE;AACF,oDAAoD;AACpD,sEAAsE;AACtE,yEAAyE;AACzE,EAAE;AACF,8EAA8E;AAC9E,2EAA2E;AAC3E,2EAA2E;AAE3E,4EAA4E;AAC5E,MAAM,iBAAiB,GAAG,CAAC,aAAa,EAAE,cAAc,EAAE,SAAS,CAAU,CAAC;AAE9E,wEAAwE;AACxE,SAAS,cAAc,CAAC,KAAa;IACnC,4EAA4E;IAC5E,+CAA+C;IAC/C,OAAO,CACL,KAAK,CAAC,MAAM,GAAG,EAAE;QACjB,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC;QAC7B,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC;QAC9B,kCAAkC,CAAC,IAAI,CAAC,KAAK,CAAC,CAC/C,CAAC;AACJ,CAAC;AAED,SAAS,WAAW,CAAC,KAAa;IAChC,2EAA2E;IAC3E,mDAAmD;IACnD,MAAM,SAAS,GAAI,UAA2D;SAC3E,GAAG,EAAE,MAAM,CAAC;IACf,OAAO,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;AACzE,CAAC;AAED,+DAA+D;AAC/D,SAAS,aAAa,CAAC,EAAW;IAChC,MAAM,GAAG,GAAG,EAAE,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;IACrC,MAAM,MAAM,G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CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;KAC3C,CAAC;AACJ,CAAC;AAED,gFAAgF;AAChF,MAAM,UAAU,SAAS,CACvB,QAAgB,EAChB,OAAe,EACf,OAAe;IAEf,MAAM,EAAE,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC;IACrC,IAAI,CAAC,EAAE;QAAE,OAAO,IAAI,CAAC;IACrB,MAAM,IAAI,GAAG,EAAE,CAAC,qBAAqB,EAAE,CAAC;IACxC,IAAI,IAAI,CAAC,KAAK,KAAK,CAAC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACvD,OAAO;QACL,CAAC,EAAE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,KAAK,GAAG,OAAO;QACnC,CAAC,EAAE,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,MAAM,GAAG,OAAO;KACpC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { type ToolbarClient, type ToolbarSession } from "./client.js";
2
+ export type ToolbarSessionPhase = {
3
+ kind: "loading";
4
+ } | {
5
+ kind: "error";
6
+ message: string;
7
+ } | {
8
+ kind: "session";
9
+ session: ToolbarSession;
10
+ };
11
+ export interface UseToolbarSession {
12
+ phase: ToolbarSessionPhase;
13
+ /** The project the caller may act on, or null. Drives the pin layer. */
14
+ readyProjectId: string | null;
15
+ /** Re-resolve, e.g. after the reviewer follows their magic link. */
16
+ reload: () => void;
17
+ }
18
+ export declare function useToolbarSession(client: ToolbarClient, projectUrl: string): UseToolbarSession;
19
+ //# sourceMappingURL=session.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":"AAYA,OAAO,EAAmB,KAAK,aAAa,EAAE,KAAK,cAAc,EAAE,MAAM,UAAU,CAAC;AAEpF,MAAM,MAAM,mBAAmB,GAC3B;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,GACnB;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAClC;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,OAAO,EAAE,cAAc,CAAA;CAAE,CAAC;AAEjD,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,mBAAmB,CAAC;IAC3B,wEAAwE;IACxE,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,oEAAoE;IACpE,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAED,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,aAAa,EACrB,UAAU,EAAE,MAAM,GACjB,iBAAiB,CA4BnB"}
@@ -0,0 +1,36 @@
1
+ "use client";
2
+ // Who the visitor is and whether they can act on this project, resolved once
3
+ // per page rather than once per surface.
4
+ //
5
+ // This lives outside the panel because the pin layer needs the answer too, and
6
+ // it needs it before anybody opens the panel: existing pins have to be on the
7
+ // page as soon as it loads, or a reviewer opens the toolbar to report a bug a
8
+ // colleague already reported. Resolving it in the panel made the pins depend
9
+ // on the panel being open, which is the wrong dependency.
10
+ import { useCallback, useEffect, useState } from "react";
11
+ import { ToolbarApiError } from "./client.js";
12
+ export function useToolbarSession(client, projectUrl) {
13
+ const [phase, setPhase] = useState({ kind: "loading" });
14
+ const load = useCallback(async () => {
15
+ setPhase({ kind: "loading" });
16
+ try {
17
+ setPhase({ kind: "session", session: await client.session(projectUrl) });
18
+ }
19
+ catch (err) {
20
+ setPhase({
21
+ kind: "error",
22
+ message: err instanceof ToolbarApiError && err.code === "network_error"
23
+ ? "Could not reach the feedback service."
24
+ : "Something went wrong loading your session.",
25
+ });
26
+ }
27
+ }, [client, projectUrl]);
28
+ useEffect(() => {
29
+ void load();
30
+ }, [load]);
31
+ const readyProjectId = phase.kind === "session" && phase.session.state === "ready"
32
+ ? (phase.session.project?.id ?? null)
33
+ : null;
34
+ return { phase, readyProjectId, reload: ()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,CAAC,IAAI,KAAK,SAAS,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,KAAK,OAAO;QACzD,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,IAAI,IAAI,CAAC;QACrC,CAAC,CAAC,IAAI,CAAC;IAEX,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,KAAK,IAAI,EAAE,EAAE,CAAC;AAC9D,CAAC"}
@@ -0,0 +1,88 @@
1
+ /**
2
+ * A chord: a primary modifier, zero or more keys held down with it, and the
3
+ * key whose keydown fires it.
4
+ *
5
+ * `holdKeys` and `triggerKey` are `KeyboardEvent.key` values, lowercased -
6
+ * the LOGICAL key rather than the physical position. `event.code` would be
7
+ * wrong here: on AZERTY the key printed `F` is not `KeyF`, so a reviewer told
8
+ * to press F would have to press something else, and the tooltip and the
9
+ * behaviour would disagree for exactly the people least able to diagnose it.
10
+ */
11
+ export interface ShortcutChord {
12
+ /** Cmd on macOS, Ctrl everywhere else. The platform split is at match time. */
13
+ primaryModifier: boolean;
14
+ /** Keys held down when the trigger is pressed. Order is not significant. */
15
+ holdKeys: string[];
16
+ /** The key whose keydown fires the chord. */
17
+ triggerKey: string;
18
+ }
19
+ /**
20
+ * The default binding. The single definition the matcher, the host override
21
+ * and the tooltip hint all resolve back to.
22
+ */
23
+ export declare const DEFAULT_PIN_SHORTCUT: ShortcutChord;
24
+ /**
25
+ * What a host may say about the chord: replace it, or `null` to switch it off
26
+ * entirely. Off means no listener at all rather than a listener that declines
27
+ * - a disabled shortcut must not observe a single keystroke.
28
+ */
29
+ export type PinShortcutSetting = ShortcutChord | null;
30
+ /** Whether this platform spells the primary modifier Cmd rather than Ctrl. */
31
+ export declare function isApplePlatform(navigatorLike: {
32
+ platform?: string;
33
+ userAgent?: string;
34
+ } | undefined): boolean;
35
+ /**
36
+ * Whether a keystroke aimed at this element belongs to the host page.
37
+ *
38
+ * Walks up rather than testing the target alone, because a `contenteditable`
39
+ * region's keystrokes are delivered to whatever inner node holds the caret -
40
+ * a `<b>`, a `<div>`, a text node's parent - and testing only the target
41
+ * would leave every rich-text editor on the web unprotected.
42
+ *
43
+ * `readOnly` inputs are deliberately still treated as editable: they take
44
+ * focus and a reviewer may be selecting text in one, and being wrong in this
45
+ * direction costs a shortcut press while being wrong in the other costs
46
+ * somebody's typing.
47
+ */
48
+ export declare function isEditableTarget(target: EventTarget | null): boolean;
49
+ /**
50
+ * Whether this keydown, with these keys already held, is the chord.
51
+ *
52
+ * Modifier discipline is strict in one direction only: Shift and Alt must NOT
53
+ * be held, because `Cmd+Shift+F` is a different gesture the reviewer may mean
54
+ * for something else, and treating it as this chord would make the toolbar
55
+ * answer for a keystroke it was not given. The primary modifier is checked
56
+ * against the platform's spelling.
57
+ */
58
+ export declare function matchesChord(chord: ShortcutChord, event: Pick<KeyboardEvent, "key" | "metaKey" | "ctrlKey" | "shiftKey" | "altKey">, held: ReadonlySet<string>, apple: boolean): boolean;
59
+ /**
60
+ * The set of non-modifier keys currently held down.
61
+ *
62
+ * A LOST KEYUP IS THE FAILURE MODE THIS EXISTS TO SURVIVE. Hold Space, switch
63
+ * tab or trigger Spotlight, release it somewhere this document never hears
64
+ * about, and the set says Space is still down for the rest of the page's life
65
+ * - so a later lone `F` fires the chord and arms picking out of nowhere. Blur
66
+ * and a visibility change both clear it, because both mean the same thing:
67
+ * this document is no longer receiving the reviewer's keystrokes and cannot
68
+ * know what they let go of.
69
+ */
70
+ export declare class ChordWatcher {
71
+ private readonly held;
72
+ /** Record a key going down. Modifiers are not tracked; they ride the event. */
73
+ down(key: string): void;
74
+ up(key: string): void;
75
+ /** Everything is released, because we can no longer observe releases. */
76
+ clear(): void;
77
+ keys(): ReadonlySet<string>;
78
+ }
79
+ /**
80
+ * The chord as a reviewer's own platform writes it: `⌘ Space F` on a Mac,
81
+ * `Ctrl Space F` elsewhere.
82
+ *
83
+ * Derived from the chord rather than written beside it, so a host override
84
+ * changes what the tooltip teaches. A hardcoded string here would rot silently
85
+ * into advice that does nothing.
86
+ */
87
+ export declare function formatChord(chord: ShortcutChord, apple: boolean): string;
88
+ //# sourceMappingURL=shortcut.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shortcut.d.ts","sourceRoot":"","sources":["../src/shortcut.ts"],"names":[],"mappings":"AAmCA;;;;;;;;;GASG;AACH,MAAM,WAAW,aAAa;IAC5B,+EAA+E;IAC/E,eAAe,EAAE,OAAO,CAAC;IACzB,4EAA4E;IAC5E,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,6CAA6C;IAC7C,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,aAIjC,CAAC;AAEH;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG,aAAa,GAAG,IAAI,CAAC;AAEtD,8EAA8E;AAC9E,wBAAgB,eAAe,CAC7B,aAAa,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,GACnE,OAAO,CAIT;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,GAAG,OAAO,CAMpE;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,aAAa,EACpB,KAAK,EAAE,IAAI,CACT,aAAa,EACb,KAAK,GAAG,SAAS,GAAG,SAAS,GAAG,UAAU,GAAG,QAAQ,CACtD,EACD,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,EACzB,KAAK,EAAE,OAAO,GACb,OAAO,CAcT;AAED;;;;;;;;;;GAUG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAqB;IAE1C,+EAA+E;IAC/E,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAIvB,EAAE,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAIrB,yEAAyE;IACzE,KAAK,IAAI,IAAI;IAIb,IAAI,IAAI,WAAW,CAAC,MAAM,CAAC;CAG5B;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,OAAO,GAAG,MAAM,CAMxE"}
@@ -0,0 +1,149 @@
1
+ // The one keyboard chord this package claims, and the rules that keep it from
2
+ // being a keystroke stolen from somebody else's application.
3
+ //
4
+ // WHY THIS IS A MODULE AND NOT A `useEffect`. Three things have to agree about
5
+ // the chord and they are written in three different places: the matcher that
6
+ // decides whether a keydown is it, the host override that may replace it, and
7
+ // the hint the pin button's tooltip shows. Three copies of one truth is how a
8
+ // tooltip ends up confidently teaching a keystroke that does nothing, so the
9
+ // chord is DEFINED ONCE here and those three read it. That single definition
10
+ // is also the whole basis on which the chord was chosen: changing it later is
11
+ // a one-line edit rather than a hunt, which is what makes the collisions below
12
+ // an acceptable risk rather than a permanent mistake.
13
+ //
14
+ // THE CHORD IS `Cmd+Space+F` ON macOS AND `Ctrl+Space+F` ELSEWHERE, and two
15
+ // things about that are load-bearing rather than incidental:
16
+ //
17
+ // - `Space` IS NOT A MODIFIER. A conventional shortcut is one keydown read
18
+ // together with `event.metaKey`/`ctrlKey`/`shiftKey`, and this one cannot
19
+ // be: the browser reports no "spaceKey" flag. It needs the set of keys
20
+ // currently held, tracked across keydown and keyup, which is what
21
+ // `ChordWatcher` below is. That set is state living outside React for the
22
+ // same reason the preference store is - it is updated by events that must
23
+ // not re-render anything.
24
+ // - IT COLLIDES, KNOWINGLY. `Cmd+Space` is Spotlight on macOS and is handled
25
+ // by the operating system before the browser sees it, so page JavaScript
26
+ // cannot cancel it; on Windows and Linux `Ctrl+Space` is commonly taken by
27
+ // input method editors and by an application's own autocomplete. The
28
+ // remedy is the host override in config.ts, which is why that override is
29
+ // part of the feature rather than a courtesy - see `PIN_SHORTCUT` there.
30
+ //
31
+ // WHAT THIS FILE WILL NOT DO. It never reports a match while the reviewer is
32
+ // typing into the host's own page. That is not politeness: a review tool that
33
+ // eats a character out of somebody's form field is a review tool that gets
34
+ // removed, and it outranks the convenience the chord exists to provide.
35
+ /**
36
+ * The default binding. The single definition the matcher, the host override
37
+ * and the tooltip hint all resolve back to.
38
+ */
39
+ export const DEFAULT_PIN_SHORTCUT = Object.freeze({
40
+ primaryModifier: true,
41
+ holdKeys: Object.freeze([" "]),
42
+ triggerKey: "f",
43
+ });
44
+ /** Whether this platform spells the primary modifier Cmd rather than Ctrl. */
45
+ export function isApplePlatform(navigatorLike) {
46
+ if (navigatorLike === undefined)
47
+ return false;
48
+ const haystack = `${navigatorLike.platform ?? ""} ${navigatorLike.userAgent ?? ""}`;
49
+ return /mac|iphone|ipad|ipod/i.test(haystack);
50
+ }
51
+ /**
52
+ * Whether a keystroke aimed at this element belongs to the host page.
53
+ *
54
+ * Walks up rather than testing the target alone, because a `contenteditable`
55
+ * region's keystrokes are delivered to whatever inner node holds the caret -
56
+ * a `<b>`, a `<div>`, a text node's parent - and testing only the target
57
+ * would leave every rich-text editor on the web unprotected.
58
+ *
59
+ * `readOnly` inputs are deliberately still treated as editable: they take
60
+ * focus and a reviewer may be selecting text in one, and being wrong in this
61
+ * direction costs a shortcut press while being wrong in the other costs
62
+ * somebody's typing.
63
+ */
64
+ export function isEditableTarget(target) {
65
+ if (target === null || !(target instanceof Element))
66
+ return false;
67
+ const el = target.closest("input, textarea, select, [contenteditable]:not([contenteditable='false'])");
68
+ return el !== null;
69
+ }
70
+ /**
71
+ * Whether this keydown, with these keys already held, is the chord.
72
+ *
73
+ * Modifier discipline is strict in one direction only: Shift and Alt must NOT
74
+ * be held, because `Cmd+Shift+F` is a different gesture the reviewer may mean
75
+ * for something else, and treating it as this chord would make the toolbar
76
+ * answer for a keystroke it was not given. The primary modifier is checked
77
+ * against the platform's spelling.
78
+ */
79
+ export function matchesChord(chord, event, held, apple) {
80
+ if (event.key.toLowerCase() !== chord.triggerKey)
81
+ return false;
82
+ if (event.shiftKey || event.altKey)
83
+ return false;
84
+ if (chord.primaryModifier) {
85
+ const primary = apple ? event.metaKey : event.ctrlKey;
86
+ if (!primary)
87
+ return false;
88
+ // The other one must be absent, or Ctrl+Cmd+Space+F on a Mac would match
89
+ // a chord the reviewer did not press.
90
+ const secondary = apple ? event.ctrlKey : event.metaKey;
91
+ if (secondary)
92
+ return false;
93
+ }
94
+ else if (event.metaKey || event.ctrlKey) {
95
+ return false;
96
+ }
97
+ return chord.holdKeys.every((key) => held.has(key));
98
+ }
99
+ /**
100
+ * The set of non-modifier keys currently held down.
101
+ *
102
+ * A LOST KEYUP IS THE FAILURE MODE THIS EXISTS TO SURVIVE. Hold Space, switch
103
+ * tab or trigger Spotlight, release it somewhere this document never hears
104
+ * about, and the set says Space is still down for the rest of the page's life
105
+ * - so a later lone `F` fires the chord and arms picking out of nowhere. Blur
106
+ * and a visibility change both clear it, because both mean the same thing:
107
+ * this document is no longer receiving the reviewer's keystrokes and cannot
108
+ * know what they let go of.
109
+ */
110
+ export class ChordWatcher {
111
+ held = new Set();
112
+ /** Record a key going down. Modifiers are not tracked; they ride the event. */
113
+ down(key) {
114
+ this.held.add(key.toLowerCase());
115
+ }
116
+ up(key) {
117
+ this.held.delete(key.toLowerCase());
118
+ }
119
+ /** Everything is released, because we can no longer observe releases. */
120
+ clear() {
121
+ this.held.clear();
122
+ }
123
+ keys() {
124
+ return this.held;
125
+ }
126
+ }
127
+ /**
128
+ * The chord as a reviewer's own platform writes it: `⌘ Space F` on a Mac,
129
+ * `Ctrl Space F` elsewhere.
130
+ *
131
+ * Derived from the chord rather than written beside it, so a host override
132
+ * changes what the tooltip teaches. A hardcoded string here would rot silently
133
+ * into advice that does nothing.
134
+ */
135
+ export function formatChord(chord, apple) {
136
+ const parts = [];
137
+ if (chord.primaryModifier)
138
+ parts.push(apple ? "⌘" : "Ctrl");
139
+ for (const key of chord.holdKeys)
140
+ parts.push(labelForKey(key));
141
+ parts.push(labelForKey(chord.triggerKey));
142
+ return parts.join(apple ? " " : "+");
143
+ }
144
+ function labelForKey(key) {
145
+ if (key === " ")
146
+ return "Space";
147
+ return key.length === 1 ? key.toUpperCase() : key;
148
+ }
149
+ //# sourceMappingURL=shortcut.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shortcut.js","sourceRoot":"","sources":["../src/shortcut.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,6DAA6D;AAC7D,EAAE;AACF,+EAA+E;AAC/E,6EAA6E;AAC7E,8EAA8E;AAC9E,8EAA8E;AAC9E,6EAA6E;AAC7E,6EAA6E;AAC7E,8EAA8E;AAC9E,+EAA+E;AAC/E,sDAAsD;AACtD,EAAE;AACF,4EAA4E;AAC5E,6DAA6D;AAC7D,EAAE;AACF,6EAA6E;AAC7E,8EAA8E;AAC9E,2EAA2E;AAC3E,sEAAsE;AACtE,8EAA8E;AAC9E,8EAA8E;AAC9E,8BAA8B;AAC9B,+EAA+E;AAC/E,6EAA6E;AAC7E,+EAA+E;AAC/E,yEAAyE;AACzE,8EAA8E;AAC9E,6EAA6E;AAC7E,EAAE;AACF,6EAA6E;AAC7E,8EAA8E;AAC9E,2EAA2E;AAC3E,wEAAwE;AAqBxE;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAkB,MAAM,CAAC,MAAM,CAAC;IAC/D,eAAe,EAAE,IAAI;IACrB,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAwB;IACrD,UAAU,EAAE,GAAG;CAChB,CAAC,CAAC;AASH,8EAA8E;AAC9E,MAAM,UAAU,eAAe,CAC7B,aAAoE;IAEpE,IAAI,aAAa,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IAC9C,MAAM,QAAQ,GAAG,GAAG,aAAa,CAAC,QAAQ,IAAI,EAAE,IAAI,aAAa,CAAC,SAAS,IAAI,EAAE,EAAE,CAAC;IACpF,OAAO,uBAAuB,CAAC,IAAI,CAAC,QAAQ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