decord/beta/source/modules/keyboard/native/KeyCommands.tsx

170 lines
4.5 KiB
TypeScript
Raw Permalink Normal View History

2026-10-12 16:32:48 +00:00
// Module ID: 5373
// Function ID: 5374
// Name: KeyCommands
2026-10-12 16:32:48 +00:00
// Dependencies: [19, 5374, 558, 576, 2]
2026-10-02 13:37:24 +00:00
// Exports: subscribeKeyCommand
2026-10-12 16:32:48 +00:00
// Module 5373 (KeyCommands)
2026-10-01 14:13:23 +00:00
import react from "react" /* 19 */;
2026-10-12 16:32:48 +00:00
import react_native_mod from "react-native" /* 5374 */;
2026-10-02 13:37:24 +00:00
import ReactCompilerGating from "ReactCompilerGating" /* 558 */;
2026-10-01 14:13:23 +00:00
import size from "module_2" /* 2 */;
2026-10-02 13:37:24 +00:00
const require = globalThis.__r;
let _require, map;
2026-10-01 14:13:23 +00:00
2026-10-12 16:32:48 +00:00
const f91964 = () => {
2026-10-02 13:37:24 +00:00
c5 = false;
2026-10-01 14:13:23 +00:00
map = new Map();
2026-10-02 13:37:24 +00:00
for (const item10012 of closure_1_4) {
2026-10-01 14:13:23 +00:00
let result = map.set(item10012.eventName, item10012);
continue;
}
items = [...map.values()];
2026-10-02 13:37:24 +00:00
const obj2 = closure_1_1(closure_1_2[1]);
obj2.setKeyCommands(items.map(closure_1_7));
2026-10-01 14:13:23 +00:00
};
function toNativeKeyCommand(eventName) {
return { eventName: eventName.eventName, input: eventName.input, modifierFlags: eventName.modifierFlags, discoverabilityTitle: eventName.discoverabilityTitle };
}
function registerKeyCommand(arg0) {
const items = [];
2026-10-02 13:37:24 +00:00
items[HermesBuiltin.arraySpread(items, closure_4, 0)] = arg0;
closure_4 = items;
if (null == closure_6) {
2026-10-01 14:13:23 +00:00
const obj = react_native;
2026-10-02 13:37:24 +00:00
closure_6 = obj.onKeyCommand((eventName) => {
let diff = items.length - 1;
if (0 <= diff) {
while (true) {
let obj = items[diff];
if (obj.eventName === eventName.eventName) {
if (obj.onKeyCommand(eventName)) {
break;
}
}
diff = diff - 1;
}
}
});
}
2026-10-02 13:37:24 +00:00
const tmp4 = c5;
2026-10-01 14:13:23 +00:00
if (!tmp4) {
2026-10-02 13:37:24 +00:00
c5 = true;
const _queueMicrotask = queueMicrotask;
2026-10-12 16:32:48 +00:00
queueMicrotask(f91964);
}
}
function unregisterKeyCommand(arg0) {
2026-10-01 14:13:23 +00:00
let closure_0 = arg0;
2026-10-02 13:37:24 +00:00
closure_4 = closure_4.filter((item) => item !== closure_0);
const tmp = c5;
2026-10-01 14:13:23 +00:00
if (!tmp) {
2026-10-02 13:37:24 +00:00
c5 = true;
const _queueMicrotask = queueMicrotask;
2026-10-12 16:32:48 +00:00
queueMicrotask(f91964);
}
}
2026-10-01 14:13:23 +00:00
let react_native = react_native_mod;
2026-10-02 13:37:24 +00:00
let closure_4 = [];
let c5 = false;
let closure_6 = null;
2026-10-01 14:13:23 +00:00
react_native = react_native.getConstants();
2026-10-12 16:32:48 +00:00
let tmp3 = ReactCompilerGating.isReactCompilerEnabled() ? (function useKeyCommands(arg0) {
2026-10-02 13:37:24 +00:00
let closure_0;
let tmp2;
let tmp3;
_require = arg0;
const obj = require("react");
const cResult = obj.c(3);
if (cResult[0] !== arg0) {
2026-10-12 16:32:48 +00:00
const fn = function o() {
2026-10-02 13:37:24 +00:00
let tmp2 = closure_0[Symbol.iterator]();
while (tmp2 !== undefined) {
let tmp4 = registerKeyCommand;
let tmp5 = registerKeyCommand(tmp3);
continue;
}
return () => {
const tmp2 = closure_1_0[Symbol.iterator]();
while (tmp2 !== undefined) {
let tmp5 = unregisterKeyCommand(tmp3);
continue;
}
};
};
const items = [arg0];
cResult[0] = arg0;
cResult[1] = fn;
cResult[2] = items;
tmp3 = items;
tmp2 = fn;
} else {
tmp2 = cResult[1];
tmp3 = cResult[2];
}
const effect = react.useEffect(tmp2, tmp3);
2026-10-12 16:32:48 +00:00
}) : (function useKeyCommands(arg0) {
2026-10-02 13:37:24 +00:00
let closure_0 = arg0;
const items = [arg0];
const effect = react.useEffect(() => {
let tmp2 = closure_0[Symbol.iterator]();
while (tmp2 !== undefined) {
let tmp4 = registerKeyCommand;
let tmp5 = registerKeyCommand(tmp3);
continue;
}
return () => {
const tmp2 = closure_1_0[Symbol.iterator]();
while (tmp2 !== undefined) {
let tmp5 = unregisterKeyCommand(tmp3);
continue;
}
};
}, items);
});
let result = size.fileFinishedImporting("modules/keyboard/native/KeyCommands.tsx");
2026-10-01 14:13:23 +00:00
export const KeyModifierFlags = react_native;
export const KeyInputs = { ESCAPE: "UIKeyInputEscape" };
export const subscribeKeyCommand = function subscribeKeyCommand(arg0) {
2026-10-02 13:37:24 +00:00
let closure_0 = arg0;
let items = [];
2026-10-01 14:13:23 +00:00
items[HermesBuiltin.arraySpread(items, items, 0)] = arg0;
2026-10-02 13:37:24 +00:00
if (null == closure_6) {
2026-10-01 14:13:23 +00:00
let tmp2 = importDefault;
let tmp3 = dependencyMap;
let obj = react_native;
2026-10-02 13:37:24 +00:00
closure_6 = obj.onKeyCommand((eventName) => {
let diff = items.length - 1;
if (0 <= diff) {
while (true) {
let obj = items[diff];
if (obj.eventName === eventName.eventName) {
if (obj.onKeyCommand(eventName)) {
break;
}
}
diff = diff - 1;
}
}
});
}
2026-10-02 13:37:24 +00:00
const tmp4 = c5;
2026-10-01 14:13:23 +00:00
if (!tmp4) {
2026-10-02 13:37:24 +00:00
c5 = true;
let _queueMicrotask = queueMicrotask;
2026-10-12 16:32:48 +00:00
queueMicrotask(f91964);
}
return () => {
items = items.filter((item) => item !== closure_0);
2026-10-02 13:37:24 +00:00
const tmp = c5;
2026-10-01 14:13:23 +00:00
if (!tmp) {
2026-10-02 13:37:24 +00:00
c5 = true;
const _queueMicrotask = queueMicrotask;
2026-10-12 16:32:48 +00:00
queueMicrotask(f91964);
}
};
};
2026-10-02 13:37:24 +00:00
export const useKeyCommands = tmp3;