@lvce-editor/settings-view 2.27.2 → 2.27.3

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.
@@ -1559,6 +1559,7 @@ const create$1 = (id, uri, x, y, width, height) => {
1559
1559
  minLineY: 0,
1560
1560
  modifiedSettings: {},
1561
1561
  preferences: {},
1562
+ schemaErrors: [],
1562
1563
  scrollBarMinHeight: 0,
1563
1564
  scrollBarThumbHeight: 0,
1564
1565
  scrollBarThumbTop: 0,
@@ -3056,6 +3057,15 @@ const getPreferences = async () => {
3056
3057
  }
3057
3058
  };
3058
3059
 
3060
+ const getSchemaErrors = async () => {
3061
+ try {
3062
+ return await invoke$1('SettingsWorker.getSchemaErrors');
3063
+ } catch {
3064
+ // Older settings-worker versions do not expose schema diagnostics yet.
3065
+ return [];
3066
+ }
3067
+ };
3068
+
3059
3069
  const getSettingItems = async () => {
3060
3070
  return invoke$1('SettingsWorker.getSettingsItems2');
3061
3071
  };
@@ -3172,7 +3182,7 @@ const loadContent = async (state, savedState) => {
3172
3182
  } = restoreState(savedState);
3173
3183
  const tabs = await getTabs();
3174
3184
  const newTabs = getUpdatedTabs(tabs, tabId);
3175
- const [items, preferences] = await Promise.all([getSettingItems(), getPreferences()]);
3185
+ const [items, preferences, schemaErrors] = await Promise.all([getSettingItems(), getPreferences(), getSchemaErrors()]);
3176
3186
  const modifiedSettings = getModifiedSettings(preferences);
3177
3187
  const filteredItems = getFilteredItems(items, newTabs, searchValue, modifiedSettings, preferences);
3178
3188
  const {
@@ -3202,6 +3212,7 @@ const loadContent = async (state, savedState) => {
3202
3212
  minLineY,
3203
3213
  modifiedSettings,
3204
3214
  preferences,
3215
+ schemaErrors,
3205
3216
  scrollBarThumbHeight: thumbHeight,
3206
3217
  scrollBarThumbTop: thumbTop,
3207
3218
  scrollOffset,
@@ -3240,6 +3251,7 @@ const renderCss = (oldState, newState) => {
3240
3251
 
3241
3252
  const Clear = 'Clear';
3242
3253
  const Filter = 'Filter';
3254
+ const SchemaErrorsTab = 'schema-errors';
3243
3255
  const SettingsSearch = 'SettingsSearch';
3244
3256
 
3245
3257
  const renderFocus = (oldState, newState) => {
@@ -3288,11 +3300,21 @@ const SettingsScrollBar = 'ScrollBar';
3288
3300
  const SettingsScrollBarSmall = 'ScrollBarSmall';
3289
3301
  const SettingsScrollBarThumb = 'ScrollBarThumb';
3290
3302
  const SettingsSearchInput = 'SettingsSearchInput';
3303
+ const SettingsSchemaError = 'SettingsSchemaError';
3304
+ const SettingsSchemaErrors = 'SettingsSchemaErrors';
3291
3305
  const SettingsSideBar = 'SettingsSideBar';
3292
3306
  const SettingsTabs = 'SettingsTabs';
3293
3307
  const Tab = 'Tab';
3294
3308
  const TabSelected = 'TabSelected';
3295
3309
 
3310
+ const getFilteredSchemaErrors = (errors, searchValue) => {
3311
+ const search = searchValue.trim().toLowerCase();
3312
+ if (!search) {
3313
+ return errors;
3314
+ }
3315
+ return errors.filter(error => `${error.id} ${error.message} ${error.source}`.toLowerCase().includes(search));
3316
+ };
3317
+
3296
3318
  const inputBadgeNode = {
3297
3319
  childCount: 1,
3298
3320
  className: InputBadge,
@@ -3369,6 +3391,7 @@ const getSettingsInputButtonsDom = hasSearchValue => {
3369
3391
  return [...getClearButtonDom(hasSearchValue), ...getFilterButtonDom()];
3370
3392
  };
3371
3393
 
3394
+ const searchInputClassName = mergeClassNames(InputBox, SettingsSearchInput, 'MultilineInputBox');
3372
3395
  const getSettingsInputDom = () => {
3373
3396
  const placeholder = searchSettings();
3374
3397
  return [{
@@ -3376,7 +3399,7 @@ const getSettingsInputDom = () => {
3376
3399
  autocomplete: 'off',
3377
3400
  autocorrect: 'off',
3378
3401
  childCount: 0,
3379
- className: mergeClassNames(InputBox, SettingsSearchInput, 'MultilineInputBox'),
3402
+ className: searchInputClassName,
3380
3403
  name: SettingsSearch,
3381
3404
  onFocus: HandleInputFocus,
3382
3405
  onInput: HandleInput,
@@ -3386,6 +3409,7 @@ const getSettingsInputDom = () => {
3386
3409
  }];
3387
3410
  };
3388
3411
 
3412
+ const inputWrapperClassName = mergeClassNames(SettingsInputWrapper, 'SearchField');
3389
3413
  const settingsHeaderNode = {
3390
3414
  childCount: 1,
3391
3415
  className: SettingsHeader,
@@ -3398,7 +3422,7 @@ const getSettingsHeaderDom = (filteredSettingsCount, hasSearchValue) => {
3398
3422
  const childCount = getChildCount$1(hasSearchValue);
3399
3423
  return [settingsHeaderNode, {
3400
3424
  childCount,
3401
- className: mergeClassNames(SettingsInputWrapper, 'SearchField'),
3425
+ className: inputWrapperClassName,
3402
3426
  type: Div
3403
3427
  }, ...getSettingsInputDom(), ...getSettingsInputBadgeDom(filteredSettingsCount, hasSearchValue), ...getSettingsInputButtonsDom(hasSearchValue)];
3404
3428
  };
@@ -3426,6 +3450,21 @@ const getContentHeadingDom = headerText => {
3426
3450
  return [parentNode$2, text(headerText)];
3427
3451
  };
3428
3452
 
3453
+ const getSchemaErrorsDom = errors => {
3454
+ return [{
3455
+ childCount: errors.length,
3456
+ className: SettingsSchemaErrors,
3457
+ role: Group,
3458
+ type: Div
3459
+ }, ...errors.flatMap(error => [{
3460
+ childCount: 2,
3461
+ className: SettingsSchemaError,
3462
+ name: error.id,
3463
+ role: Group,
3464
+ type: Div
3465
+ }, text(`${error.id}: ${error.message}`), text(`Source: ${error.source}`)])];
3466
+ };
3467
+
3429
3468
  const parentNode$1 = {
3430
3469
  childCount: 1,
3431
3470
  className: mergeClassNames(SettingsScrollBar, SettingsScrollBarSmall),
@@ -3477,6 +3516,7 @@ const getItemLabelDom = (domId, label) => {
3477
3516
  }, text(label)];
3478
3517
  };
3479
3518
 
3519
+ const errorInputClassName$3 = mergeClassNames(InputBox, InputBoxError);
3480
3520
  const getItemArrayVirtualDom = item => {
3481
3521
  const {
3482
3522
  description,
@@ -3487,7 +3527,7 @@ const getItemArrayVirtualDom = item => {
3487
3527
  modified
3488
3528
  } = item;
3489
3529
  const domId = getInputId(id);
3490
- const inputClassName = hasError ? mergeClassNames(InputBox, InputBoxError) : InputBox;
3530
+ const inputClassName = hasError ? errorInputClassName$3 : InputBox;
3491
3531
  const errorChildCount = hasError ? 1 : 0;
3492
3532
  return [{
3493
3533
  childCount: 3 + errorChildCount,
@@ -3508,6 +3548,7 @@ const getItemArrayVirtualDom = item => {
3508
3548
  }, ...getErrorMessageDom(errorMessage)];
3509
3549
  };
3510
3550
 
3551
+ const errorCheckBoxClassName = mergeClassNames(CheckBox, InputBoxError);
3511
3552
  const checkBoxWrapperNode = {
3512
3553
  childCount: 2,
3513
3554
  className: SettingsItemCheckBox,
@@ -3524,7 +3565,7 @@ const getItemCheckBoxVirtualDom = item => {
3524
3565
  value
3525
3566
  } = item;
3526
3567
  const domId = getInputId(id);
3527
- const checkBoxClassName = hasError ? mergeClassNames(CheckBox, InputBoxError) : CheckBox;
3568
+ const checkBoxClassName = hasError ? errorCheckBoxClassName : CheckBox;
3528
3569
  const errorChildCount = hasError ? 1 : 0;
3529
3570
  const isChecked = value === true || value === 'true';
3530
3571
  return [{
@@ -3546,6 +3587,8 @@ const getItemCheckBoxVirtualDom = item => {
3546
3587
  }, ...getItemLabelDom(domId, description), ...getErrorMessageDom(errorMessage)];
3547
3588
  };
3548
3589
 
3590
+ const errorColorInputClassName = mergeClassNames('ColorInput', InputBoxError);
3591
+ const defaultColorInputClassName = mergeClassNames('ColorInput');
3549
3592
  const colorInputWrapperNode = {
3550
3593
  childCount: 2,
3551
3594
  className: SettingsItemCheckBox,
@@ -3561,7 +3604,7 @@ const getItemColorVirtualDom = item => {
3561
3604
  modified
3562
3605
  } = item;
3563
3606
  const domId = getInputId(id);
3564
- const colorInputClassName = hasError ? mergeClassNames('ColorInput', InputBoxError) : mergeClassNames('ColorInput');
3607
+ const colorInputClassName = hasError ? errorColorInputClassName : defaultColorInputClassName;
3565
3608
  const errorChildCount = hasError ? 1 : 0;
3566
3609
  return [{
3567
3610
  childCount: 3 + errorChildCount,
@@ -3594,6 +3637,7 @@ const getSettingsModifiedIndicatorDom = isModified => {
3594
3637
  return [modifiedIndicatorNode];
3595
3638
  };
3596
3639
 
3640
+ const errorInputClassName$2 = mergeClassNames(InputBox, InputBoxError);
3597
3641
  const getChildCount = (modified, hasError) => {
3598
3642
  const modifiedChildCount = modified ? 1 : 0;
3599
3643
  const errorChildCount = hasError ? 1 : 0;
@@ -3602,7 +3646,7 @@ const getChildCount = (modified, hasError) => {
3602
3646
  };
3603
3647
  const getInputClassName = hasError => {
3604
3648
  if (hasError) {
3605
- return mergeClassNames(InputBox, InputBoxError);
3649
+ return errorInputClassName$2;
3606
3650
  }
3607
3651
  return InputBox;
3608
3652
  };
@@ -3649,6 +3693,7 @@ const getOptionDom = option => {
3649
3693
  }, text(label)];
3650
3694
  };
3651
3695
 
3696
+ const errorSelectClassName = mergeClassNames(Select, InputBoxError);
3652
3697
  const getItemSelectVirtualDom = item => {
3653
3698
  const {
3654
3699
  description,
@@ -3659,7 +3704,7 @@ const getItemSelectVirtualDom = item => {
3659
3704
  options
3660
3705
  } = item;
3661
3706
  const domId = getInputId(id);
3662
- const selectClassName = hasError ? mergeClassNames(Select, InputBoxError) : Select;
3707
+ const selectClassName = hasError ? errorSelectClassName : Select;
3663
3708
  const errorChildCount = hasError ? 1 : 0;
3664
3709
  return [{
3665
3710
  childCount: 3 + errorChildCount,
@@ -3677,6 +3722,7 @@ const getItemSelectVirtualDom = item => {
3677
3722
  }, ...(options?.flatMap(getOptionDom) || []), ...getErrorMessageDom(errorMessage)];
3678
3723
  };
3679
3724
 
3725
+ const errorInputClassName$1 = mergeClassNames(InputBox, InputBoxError);
3680
3726
  const getItemStringVirtualDom = item => {
3681
3727
  const {
3682
3728
  description,
@@ -3686,7 +3732,7 @@ const getItemStringVirtualDom = item => {
3686
3732
  id
3687
3733
  } = item;
3688
3734
  const domId = getInputId(id);
3689
- const inputClassName = hasError ? mergeClassNames(InputBox, InputBoxError) : InputBox;
3735
+ const inputClassName = hasError ? errorInputClassName$1 : InputBox;
3690
3736
  const errorChildCount = hasError ? 1 : 0;
3691
3737
  return [{
3692
3738
  childCount: 3 + errorChildCount,
@@ -3716,6 +3762,7 @@ const getItemUnknownVirtualDom = item => {
3716
3762
  }, text(unknownSettingType())];
3717
3763
  };
3718
3764
 
3765
+ const errorInputClassName = mergeClassNames(InputBox, InputBoxError);
3719
3766
  const getItemUrlVirtualDom = item => {
3720
3767
  const {
3721
3768
  description,
@@ -3726,7 +3773,7 @@ const getItemUrlVirtualDom = item => {
3726
3773
  modified
3727
3774
  } = item;
3728
3775
  const domId = getInputId(id);
3729
- const inputClassName = hasError ? mergeClassNames(InputBox, InputBoxError) : InputBox;
3776
+ const inputClassName = hasError ? errorInputClassName : InputBox;
3730
3777
  const errorChildCount = hasError ? 1 : 0;
3731
3778
  return [{
3732
3779
  childCount: 3 + errorChildCount,
@@ -3811,14 +3858,15 @@ const settingsItemWrapperNode = {
3811
3858
  className: SettingsItemWrapper,
3812
3859
  type: Div
3813
3860
  };
3814
- const getSettingsContentDom = (visibleItems, tabs, searchValue, showScrollBar) => {
3861
+ const getSettingsContentDom = (visibleItems, tabs, searchValue, showScrollBar, schemaErrors = []) => {
3815
3862
  const selectedTab = tabs.find(tab => tab.selected);
3816
3863
  const headerText = selectedTab ? selectedTab.label : settingsContent();
3817
- return [settingsContentNode, ...getContentHeadingDom(headerText), settingsItemWrapperNode, ...getSettingsItemsDom(visibleItems, searchValue), ...getScrollBarDom(showScrollBar)];
3864
+ return [settingsContentNode, ...getContentHeadingDom(headerText), settingsItemWrapperNode, ...(selectedTab?.id === SchemaErrorsTab ? getSchemaErrorsDom(schemaErrors) : getSettingsItemsDom(visibleItems, searchValue)), ...getScrollBarDom(showScrollBar)];
3818
3865
  };
3819
3866
 
3867
+ const selectedTabClassName = mergeClassNames(Tab, TabSelected);
3820
3868
  const getTabClassName = tab => {
3821
- return tab.selected ? mergeClassNames(Tab, TabSelected) : Tab;
3869
+ return tab.selected ? selectedTabClassName : Tab;
3822
3870
  };
3823
3871
 
3824
3872
  const getTabVirtualDom = tab => {
@@ -3858,10 +3906,10 @@ const settingsMainNode = {
3858
3906
  className: SettingsMain,
3859
3907
  type: Div
3860
3908
  };
3861
- const getSettingsMainDom = (tabs, visibleItems, totalItemCount, searchValue, height, itemHeight) => {
3909
+ const getSettingsMainDom = (tabs, visibleItems, totalItemCount, searchValue, height, itemHeight, schemaErrors = []) => {
3862
3910
  const totalHeight = totalItemCount * itemHeight;
3863
3911
  const showScrollBar = totalHeight > height;
3864
- return [settingsMainNode, ...getSettingsSideBarDom(tabs), ...getResizerVirtualDom(), ...getSettingsContentDom(visibleItems, tabs, searchValue, showScrollBar)];
3912
+ return [settingsMainNode, ...getSettingsSideBarDom(tabs), ...getResizerVirtualDom(), ...getSettingsContentDom(visibleItems, tabs, searchValue, showScrollBar, schemaErrors)];
3865
3913
  };
3866
3914
 
3867
3915
  const parentNode = {
@@ -3869,18 +3917,28 @@ const parentNode = {
3869
3917
  className: mergeClassNames(Viewlet, Settings),
3870
3918
  type: Div
3871
3919
  };
3920
+ const getFilteredItemsCount = (isSchemaErrorsTab, schemaErrorsLength, filteredItemsLength) => {
3921
+ if (isSchemaErrorsTab) {
3922
+ return schemaErrorsLength;
3923
+ }
3924
+ return filteredItemsLength;
3925
+ };
3872
3926
  const getSettingsDom = state => {
3873
3927
  const {
3874
3928
  filteredItems,
3875
3929
  height,
3876
3930
  itemHeight,
3931
+ schemaErrors = [],
3877
3932
  searchValue,
3878
3933
  tabs,
3879
3934
  visibleItems
3880
3935
  } = state;
3936
+ const isSchemaErrorsTab = tabs.some(tab => tab.selected && tab.id === SchemaErrorsTab);
3881
3937
  const hasSearchValue = searchValue.trim().length > 0;
3882
- const filteredItemsCount = filteredItems.length;
3883
- return [parentNode, ...getSettingsHeaderDom(filteredItemsCount, hasSearchValue), ...getSettingsMainDom(tabs, visibleItems, filteredItemsCount, searchValue, height, itemHeight)];
3938
+ const filteredSchemaErrors = getFilteredSchemaErrors(schemaErrors, searchValue);
3939
+ const filteredItemsCount = getFilteredItemsCount(isSchemaErrorsTab, filteredSchemaErrors.length, filteredItems.length);
3940
+ const mainDom = getSettingsMainDom(tabs, visibleItems, filteredItemsCount, searchValue, height, itemHeight, filteredSchemaErrors);
3941
+ return [parentNode, ...getSettingsHeaderDom(filteredItemsCount, hasSearchValue), ...mainDom];
3884
3942
  };
3885
3943
 
3886
3944
  const renderItems = (oldState, newState) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/settings-view",
3
- "version": "2.27.2",
3
+ "version": "2.27.3",
4
4
  "description": "Explorer Worker",
5
5
  "repository": {
6
6
  "type": "git",