@lvce-editor/editor-worker 16.10.0 → 17.1.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,9 +1174,11 @@ 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
+ const SetFocusContext$1 = 'Viewlet.setFocusContext';
1181
+
1180
1182
  const FocusEditorText$1 = 12;
1181
1183
 
1182
1184
  const rpcs = Object.create(null);
@@ -1275,7 +1277,7 @@ const {
1275
1277
  invokeAndTransfer: invokeAndTransfer$1,
1276
1278
  registerMockRpc,
1277
1279
  set: set$b
1278
- } = create$9(RendererWorker$2);
1280
+ } = create$9(RendererWorker$1);
1279
1281
  const searchFileHtml = async uri => {
1280
1282
  return invoke$d('ExtensionHost.searchFileWithHtml', uri);
1281
1283
  };
@@ -1576,7 +1578,7 @@ const refreshOutput = async () => {
1576
1578
  await invoke$d('Output.refresh');
1577
1579
  };
1578
1580
 
1579
- const RendererWorker$1 = {
1581
+ const RendererWorker = {
1580
1582
  __proto__: null,
1581
1583
  activateByEvent: activateByEvent$1,
1582
1584
  applyBulkReplacement,
@@ -3122,7 +3124,7 @@ const splitLines = lines => {
3122
3124
  };
3123
3125
 
3124
3126
  const {
3125
- invoke: invoke$8} = RendererWorker$1;
3127
+ invoke: invoke$8} = RendererWorker;
3126
3128
 
3127
3129
  const notifyTabModifiedStatusChange = async uri => {
3128
3130
  try {
@@ -9975,61 +9977,8 @@ const getDiagnostics$1 = async editorUid => {
9975
9977
  return diagnostics;
9976
9978
  };
9977
9979
 
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
9980
  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);
9981
+ await invoke$7('TextMeasurement.ensureFont', fontName, fontUrl);
10033
9982
  };
10034
9983
 
10035
9984
  const getKeyBindings = () => {
@@ -10799,8 +10748,7 @@ const initializeSyntaxHighlighting = async (syntaxHighlightingEnabled, syncIncre
10799
10748
  };
10800
10749
 
10801
10750
  const send$1 = port => {
10802
- // @ts-ignore
10803
- return RendererWorker.sendMessagePortToTextMeasurementWorker(port);
10751
+ return sendMessagePortToTextMeasurementWorker(port);
10804
10752
  };
10805
10753
  const initializeTextMeasurementWorker = async () => {
10806
10754
  try {
@@ -11089,7 +11037,7 @@ const renderFocus$1 = {
11089
11037
  };
11090
11038
  const renderFocusContext = {
11091
11039
  apply(oldState, newState) {
11092
- return ['Viewlet.setFocusContext', newState.uid, newState.focus];
11040
+ return [SetFocusContext$1, newState.uid, newState.focus, 0, newState.uid, 'Editor'];
11093
11041
  },
11094
11042
  isEqual(oldState, newState) {
11095
11043
  return oldState.focus === newState.focus;
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.1.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git@github.com:lvce-editor/editor-worker.git"