@buoy-gg/tv-remote 7.0.40 → 7.0.41
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 +4 -0
- package/lib/commonjs/store/remotePlatform.js +10 -0
- package/lib/commonjs/store/remotePlatform.js.map +1 -0
- package/lib/commonjs/store/remotePlatform.web.js +43 -0
- package/lib/commonjs/store/remotePlatform.web.js.map +1 -0
- package/lib/commonjs/store/tvEventStore.js +5 -5
- package/lib/commonjs/store/tvEventStore.js.map +1 -1
- package/lib/module/store/remotePlatform.js +5 -0
- package/lib/module/store/remotePlatform.js.map +1 -0
- package/lib/module/store/remotePlatform.web.js +39 -0
- package/lib/module/store/remotePlatform.web.js.map +1 -0
- package/lib/module/store/tvEventStore.js +4 -3
- package/lib/module/store/tvEventStore.js.map +1 -1
- package/lib/typescript/store/remotePlatform.d.ts +3 -0
- package/lib/typescript/store/remotePlatform.d.ts.map +1 -0
- package/lib/typescript/store/remotePlatform.web.d.ts +12 -0
- package/lib/typescript/store/remotePlatform.web.d.ts.map +1 -0
- package/lib/typescript/store/tvEventStore.d.ts +1 -1
- package/lib/typescript/store/tvEventStore.d.ts.map +1 -1
- package/lib/web/index.mjs +2 -0
- package/package.json +38 -4
package/README.md
CHANGED
|
@@ -59,3 +59,7 @@ For custom integrations, exports include `arm`, `disarm`, `clear`, `setMenuCaptu
|
|
|
59
59
|
React Native connections require `@buoy-gg/external-sync`. Follow the [Desktop connection guide](https://buoy.gg/buoy/latest/docs/desktop), sign in to Desktop separately, and confirm the selected device. [MCP](https://buoy.gg/buoy/latest/docs/mcp) also needs a process account and Pro access.
|
|
60
60
|
|
|
61
61
|
Device data can travel over your LAN to the configured broker. Account validation makes network requests. See [Telemetry](https://buoy.gg/buoy/latest/docs/telemetry) for data-flow details.
|
|
62
|
+
|
|
63
|
+
## Web support (unreleased)
|
|
64
|
+
|
|
65
|
+
Browser capture observes keyboard events without consuming them. It does not reproduce a TV’s native focus behavior. The browser build is available in this checkout and has not been published yet. See the [web setup guide](https://buoy.gg/buoy/latest/docs/web-preview) for registration, dependencies, and browser boundaries.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.remotePlatform = void 0;
|
|
7
|
+
var ReactNative = _interopRequireWildcard(require("react-native"));
|
|
8
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
9
|
+
const remotePlatform = exports.remotePlatform = ReactNative;
|
|
10
|
+
//# sourceMappingURL=remotePlatform.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ReactNative","_interopRequireWildcard","require","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","remotePlatform","exports"],"sourceRoot":"../../../src","sources":["store/remotePlatform.ts"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,uBAAA,CAAAC,OAAA;AAA4C,SAAAD,wBAAAE,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAJ,uBAAA,YAAAA,CAAAE,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAAAK,GAAA,IAAAL,CAAA,CAAAM,GAAA,IAAAP,CAAA,CAAAE,CAAA,EAAAP,CAAA,EAAAM,CAAA,IAAAC,CAAA,CAAAP,CAAA,IAAAD,CAAA,CAAAC,CAAA,WAAAO,CAAA,KAAAR,CAAA,EAAAC,CAAA;AACrC,MAAMkB,cAAc,GAAAC,OAAA,CAAAD,cAAA,GAAGtB,WAAW","ignoreList":[]}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.remotePlatform = void 0;
|
|
7
|
+
const keys = {
|
|
8
|
+
ArrowUp: 'up',
|
|
9
|
+
ArrowDown: 'down',
|
|
10
|
+
ArrowLeft: 'left',
|
|
11
|
+
ArrowRight: 'right',
|
|
12
|
+
Enter: 'select',
|
|
13
|
+
' ': 'select',
|
|
14
|
+
Escape: 'menu',
|
|
15
|
+
MediaPlayPause: 'playPause'
|
|
16
|
+
};
|
|
17
|
+
const remotePlatform = exports.remotePlatform = {
|
|
18
|
+
Platform: {
|
|
19
|
+
OS: 'web',
|
|
20
|
+
isTV: false
|
|
21
|
+
},
|
|
22
|
+
TVEventHandler: {
|
|
23
|
+
addListener(listener) {
|
|
24
|
+
if (typeof document === 'undefined') return {
|
|
25
|
+
remove() {}
|
|
26
|
+
};
|
|
27
|
+
const onKey = event => {
|
|
28
|
+
const eventType = keys[event.key];
|
|
29
|
+
if (eventType) listener({
|
|
30
|
+
eventType,
|
|
31
|
+
eventKeyAction: 1
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
document.addEventListener('keyup', onKey, true);
|
|
35
|
+
return {
|
|
36
|
+
remove() {
|
|
37
|
+
document.removeEventListener('keyup', onKey, true);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=remotePlatform.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["keys","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Enter","Escape","MediaPlayPause","remotePlatform","exports","Platform","OS","isTV","TVEventHandler","addListener","listener","document","remove","onKey","event","eventType","key","eventKeyAction","addEventListener","removeEventListener"],"sourceRoot":"../../../src","sources":["store/remotePlatform.web.ts"],"mappings":";;;;;;AAAA,MAAMA,IAA4B,GAAG;EAAEC,OAAO,EAAE,IAAI;EAAEC,SAAS,EAAE,MAAM;EAAEC,SAAS,EAAE,MAAM;EAAEC,UAAU,EAAE,OAAO;EAAEC,KAAK,EAAE,QAAQ;EAAE,GAAG,EAAE,QAAQ;EAAEC,MAAM,EAAE,MAAM;EAAEC,cAAc,EAAE;AAAY,CAAC;AACvL,MAAMC,cAAc,GAAAC,OAAA,CAAAD,cAAA,GAAG;EAC5BE,QAAQ,EAAE;IAAEC,EAAE,EAAE,KAAK;IAAEC,IAAI,EAAE;EAAM,CAAC;EACpCC,cAAc,EAAE;IAAEC,WAAWA,CAACC,QAAkC,EAAE;MAChE,IAAI,OAAOC,QAAQ,KAAK,WAAW,EAAE,OAAO;QAAEC,MAAMA,CAAA,EAAG,CAAC;MAAE,CAAC;MAC3D,MAAMC,KAAK,GAAIC,KAAoB,IAAK;QAAE,MAAMC,SAAS,GAAGpB,IAAI,CAACmB,KAAK,CAACE,GAAG,CAAC;QAAE,IAAID,SAAS,EAAEL,QAAQ,CAAC;UAAEK,SAAS;UAAEE,cAAc,EAAE;QAAE,CAAC,CAAC;MAAE,CAAC;MACzIN,QAAQ,CAACO,gBAAgB,CAAC,OAAO,EAAEL,KAAK,EAAE,IAAI,CAAC;MAC/C,OAAO;QAAED,MAAMA,CAAA,EAAG;UAAED,QAAQ,CAACQ,mBAAmB,CAAC,OAAO,EAAEN,KAAK,EAAE,IAAI,CAAC;QAAE;MAAE,CAAC;IAC7E;EAAE;AACJ,CAAC","ignoreList":[]}
|
|
@@ -10,8 +10,7 @@ exports.getEventsSince = getEventsSince;
|
|
|
10
10
|
exports.getState = getState;
|
|
11
11
|
exports.setMenuCapture = setMenuCapture;
|
|
12
12
|
exports.subscribe = subscribe;
|
|
13
|
-
var
|
|
14
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
13
|
+
var _remotePlatform = require("./remotePlatform");
|
|
15
14
|
/**
|
|
16
15
|
* tvEventStore — the whole device-side half of the TV remote tool.
|
|
17
16
|
*
|
|
@@ -50,8 +49,9 @@ const IGNORED_EVENT_TYPES = new Set(["pan", "swipeUp", "swipeDown", "swipeLeft",
|
|
|
50
49
|
* A namespace read (rather than a named import) keeps this module importable on
|
|
51
50
|
* stock react-native, where those exports are absent.
|
|
52
51
|
*/
|
|
53
|
-
const RN =
|
|
52
|
+
const RN = _remotePlatform.remotePlatform;
|
|
54
53
|
const isTV = RN.Platform?.isTV === true;
|
|
54
|
+
const supportsInput = isTV || RN.Platform?.OS === "web";
|
|
55
55
|
let events = [];
|
|
56
56
|
let seq = 0;
|
|
57
57
|
let armed = false;
|
|
@@ -97,7 +97,7 @@ function handleEvent(raw) {
|
|
|
97
97
|
function arm() {
|
|
98
98
|
if (armed) return;
|
|
99
99
|
armed = true;
|
|
100
|
-
if (
|
|
100
|
+
if (supportsInput && RN.TVEventHandler && !subscription) {
|
|
101
101
|
subscription = RN.TVEventHandler.addListener(handleEvent);
|
|
102
102
|
}
|
|
103
103
|
emitChange();
|
|
@@ -149,7 +149,7 @@ function getEventsSince(sinceSeq) {
|
|
|
149
149
|
}
|
|
150
150
|
function getState() {
|
|
151
151
|
return {
|
|
152
|
-
supported:
|
|
152
|
+
supported: supportsInput,
|
|
153
153
|
platform: RN.Platform?.OS ?? "unknown",
|
|
154
154
|
captureArmed: armed,
|
|
155
155
|
listening: subscription !== null,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_remotePlatform","require","MAX_EVENTS","IGNORED_EVENT_TYPES","Set","RN","ReactNative","isTV","Platform","supportsInput","OS","events","seq","armed","menuCaptureArmed","subscription","listeners","emitChange","forEach","listener","handleEvent","raw","event","eventType","has","eventKeyAction","next","t","Date","now","length","slice","arm","TVEventHandler","addListener","disarm","remove","setMenuCapture","on","TVEventControl","enableTVMenuKey","disableTVMenuKey","clear","getEventsSince","sinceSeq","Number","isFinite","filter","getState","supported","platform","captureArmed","listening","recent","subscribe","add","delete"],"sourceRoot":"../../../src","sources":["store/tvEventStore.ts"],"mappings":";;;;;;;;;;;;AAkBA,IAAAA,eAAA,GAAAC,OAAA;AAlBA;AACA;AACA;AACA;AACA;AACA;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,CAACE,gBAAgB,CAAC,CAAC;EACtC;EACA3B,gBAAgB,GAAGwB,EAAE;EACrBrB,UAAU,CAAC,CAAC;AACd;AAEO,SAASyB,KAAKA,CAAA,EAAS;EAC5B,IAAI/B,MAAM,CAACmB,MAAM,KAAK,CAAC,EAAE;EACzBnB,MAAM,GAAG,EAAE;EACXM,UAAU,CAAC,CAAC;AACd;;AAEA;AACO,SAAS0B,cAAcA,CAACC,QAAgB,EAAmB;EAChE,IAAI,CAACC,MAAM,CAACC,QAAQ,CAACF,QAAQ,CAAC,EAAE,OAAOjC,MAAM,CAACoB,KAAK,CAAC,CAAC;EACrD,OAAOpB,MAAM,CAACoC,MAAM,CAAEzB,KAAK,IAAKA,KAAK,CAACV,GAAG,GAAGgC,QAAQ,CAAC;AACvD;AAEO,SAASI,QAAQA,CAAA,EAAkB;EACxC,OAAO;IACLC,SAAS,EAAExC,aAAa;IACxByC,QAAQ,EAAE7C,EAAE,CAACG,QAAQ,EAAEE,EAAE,IAAI,SAAS;IACtCyC,YAAY,EAAEtC,KAAK;IACnBuC,SAAS,EAAErC,YAAY,KAAK,IAAI;IAChCD,gBAAgB;IAChBF,GAAG;IACHyC,MAAM,EAAE1C,MAAM,CAACoB,KAAK,CAAC;EACvB,CAAC;AACH;AAEO,SAASuB,SAASA,CAACnC,QAAoB,EAAc;EAC1DH,SAAS,CAACuC,GAAG,CAACpC,QAAQ,CAAC;EACvB,OAAO,MAAM;IACXH,SAAS,CAACwC,MAAM,CAACrC,QAAQ,CAAC;EAC5B,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ReactNative","remotePlatform"],"sourceRoot":"../../../src","sources":["store/remotePlatform.ts"],"mappings":";;AAAA,OAAO,KAAKA,WAAW,MAAM,cAAc;AAC3C,OAAO,MAAMC,cAAc,GAAGD,WAAW","ignoreList":[]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const keys = {
|
|
4
|
+
ArrowUp: 'up',
|
|
5
|
+
ArrowDown: 'down',
|
|
6
|
+
ArrowLeft: 'left',
|
|
7
|
+
ArrowRight: 'right',
|
|
8
|
+
Enter: 'select',
|
|
9
|
+
' ': 'select',
|
|
10
|
+
Escape: 'menu',
|
|
11
|
+
MediaPlayPause: 'playPause'
|
|
12
|
+
};
|
|
13
|
+
export const remotePlatform = {
|
|
14
|
+
Platform: {
|
|
15
|
+
OS: 'web',
|
|
16
|
+
isTV: false
|
|
17
|
+
},
|
|
18
|
+
TVEventHandler: {
|
|
19
|
+
addListener(listener) {
|
|
20
|
+
if (typeof document === 'undefined') return {
|
|
21
|
+
remove() {}
|
|
22
|
+
};
|
|
23
|
+
const onKey = event => {
|
|
24
|
+
const eventType = keys[event.key];
|
|
25
|
+
if (eventType) listener({
|
|
26
|
+
eventType,
|
|
27
|
+
eventKeyAction: 1
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
document.addEventListener('keyup', onKey, true);
|
|
31
|
+
return {
|
|
32
|
+
remove() {
|
|
33
|
+
document.removeEventListener('keyup', onKey, true);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=remotePlatform.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["keys","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Enter","Escape","MediaPlayPause","remotePlatform","Platform","OS","isTV","TVEventHandler","addListener","listener","document","remove","onKey","event","eventType","key","eventKeyAction","addEventListener","removeEventListener"],"sourceRoot":"../../../src","sources":["store/remotePlatform.web.ts"],"mappings":";;AAAA,MAAMA,IAA4B,GAAG;EAAEC,OAAO,EAAE,IAAI;EAAEC,SAAS,EAAE,MAAM;EAAEC,SAAS,EAAE,MAAM;EAAEC,UAAU,EAAE,OAAO;EAAEC,KAAK,EAAE,QAAQ;EAAE,GAAG,EAAE,QAAQ;EAAEC,MAAM,EAAE,MAAM;EAAEC,cAAc,EAAE;AAAY,CAAC;AAC9L,OAAO,MAAMC,cAAc,GAAG;EAC5BC,QAAQ,EAAE;IAAEC,EAAE,EAAE,KAAK;IAAEC,IAAI,EAAE;EAAM,CAAC;EACpCC,cAAc,EAAE;IAAEC,WAAWA,CAACC,QAAkC,EAAE;MAChE,IAAI,OAAOC,QAAQ,KAAK,WAAW,EAAE,OAAO;QAAEC,MAAMA,CAAA,EAAG,CAAC;MAAE,CAAC;MAC3D,MAAMC,KAAK,GAAIC,KAAoB,IAAK;QAAE,MAAMC,SAAS,GAAGnB,IAAI,CAACkB,KAAK,CAACE,GAAG,CAAC;QAAE,IAAID,SAAS,EAAEL,QAAQ,CAAC;UAAEK,SAAS;UAAEE,cAAc,EAAE;QAAE,CAAC,CAAC;MAAE,CAAC;MACzIN,QAAQ,CAACO,gBAAgB,CAAC,OAAO,EAAEL,KAAK,EAAE,IAAI,CAAC;MAC/C,OAAO;QAAED,MAAMA,CAAA,EAAG;UAAED,QAAQ,CAACQ,mBAAmB,CAAC,OAAO,EAAEN,KAAK,EAAE,IAAI,CAAC;QAAE;MAAE,CAAC;IAC7E;EAAE;AACJ,CAAC","ignoreList":[]}
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* `Platform.isTV` is true, so the cost on a phone is one boolean.
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
|
-
import
|
|
21
|
+
import { remotePlatform as ReactNative } from "./remotePlatform";
|
|
22
22
|
|
|
23
23
|
/** One captured remote event, as it goes over the wire to the dashboard. */
|
|
24
24
|
|
|
@@ -42,6 +42,7 @@ const IGNORED_EVENT_TYPES = new Set(["pan", "swipeUp", "swipeDown", "swipeLeft",
|
|
|
42
42
|
*/
|
|
43
43
|
const RN = ReactNative;
|
|
44
44
|
const isTV = RN.Platform?.isTV === true;
|
|
45
|
+
const supportsInput = isTV || RN.Platform?.OS === "web";
|
|
45
46
|
let events = [];
|
|
46
47
|
let seq = 0;
|
|
47
48
|
let armed = false;
|
|
@@ -87,7 +88,7 @@ function handleEvent(raw) {
|
|
|
87
88
|
export function arm() {
|
|
88
89
|
if (armed) return;
|
|
89
90
|
armed = true;
|
|
90
|
-
if (
|
|
91
|
+
if (supportsInput && RN.TVEventHandler && !subscription) {
|
|
91
92
|
subscription = RN.TVEventHandler.addListener(handleEvent);
|
|
92
93
|
}
|
|
93
94
|
emitChange();
|
|
@@ -139,7 +140,7 @@ export function getEventsSince(sinceSeq) {
|
|
|
139
140
|
}
|
|
140
141
|
export function getState() {
|
|
141
142
|
return {
|
|
142
|
-
supported:
|
|
143
|
+
supported: supportsInput,
|
|
143
144
|
platform: RN.Platform?.OS ?? "unknown",
|
|
144
145
|
captureArmed: armed,
|
|
145
146
|
listening: subscription !== null,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ReactNative","MAX_EVENTS","IGNORED_EVENT_TYPES","Set","RN","isTV","Platform","events","seq","armed","menuCaptureArmed","subscription","listeners","emitChange","forEach","listener","handleEvent","raw","event","eventType","has","eventKeyAction","next","t","Date","now","length","slice","arm","TVEventHandler","addListener","disarm","remove","setMenuCapture","on","
|
|
1
|
+
{"version":3,"names":["remotePlatform","ReactNative","MAX_EVENTS","IGNORED_EVENT_TYPES","Set","RN","isTV","Platform","supportsInput","OS","events","seq","armed","menuCaptureArmed","subscription","listeners","emitChange","forEach","listener","handleEvent","raw","event","eventType","has","eventKeyAction","next","t","Date","now","length","slice","arm","TVEventHandler","addListener","disarm","remove","setMenuCapture","on","TVEventControl","enableTVMenuKey","disableTVMenuKey","clear","getEventsSince","sinceSeq","Number","isFinite","filter","getState","supported","platform","captureArmed","listening","recent","subscribe","add","delete"],"sourceRoot":"../../../src","sources":["store/tvEventStore.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,cAAc,IAAIC,WAAW,QAAQ,kBAAkB;;AA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gBAAgB,GAAGwB,EAAE;EACrBrB,UAAU,CAAC,CAAC;AACd;AAEA,OAAO,SAASyB,KAAKA,CAAA,EAAS;EAC5B,IAAI/B,MAAM,CAACmB,MAAM,KAAK,CAAC,EAAE;EACzBnB,MAAM,GAAG,EAAE;EACXM,UAAU,CAAC,CAAC;AACd;;AAEA;AACA,OAAO,SAAS0B,cAAcA,CAACC,QAAgB,EAAmB;EAChE,IAAI,CAACC,MAAM,CAACC,QAAQ,CAACF,QAAQ,CAAC,EAAE,OAAOjC,MAAM,CAACoB,KAAK,CAAC,CAAC;EACrD,OAAOpB,MAAM,CAACoC,MAAM,CAAEzB,KAAK,IAAKA,KAAK,CAACV,GAAG,GAAGgC,QAAQ,CAAC;AACvD;AAEA,OAAO,SAASI,QAAQA,CAAA,EAAkB;EACxC,OAAO;IACLC,SAAS,EAAExC,aAAa;IACxByC,QAAQ,EAAE5C,EAAE,CAACE,QAAQ,EAAEE,EAAE,IAAI,SAAS;IACtCyC,YAAY,EAAEtC,KAAK;IACnBuC,SAAS,EAAErC,YAAY,KAAK,IAAI;IAChCD,gBAAgB;IAChBF,GAAG;IACHyC,MAAM,EAAE1C,MAAM,CAACoB,KAAK,CAAC;EACvB,CAAC;AACH;AAEA,OAAO,SAASuB,SAASA,CAACnC,QAAoB,EAAc;EAC1DH,SAAS,CAACuC,GAAG,CAACpC,QAAQ,CAAC;EACvB,OAAO,MAAM;IACXH,SAAS,CAACwC,MAAM,CAACrC,QAAQ,CAAC;EAC5B,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remotePlatform.d.ts","sourceRoot":"","sources":["../../../src/store/remotePlatform.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,cAAc,CAAC;AAC5C,eAAO,MAAM,cAAc,oBAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remotePlatform.web.d.ts","sourceRoot":"","sources":["../../../src/store/remotePlatform.web.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,cAAc;;;;;;8BAEe,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI;;;;CAMjE,CAAC"}
|
|
@@ -27,7 +27,7 @@ export interface TvRemoteEvent {
|
|
|
27
27
|
eventKeyAction?: number;
|
|
28
28
|
}
|
|
29
29
|
export interface TvRemoteState {
|
|
30
|
-
/**
|
|
30
|
+
/** Available on TV devices and browsers with keyboard input. */
|
|
31
31
|
supported: boolean;
|
|
32
32
|
platform: string;
|
|
33
33
|
captureArmed: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tvEventStore.d.ts","sourceRoot":"","sources":["../../../src/store/tvEventStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,4EAA4E;AAC5E,MAAM,WAAW,aAAa;IAC5B,kEAAkE;IAClE,GAAG,EAAE,MAAM,CAAC;IACZ,+BAA+B;IAC/B,CAAC,EAAE,MAAM,CAAC;IACV,+GAA+G;IAC/G,SAAS,EAAE,MAAM,CAAC;IAClB,wDAAwD;IACxD,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,aAAa;IAC5B,
|
|
1
|
+
{"version":3,"file":"tvEventStore.d.ts","sourceRoot":"","sources":["../../../src/store/tvEventStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,4EAA4E;AAC5E,MAAM,WAAW,aAAa;IAC5B,kEAAkE;IAClE,GAAG,EAAE,MAAM,CAAC;IACZ,+BAA+B;IAC/B,CAAC,EAAE,MAAM,CAAC;IACV,+GAA+G;IAC/G,SAAS,EAAE,MAAM,CAAC;IAClB,wDAAwD;IACxD,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,aAAa;IAC5B,gEAAgE;IAChE,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,OAAO,CAAC;IACtB;;;;;OAKG;IACH,SAAS,EAAE,OAAO,CAAC;IACnB,0EAA0E;IAC1E,gBAAgB,EAAE,OAAO,CAAC;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,aAAa,EAAE,CAAC;CACzB;AAyFD,+DAA+D;AAC/D,wBAAgB,GAAG,IAAI,IAAI,CAO1B;AAED;;;;GAIG;AACH,wBAAgB,MAAM,IAAI,IAAI,CAS7B;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,OAAO,GAAG,IAAI,CAUhD;AAED,wBAAgB,KAAK,IAAI,IAAI,CAI5B;AAED,sEAAsE;AACtE,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,aAAa,EAAE,CAGhE;AAED,wBAAgB,QAAQ,IAAI,aAAa,CAUxC;AAED,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAK1D"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
typeof window<"u"&&typeof globalThis.global>"u"&&(globalThis.global=globalThis);var V={ArrowUp:"up",ArrowDown:"down",ArrowLeft:"left",ArrowRight:"right",Enter:"select"," ":"select",Escape:"menu",MediaPlayPause:"playPause"},S={Platform:{OS:"web",isTV:!1},TVEventHandler:{addListener(e){if(typeof document>"u")return{remove(){}};let t=i=>{let u=V[i.key];u&&e({eventType:u,eventKeyAction:1})};return document.addEventListener("keyup",t,!0),{remove(){document.removeEventListener("keyup",t,!0)}}}}};var w=50,A=new Set(["pan","swipeUp","swipeDown","swipeLeft","swipeRight"]),n=S,g=n.Platform?.isTV===!0,R=g||n.Platform?.OS==="web",r=[],d=0,a=!1,l=!1,s=null,p=new Set;function v(){p.forEach(e=>{e()})}function x(e){if(!a)return;let t=e,i=t?.eventType;if(typeof i!="string"||A.has(i)||t?.eventKeyAction===0)return;d+=1;let u={seq:d,t:Date.now(),eventType:i,eventKeyAction:t?.eventKeyAction};r=r.length>=w?[...r.slice(1),u]:[...r,u],v()}function f(){a||(a=!0,R&&n.TVEventHandler&&!s&&(s=n.TVEventHandler.addListener(x)),v())}function T(){s&&(s.remove(),s=null),l&&c(!1),a&&(a=!1,v())}function c(e){!g||n.Platform.OS!=="ios"||!n.TVEventControl||e!==l&&(e?n.TVEventControl.enableTVMenuKey():n.TVEventControl.disableTVMenuKey(),l=e,v())}function b(){r.length!==0&&(r=[],v())}function E(e){return Number.isFinite(e)?r.filter(t=>t.seq>e):r.slice()}function o(){return{supported:R,platform:n.Platform?.OS??"unknown",captureArmed:a,listening:s!==null,menuCaptureArmed:l,seq:d,recent:r.slice()}}function y(e){return p.add(e),()=>{p.delete(e)}}var M={version:1,getSnapshot(){return o()},subscribe(e){return y(e)},actions:{arm(){return f(),o()},disarm(){return T(),o()},getEventsSince(e){let t=typeof e?.seq=="number"?e.seq:0;return{seq:o().seq,events:E(t)}},setMenuCapture(e){return c(e?.on===!0),o()},clear(){return b(),o()}}};export{f as arm,b as clear,T as disarm,E as getEventsSince,o as getState,c as setMenuCapture,y as subscribe,M as tvRemoteSyncAdapter};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@buoy-gg/tv-remote",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.41",
|
|
4
4
|
"description": "TV remote capture for React Native TV apps — records the D-pad/select/menu events the app actually receives, so Buoy Desktop can drive and replay real remote presses. Part of Buoy devtools.",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -13,7 +13,9 @@
|
|
|
13
13
|
"sideEffects": false,
|
|
14
14
|
"peerDependencies": {
|
|
15
15
|
"react": "*",
|
|
16
|
-
"react-native": "*"
|
|
16
|
+
"react-native": "*",
|
|
17
|
+
"react-native-web": "^0.21.0",
|
|
18
|
+
"react-dom": ">=18"
|
|
17
19
|
},
|
|
18
20
|
"devDependencies": {
|
|
19
21
|
"@types/react": "^19.1.0",
|
|
@@ -60,11 +62,43 @@
|
|
|
60
62
|
"d-pad",
|
|
61
63
|
"focus"
|
|
62
64
|
],
|
|
65
|
+
"exports": {
|
|
66
|
+
".": {
|
|
67
|
+
"browser": {
|
|
68
|
+
"types": "./lib/typescript/index.d.ts",
|
|
69
|
+
"default": "./lib/web/index.mjs"
|
|
70
|
+
},
|
|
71
|
+
"import": {
|
|
72
|
+
"types": "./lib/typescript/index.d.ts",
|
|
73
|
+
"default": "./lib/module/index.js"
|
|
74
|
+
},
|
|
75
|
+
"require": {
|
|
76
|
+
"types": "./lib/typescript/index.d.ts",
|
|
77
|
+
"default": "./lib/commonjs/index.js"
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
"./web": {
|
|
81
|
+
"types": "./lib/typescript/index.d.ts",
|
|
82
|
+
"default": "./lib/web/index.mjs"
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
"peerDependenciesMeta": {
|
|
86
|
+
"react-native": {
|
|
87
|
+
"optional": true
|
|
88
|
+
},
|
|
89
|
+
"react-native-web": {
|
|
90
|
+
"optional": true
|
|
91
|
+
},
|
|
92
|
+
"react-dom": {
|
|
93
|
+
"optional": true
|
|
94
|
+
}
|
|
95
|
+
},
|
|
63
96
|
"scripts": {
|
|
64
|
-
"build": "bob build",
|
|
97
|
+
"build": "bob build && pnpm run build:web",
|
|
65
98
|
"typecheck": "tsc --noEmit",
|
|
66
99
|
"clean": "rimraf lib",
|
|
67
100
|
"test": "pnpm run typecheck",
|
|
68
|
-
"postinstall": "echo \"Run pnpm build to compile this package\""
|
|
101
|
+
"postinstall": "echo \"Run pnpm build to compile this package\"",
|
|
102
|
+
"build:web": "node ../../scripts/build-web.mjs tv-remote"
|
|
69
103
|
}
|
|
70
104
|
}
|