xterm-addon-ligatures
Advanced tools
Comparing version 0.5.0 to 0.5.1
@@ -6,9 +6,2 @@ "use strict"; | ||
*/ | ||
var __asyncValues = (this && this.__asyncValues) || function (o) { | ||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); | ||
var m = o[Symbol.asyncIterator], i; | ||
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); | ||
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } | ||
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -25,4 +18,3 @@ const font_ligatures_1 = require("font-ligatures"); | ||
async function load(fontFamily, cacheSize) { | ||
var e_1, _a; | ||
var _b, _c; | ||
var _a, _b; | ||
if (!fontsPromise) { | ||
@@ -32,3 +24,3 @@ // Web environment that supports font access API | ||
try { | ||
const status = await ((_c = (_b = navigator.permissions).request) === null || _c === void 0 ? void 0 : _c.call(_b, { | ||
const status = await ((_b = (_a = navigator.permissions).request) === null || _b === void 0 ? void 0 : _b.call(_a, { | ||
name: 'local-fonts' | ||
@@ -50,19 +42,9 @@ })); | ||
try { | ||
const fontsIterator = navigator.fonts.query(); | ||
try { | ||
for (var fontsIterator_1 = __asyncValues(fontsIterator), fontsIterator_1_1; fontsIterator_1_1 = await fontsIterator_1.next(), !fontsIterator_1_1.done;) { | ||
const metadata = fontsIterator_1_1.value; | ||
if (!fonts.hasOwnProperty(metadata.family)) { | ||
fonts[metadata.family] = []; | ||
} | ||
fonts[metadata.family].push(metadata); | ||
const fontsIterator = await navigator.fonts.query(); | ||
for (const metadata of fontsIterator) { | ||
if (!fonts.hasOwnProperty(metadata.family)) { | ||
fonts[metadata.family] = []; | ||
} | ||
fonts[metadata.family].push(metadata); | ||
} | ||
catch (e_1_1) { e_1 = { error: e_1_1 }; } | ||
finally { | ||
try { | ||
if (fontsIterator_1_1 && !fontsIterator_1_1.done && (_a = fontsIterator_1.return)) await _a.call(fontsIterator_1); | ||
} | ||
finally { if (e_1) throw e_1.error; } | ||
} | ||
fontsPromise = Promise.resolve(fonts); | ||
@@ -69,0 +51,0 @@ } |
{ | ||
"name": "xterm-addon-ligatures", | ||
"version": "0.5.0", | ||
"version": "0.5.1", | ||
"description": "Add support for programming ligatures to xterm.js", | ||
@@ -5,0 +5,0 @@ "author": { |
@@ -18,2 +18,11 @@ /** | ||
interface IFontAccessNavigator { | ||
fonts: { | ||
query: () => Promise<IFontMetadata[]>; | ||
}; | ||
permissions: { | ||
request?: (permission: { name: string }) => Promise<{state: string}>; | ||
}; | ||
} | ||
let fontsPromise: Promise<FontList | Record<string, IFontMetadata[]>> | undefined = undefined; | ||
@@ -32,3 +41,3 @@ | ||
try { | ||
const status = await (navigator as any).permissions.request?.({ | ||
const status = await (navigator as unknown as IFontAccessNavigator).permissions.request?.({ | ||
name: 'local-fonts' | ||
@@ -49,4 +58,4 @@ }); | ||
try { | ||
const fontsIterator: AsyncIterableIterator<IFontMetadata> = (navigator as any).fonts.query(); | ||
for await (const metadata of fontsIterator) { | ||
const fontsIterator = await (navigator as unknown as IFontAccessNavigator).fonts.query(); | ||
for (const metadata of fontsIterator) { | ||
if (!fonts.hasOwnProperty(metadata.family)) { | ||
@@ -53,0 +62,0 @@ fonts[metadata.family] = []; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
960609
1470