@maple-kit/ui 0.10.0 → 0.11.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.
@@ -1,3 +1,4 @@
1
+ import { COMMENT_SHORTCUT } from "@maple-kit/core/client";
1
2
  //#region src/island/language.ts
2
3
  const FILTER_LABELS = {
3
4
  all: "All",
@@ -23,11 +24,6 @@ function tallyTitle(filter, count) {
23
24
  const many = count === 1 ? "comment" : "comments";
24
25
  return `${String(count)} ${FILTER_LABELS[filter].toLowerCase()} ${many} — click to show only these`;
25
26
  }
26
- const PICK_ORDER = [
27
- "element",
28
- "text",
29
- "region"
30
- ];
31
27
  const PICK_LABELS = {
32
28
  element: "Element",
33
29
  region: "Region",
@@ -135,8 +131,8 @@ function openLabel(count) {
135
131
  function triggerLabel(count) {
136
132
  return `Open Maple: ${openLabel(count)}`;
137
133
  }
138
- function pickTitle(kind) {
139
- return `Comment on ${kind} — press t while picking to cycle`;
134
+ function pickTitle(kind, key = COMMENT_SHORTCUT) {
135
+ return `Comment on ${kind} — press ${key} again while picking to cycle`;
140
136
  }
141
137
  function kindPhrase(kind, human) {
142
138
  if (human === void 0) return "somewhere on this page";
@@ -144,4 +140,4 @@ function kindPhrase(kind, human) {
144
140
  return kind === "region" ? `an area of ${human}` : human;
145
141
  }
146
142
  //#endregion
147
- export { ACCOUNT_COPY, APPROVE_COPY, CORNER_LABELS, CORNER_ORDER, FILTERS_LABEL, FILTER_LABELS, FILTER_ORDER, ISLAND_COPY, PICK_LABELS, PICK_ORDER, SETTINGS_COPY, TALLY_ORDER, THEME_LABELS, THEME_TITLES, UNSENT_COPY, kindPhrase, openLabel, pickTitle, tallyTitle, triggerLabel };
143
+ export { ACCOUNT_COPY, APPROVE_COPY, CORNER_LABELS, CORNER_ORDER, FILTERS_LABEL, FILTER_LABELS, FILTER_ORDER, ISLAND_COPY, PICK_LABELS, SETTINGS_COPY, TALLY_ORDER, THEME_LABELS, THEME_TITLES, UNSENT_COPY, kindPhrase, openLabel, pickTitle, tallyTitle, triggerLabel };
package/dist/maple.js CHANGED
@@ -7,7 +7,6 @@ import { MapleComposer } from "./composer/composer.js";
7
7
  import { MapleDetail } from "./composer/detail.js";
8
8
  import { MapleScoreCard } from "./composer/score.js";
9
9
  import { MapleTarget } from "./composer/target.js";
10
- import { PICK_ORDER } from "./island/language.js";
11
10
  import { Approve } from "./island/approve.js";
12
11
  import { IslandContent } from "./island/content.js";
13
12
  import { Filters } from "./island/filters.js";
@@ -24,6 +23,7 @@ import { MapleMock } from "./mock/mock.js";
24
23
  import { MapleNotice } from "./notice/notice.js";
25
24
  import { MaplePicker } from "./picker/picker.js";
26
25
  import { createElement, forwardRef } from "react";
26
+ import { PICK_ORDER } from "@maple-kit/core/client";
27
27
  //#region src/maple.ts
28
28
  const LOAD_CALLS = [
29
29
  "load",
package/dist/marks/css.js CHANGED
@@ -232,9 +232,8 @@ function ringCss() {
232
232
  will-change: transform;
233
233
  }
234
234
 
235
- .mk-ring[data-mk-state="hovered"] {
236
- box-shadow: 0 0 0 1.5px color-mix(in oklab, var(--mk-accent) 60%, transparent);
237
- }
235
+ /* No quieter hovered ring: pointing at a mark or tabbing onto it is asking
236
+ "which one", and a hairline answered it too faintly to be seen. */
238
237
 
239
238
  /* A passage is its own lines and nothing else: the box around them is the
240
239
  paragraph, and outlining that says the comment is on the paragraph. */
@@ -7,7 +7,7 @@ export declare const PICKER_COPY: {
7
7
  readonly cancel: "Cancel";
8
8
  readonly cancelHint: "Esc";
9
9
  readonly bar: "Choosing what to comment on";
10
- readonly cycle: "Press t to cycle";
10
+ readonly cycle: "Press c again to cycle";
11
11
  };
12
12
  /** What a screen reader hears on the bar while a pick is armed. */
13
13
  export declare function pickerLabel(kind: PickKind): string;
@@ -8,7 +8,7 @@ const PICKER_COPY = {
8
8
  cancel: "Cancel",
9
9
  cancelHint: "Esc",
10
10
  bar: "Choosing what to comment on",
11
- cycle: "Press t to cycle"
11
+ cycle: "Press c again to cycle"
12
12
  };
13
13
  function pickerLabel(kind) {
14
14
  return `${PICKER_COPY.bar}: ${PICK_HINTS[kind]}.`;
@@ -1,12 +1,12 @@
1
1
  import { useMapleUi } from "../context.js";
2
2
  import { useShots } from "../shots.js";
3
- import { PICK_ORDER } from "../island/language.js";
4
3
  import { ringLabel } from "../marks/label.js";
5
4
  import { MapleTargetRing } from "../marks/ring.js";
6
5
  import { PICKER_COPY, PICK_HINTS, pickerLabel } from "./language.js";
7
6
  import { startSession } from "./session.js";
8
7
  import { elementOf, targetFor } from "./target.js";
9
- import { Fragment, createElement, useCallback, useEffect, useRef, useState } from "react";
8
+ import { Fragment, createElement, useCallback, useEffect, useState } from "react";
9
+ import { PICK_ORDER } from "@maple-kit/core/client";
10
10
  import { captureContext, watchPickKeys } from "@maple-kit/core/overlay";
11
11
  import { useMaple, useMapleClient } from "@maple-kit/react";
12
12
  import { captureElement } from "@maple-kit/core/screenshot";
@@ -41,7 +41,7 @@ function MaplePicker(props) {
41
41
  pick.armed,
42
42
  root
43
43
  ]);
44
- useKeys(pick.armed, kind, client);
44
+ useKeys(pick.armed, client);
45
45
  if (!pick.armed || !kind) return null;
46
46
  return createElement(Fragment, null, kind === "text" ? null : createElement("div", { className: shieldClass(props, kind) }), band ? createElement("div", {
47
47
  className: "mk-band",
@@ -78,16 +78,13 @@ function capture(element, shots) {
78
78
  function reasonOf(error) {
79
79
  return error instanceof Error ? error.message : String(error);
80
80
  }
81
- function useKeys(armed, kind, client) {
82
- const latest = useRef(kind);
83
- latest.current = kind;
81
+ function useKeys(armed, client) {
84
82
  useEffect(() => {
85
83
  if (!armed) return;
86
84
  const stop = new AbortController();
87
85
  watchPickKeys({
88
86
  signal: stop.signal,
89
- onCancel: () => client.disarm(),
90
- onCycle: () => client.arm(next(latest.current))
87
+ onCancel: () => client.disarm()
91
88
  });
92
89
  return () => stop.abort();
93
90
  }, [armed, client]);
@@ -97,10 +94,6 @@ function onOwnControl(event, root) {
97
94
  if (!(target instanceof Element) || target.getRootNode() !== root) return false;
98
95
  return !target.classList.contains("mk-shield");
99
96
  }
100
- function next(kind) {
101
- const at = kind === void 0 ? -1 : PICK_ORDER.indexOf(kind);
102
- return PICK_ORDER[(at + 1) % PICK_ORDER.length] ?? "element";
103
- }
104
97
  function Hint(props) {
105
98
  const client = useMapleClient();
106
99
  return createElement("div", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maple-kit/ui",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "description": "Maple's composed reviewer parts: the marks, the island and the composer",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -33,9 +33,9 @@
33
33
  "./package.json": "./package.json"
34
34
  },
35
35
  "dependencies": {
36
- "@maple-kit/core": "0.10.0",
37
- "@maple-kit/mock": "0.10.0",
38
- "@maple-kit/react": "0.10.0"
36
+ "@maple-kit/core": "0.11.0",
37
+ "@maple-kit/react": "0.11.0",
38
+ "@maple-kit/mock": "0.11.0"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "react": "^18.2.0 || ^19.0.0",