@lvce-editor/editor-worker 19.77.6 → 19.77.8

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.
package/dist/diff-sdk.js CHANGED
@@ -7650,11 +7650,10 @@ const getLanguageId$1 = (uri, languages) => {
7650
7650
  return 'unknown';
7651
7651
  };
7652
7652
 
7653
- const getLanguages = async (platform, assetDir) => {
7653
+ const getLanguages = async (platform, assetDir, applicationId) => {
7654
7654
  number(platform);
7655
7655
  string(assetDir);
7656
- const languages = await ExtensionManagementWorker.getLanguages(platform, assetDir);
7657
- return languages;
7656
+ return invoke$9(applicationId, 'Extensions.getLanguages', platform, assetDir);
7658
7657
  };
7659
7658
 
7660
7659
  const cacheName = 'lvce-editor-character-widths-v1';
@@ -7749,7 +7748,7 @@ const createEditor = async ({
7749
7748
  string(content);
7750
7749
  // TODO support overwriting language id by setting it explicitly or via settings
7751
7750
  const charWidth = await measureCharacterWidth(fontWeight, fontSize, fontFamily, letterSpacing);
7752
- const languages = await getLanguages(platform, assetDir);
7751
+ const languages = await getLanguages(platform, assetDir, applicationId);
7753
7752
  const computedlanguageId = getLanguageId$1(uri, languages);
7754
7753
  const editor = {
7755
7754
  ...(applicationId !== undefined && {
@@ -19030,7 +19029,7 @@ const loadContent = async (state, savedState, largeFile = false, focus = true, f
19030
19029
  } = await getEditorPreferences(state.applicationId);
19031
19030
  // TODO support overwriting language id by setting it explicitly or via settings
19032
19031
  const charWidth = await measureCharacterWidth(fontWeight, fontSize, fontFamily, letterSpacing);
19033
- const languages = await getLanguages(platform, assetDir);
19032
+ const languages = await getLanguages(platform, assetDir, state.applicationId);
19034
19033
  setTokenizePaths(languages);
19035
19034
  const explicitLanguageId = getSavedLanguageId(savedState, languages);
19036
19035
  const computedLanguageId = explicitLanguageId || getLanguageId$1(uri, languages);
@@ -19688,8 +19687,23 @@ const getDiagnosticVirtualDom = diagnostic => {
19688
19687
  }];
19689
19688
  };
19690
19689
 
19690
+ const sortDiagnosticsBySeverity = diagnostics => {
19691
+ return diagnostics.toSorted((left, right) => {
19692
+ if (left.type === right.type) {
19693
+ return 0;
19694
+ }
19695
+ if (left.type === 'warning') {
19696
+ return -1;
19697
+ }
19698
+ if (right.type === 'warning') {
19699
+ return 1;
19700
+ }
19701
+ return 0;
19702
+ });
19703
+ };
19704
+
19691
19705
  const getDiagnosticsVirtualDom = diagnostics => {
19692
- const dom = diagnostics.flatMap(getDiagnosticVirtualDom);
19706
+ const dom = sortDiagnosticsBySeverity(diagnostics).flatMap(getDiagnosticVirtualDom);
19693
19707
  return dom;
19694
19708
  };
19695
19709
 
@@ -19984,7 +19998,7 @@ const getEditorScrollBarDiagnosticsVirtualDom = scrollBarDiagnostics => {
19984
19998
  childCount: scrollBarDiagnostics.length,
19985
19999
  className: 'ScrollBarDiagnostics',
19986
20000
  type: Div
19987
- }, ...scrollBarDiagnostics.map(({
20001
+ }, ...scrollBarDiagnostics.toSorted((left, right) => left.top - right.top || (left.type === 'warning' && right.type !== 'warning' ? -1 : right.type === 'warning' && left.type !== 'warning' ? 1 : 0)).map(({
19988
20002
  height,
19989
20003
  top,
19990
20004
  type
@@ -1360,9 +1360,6 @@ const {
1360
1360
  invokeAndTransfer: invokeAndTransfer$2,
1361
1361
  set: set$g
1362
1362
  } = create$c(ExtensionManagementWorker);
1363
- const getLanguages$1 = (platform, assetDir) => {
1364
- return invoke$h('Extensions.getLanguages', platform, assetDir);
1365
- };
1366
1363
 
1367
1364
  const createLazyRpc = rpcId => {
1368
1365
  let activeRpc;
@@ -8078,11 +8075,10 @@ const getLanguageId$1 = (uri, languages) => {
8078
8075
  return 'unknown';
8079
8076
  };
8080
8077
 
8081
- const getLanguages = async (platform, assetDir) => {
8078
+ const getLanguages = async (platform, assetDir, applicationId) => {
8082
8079
  number(platform);
8083
8080
  string(assetDir);
8084
- const languages = await getLanguages$1(platform, assetDir);
8085
- return languages;
8081
+ return invoke$9(applicationId, 'Extensions.getLanguages', platform, assetDir);
8086
8082
  };
8087
8083
 
8088
8084
  const cacheName = 'lvce-editor-character-widths-v1';
@@ -8177,7 +8173,7 @@ const createEditor = async ({
8177
8173
  string(content);
8178
8174
  // TODO support overwriting language id by setting it explicitly or via settings
8179
8175
  const charWidth = await measureCharacterWidth(fontWeight, fontSize, fontFamily, letterSpacing);
8180
- const languages = await getLanguages(platform, assetDir);
8176
+ const languages = await getLanguages(platform, assetDir, applicationId);
8181
8177
  const computedlanguageId = getLanguageId$1(uri, languages);
8182
8178
  const editor = {
8183
8179
  ...(applicationId !== undefined && {
@@ -19449,7 +19445,7 @@ const loadContent = async (state, savedState, largeFile = false, focus = true, f
19449
19445
  } = await getEditorPreferences(state.applicationId);
19450
19446
  // TODO support overwriting language id by setting it explicitly or via settings
19451
19447
  const charWidth = await measureCharacterWidth(fontWeight, fontSize, fontFamily, letterSpacing);
19452
- const languages = await getLanguages(platform, assetDir);
19448
+ const languages = await getLanguages(platform, assetDir, state.applicationId);
19453
19449
  setTokenizePaths(languages);
19454
19450
  const explicitLanguageId = getSavedLanguageId(savedState, languages);
19455
19451
  const computedLanguageId = explicitLanguageId || getLanguageId$1(uri, languages);
@@ -20107,8 +20103,23 @@ const getDiagnosticVirtualDom = diagnostic => {
20107
20103
  }];
20108
20104
  };
20109
20105
 
20106
+ const sortDiagnosticsBySeverity = diagnostics => {
20107
+ return diagnostics.toSorted((left, right) => {
20108
+ if (left.type === right.type) {
20109
+ return 0;
20110
+ }
20111
+ if (left.type === 'warning') {
20112
+ return -1;
20113
+ }
20114
+ if (right.type === 'warning') {
20115
+ return 1;
20116
+ }
20117
+ return 0;
20118
+ });
20119
+ };
20120
+
20110
20121
  const getDiagnosticsVirtualDom = diagnostics => {
20111
- const dom = diagnostics.flatMap(getDiagnosticVirtualDom);
20122
+ const dom = sortDiagnosticsBySeverity(diagnostics).flatMap(getDiagnosticVirtualDom);
20112
20123
  return dom;
20113
20124
  };
20114
20125
 
@@ -20403,7 +20414,7 @@ const getEditorScrollBarDiagnosticsVirtualDom = scrollBarDiagnostics => {
20403
20414
  childCount: scrollBarDiagnostics.length,
20404
20415
  className: 'ScrollBarDiagnostics',
20405
20416
  type: Div
20406
- }, ...scrollBarDiagnostics.map(({
20417
+ }, ...scrollBarDiagnostics.toSorted((left, right) => left.top - right.top || (left.type === 'warning' && right.type !== 'warning' ? -1 : right.type === 'warning' && left.type !== 'warning' ? 1 : 0)).map(({
20407
20418
  height,
20408
20419
  top,
20409
20420
  type
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/editor-worker",
3
- "version": "19.77.6",
3
+ "version": "19.77.8",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git@github.com:lvce-editor/editor-worker.git"