@lvce-editor/settings-view 2.14.0 → 2.16.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.
@@ -54,49 +54,6 @@ class VError extends Error {
54
54
  }
55
55
  }
56
56
 
57
- class AssertionError extends Error {
58
- constructor(message) {
59
- super(message);
60
- this.name = 'AssertionError';
61
- }
62
- }
63
- const Object$1 = 1;
64
- const Number$2 = 2;
65
- const Array$1 = 3;
66
- const String$1 = 4;
67
- const Boolean$2 = 5;
68
- const Function = 6;
69
- const Null = 7;
70
- const Unknown = 8;
71
- const getType = value => {
72
- switch (typeof value) {
73
- case 'number':
74
- return Number$2;
75
- case 'function':
76
- return Function;
77
- case 'string':
78
- return String$1;
79
- case 'object':
80
- if (value === null) {
81
- return Null;
82
- }
83
- if (Array.isArray(value)) {
84
- return Array$1;
85
- }
86
- return Object$1;
87
- case 'boolean':
88
- return Boolean$2;
89
- default:
90
- return Unknown;
91
- }
92
- };
93
- const number = value => {
94
- const type = getType(value);
95
- if (type !== Number$2) {
96
- throw new AssertionError('expected value to be of type number');
97
- }
98
- };
99
-
100
57
  const isMessagePort = value => {
101
58
  return value && value instanceof MessagePort;
102
59
  };
@@ -2999,6 +2956,49 @@ const create = rpcId => {
2999
2956
  };
3000
2957
  };
3001
2958
 
2959
+ class AssertionError extends Error {
2960
+ constructor(message) {
2961
+ super(message);
2962
+ this.name = 'AssertionError';
2963
+ }
2964
+ }
2965
+ const Object$1 = 1;
2966
+ const Number$2 = 2;
2967
+ const Array$1 = 3;
2968
+ const String$1 = 4;
2969
+ const Boolean$2 = 5;
2970
+ const Function = 6;
2971
+ const Null = 7;
2972
+ const Unknown = 8;
2973
+ const getType = value => {
2974
+ switch (typeof value) {
2975
+ case 'number':
2976
+ return Number$2;
2977
+ case 'function':
2978
+ return Function;
2979
+ case 'string':
2980
+ return String$1;
2981
+ case 'object':
2982
+ if (value === null) {
2983
+ return Null;
2984
+ }
2985
+ if (Array.isArray(value)) {
2986
+ return Array$1;
2987
+ }
2988
+ return Object$1;
2989
+ case 'boolean':
2990
+ return Boolean$2;
2991
+ default:
2992
+ return Unknown;
2993
+ }
2994
+ };
2995
+ const number = value => {
2996
+ const type = getType(value);
2997
+ if (type !== Number$2) {
2998
+ throw new AssertionError('expected value to be of type number');
2999
+ }
3000
+ };
3001
+
3002
3002
  const {
3003
3003
  dispose,
3004
3004
  invoke,
@@ -3439,7 +3439,10 @@ const show2 = async (uid, menuId, x, y, args) => {
3439
3439
  };
3440
3440
 
3441
3441
  const handleClickFilterButton = async (state, x, y) => {
3442
- await show2(state.id, SettingsFilter, x, y, {
3442
+ const {
3443
+ id
3444
+ } = state;
3445
+ await show2(id, SettingsFilter, x, y, {
3443
3446
  menuId: SettingsFilter
3444
3447
  });
3445
3448
  return state;
@@ -5075,16 +5078,17 @@ const SettingsTabs = 'SettingsTabs';
5075
5078
  const Tab = 'Tab';
5076
5079
  const TabSelected = 'TabSelected';
5077
5080
 
5081
+ const inputBadgeNode = {
5082
+ childCount: 1,
5083
+ className: InputBadge,
5084
+ type: Div
5085
+ };
5078
5086
  const getSettingsInputBadgeDom = (filteredSettingsCount, hasSearchValue) => {
5079
5087
  if (!hasSearchValue) {
5080
5088
  return [];
5081
5089
  }
5082
5090
  const badgeText = matchingSettings(filteredSettingsCount);
5083
- return [{
5084
- childCount: 1,
5085
- className: InputBadge,
5086
- type: Div
5087
- }, text(badgeText)];
5091
+ return [inputBadgeNode, text(badgeText)];
5088
5092
  };
5089
5093
 
5090
5094
  // TODo use numeric ids
@@ -5166,33 +5170,35 @@ const getSettingsInputDom = () => {
5166
5170
  }];
5167
5171
  };
5168
5172
 
5173
+ const settingsHeaderNode = {
5174
+ childCount: 1,
5175
+ className: SettingsHeader,
5176
+ type: Div
5177
+ };
5169
5178
  const getChildCount$1 = hasSearchValue => {
5170
5179
  return hasSearchValue ? 4 : 3;
5171
5180
  };
5172
5181
  const getSettingsHeaderDom = (filteredSettingsCount, hasSearchValue) => {
5173
5182
  const childCount = getChildCount$1(hasSearchValue);
5174
- return [{
5175
- childCount: 1,
5176
- className: SettingsHeader,
5177
- type: Div
5178
- }, {
5183
+ return [settingsHeaderNode, {
5179
5184
  childCount,
5180
5185
  className: mergeClassNames(SettingsInputWrapper, 'SearchField'),
5181
5186
  type: Div
5182
5187
  }, ...getSettingsInputDom(), ...getSettingsInputBadgeDom(filteredSettingsCount, hasSearchValue), ...getSettingsInputButtonsDom(hasSearchValue)];
5183
5188
  };
5184
5189
 
5190
+ const resizerDom = [{
5191
+ childCount: 1,
5192
+ className: mergeClassNames(Resizer, 'SettingsResizer'),
5193
+ onPointerDown: HandleResizerPointerDown,
5194
+ type: Div
5195
+ }, {
5196
+ childCount: 0,
5197
+ className: ResizerHighlight,
5198
+ type: Div
5199
+ }];
5185
5200
  const getResizerVirtualDom = () => {
5186
- return [{
5187
- childCount: 1,
5188
- className: mergeClassNames(Resizer, 'SettingsResizer'),
5189
- onPointerDown: HandleResizerPointerDown,
5190
- type: Div
5191
- }, {
5192
- childCount: 0,
5193
- className: ResizerHighlight,
5194
- type: Div
5195
- }];
5201
+ return resizerDom;
5196
5202
  };
5197
5203
 
5198
5204
  const parentNode$2 = {
@@ -5209,26 +5215,28 @@ const parentNode$1 = {
5209
5215
  className: mergeClassNames(SettingsScrollBar, SettingsScrollBarSmall),
5210
5216
  type: Div
5211
5217
  };
5218
+ const thumbNode = {
5219
+ childCount: 0,
5220
+ className: SettingsScrollBarThumb,
5221
+ type: Div
5222
+ };
5212
5223
  const getScrollBarDom = visible => {
5213
5224
  if (!visible) {
5214
5225
  return [];
5215
5226
  }
5216
- return [parentNode$1, {
5217
- childCount: 0,
5218
- className: SettingsScrollBarThumb,
5219
- type: Div
5220
- }];
5227
+ return [parentNode$1, thumbNode];
5221
5228
  };
5222
5229
 
5230
+ const errorMessageNode = {
5231
+ childCount: 1,
5232
+ className: ErrorMessage,
5233
+ type: Div
5234
+ };
5223
5235
  const getErrorMessageDom = errorMessage => {
5224
5236
  if (!errorMessage) {
5225
5237
  return [];
5226
5238
  }
5227
- return [{
5228
- childCount: 1,
5229
- className: ErrorMessage,
5230
- type: Div
5231
- }, text(errorMessage)];
5239
+ return [errorMessageNode, text(errorMessage)];
5232
5240
  };
5233
5241
 
5234
5242
  const getInputId = id => {
@@ -5253,6 +5261,11 @@ const getItemLabelDom = (domId, label) => {
5253
5261
  }, text(label)];
5254
5262
  };
5255
5263
 
5264
+ const checkBoxWrapperNode = {
5265
+ childCount: 2,
5266
+ className: SettingsItemCheckBox,
5267
+ type: Div
5268
+ };
5256
5269
  const getItemCheckBoxVirtualDom = item => {
5257
5270
  const {
5258
5271
  description,
@@ -5263,7 +5276,7 @@ const getItemCheckBoxVirtualDom = item => {
5263
5276
  modified
5264
5277
  } = item;
5265
5278
  const domId = getInputId(id);
5266
- const checkBoxClassName = hasError ? `${CheckBox} ${InputBoxError}` : CheckBox;
5279
+ const checkBoxClassName = hasError ? mergeClassNames(CheckBox, InputBoxError) : CheckBox;
5267
5280
  const errorChildCount = hasError ? 1 : 0;
5268
5281
  return [{
5269
5282
  childCount: 2 + errorChildCount,
@@ -5271,11 +5284,7 @@ const getItemCheckBoxVirtualDom = item => {
5271
5284
  'data-modified': modified,
5272
5285
  role: Group,
5273
5286
  type: Div
5274
- }, ...getItemHeadingDom(heading), {
5275
- childCount: 2,
5276
- className: SettingsItemCheckBox,
5277
- type: Div
5278
- }, {
5287
+ }, ...getItemHeadingDom(heading), checkBoxWrapperNode, {
5279
5288
  childCount: 0,
5280
5289
  className: checkBoxClassName,
5281
5290
  id: domId,
@@ -5286,6 +5295,11 @@ const getItemCheckBoxVirtualDom = item => {
5286
5295
  }, ...getItemLabelDom(domId, description), ...getErrorMessageDom(errorMessage)];
5287
5296
  };
5288
5297
 
5298
+ const colorInputWrapperNode = {
5299
+ childCount: 2,
5300
+ className: SettingsItemCheckBox,
5301
+ type: Div
5302
+ };
5289
5303
  const getItemColorVirtualDom = item => {
5290
5304
  const {
5291
5305
  description,
@@ -5304,11 +5318,7 @@ const getItemColorVirtualDom = item => {
5304
5318
  'data-modified': modified,
5305
5319
  role: Group,
5306
5320
  type: Div
5307
- }, ...getItemHeadingDom(heading), {
5308
- childCount: 2,
5309
- className: SettingsItemCheckBox,
5310
- type: Div
5311
- }, {
5321
+ }, ...getItemHeadingDom(heading), colorInputWrapperNode, {
5312
5322
  childCount: 0,
5313
5323
  className: colorInputClassName,
5314
5324
  id: domId,
@@ -5320,15 +5330,16 @@ const getItemColorVirtualDom = item => {
5320
5330
  }, ...getItemLabelDom(domId, description), ...getErrorMessageDom(errorMessage)];
5321
5331
  };
5322
5332
 
5333
+ const modifiedIndicatorNode = {
5334
+ childCount: 0,
5335
+ className: ModifiedIndicator,
5336
+ type: Div
5337
+ };
5323
5338
  const getSettingsModifiedIndicatorDom = isModified => {
5324
5339
  if (!isModified) {
5325
5340
  return [];
5326
5341
  }
5327
- return [{
5328
- childCount: 0,
5329
- className: ModifiedIndicator,
5330
- type: Div
5331
- }];
5342
+ return [modifiedIndicatorNode];
5332
5343
  };
5333
5344
 
5334
5345
  const getChildCount = (modified, hasError) => {
@@ -5339,7 +5350,7 @@ const getChildCount = (modified, hasError) => {
5339
5350
  };
5340
5351
  const getInputClassName = hasError => {
5341
5352
  if (hasError) {
5342
- return `${InputBox} ${InputBoxError}`;
5353
+ return mergeClassNames(InputBox, InputBoxError);
5343
5354
  }
5344
5355
  return InputBox;
5345
5356
  };
@@ -5395,7 +5406,7 @@ const getItemSelectVirtualDom = item => {
5395
5406
  options
5396
5407
  } = item;
5397
5408
  const domId = getInputId(id);
5398
- const selectClassName = hasError ? `${Select} ${InputBoxError}` : Select;
5409
+ const selectClassName = hasError ? mergeClassNames(Select, InputBoxError) : Select;
5399
5410
  const errorChildCount = hasError ? 1 : 0;
5400
5411
  return [{
5401
5412
  childCount: 3 + errorChildCount,
@@ -5421,7 +5432,7 @@ const getItemStringVirtualDom = item => {
5421
5432
  id
5422
5433
  } = item;
5423
5434
  const domId = getInputId(id);
5424
- const inputClassName = hasError ? `${InputBox} ${InputBoxError}` : InputBox;
5435
+ const inputClassName = hasError ? mergeClassNames(InputBox, InputBoxError) : InputBox;
5425
5436
  const errorChildCount = hasError ? 1 : 0;
5426
5437
  return [{
5427
5438
  childCount: 3 + errorChildCount,
@@ -5440,13 +5451,14 @@ const getItemStringVirtualDom = item => {
5440
5451
  }, ...getErrorMessageDom(errorMessage)];
5441
5452
  };
5442
5453
 
5454
+ const unknownItemNode = {
5455
+ childCount: 1,
5456
+ className: SettingsItem,
5457
+ role: Group,
5458
+ type: Div
5459
+ };
5443
5460
  const getItemUnknownVirtualDom = () => {
5444
- return [{
5445
- childCount: 1,
5446
- className: SettingsItem,
5447
- role: Group,
5448
- type: Div
5449
- }, text(unknownSettingType())];
5461
+ return [unknownItemNode, text(unknownSettingType())];
5450
5462
  };
5451
5463
 
5452
5464
  const getItemUrlVirtualDom = item => {
@@ -5459,7 +5471,7 @@ const getItemUrlVirtualDom = item => {
5459
5471
  modified
5460
5472
  } = item;
5461
5473
  const domId = getInputId(id);
5462
- const inputClassName = hasError ? `${InputBox} ${InputBoxError}` : InputBox;
5474
+ const inputClassName = hasError ? mergeClassNames(InputBox, InputBoxError) : InputBox;
5463
5475
  const errorChildCount = hasError ? 1 : 0;
5464
5476
  return [{
5465
5477
  childCount: 3 + errorChildCount,
@@ -5503,16 +5515,18 @@ const getItemVirtualDom = item => {
5503
5515
  return fn(item);
5504
5516
  };
5505
5517
 
5518
+ const settingsItemsNode = {
5519
+ childCount: 1,
5520
+ className: SettingsItems,
5521
+ type: Div
5522
+ };
5523
+ const noResultsNode = {
5524
+ childCount: 1,
5525
+ className: SettingsNoResults,
5526
+ type: P
5527
+ };
5506
5528
  const getSettingsNoResultsDom = searchValue => {
5507
- return [{
5508
- childCount: 1,
5509
- className: SettingsItems,
5510
- type: Div
5511
- }, {
5512
- childCount: 1,
5513
- className: SettingsNoResults,
5514
- type: P
5515
- }, text(noSettingsMatching(searchValue))];
5529
+ return [settingsItemsNode, noResultsNode, text(noSettingsMatching(searchValue))];
5516
5530
  };
5517
5531
 
5518
5532
  const getSettingsItemsDom = (items, searchValue) => {
@@ -5526,19 +5540,21 @@ const getSettingsItemsDom = (items, searchValue) => {
5526
5540
  }, ...items.flatMap(getItemVirtualDom)];
5527
5541
  };
5528
5542
 
5543
+ const settingsContentNode = {
5544
+ childCount: 2,
5545
+ className: SettingsContent,
5546
+ onWheel: HandleWheel,
5547
+ type: Div
5548
+ };
5549
+ const settingsItemWrapperNode = {
5550
+ childCount: 2,
5551
+ className: SettingsItemWrapper,
5552
+ type: Div
5553
+ };
5529
5554
  const getSettingsContentDom = (visibleItems, tabs, searchValue, showScrollBar) => {
5530
5555
  const selectedTab = tabs.find(tab => tab.selected);
5531
5556
  const headerText = selectedTab ? selectedTab.label : settingsContent();
5532
- return [{
5533
- childCount: 2,
5534
- className: SettingsContent,
5535
- onWheel: HandleWheel,
5536
- type: Div
5537
- }, ...getContentHeadingDom(headerText), {
5538
- childCount: 2,
5539
- className: SettingsItemWrapper,
5540
- type: Div
5541
- }, ...getSettingsItemsDom(visibleItems, searchValue), ...getScrollBarDom(showScrollBar)];
5557
+ return [settingsContentNode, ...getContentHeadingDom(headerText), settingsItemWrapperNode, ...getSettingsItemsDom(visibleItems, searchValue), ...getScrollBarDom(showScrollBar)];
5542
5558
  };
5543
5559
 
5544
5560
  const getTabClassName = tab => {
@@ -5568,22 +5584,24 @@ const getSettingsTabsDom = tabs => {
5568
5584
  }, ...tabs.flatMap(getTabVirtualDom)];
5569
5585
  };
5570
5586
 
5587
+ const settingsSideBarNode = {
5588
+ childCount: 1,
5589
+ className: SettingsSideBar,
5590
+ type: Aside
5591
+ };
5571
5592
  const getSettingsSideBarDom = tabs => {
5572
- return [{
5573
- childCount: 1,
5574
- className: SettingsSideBar,
5575
- type: Aside
5576
- }, ...getSettingsTabsDom(tabs)];
5593
+ return [settingsSideBarNode, ...getSettingsTabsDom(tabs)];
5577
5594
  };
5578
5595
 
5596
+ const settingsMainNode = {
5597
+ childCount: 3,
5598
+ className: SettingsMain,
5599
+ type: Div
5600
+ };
5579
5601
  const getSettingsMainDom = (tabs, visibleItems, totalItemCount, searchValue, height, itemHeight) => {
5580
5602
  const totalHeight = totalItemCount * itemHeight;
5581
5603
  const showScrollBar = totalHeight > height;
5582
- return [{
5583
- childCount: 3,
5584
- className: SettingsMain,
5585
- type: Div
5586
- }, ...getSettingsSideBarDom(tabs), ...getResizerVirtualDom(), ...getSettingsContentDom(visibleItems, tabs, searchValue, showScrollBar)];
5604
+ return [settingsMainNode, ...getSettingsSideBarDom(tabs), ...getResizerVirtualDom(), ...getSettingsContentDom(visibleItems, tabs, searchValue, showScrollBar)];
5587
5605
  };
5588
5606
 
5589
5607
  const parentNode = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/settings-view",
3
- "version": "2.14.0",
3
+ "version": "2.16.0",
4
4
  "description": "Explorer Worker",
5
5
  "repository": {
6
6
  "type": "git",