@3sln/nook 0.1.0 → 0.2.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.
@@ -29,6 +29,7 @@ export function onboardingResource({ storage, owner }) {
29
29
  storage,
30
30
  hasSeen: () => resource.hasSeen(),
31
31
  });
32
+ resource.acknowledgeAttention = () => page.attention?.acknowledge();
32
33
  resource.subscribeAttention = (listener) =>
33
34
  page.attention.subscribe(listener);
34
35
  return resource;
package/src/ui/bounds.js CHANGED
@@ -1,4 +1,5 @@
1
1
  const definitions = new Set([
2
+ "nook-item",
2
3
  "nook-action",
3
4
  "nook-setting",
4
5
  "nook-menu",
@@ -12,7 +12,8 @@ export default function feedback({ view, make, i18n, dock, getHooks, signal }) {
12
12
  kind.type = "hidden";
13
13
  kind.name = "type";
14
14
  kind.value = "bug";
15
- const label = make("label", "feedback-label", "Tell us more");
15
+ const label = make("label", "feedback-label");
16
+ label.append(make("span", "feedback-message-label", "Tell us more"));
16
17
  label.className = "feedback-label";
17
18
  const text = make("textarea", "feedback-message");
18
19
  text.name = "message";
@@ -104,7 +105,16 @@ export default function feedback({ view, make, i18n, dock, getHooks, signal }) {
104
105
  previewEmpty.hidden = true;
105
106
  const thumbnails = make("div", "capture-thumbnails");
106
107
  thumbnails.className = "capture-thumbnails";
107
- gallery.append(largePreview, previewEmpty, thumbnails);
108
+ const hidePreviews = make("button", "capture-hide-previews", "Hide previews");
109
+ hidePreviews.type = "button";
110
+ hidePreviews.className = "quiet";
111
+ const collapsePreviews = () => {
112
+ gallery.hidden = true;
113
+ review.setAttribute("aria-expanded", "false");
114
+ review.focus();
115
+ };
116
+ hidePreviews.onclick = collapsePreviews;
117
+ gallery.append(hidePreviews, largePreview, previewEmpty, thumbnails);
108
118
  controls.append(shutter, review, captureDone);
109
119
  sessionUI.append(controls, captureStatus, gallery);
110
120
  (dock.overlayAnchor || dock.anchor).append(sessionUI);
@@ -273,7 +283,8 @@ export default function feedback({ view, make, i18n, dock, getHooks, signal }) {
273
283
  if (event.key === "Escape") {
274
284
  event.preventDefault();
275
285
  event.stopPropagation();
276
- finishCapture();
286
+ if (!gallery.hidden) collapsePreviews();
287
+ else finishCapture();
277
288
  }
278
289
  });
279
290
  signal.addEventListener("abort", () => finishCapture(false), { once: true });
@@ -0,0 +1,31 @@
1
+ // Platform affects wording only. It never establishes a keyboard layout.
2
+ export function keyboardLabels(navigator) {
3
+ const platform =
4
+ navigator.userAgentData?.platform || navigator.platform || "";
5
+ const mac = /mac/i.test(platform);
6
+ return {
7
+ mac,
8
+ alt: mac ? "Option" : "Alt",
9
+ back: mac ? "Delete" : "Backspace",
10
+ format(binding) {
11
+ return binding
12
+ .split("+")
13
+ .map((key) => {
14
+ const value = key.trim();
15
+ return (
16
+ {
17
+ alt: mac ? "Option" : "Alt",
18
+ opt: mac ? "Option" : "Alt",
19
+ option: mac ? "Option" : "Alt",
20
+ ctrl: "Ctrl",
21
+ control: "Ctrl",
22
+ meta: mac ? "Command" : "Meta",
23
+ cmd: mac ? "Command" : "Meta",
24
+ command: mac ? "Command" : "Meta",
25
+ }[value.toLowerCase()] || value
26
+ );
27
+ })
28
+ .join(" + ");
29
+ },
30
+ };
31
+ }