@mattebox/player-spatial-nav 0.1.2 → 0.3.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.
Files changed (45) hide show
  1. package/README.md +22 -11
  2. package/dist/cdn/mattebox-player-spatial-nav-gamepad.min.js +1 -0
  3. package/dist/cdn/mattebox-player-spatial-nav.min.js +1 -1
  4. package/dist/component.js +40 -44
  5. package/dist/component.js.map +1 -1
  6. package/dist/es2015/component.js +2 -2
  7. package/dist/es2015/gamepad-help.js +139 -0
  8. package/dist/es2015/gamepad-index.js +17 -0
  9. package/dist/es2015/gamepad.js +321 -0
  10. package/dist/es2015/host.js +10 -1
  11. package/dist/es2015/index.js +3 -0
  12. package/dist/es2015/pad.js +157 -0
  13. package/dist/es2015/spatial-nav.js +2 -7
  14. package/dist/gamepad-help.d.ts +30 -0
  15. package/dist/gamepad-help.d.ts.map +1 -0
  16. package/dist/gamepad-help.js +137 -0
  17. package/dist/gamepad-help.js.map +1 -0
  18. package/dist/gamepad-index.d.ts +24 -0
  19. package/dist/gamepad-index.d.ts.map +1 -0
  20. package/dist/gamepad-index.js +19 -0
  21. package/dist/gamepad-index.js.map +1 -0
  22. package/dist/gamepad.d.ts +98 -0
  23. package/dist/gamepad.d.ts.map +1 -0
  24. package/dist/gamepad.js +316 -0
  25. package/dist/gamepad.js.map +1 -0
  26. package/dist/host.d.ts +2 -0
  27. package/dist/host.d.ts.map +1 -1
  28. package/dist/host.js +23 -14
  29. package/dist/host.js.map +1 -1
  30. package/dist/index.d.ts +3 -0
  31. package/dist/index.d.ts.map +1 -1
  32. package/dist/index.js +14 -11
  33. package/dist/index.js.map +1 -1
  34. package/dist/keys.js +31 -30
  35. package/dist/keys.js.map +1 -1
  36. package/dist/navigate.js +78 -85
  37. package/dist/navigate.js.map +1 -1
  38. package/dist/pad.d.ts +48 -0
  39. package/dist/pad.d.ts.map +1 -0
  40. package/dist/pad.js +157 -0
  41. package/dist/pad.js.map +1 -0
  42. package/dist/spatial-nav.d.ts.map +1 -1
  43. package/dist/spatial-nav.js +173 -201
  44. package/dist/spatial-nav.js.map +1 -1
  45. package/package.json +12 -6
@@ -0,0 +1,137 @@
1
+ import { Component } from "./component.js";
2
+ import { BUTTONS, GLYPHS, SPOKEN } from "./pad.js";
3
+ // src/gamepad-help.ts
4
+ /**
5
+ * <mbx-gamepad-help>: a bubble over the video that lists what each button
6
+ * of the controller does. It reads the mapping from the player's
7
+ * <mbx-gamepad>, overrides included, and draws the buttons as the make of
8
+ * the pad in use prints them.
9
+ *
10
+ * - It opens when a pad connects, and closes by itself after `close-ms`
11
+ * (6000 by default). `manual` keeps it closed until the `help` action.
12
+ * - The `help` action opens and closes it. Back closes it.
13
+ * - `label` names the bubble ("Controller"). `label-<action>` names an
14
+ * action, such as `label-next="Next episode"`; an action of the page's
15
+ * own shows only with a label.
16
+ */
17
+ const STYLE = ":host{right:var(--mbx-gap,12px);z-index:3;max-width:calc(100% - 2 * var(--mbx-gap,12px));color:var(--mbx-text,#fff);font-family:var(--mbx-font,system-ui, sans-serif);pointer-events:none;font-size:14px;display:none;position:absolute;bottom:72px}:host([open]){display:block}[part~=bubble]{padding:var(--mbx-pad,12px) calc(var(--mbx-pad,12px) * 1.5);border-radius:var(--mbx-radius,8px);background:#000000d1}[part~=heading]{margin:0 0 8px;font-size:14px;font-weight:600}[part~=list]{grid-template-columns:auto auto;align-items:center;gap:6px 16px;margin:0;display:grid}dt{text-align:right;white-space:nowrap}dd{margin:0}[part~=button]{text-align:center;border:1px solid #ffffff80;border-radius:4px;min-width:1.6em;padding:1px 6px;font-family:inherit;font-size:12px;line-height:18px;display:inline-block}dt [part~=button]+[part~=button]{margin-left:4px}";
18
+ const CLOSE_MS = 6e3;
19
+ /** The words of each action, in the order the bubble lists them. */
20
+ const WORDS = [
21
+ ["move", "Move"],
22
+ ["activate", "Select"],
23
+ ["back", "Back"],
24
+ ["play-pause", "Play or pause"],
25
+ ["rewind", "Rewind"],
26
+ ["fast-forward", "Fast forward"],
27
+ ["previous", "Previous"],
28
+ ["next", "Next"],
29
+ ["subtitles", "Subtitles"],
30
+ ["mute", "Mute"],
31
+ ["fullscreen", "Fullscreen"],
32
+ ["help", "Controls"]
33
+ ];
34
+ const DIRECTIONS = /* @__PURE__ */ new Set([
35
+ "up",
36
+ "down",
37
+ "left",
38
+ "right"
39
+ ]);
40
+ var MbxGamepadHelp = class extends Component {
41
+ static get observedAttributes() {
42
+ return ["open"];
43
+ }
44
+ constructor() {
45
+ super();
46
+ const root = this.attachShadow({ mode: "open" });
47
+ const style = document.createElement("style");
48
+ style.textContent = STYLE;
49
+ const bubble = document.createElement("section");
50
+ bubble.setAttribute("part", "bubble");
51
+ this.heading = document.createElement("h2");
52
+ this.heading.setAttribute("part", "heading");
53
+ this.heading.id = "heading";
54
+ bubble.setAttribute("aria-labelledby", "heading");
55
+ this.list = document.createElement("dl");
56
+ this.list.setAttribute("part", "list");
57
+ bubble.append(this.heading, this.list);
58
+ root.append(style, bubble);
59
+ this.timer = void 0;
60
+ }
61
+ attributeChangedCallback() {
62
+ clearTimeout(this.timer);
63
+ if (this.hasAttribute("open")) this.render();
64
+ }
65
+ disconnectedCallback() {
66
+ clearTimeout(this.timer);
67
+ super.disconnectedCallback();
68
+ }
69
+ attach(player) {
70
+ this.on(player, "gamepadconnect", () => {
71
+ if (this.hasAttribute("manual")) return;
72
+ this.setAttribute("open", "");
73
+ this.timer = setTimeout(() => this.removeAttribute("open"), number(this, "close-ms"));
74
+ });
75
+ this.on(player, "gamepadaction", (event) => {
76
+ const { action } = event.detail;
77
+ if (action === "back" && this.hasAttribute("open")) {
78
+ event.preventDefault();
79
+ this.removeAttribute("open");
80
+ }
81
+ });
82
+ if (this.hasAttribute("open")) this.render();
83
+ }
84
+ /** The player's <mbx-gamepad>, or null. */
85
+ pad() {
86
+ return this.player?.querySelector("mbx-gamepad") ?? null;
87
+ }
88
+ /** Lists each action the mapping binds, with its buttons as the make in use prints them. */
89
+ render() {
90
+ const pad = this.pad();
91
+ const kind = pad?.kind ?? "xbox";
92
+ this.heading.textContent = this.getAttribute("label") ?? "Controller";
93
+ this.setAttribute("kind", kind);
94
+ const bindings = pad?.bindings(kind) ?? null;
95
+ const by = /* @__PURE__ */ new Map();
96
+ if (bindings !== null) for (const button of BUTTONS) {
97
+ const action = bindings[button];
98
+ if (action == null) continue;
99
+ const key = DIRECTIONS.has(action) && action === button ? "move" : action;
100
+ by.set(key, [...by.get(key) ?? [], button]);
101
+ }
102
+ const rows = [];
103
+ const known = new Set(WORDS.map(([action]) => action));
104
+ const order = [...WORDS.map(([action]) => action), ...[...by.keys()].filter((a) => !known.has(a))];
105
+ for (const action of order) {
106
+ const buttons = by.get(action);
107
+ if (buttons === void 0) continue;
108
+ const own = WORDS.find(([name]) => name === action)?.[1];
109
+ const words = this.getAttribute(`label-${action}`) ?? own;
110
+ if (words === void 0) continue;
111
+ const term = document.createElement("dt");
112
+ for (const button of buttons) term.append(glyph(GLYPHS[kind][button]));
113
+ const description = document.createElement("dd");
114
+ description.textContent = words;
115
+ rows.push(term, description);
116
+ }
117
+ while (this.list.firstChild !== null) this.list.removeChild(this.list.firstChild);
118
+ for (const row of rows) this.list.append(row);
119
+ }
120
+ };
121
+ /** A button as its make prints it, named for a screen reader where the print is a symbol. */
122
+ function glyph(text) {
123
+ const kbd = document.createElement("kbd");
124
+ kbd.setAttribute("part", "button");
125
+ kbd.textContent = text;
126
+ const spoken = SPOKEN[text];
127
+ if (spoken !== void 0) kbd.setAttribute("aria-label", spoken);
128
+ return kbd;
129
+ }
130
+ /** The element's number attribute `name`, or the default. */
131
+ function number(element, name) {
132
+ const value = Number(element.getAttribute(name));
133
+ return element.hasAttribute(name) && Number.isFinite(value) ? value : CLOSE_MS;
134
+ }
135
+ export { MbxGamepadHelp };
136
+
137
+ //# sourceMappingURL=gamepad-help.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gamepad-help.js","names":[],"sources":["../src/gamepad-help.ts"],"sourcesContent":["/**\n * <mbx-gamepad-help>: a bubble over the video that lists what each button\n * of the controller does. It reads the mapping from the player's\n * <mbx-gamepad>, overrides included, and draws the buttons as the make of\n * the pad in use prints them.\n *\n * - It opens when a pad connects, and closes by itself after `close-ms`\n * (6000 by default). `manual` keeps it closed until the `help` action.\n * - The `help` action opens and closes it. Back closes it.\n * - `label` names the bubble (\"Controller\"). `label-<action>` names an\n * action, such as `label-next=\"Next episode\"`; an action of the page's\n * own shows only with a label.\n */\nimport { Component } from './component.js';\nimport type { GamepadActionDetail, MbxGamepad } from './gamepad.js';\nimport STYLE from './gamepad-help.css?inline';\nimport type { PlayerHost } from './host.js';\nimport type { PadButton, PadKind } from './pad.js';\nimport { BUTTONS, GLYPHS, SPOKEN } from './pad.js';\n\nconst CLOSE_MS = 6000;\n\n/** The words of each action, in the order the bubble lists them. */\nconst WORDS: ReadonlyArray<readonly [string, string]> = [\n ['move', 'Move'],\n ['activate', 'Select'],\n ['back', 'Back'],\n ['play-pause', 'Play or pause'],\n ['rewind', 'Rewind'],\n ['fast-forward', 'Fast forward'],\n ['previous', 'Previous'],\n ['next', 'Next'],\n ['subtitles', 'Subtitles'],\n ['mute', 'Mute'],\n ['fullscreen', 'Fullscreen'],\n ['help', 'Controls'],\n];\n\nconst DIRECTIONS = new Set(['up', 'down', 'left', 'right']);\n\nexport class MbxGamepadHelp extends Component {\n declare private list: HTMLDListElement;\n declare private heading: HTMLElement;\n declare private timer: ReturnType<typeof setTimeout> | undefined;\n\n static get observedAttributes(): string[] {\n return ['open'];\n }\n\n constructor() {\n super();\n const root = this.attachShadow({ mode: 'open' });\n const style = document.createElement('style');\n style.textContent = STYLE;\n const bubble = document.createElement('section');\n bubble.setAttribute('part', 'bubble');\n this.heading = document.createElement('h2');\n this.heading.setAttribute('part', 'heading');\n this.heading.id = 'heading';\n bubble.setAttribute('aria-labelledby', 'heading');\n this.list = document.createElement('dl');\n this.list.setAttribute('part', 'list');\n bubble.append(this.heading, this.list);\n root.append(style, bubble);\n this.timer = undefined;\n }\n\n attributeChangedCallback(): void {\n clearTimeout(this.timer);\n if (this.hasAttribute('open')) this.render();\n }\n\n override disconnectedCallback(): void {\n clearTimeout(this.timer);\n super.disconnectedCallback();\n }\n\n protected override attach(player: PlayerHost): void {\n this.on(player, 'gamepadconnect', () => {\n if (this.hasAttribute('manual')) return;\n this.setAttribute('open', '');\n this.timer = setTimeout(() => this.removeAttribute('open'), number(this, 'close-ms'));\n });\n this.on(player, 'gamepadaction', (event) => {\n const { action } = (event as CustomEvent<GamepadActionDetail>).detail;\n if (action === 'back' && this.hasAttribute('open')) {\n event.preventDefault();\n this.removeAttribute('open');\n }\n });\n if (this.hasAttribute('open')) this.render();\n }\n\n /** The player's <mbx-gamepad>, or null. */\n private pad(): MbxGamepad | null {\n return this.player?.querySelector('mbx-gamepad') ?? null;\n }\n\n /** Lists each action the mapping binds, with its buttons as the make in use prints them. */\n private render(): void {\n const pad = this.pad();\n const kind: PadKind = pad?.kind ?? 'xbox';\n this.heading.textContent = this.getAttribute('label') ?? 'Controller';\n this.setAttribute('kind', kind);\n const bindings = pad?.bindings(kind) ?? null;\n const by = new Map<string, PadButton[]>();\n if (bindings !== null) {\n for (const button of BUTTONS) {\n const action = bindings[button];\n if (action == null) continue;\n const key = DIRECTIONS.has(action) && action === button ? 'move' : action;\n by.set(key, [...(by.get(key) ?? []), button]);\n }\n }\n const rows: Node[] = [];\n const known = new Set(WORDS.map(([action]) => action));\n const order = [\n ...WORDS.map(([action]) => action),\n ...[...by.keys()].filter((a) => !known.has(a)),\n ];\n for (const action of order) {\n const buttons = by.get(action);\n if (buttons === undefined) continue;\n const own = WORDS.find(([name]) => name === action)?.[1];\n const words = this.getAttribute(`label-${action}`) ?? own;\n if (words === undefined) continue;\n const term = document.createElement('dt');\n for (const button of buttons) term.append(glyph(GLYPHS[kind][button]));\n const description = document.createElement('dd');\n description.textContent = words;\n rows.push(term, description);\n }\n // Not replaceChildren(): Chromium 76 has none.\n while (this.list.firstChild !== null) this.list.removeChild(this.list.firstChild);\n for (const row of rows) this.list.append(row);\n }\n}\n\n/** A button as its make prints it, named for a screen reader where the print is a symbol. */\nfunction glyph(text: string): HTMLElement {\n const kbd = document.createElement('kbd');\n kbd.setAttribute('part', 'button');\n kbd.textContent = text;\n const spoken = SPOKEN[text];\n if (spoken !== undefined) kbd.setAttribute('aria-label', spoken);\n return kbd;\n}\n\n/** The element's number attribute `name`, or the default. */\nfunction number(element: Element, name: string): number {\n const value = Number(element.getAttribute(name));\n return element.hasAttribute(name) && Number.isFinite(value) ? value : CLOSE_MS;\n}\n"],"mappings":"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"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * @mattebox/player-spatial-nav/gamepad: <mbx-gamepad> and
3
+ * <mbx-gamepad-help>, a game controller for the player. Importing this
4
+ * module registers both, and <mbx-spatial-nav>, which moves focus for the
5
+ * controller. A page with a remote alone imports the package's main entry
6
+ * and pays nothing for the controller.
7
+ */
8
+ import { MbxGamepad } from './gamepad.js';
9
+ import { MbxGamepadHelp } from './gamepad-help.js';
10
+ import './index.js';
11
+ export type { GamepadActionDetail } from './gamepad.js';
12
+ export { MbxGamepad } from './gamepad.js';
13
+ export { MbxGamepadHelp } from './gamepad-help.js';
14
+ export * from './index.js';
15
+ export type { PadAction, PadButton, PadKind, PadMap } from './pad.js';
16
+ export declare const GAMEPAD = "mbx-gamepad";
17
+ export declare const GAMEPAD_HELP = "mbx-gamepad-help";
18
+ declare global {
19
+ interface HTMLElementTagNameMap {
20
+ 'mbx-gamepad': MbxGamepad;
21
+ 'mbx-gamepad-help': MbxGamepadHelp;
22
+ }
23
+ }
24
+ //# sourceMappingURL=gamepad-index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gamepad-index.d.ts","sourceRoot":"","sources":["../src/gamepad-index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,YAAY,CAAC;AAEpB,YAAY,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,cAAc,YAAY,CAAC;AAC3B,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEtE,eAAO,MAAM,OAAO,gBAAgB,CAAC;AACrC,eAAO,MAAM,YAAY,qBAAqB,CAAC;AAO/C,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,aAAa,EAAE,UAAU,CAAC;QAC1B,kBAAkB,EAAE,cAAc,CAAC;KACpC;CACF"}
@@ -0,0 +1,19 @@
1
+ import { MbxSpatialNav } from "./spatial-nav.js";
2
+ import { MbxGamepad } from "./gamepad.js";
3
+ import { MbxGamepadHelp } from "./gamepad-help.js";
4
+ import { SPATIAL_NAV } from "./index.js";
5
+ // src/gamepad-index.ts
6
+ /**
7
+ * @mattebox/player-spatial-nav/gamepad: <mbx-gamepad> and
8
+ * <mbx-gamepad-help>, a game controller for the player. Importing this
9
+ * module registers both, and <mbx-spatial-nav>, which moves focus for the
10
+ * controller. A page with a remote alone imports the package's main entry
11
+ * and pays nothing for the controller.
12
+ */
13
+ const GAMEPAD = "mbx-gamepad";
14
+ const GAMEPAD_HELP = "mbx-gamepad-help";
15
+ if (customElements.get("mbx-gamepad") === void 0) customElements.define(GAMEPAD, MbxGamepad);
16
+ if (customElements.get("mbx-gamepad-help") === void 0) customElements.define(GAMEPAD_HELP, MbxGamepadHelp);
17
+ export { GAMEPAD, GAMEPAD_HELP, MbxGamepad, MbxGamepadHelp, MbxSpatialNav, SPATIAL_NAV };
18
+
19
+ //# sourceMappingURL=gamepad-index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gamepad-index.js","names":[],"sources":["../src/gamepad-index.ts"],"sourcesContent":["/**\n * @mattebox/player-spatial-nav/gamepad: <mbx-gamepad> and\n * <mbx-gamepad-help>, a game controller for the player. Importing this\n * module registers both, and <mbx-spatial-nav>, which moves focus for the\n * controller. A page with a remote alone imports the package's main entry\n * and pays nothing for the controller.\n */\nimport { MbxGamepad } from './gamepad.js';\nimport { MbxGamepadHelp } from './gamepad-help.js';\nimport './index.js';\n\nexport type { GamepadActionDetail } from './gamepad.js';\nexport { MbxGamepad } from './gamepad.js';\nexport { MbxGamepadHelp } from './gamepad-help.js';\nexport * from './index.js';\nexport type { PadAction, PadButton, PadKind, PadMap } from './pad.js';\n\nexport const GAMEPAD = 'mbx-gamepad';\nexport const GAMEPAD_HELP = 'mbx-gamepad-help';\n\nif (customElements.get(GAMEPAD) === undefined) customElements.define(GAMEPAD, MbxGamepad);\nif (customElements.get(GAMEPAD_HELP) === undefined) {\n customElements.define(GAMEPAD_HELP, MbxGamepadHelp);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'mbx-gamepad': MbxGamepad;\n 'mbx-gamepad-help': MbxGamepadHelp;\n }\n}\n"],"mappings":";;;;;;;;;;;;AAiBA,MAAa,UAAU;AACvB,MAAa,eAAe;AAE5B,IAAI,eAAe,IAAA,aAAW,MAAM,KAAA,GAAW,eAAe,OAAO,SAAS,UAAU;AACxF,IAAI,eAAe,IAAA,kBAAgB,MAAM,KAAA,GACvC,eAAe,OAAO,cAAc,cAAc"}
@@ -0,0 +1,98 @@
1
+ /**
2
+ * <mbx-gamepad>: a game controller drives the player. Placed inside the
3
+ * player beside <mbx-spatial-nav>, it renders nothing.
4
+ *
5
+ * The Gamepad API has no button events, so the element reads the pads once
6
+ * a frame, on `requestAnimationFrame`. It reads them only while one is
7
+ * connected and the page is visible: a page without a pad pays nothing
8
+ * after `attach`.
9
+ *
10
+ * Each press of a button takes the action the mapping gives it (`pad.ts`).
11
+ * The element fires `gamepadaction` first, cancellable, so the page can
12
+ * take any action, or one of its own name. Nobody took it: the element
13
+ * sends the player the key a remote would send.
14
+ *
15
+ * - The directions are the arrows, which <mbx-spatial-nav> turns into
16
+ * moves of focus. They repeat while held.
17
+ * - `activate` is Enter on the focused control. With no control focused,
18
+ * or the bar asleep, it plays or pauses.
19
+ * - `back` is the remote's Back. With no control focused, it leaves
20
+ * fullscreen first; after that, Back is the application's.
21
+ * - `rewind` and `fast-forward` seek a step at each press, and again while
22
+ * held, faster the harder the trigger is pressed.
23
+ * - `previous` and `next` go to the chapter before or after, when the
24
+ * programme has chapters, else to the playlist's item.
25
+ *
26
+ * A press sets `focus-ring` on the player, and a pointer's press takes it
27
+ * off. The keys the element sends are synthetic, and after them the
28
+ * browser shows no `:focus-visible`, so without it the focus would not show.
29
+ *
30
+ * Edge on Xbox drives a mouse cursor with the pad unless the page asks for
31
+ * the pad itself, so the element asks, where the browser has the switch.
32
+ */
33
+ import { Component } from './component.js';
34
+ import type { PlayerHost } from './host.js';
35
+ import type { PadButton, PadKind, PadMap } from './pad.js';
36
+ /** What `gamepadaction` carries. */
37
+ export interface GamepadActionDetail {
38
+ readonly action: string;
39
+ readonly button: PadButton;
40
+ readonly kind: PadKind;
41
+ }
42
+ export declare class MbxGamepad extends Component {
43
+ /** The buttons down on each pad, by the pad's index. */
44
+ private held;
45
+ /** The animation frame asked for, or 0 while the loop sleeps. */
46
+ private frame;
47
+ /** The mapping the page set from script, over the attribute's. */
48
+ private own;
49
+ /** The make of the pad used last. */
50
+ private last;
51
+ constructor();
52
+ /** The overrides set from script, over the defaults and the `map` attribute. Null unbinds a button. */
53
+ get map(): PadMap;
54
+ set map(value: PadMap);
55
+ /** The make of the pad used last, `xbox` before any. */
56
+ get kind(): PadKind;
57
+ /** What each button does on `kind`: the defaults, the `map` attribute, then `map`. */
58
+ bindings(kind?: PadKind): Record<PadButton, string | null>;
59
+ disconnectedCallback(): void;
60
+ protected attach(player: PlayerHost): void;
61
+ /** Fires `name` on the element, bubbling and composed, with the pad's make and id. */
62
+ private tell;
63
+ /** The connected pads. Chromium lists empty slots as null. */
64
+ private pads;
65
+ /** Starts the loop, unless it runs, the page is hidden, or no pad is connected. */
66
+ private start;
67
+ private stop;
68
+ private tick;
69
+ /** Compares one pad with the frame before, and acts on what went down or is held. */
70
+ private read;
71
+ /**
72
+ * How far `button` is pressed, from 0 to 1, or 0 when it is not. The
73
+ * directions read the left stick too, past the dead zone.
74
+ */
75
+ private value;
76
+ /** Asks the page with `gamepadaction`, then does the action nobody took. */
77
+ private act;
78
+ private run;
79
+ /**
80
+ * Enter on the focused control. A native button clicks itself only on a
81
+ * real Enter, so a button nobody took is clicked here. No control
82
+ * focused, or the bar asleep: play or pause, as on a console's player.
83
+ */
84
+ private activate;
85
+ /** The remote's Back, which <mbx-spatial-nav> reads. With nothing focused, fullscreen ends first. */
86
+ private back;
87
+ /**
88
+ * The chapter before or after, else the playlist's item. Previous goes
89
+ * to the start of the chapter that plays first, past its first seconds,
90
+ * as a remote's previous does.
91
+ */
92
+ private skip;
93
+ /** Clicks the button of the control `tag` in the player, when it shows. */
94
+ private press;
95
+ /** Sends `name` as a keydown on `target`; true when nobody took it. */
96
+ private key;
97
+ }
98
+ //# sourceMappingURL=gamepad.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gamepad.d.ts","sourceRoot":"","sources":["../src/gamepad.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE5C,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAwC3D,oCAAoC;AACpC,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;CACxB;AAOD,qBAAa,UAAW,SAAQ,SAAS;IACvC,wDAAwD;IACxD,QAAgB,IAAI,CAAoC;IACxD,iEAAiE;IACjE,QAAgB,KAAK,CAAS;IAC9B,kEAAkE;IAClE,QAAgB,GAAG,CAAS;IAC5B,qCAAqC;IACrC,QAAgB,IAAI,CAAU;;IAU9B,uGAAuG;IACvG,IAAI,GAAG,IAAI,MAAM,CAEhB;IAED,IAAI,GAAG,CAAC,KAAK,EAAE,MAAM,EAGpB;IAED,wDAAwD;IACxD,IAAI,IAAI,IAAI,OAAO,CAElB;IAED,sFAAsF;IACtF,QAAQ,CAAC,IAAI,GAAE,OAAmB,GAAG,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAI5D,oBAAoB,IAAI,IAAI;cAMlB,MAAM,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI;IAmBnD,sFAAsF;IACtF,OAAO,CAAC,IAAI;IAKZ,8DAA8D;IAC9D,OAAO,CAAC,IAAI;IAOZ,mFAAmF;IACnF,OAAO,CAAC,KAAK;IAKb,OAAO,CAAC,IAAI;IAMZ,OAAO,CAAC,IAAI;IAWZ,qFAAqF;IACrF,OAAO,CAAC,IAAI;IA8BZ;;;OAGG;IACH,OAAO,CAAC,KAAK;IAoBb,4EAA4E;IAC5E,OAAO,CAAC,GAAG;IAaX,OAAO,CAAC,GAAG;IAgDX;;;;OAIG;IACH,OAAO,CAAC,QAAQ;IAShB,qGAAqG;IACrG,OAAO,CAAC,IAAI;IASZ;;;;OAIG;IACH,OAAO,CAAC,IAAI;IAoBZ,2EAA2E;IAC3E,OAAO,CAAC,KAAK;IAMb,uEAAuE;IACvE,OAAO,CAAC,GAAG;CAKZ"}
@@ -0,0 +1,316 @@
1
+ import { Component } from "./component.js";
2
+ import { focusedIn } from "./host.js";
3
+ import { BUTTONS, kindOf, mapping, parseMap } from "./pad.js";
4
+ // src/gamepad.ts
5
+ /**
6
+ * <mbx-gamepad>: a game controller drives the player. Placed inside the
7
+ * player beside <mbx-spatial-nav>, it renders nothing.
8
+ *
9
+ * The Gamepad API has no button events, so the element reads the pads once
10
+ * a frame, on `requestAnimationFrame`. It reads them only while one is
11
+ * connected and the page is visible: a page without a pad pays nothing
12
+ * after `attach`.
13
+ *
14
+ * Each press of a button takes the action the mapping gives it (`pad.ts`).
15
+ * The element fires `gamepadaction` first, cancellable, so the page can
16
+ * take any action, or one of its own name. Nobody took it: the element
17
+ * sends the player the key a remote would send.
18
+ *
19
+ * - The directions are the arrows, which <mbx-spatial-nav> turns into
20
+ * moves of focus. They repeat while held.
21
+ * - `activate` is Enter on the focused control. With no control focused,
22
+ * or the bar asleep, it plays or pauses.
23
+ * - `back` is the remote's Back. With no control focused, it leaves
24
+ * fullscreen first; after that, Back is the application's.
25
+ * - `rewind` and `fast-forward` seek a step at each press, and again while
26
+ * held, faster the harder the trigger is pressed.
27
+ * - `previous` and `next` go to the chapter before or after, when the
28
+ * programme has chapters, else to the playlist's item.
29
+ *
30
+ * A press sets `focus-ring` on the player, and a pointer's press takes it
31
+ * off. The keys the element sends are synthetic, and after them the
32
+ * browser shows no `:focus-visible`, so without it the focus would not show.
33
+ *
34
+ * Edge on Xbox drives a mouse cursor with the pad unless the page asks for
35
+ * the pad itself, so the element asks, where the browser has the switch.
36
+ */
37
+ /** The help bubble's tag: `help` opens it. */
38
+ const HELP = "mbx-gamepad-help";
39
+ /** The player's attribute that shows the focus a pad gave. */
40
+ const RING = "focus-ring";
41
+ /** The left stick leans a direction past this much. */
42
+ const DEAD_ZONE = .5;
43
+ /** A trigger counts as pressed past this much of its travel. */
44
+ const TRIGGER = .15;
45
+ /** A held direction repeats after this long, in ms, then every `STEP_MS`. */
46
+ const DELAY_MS = 400;
47
+ const STEP_MS = 120;
48
+ /** A held trigger seeks again after this long, in ms, then every `SCAN_MS` at full press. */
49
+ const SCAN_DELAY_MS = 300;
50
+ const SCAN_MS = 100;
51
+ /** Back to the start of the chapter, not the one before, this far into it, in seconds. */
52
+ const RESTART_S = 3;
53
+ /** The seconds a step seeks where no control bar answers the media keys. */
54
+ const STEP_S = 5;
55
+ /** The keys the directions send. */
56
+ const ARROWS = {
57
+ up: "ArrowUp",
58
+ down: "ArrowDown",
59
+ left: "ArrowLeft",
60
+ right: "ArrowRight"
61
+ };
62
+ /** The actions that repeat while their button is held. */
63
+ const REPEATING = /* @__PURE__ */ new Set([
64
+ "up",
65
+ "down",
66
+ "left",
67
+ "right",
68
+ "rewind",
69
+ "fast-forward"
70
+ ]);
71
+ var MbxGamepad = class extends Component {
72
+ constructor() {
73
+ super();
74
+ this.held = /* @__PURE__ */ new Map();
75
+ this.frame = 0;
76
+ this.own = {};
77
+ this.last = "xbox";
78
+ }
79
+ /** The overrides set from script, over the defaults and the `map` attribute. Null unbinds a button. */
80
+ get map() {
81
+ return Object.assign({}, this.own);
82
+ }
83
+ set map(value) {
84
+ this.own = Object.assign({}, value);
85
+ }
86
+ /** The make of the pad used last, `xbox` before any. */
87
+ get kind() {
88
+ return this.last;
89
+ }
90
+ /** What each button does on `kind`: the defaults, the `map` attribute, then `map`. */
91
+ bindings(kind = this.last) {
92
+ return mapping(kind, parseMap(this.getAttribute("map")), this.own);
93
+ }
94
+ disconnectedCallback() {
95
+ this.stop();
96
+ this.player?.removeAttribute(RING);
97
+ super.disconnectedCallback();
98
+ }
99
+ attach(player) {
100
+ const nav = navigator;
101
+ if ("gamepadInputEmulation" in nav) nav.gamepadInputEmulation = "gamepad";
102
+ this.on(window, "gamepadconnected", (event) => {
103
+ const pad = event.gamepad;
104
+ this.last = kindOf(pad.id);
105
+ this.tell("gamepadconnect", pad);
106
+ this.start(player);
107
+ });
108
+ this.on(window, "gamepaddisconnected", (event) => {
109
+ const pad = event.gamepad;
110
+ this.held.delete(pad.index);
111
+ this.tell("gamepaddisconnect", pad);
112
+ });
113
+ this.on(document, "visibilitychange", () => this.start(player));
114
+ this.on(player, "pointerdown", () => player.removeAttribute(RING), { capture: true });
115
+ this.start(player);
116
+ }
117
+ /** Fires `name` on the element, bubbling and composed, with the pad's make and id. */
118
+ tell(name, pad) {
119
+ const detail = {
120
+ kind: kindOf(pad.id),
121
+ id: pad.id
122
+ };
123
+ this.dispatchEvent(new CustomEvent(name, {
124
+ detail,
125
+ bubbles: true,
126
+ composed: true
127
+ }));
128
+ }
129
+ /** The connected pads. Chromium lists empty slots as null. */
130
+ pads() {
131
+ if (typeof navigator.getGamepads !== "function") return [];
132
+ const out = [];
133
+ for (const pad of navigator.getGamepads()) if (pad?.connected === true) out.push(pad);
134
+ return out;
135
+ }
136
+ /** Starts the loop, unless it runs, the page is hidden, or no pad is connected. */
137
+ start(player) {
138
+ if (this.frame !== 0 || document.hidden || this.pads().length === 0) return;
139
+ this.frame = requestAnimationFrame((now) => this.tick(player, now));
140
+ }
141
+ stop() {
142
+ if (this.frame !== 0) cancelAnimationFrame(this.frame);
143
+ this.frame = 0;
144
+ this.held.clear();
145
+ }
146
+ tick(player, now) {
147
+ this.frame = 0;
148
+ const pads = this.pads();
149
+ if (pads.length === 0 || document.hidden || this.player !== player) {
150
+ this.held.clear();
151
+ return;
152
+ }
153
+ for (const pad of pads) this.read(player, pad, now);
154
+ this.frame = requestAnimationFrame((next) => this.tick(player, next));
155
+ }
156
+ /** Compares one pad with the frame before, and acts on what went down or is held. */
157
+ read(player, pad, now) {
158
+ const kind = kindOf(pad.id);
159
+ let held = this.held.get(pad.index);
160
+ if (held === void 0) {
161
+ held = /* @__PURE__ */ new Map();
162
+ this.held.set(pad.index, held);
163
+ }
164
+ const map = this.bindings(kind);
165
+ for (const [index, button] of BUTTONS.entries()) {
166
+ const value = this.value(pad, index, button);
167
+ const was = held.get(button);
168
+ if (value === 0) {
169
+ held.delete(button);
170
+ continue;
171
+ }
172
+ const action = map[button];
173
+ if (was === void 0) {
174
+ this.last = kind;
175
+ held.set(button, { next: now + (action === "rewind" || action === "fast-forward" ? SCAN_DELAY_MS : DELAY_MS) });
176
+ if (action != null) this.act(player, action, button, kind);
177
+ } else if (action != null && REPEATING.has(action) && now >= was.next) {
178
+ was.next = now + (action === "rewind" || action === "fast-forward" ? SCAN_MS + (1 - value) * SCAN_DELAY_MS : STEP_MS);
179
+ this.act(player, action, button, kind);
180
+ }
181
+ }
182
+ }
183
+ /**
184
+ * How far `button` is pressed, from 0 to 1, or 0 when it is not. The
185
+ * directions read the left stick too, past the dead zone.
186
+ */
187
+ value(pad, index, button) {
188
+ const own = pad.buttons[index];
189
+ const trigger = button === "lt" || button === "rt";
190
+ let value = own === void 0 ? 0 : own.pressed ? Math.max(own.value, .5) : own.value;
191
+ if (value < (trigger ? TRIGGER : .5)) value = 0;
192
+ const x = pad.axes[0] ?? 0;
193
+ const y = pad.axes[1] ?? 0;
194
+ return (button === "left" ? -x : button === "right" ? x : button === "up" ? -y : button === "down" ? y : 0) > DEAD_ZONE ? Math.max(value, 1) : value;
195
+ }
196
+ /** Asks the page with `gamepadaction`, then does the action nobody took. */
197
+ act(player, action, button, kind) {
198
+ const asked = new CustomEvent("gamepadaction", {
199
+ detail: {
200
+ action,
201
+ button,
202
+ kind
203
+ },
204
+ bubbles: true,
205
+ composed: true,
206
+ cancelable: true
207
+ });
208
+ if (!this.dispatchEvent(asked)) return;
209
+ player.toggleAttribute(RING, true);
210
+ this.run(player, action);
211
+ }
212
+ run(player, action) {
213
+ const media = player.media;
214
+ const arrow = ARROWS[action];
215
+ if (arrow !== void 0) {
216
+ this.key(focusedIn(player) ?? player, arrow);
217
+ return;
218
+ }
219
+ switch (action) {
220
+ case "activate":
221
+ this.activate(player);
222
+ break;
223
+ case "back":
224
+ this.back(player);
225
+ break;
226
+ case "play-pause":
227
+ if (this.key(player, "MediaPlayPause")) toggle(media);
228
+ break;
229
+ case "rewind":
230
+ if (this.key(player, "MediaRewind")) media.currentTime = Math.max(0, media.currentTime - STEP_S);
231
+ break;
232
+ case "fast-forward":
233
+ if (this.key(player, "MediaFastForward")) media.currentTime += STEP_S;
234
+ break;
235
+ case "previous":
236
+ this.skip(player, -1);
237
+ break;
238
+ case "next":
239
+ this.skip(player, 1);
240
+ break;
241
+ case "subtitles":
242
+ this.press(player, "mbx-subtitles-menu");
243
+ break;
244
+ case "mute":
245
+ if (this.key(player, "m")) media.muted = !media.muted;
246
+ break;
247
+ case "fullscreen":
248
+ this.key(player, "f");
249
+ break;
250
+ case "help": player.querySelector(HELP)?.toggleAttribute("open");
251
+ }
252
+ }
253
+ /**
254
+ * Enter on the focused control. A native button clicks itself only on a
255
+ * real Enter, so a button nobody took is clicked here. No control
256
+ * focused, or the bar asleep: play or pause, as on a console's player.
257
+ */
258
+ activate(player) {
259
+ const current = focusedIn(player);
260
+ if (current === null || player.hasAttribute("idle")) {
261
+ if (this.key(player, "MediaPlayPause")) toggle(player.media);
262
+ return;
263
+ }
264
+ if (this.key(current, "Enter") && current instanceof HTMLButtonElement) current.click();
265
+ }
266
+ /** The remote's Back, which <mbx-spatial-nav> reads. With nothing focused, fullscreen ends first. */
267
+ back(player) {
268
+ const current = focusedIn(player);
269
+ if (current === null && player.hasAttribute("fullscreen")) {
270
+ this.key(player, "f");
271
+ return;
272
+ }
273
+ this.key(current ?? player, "GoBack");
274
+ }
275
+ /**
276
+ * The chapter before or after, else the playlist's item. Previous goes
277
+ * to the start of the chapter that plays first, past its first seconds,
278
+ * as a remote's previous does.
279
+ */
280
+ skip(player, by) {
281
+ const media = player.media;
282
+ const list = player.chapters ?? [];
283
+ const now = media.currentTime;
284
+ let at = -1;
285
+ for (const [i, chapter] of list.entries()) if (chapter.start <= now) at = i;
286
+ const target = by === 1 ? list[at + 1] : at >= 0 && now - (list[at]?.start ?? 0) > RESTART_S ? list[at] : list[at - 1];
287
+ if (target !== void 0) {
288
+ media.currentTime = target.start;
289
+ return;
290
+ }
291
+ this.press(player, by === 1 ? "mbx-next-button" : "mbx-previous-button");
292
+ }
293
+ /** Clicks the button of the control `tag` in the player, when it shows. */
294
+ press(player, tag) {
295
+ const button = player.querySelector(tag)?.shadowRoot?.querySelector("button");
296
+ if (button == null || button.getClientRects().length === 0) return;
297
+ button.click();
298
+ }
299
+ /** Sends `name` as a keydown on `target`; true when nobody took it. */
300
+ key(target, name) {
301
+ return target.dispatchEvent(new KeyboardEvent("keydown", {
302
+ key: name,
303
+ bubbles: true,
304
+ composed: true,
305
+ cancelable: true
306
+ }));
307
+ }
308
+ };
309
+ /** Plays a paused video, pauses a playing one. */
310
+ function toggle(media) {
311
+ if (media.paused) media.play().catch(() => void 0);
312
+ else media.pause();
313
+ }
314
+ export { MbxGamepad };
315
+
316
+ //# sourceMappingURL=gamepad.js.map