@keymanapp/common-types
Version:
Keyman Developer keyboard file types
82 lines (80 loc) • 3.47 kB
JavaScript
//
// This mirrors UKeymanTargets.pas
//
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="1c5604c4-0969-5673-81ea-bad6b3c074c4")}catch(e){}}();
export var KeymanTarget;
(function (KeymanTarget) {
KeymanTarget["any"] = "any";
KeymanTarget["windows"] = "windows";
KeymanTarget["macosx"] = "macosx";
KeymanTarget["linux"] = "linux";
KeymanTarget["web"] = "web";
KeymanTarget["iphone"] = "iphone";
KeymanTarget["ipad"] = "ipad";
KeymanTarget["androidphone"] = "androidphone";
KeymanTarget["androidtablet"] = "androidtablet";
KeymanTarget["mobile"] = "mobile";
KeymanTarget["desktop"] = "desktop";
KeymanTarget["tablet"] = "tablet";
})(KeymanTarget || (KeymanTarget = {}));
;
export const
// Note: if these change, update the copied values in KeyboardParser.pas accordingly
AllKeymanTargets = [
KeymanTarget.any,
KeymanTarget.windows, KeymanTarget.macosx, KeymanTarget.linux,
KeymanTarget.web, KeymanTarget.iphone, KeymanTarget.ipad, KeymanTarget.androidphone, KeymanTarget.androidtablet,
KeymanTarget.mobile, KeymanTarget.desktop, KeymanTarget.tablet
], TouchKeymanTargets = [
KeymanTarget.iphone, KeymanTarget.ipad, KeymanTarget.androidphone, KeymanTarget.androidtablet,
KeymanTarget.mobile, KeymanTarget.tablet
],
// Compile to .kmx
KMXKeymanTargets = [
KeymanTarget.windows, KeymanTarget.macosx, KeymanTarget.linux, KeymanTarget.desktop
],
// Compile to .js
KMWKeymanTargets = [
KeymanTarget.web, KeymanTarget.iphone, KeymanTarget.ipad, KeymanTarget.androidphone, KeymanTarget.androidtablet,
KeymanTarget.mobile, KeymanTarget.tablet
],
// Supports .kvks
KeymanTargetsUsingKVK = [
KeymanTarget.windows, KeymanTarget.macosx, KeymanTarget.linux, KeymanTarget.desktop, KeymanTarget.web
],
// Friendly names for targets, e.g. for documentation
SKeymanTargetNames = {
[]: 'All',
[]: 'Windows', [KeymanTarget.macosx]: 'macOS', [KeymanTarget.linux]: 'Linux',
[]: 'Web', [KeymanTarget.iphone]: 'iPhone', [KeymanTarget.ipad]: 'iPad',
[]: 'Android phone', [KeymanTarget.androidtablet]: 'Android tablet',
[]: 'Mobile devices', [KeymanTarget.desktop]: 'Desktop devices',
[]: 'Tablet devices'
};
export function keymanTargetsFromString(targets, options) {
let result = new Set(targets.split(/ +/));
if (options?.expandTargets) {
if (result.has(KeymanTarget.any)) {
return AllKeymanTargets;
}
if (result.has(KeymanTarget.mobile)) {
result.delete(KeymanTarget.mobile);
result.add(KeymanTarget.androidphone);
result.add(KeymanTarget.iphone);
}
if (result.has(KeymanTarget.tablet)) {
result.delete(KeymanTarget.tablet);
result.add(KeymanTarget.androidtablet);
result.add(KeymanTarget.ipad);
}
if (result.has(KeymanTarget.desktop)) {
result.delete(KeymanTarget.desktop);
result.add(KeymanTarget.linux);
result.add(KeymanTarget.macosx);
result.add(KeymanTarget.windows);
}
}
return [...result];
}
//# sourceMappingURL=keyman-targets.js.map
//# debugId=1c5604c4-0969-5673-81ea-bad6b3c074c4