@pie-players/pie-tool-annotation-toolbar 0.3.67 → 0.3.68
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/README.md +22 -1
- package/dist/rolldown-runtime--eTHp1Qs.js +20 -0
- package/dist/{sre-DVwZOEmz.js → sre-kwoc_SMV.js} +3431 -3428
- package/dist/tool-annotation-toolbar.js +5141 -2561
- package/package.json +7 -5
package/README.md
CHANGED
|
@@ -9,6 +9,8 @@ A text selection toolbar for highlighting and annotating text in the PIEoneer as
|
|
|
9
9
|
- **Persistent Annotations**: Saved to sessionStorage and restored on page load
|
|
10
10
|
- **Clear Annotations**: Remove annotations from selected text or clear all
|
|
11
11
|
- **Text-to-Speech (Read Aloud)**: Read selected text aloud with word-level highlighting
|
|
12
|
+
- **Selection Actions**: Host-supplied actions on the current selection; see below
|
|
13
|
+
- **Viewport-Aware Placement**: Sits above the selection where it fits, flips below when it does not, and clamps so no control leaves the viewport. `data-pie-placement` on the strip reads `above` or `below`.
|
|
12
14
|
- **Modern CSS Custom Highlight API**:
|
|
13
15
|
- Zero DOM mutation (no `<span>` wrappers)
|
|
14
16
|
- 10-50x faster than traditional approaches
|
|
@@ -37,7 +39,26 @@ A text selection toolbar for highlighting and annotating text in the PIEoneer as
|
|
|
37
39
|
|
|
38
40
|
## Props
|
|
39
41
|
|
|
40
|
-
|
|
42
|
+
The strip shows itself when text is selected and hides when the selection is cleared or Escape is pressed. What it needs from its host is the services it annotates and reads with, and the actions it should offer on a selection.
|
|
43
|
+
|
|
44
|
+
| Name | Attribute | Type | Notes |
|
|
45
|
+
| --------------------- | --------- | ----------------------- | ------------------------------------------------------------------------- |
|
|
46
|
+
| `enabled` | `enabled` | boolean | Defaults to `true`; `false` stops it reacting to selections. |
|
|
47
|
+
| `highlightCoordinator`| — | object | Where annotations are recorded. Without one the highlight controls no-op. |
|
|
48
|
+
| `ttsService` | — | object | Read-aloud is offered only when present. |
|
|
49
|
+
| `selectionActions` | — | `ToolSelectionAction[]` | Host-supplied actions on the current selection. See below. |
|
|
50
|
+
|
|
51
|
+
Under `<pie-assessment-toolkit>` all four are supplied by the capability's registration, so a host mounting the strip through the toolkit passes nothing.
|
|
52
|
+
|
|
53
|
+
### Selection actions
|
|
54
|
+
|
|
55
|
+
An action is `{ id, label, iconSvg?, tooltip?, isAvailable?, run }`. The strip renders each as an ordinary button, so the roving tabindex and arrow-key model cover them with no special case, and hands `run` the selected text and its range. `isAvailable` is asked per selection: an action whose target is not currently available is absent rather than present and inert.
|
|
56
|
+
|
|
57
|
+
This strip does not know what an action does. Pairing an action to a capability belongs to whoever composes them — `@pie-players/pie-default-tool-loaders` does it for the packaged dictionaries, using the coordinator's `requestTool`. That split is what keeps a highlighter from naming a dictionary, and what lets a host offer an action for a capability PIE does not ship.
|
|
58
|
+
|
|
59
|
+
Activating an action dismisses the strip and latches it down for that selection: the selection survives on purpose, and opening a panel moves focus, which fires `selectionchange` — the strip would otherwise reappear over the panel the action just opened. Escape, focus leaving and an outside click do not latch, and Shift+F10 clears one.
|
|
60
|
+
|
|
61
|
+
An action is a shortcut and never a capability's only route. Chromium will not extend a selection with Shift+Arrow in non-editable content unless caret browsing is on, an OS toggle absent on mobile, so a sighted keyboard-only learner cannot originate a selection at all — a capability reachable only from this strip is unreachable for them.
|
|
41
62
|
|
|
42
63
|
## Events
|
|
43
64
|
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
var s = Object.create, i = Object.defineProperty, f = Object.getOwnPropertyDescriptor, c = Object.getOwnPropertyNames, O = Object.getPrototypeOf, p = Object.prototype.hasOwnProperty, P = (e, r) => () => (r || (e((r = { exports: {} }).exports, r), e = null), r.exports), v = (e, r, t, o) => {
|
|
2
|
+
if (r && typeof r == "object" || typeof r == "function")
|
|
3
|
+
for (var u = c(r), a = 0, l = u.length, n; a < l; a++)
|
|
4
|
+
n = u[a], !p.call(e, n) && n !== t && i(e, n, {
|
|
5
|
+
get: ((_) => r[_]).bind(null, n),
|
|
6
|
+
enumerable: !(o = f(r, n)) || o.enumerable
|
|
7
|
+
});
|
|
8
|
+
return e;
|
|
9
|
+
}, b = (e, r, t) => (t = e != null ? s(O(e)) : {}, v(r || !e || !e.__esModule || !p.call(e, "default") ? i(t, "default", {
|
|
10
|
+
value: e,
|
|
11
|
+
enumerable: !0
|
|
12
|
+
}) : t, e)), d = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (r, t) => (typeof require < "u" ? require : r)[t] }) : e)(function(e) {
|
|
13
|
+
if (typeof require < "u") return require.apply(this, arguments);
|
|
14
|
+
throw Error('Calling `require` for "' + e + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
|
|
15
|
+
});
|
|
16
|
+
export {
|
|
17
|
+
d as n,
|
|
18
|
+
b as r,
|
|
19
|
+
P as t
|
|
20
|
+
};
|