@lvce-editor/editor-worker 16.10.0 → 17.0.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.
@@ -1174,7 +1174,7 @@ const ExtensionManagementWorker = 9006;
1174
1174
  const IconThemeWorker = 7009;
1175
1175
  const MarkdownWorker = 300;
1176
1176
  const OpenerWorker = 4561;
1177
- const RendererWorker$2 = 1;
1177
+ const RendererWorker$1 = 1;
1178
1178
  const TextMeasurementWorker = 7011;
1179
1179
 
1180
1180
  const FocusEditorText$1 = 12;
@@ -1275,7 +1275,7 @@ const {
1275
1275
  invokeAndTransfer: invokeAndTransfer$1,
1276
1276
  registerMockRpc,
1277
1277
  set: set$b
1278
- } = create$9(RendererWorker$2);
1278
+ } = create$9(RendererWorker$1);
1279
1279
  const searchFileHtml = async uri => {
1280
1280
  return invoke$d('ExtensionHost.searchFileWithHtml', uri);
1281
1281
  };
@@ -1576,7 +1576,7 @@ const refreshOutput = async () => {
1576
1576
  await invoke$d('Output.refresh');
1577
1577
  };
1578
1578
 
1579
- const RendererWorker$1 = {
1579
+ const RendererWorker = {
1580
1580
  __proto__: null,
1581
1581
  activateByEvent: activateByEvent$1,
1582
1582
  applyBulkReplacement,
@@ -3122,7 +3122,7 @@ const splitLines = lines => {
3122
3122
  };
3123
3123
 
3124
3124
  const {
3125
- invoke: invoke$8} = RendererWorker$1;
3125
+ invoke: invoke$8} = RendererWorker;
3126
3126
 
3127
3127
  const notifyTabModifiedStatusChange = async uri => {
3128
3128
  try {
@@ -9975,61 +9975,8 @@ const getDiagnostics$1 = async editorUid => {
9975
9975
  return diagnostics;
9976
9976
  };
9977
9977
 
9978
- const pending = Object.create(null);
9979
- const loaded = Object.create(null);
9980
- const setPending = (id, promise) => {
9981
- pending[id] = promise;
9982
- };
9983
- const getPending = id => {
9984
- return pending[id];
9985
- };
9986
- const hasPending = id => {
9987
- return id in pending;
9988
- };
9989
- const removePending = id => {
9990
- delete pending[id];
9991
- };
9992
- const setLoaded = id => {
9993
- loaded[id] = true;
9994
- };
9995
- const isLoaded = id => {
9996
- return loaded[id];
9997
- };
9998
-
9999
- const getFonts = () => {
10000
- // @ts-ignore
10001
- return globalThis.fonts || document.fonts;
10002
- };
10003
-
10004
- const loadFont = async (fontName, fontUrl) => {
10005
- try {
10006
- string(fontName);
10007
- string(fontUrl);
10008
- if (fontName.startsWith("'")) {
10009
- throw new Error('font name is not allowed start with quotes');
10010
- }
10011
- const fontFace = new FontFace(fontName, fontUrl, {});
10012
- await fontFace.load();
10013
- const fonts = getFonts();
10014
- // @ts-ignore
10015
- fonts.add(fontFace);
10016
- } catch (error) {
10017
- throw new VError(error, `Failed to load font ${fontName}`);
10018
- }
10019
- };
10020
-
10021
9978
  const ensure = async (fontName, fontUrl) => {
10022
- if (isLoaded(fontName)) {
10023
- return;
10024
- }
10025
- if (hasPending(fontName)) {
10026
- return getPending(fontName);
10027
- }
10028
- const promise = loadFont(fontName, fontUrl);
10029
- setPending(fontName, promise);
10030
- await promise;
10031
- removePending(fontName);
10032
- setLoaded(fontName);
9979
+ await invoke$7('TextMeasurement.ensureFont', fontName, fontUrl);
10033
9980
  };
10034
9981
 
10035
9982
  const getKeyBindings = () => {
@@ -10799,8 +10746,7 @@ const initializeSyntaxHighlighting = async (syntaxHighlightingEnabled, syncIncre
10799
10746
  };
10800
10747
 
10801
10748
  const send$1 = port => {
10802
- // @ts-ignore
10803
- return RendererWorker.sendMessagePortToTextMeasurementWorker(port);
10749
+ return sendMessagePortToTextMeasurementWorker(port);
10804
10750
  };
10805
10751
  const initializeTextMeasurementWorker = async () => {
10806
10752
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/editor-worker",
3
- "version": "16.10.0",
3
+ "version": "17.0.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git@github.com:lvce-editor/editor-worker.git"