@lvce-editor/status-bar-worker 3.27.0 → 3.29.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.
@@ -265,11 +265,10 @@ const {
265
265
  getCommandIds,
266
266
  getKeys,
267
267
  registerCommands,
268
- set: set$7,
268
+ set: set$6,
269
269
  wrapCommand,
270
270
  wrapGetter,
271
- wrapSerialCommand
272
- } = create$8();
271
+ wrapSerialAsyncCommand} = create$8();
273
272
 
274
273
  const create$7 = (uid, uri, x, y, width, height, platform, assetDir) => {
275
274
  const state = {
@@ -282,7 +281,7 @@ const create$7 = (uid, uri, x, y, width, height, platform, assetDir) => {
282
281
  uid,
283
282
  warningCount: 0
284
283
  };
285
- set$7(uid, state, state);
284
+ set$6(uid, state, state);
286
285
  };
287
286
 
288
287
  const isEqual = (oldState, newState) => {
@@ -319,6 +318,317 @@ const getComponentState = uid => {
319
318
  return get$5(uid).newState;
320
319
  };
321
320
 
321
+ const Status = 'status';
322
+
323
+ const MaskIcon = 'MaskIcon';
324
+
325
+ const Audio = 0;
326
+ const Button$1 = 1;
327
+ const Col = 2;
328
+ const ColGroup = 3;
329
+ const Div = 4;
330
+ const H1 = 5;
331
+ const Input = 6;
332
+ const Kbd = 7;
333
+ const Span = 8;
334
+ const Table = 9;
335
+ const TBody = 10;
336
+ const Td = 11;
337
+ const Text = 12;
338
+ const Th = 13;
339
+ const THead = 14;
340
+ const Tr = 15;
341
+ const I = 16;
342
+ const Img = 17;
343
+ const Root = 0;
344
+ const Ins = 20;
345
+ const Del = 21;
346
+ const H2 = 22;
347
+ const H3 = 23;
348
+ const H4 = 24;
349
+ const H5 = 25;
350
+ const H6 = 26;
351
+ const Article = 27;
352
+ const Aside = 28;
353
+ const Footer = 29;
354
+ const Header = 30;
355
+ const Nav = 40;
356
+ const Section = 41;
357
+ const Search = 42;
358
+ const Dd = 43;
359
+ const Dl = 44;
360
+ const Figcaption = 45;
361
+ const Figure = 46;
362
+ const Hr = 47;
363
+ const Li = 48;
364
+ const Ol = 49;
365
+ const P = 50;
366
+ const Pre = 51;
367
+ const A = 53;
368
+ const Abbr = 54;
369
+ const Br = 55;
370
+ const Cite = 56;
371
+ const Data = 57;
372
+ const Time = 58;
373
+ const Tfoot = 59;
374
+ const Ul = 60;
375
+ const Video = 61;
376
+ const TextArea = 62;
377
+ const Select = 63;
378
+ const Option = 64;
379
+ const Code = 65;
380
+ const Label = 66;
381
+ const Dt = 67;
382
+ const Iframe = 68;
383
+ const Main = 69;
384
+ const Strong = 70;
385
+ const Em = 71;
386
+ const Style = 72;
387
+ const Html = 73;
388
+ const Head = 74;
389
+ const Title = 75;
390
+ const Meta = 76;
391
+ const Canvas = 77;
392
+ const Form = 78;
393
+ const BlockQuote = 79;
394
+ const Quote = 80;
395
+ const Circle = 81;
396
+ const Defs = 82;
397
+ const Ellipse = 83;
398
+ const G = 84;
399
+ const Line = 85;
400
+ const Path = 86;
401
+ const Polygon = 87;
402
+ const Polyline = 88;
403
+ const Rect = 89;
404
+ const Svg = 90;
405
+ const Use = 91;
406
+ const Reference = 100;
407
+
408
+ const VirtualDomElements = {
409
+ __proto__: null,
410
+ A,
411
+ Abbr,
412
+ Article,
413
+ Aside,
414
+ Audio,
415
+ BlockQuote,
416
+ Br,
417
+ Button: Button$1,
418
+ Canvas,
419
+ Circle,
420
+ Cite,
421
+ Code,
422
+ Col,
423
+ ColGroup,
424
+ Data,
425
+ Dd,
426
+ Defs,
427
+ Del,
428
+ Div,
429
+ Dl,
430
+ Dt,
431
+ Ellipse,
432
+ Em,
433
+ Figcaption,
434
+ Figure,
435
+ Footer,
436
+ Form,
437
+ G,
438
+ H1,
439
+ H2,
440
+ H3,
441
+ H4,
442
+ H5,
443
+ H6,
444
+ Head,
445
+ Header,
446
+ Hr,
447
+ Html,
448
+ I,
449
+ Iframe,
450
+ Img,
451
+ Input,
452
+ Ins,
453
+ Kbd,
454
+ Label,
455
+ Li,
456
+ Line,
457
+ Main,
458
+ Meta,
459
+ Nav,
460
+ Ol,
461
+ Option,
462
+ P,
463
+ Path,
464
+ Polygon,
465
+ Polyline,
466
+ Pre,
467
+ Quote,
468
+ Rect,
469
+ Reference,
470
+ Root,
471
+ Search,
472
+ Section,
473
+ Select,
474
+ Span,
475
+ Strong,
476
+ Style,
477
+ Svg,
478
+ TBody,
479
+ THead,
480
+ Table,
481
+ Td,
482
+ Text,
483
+ TextArea,
484
+ Tfoot,
485
+ Th,
486
+ Time,
487
+ Title,
488
+ Tr,
489
+ Ul,
490
+ Use,
491
+ Video
492
+ };
493
+
494
+ const Button = 'event.button';
495
+ const ClientX = 'event.clientX';
496
+ const ClientY = 'event.clientY';
497
+ const TargetName = 'event.target.name';
498
+
499
+ const ExtensionManagementWorker = 9006;
500
+ const RendererProcess = 1670;
501
+ const RendererWorker = 1;
502
+
503
+ const SetDom2 = 'Viewlet.setDom2';
504
+ const SetFocusContext = 'Viewlet.setFocusContext';
505
+
506
+ const mergeClassNames = (...classNames) => {
507
+ return classNames.filter(Boolean).join(' ');
508
+ };
509
+
510
+ const text = data => {
511
+ return {
512
+ childCount: 0,
513
+ text: data,
514
+ type: Text
515
+ };
516
+ };
517
+
518
+ new Set(Object.values(VirtualDomElements));
519
+
520
+ const HandleContextMenu = 2;
521
+ const HandleClick = 11;
522
+
523
+ const ProblemsErrorIcon = 'ProblemsErrorIcon';
524
+ const ProblemsWarningIcon = 'ProblemsWarningIcon';
525
+ const StatusBarItem = 'StatusBarItem';
526
+ const StatusBarItemsLeft = 'StatusBarItemsLeft';
527
+ const StatusBarItemsRight = 'StatusBarItemsRight';
528
+
529
+ const getTextVirtualDom = (element, name) => {
530
+ return [{
531
+ childCount: 1,
532
+ className: 'StatusBarItemLabel',
533
+ name,
534
+ type: Span
535
+ }, text(element.value)];
536
+ };
537
+ const getIconVirtualDom = (element, name) => {
538
+ return [{
539
+ childCount: 0,
540
+ className: mergeClassNames(MaskIcon, 'StatusBarIcon', element.value, element.spinning ? 'Spinning' : ''),
541
+ name,
542
+ type: Div
543
+ }];
544
+ };
545
+ const getStatusBarItemElementVirtualDom = (element, name) => {
546
+ if (element.type === 'text') {
547
+ return getTextVirtualDom(element, name);
548
+ }
549
+ if (element.type === 'icon') {
550
+ return getIconVirtualDom(element, name);
551
+ }
552
+ return [];
553
+ };
554
+
555
+ const getStatusBarItemVirtualDom = statusBarItem => {
556
+ const {
557
+ ariaLabel,
558
+ elements,
559
+ name,
560
+ tooltip
561
+ } = statusBarItem;
562
+ const elementNodes = elements.flatMap(element => getStatusBarItemElementVirtualDom(element, name));
563
+ const buttonNode = {
564
+ ariaLabel,
565
+ childCount: elements.length,
566
+ className: StatusBarItem,
567
+ name,
568
+ tabIndex: -1,
569
+ title: tooltip,
570
+ type: Button$1
571
+ };
572
+ return [buttonNode, ...elementNodes];
573
+ };
574
+
575
+ const getStatusBarItemsVirtualDom = (items, className) => {
576
+ if (items.length === 0) {
577
+ return [];
578
+ }
579
+ return [{
580
+ childCount: items.length,
581
+ className,
582
+ type: Div
583
+ }, ...items.flatMap(getStatusBarItemVirtualDom)];
584
+ };
585
+
586
+ const emptyStatusBarItemsLeftDom = [{
587
+ childCount: 0,
588
+ className: StatusBarItemsLeft,
589
+ type: Div
590
+ }];
591
+ const getStatusBarItemsLeftDom = statusBarItemsLeft => {
592
+ if (statusBarItemsLeft.length === 0) {
593
+ return emptyStatusBarItemsLeftDom;
594
+ }
595
+ return getStatusBarItemsVirtualDom(statusBarItemsLeft, StatusBarItemsLeft);
596
+ };
597
+
598
+ const getStatusBarItemsRightDom = statusBarItemsRight => {
599
+ return getStatusBarItemsVirtualDom(statusBarItemsRight, StatusBarItemsRight);
600
+ };
601
+
602
+ const getChildCount = rightCount => {
603
+ return rightCount > 0 ? 2 : 1;
604
+ };
605
+ const getStatusBarVirtualDom = (statusBarItemsLeft, statusBarItemsRight) => {
606
+ const dom = [{
607
+ childCount: getChildCount(statusBarItemsRight.length),
608
+ className: 'StatusBar',
609
+ onClick: HandleClick,
610
+ onContextMenu: HandleContextMenu,
611
+ role: Status,
612
+ type: Div
613
+ }, ...getStatusBarItemsLeftDom(statusBarItemsLeft), ...getStatusBarItemsRightDom(statusBarItemsRight)];
614
+ return dom;
615
+ };
616
+
617
+ const renderItems = (oldState, newState) => {
618
+ const {
619
+ statusBarItemsLeft,
620
+ statusBarItemsRight,
621
+ uid
622
+ } = newState;
623
+ const dom = getStatusBarVirtualDom(statusBarItemsLeft, statusBarItemsRight);
624
+ return [SetDom2, uid, dom];
625
+ };
626
+
627
+ const getComponentDom = uid => {
628
+ const state = getComponentState(uid);
629
+ return renderItems(state, state)[2];
630
+ };
631
+
322
632
  const getMatchingItemInternal = (items, name) => {
323
633
  for (const item of items) {
324
634
  if (item.name === name) {
@@ -1235,407 +1545,222 @@ const create$5 = (method, params) => {
1235
1545
  const create$4 = (id, method, params) => {
1236
1546
  const message = {
1237
1547
  id,
1238
- jsonrpc: Two,
1239
- method,
1240
- params
1241
- };
1242
- return message;
1243
- };
1244
-
1245
- let id = 0;
1246
- const create$3 = () => {
1247
- return ++id;
1248
- };
1249
-
1250
- const registerPromise = map => {
1251
- const id = create$3();
1252
- const {
1253
- promise,
1254
- resolve
1255
- } = Promise.withResolvers();
1256
- map[id] = resolve;
1257
- return {
1258
- id,
1259
- promise
1260
- };
1261
- };
1262
-
1263
- const invokeHelper = async (callbacks, ipc, method, params, useSendAndTransfer) => {
1264
- const {
1265
- id,
1266
- promise
1267
- } = registerPromise(callbacks);
1268
- const message = create$4(id, method, params);
1269
- if (useSendAndTransfer && ipc.sendAndTransfer) {
1270
- ipc.sendAndTransfer(message);
1271
- } else {
1272
- ipc.send(message);
1273
- }
1274
- const responseMessage = await promise;
1275
- return unwrapJsonRpcResult(responseMessage);
1276
- };
1277
- const createRpc = ipc => {
1278
- const callbacks = Object.create(null);
1279
- ipc._resolve = (id, response) => {
1280
- const fn = callbacks[id];
1281
- if (!fn) {
1282
- console.warn(`callback ${id} may already be disposed`);
1283
- return;
1284
- }
1285
- fn(response);
1286
- delete callbacks[id];
1287
- };
1288
- const rpc = {
1289
- async dispose() {
1290
- await ipc?.dispose();
1291
- },
1292
- invoke(method, ...params) {
1293
- return invokeHelper(callbacks, ipc, method, params, false);
1294
- },
1295
- invokeAndTransfer(method, ...params) {
1296
- return invokeHelper(callbacks, ipc, method, params, true);
1297
- },
1298
- // @ts-ignore
1299
- ipc,
1300
- /**
1301
- * @deprecated
1302
- */
1303
- send(method, ...params) {
1304
- const message = create$5(method, params);
1305
- ipc.send(message);
1306
- }
1307
- };
1308
- return rpc;
1309
- };
1310
-
1311
- const requiresSocket = () => {
1312
- return false;
1313
- };
1314
- const preparePrettyError = error => {
1315
- return error;
1316
- };
1317
- const logError = () => {
1318
- // handled by renderer worker
1319
- };
1320
- const handleMessage = event => {
1321
- const actualRequiresSocket = event?.target?.requiresSocket || requiresSocket;
1322
- const actualExecute = event?.target?.execute || execute;
1323
- return handleJsonRpcMessage(event.target, event.data, actualExecute, event.target._resolve, preparePrettyError, logError, actualRequiresSocket);
1324
- };
1325
-
1326
- const handleIpc = ipc => {
1327
- if ('addEventListener' in ipc) {
1328
- ipc.addEventListener('message', handleMessage);
1329
- } else if ('on' in ipc) {
1330
- // deprecated
1331
- ipc.on('message', handleMessage);
1332
- }
1333
- };
1334
-
1335
- const listen$1 = async (module, options) => {
1336
- const rawIpc = await module.listen(options);
1337
- if (module.signal) {
1338
- module.signal(rawIpc);
1339
- }
1340
- const ipc = module.wrap(rawIpc);
1341
- return ipc;
1342
- };
1343
-
1344
- const create$2 = async ({
1345
- commandMap,
1346
- isMessagePortOpen = true,
1347
- messagePort
1348
- }) => {
1349
- // TODO create a commandMap per rpc instance
1350
- register(commandMap);
1351
- const rawIpc = await IpcParentWithMessagePort$1.create({
1352
- isMessagePortOpen,
1353
- messagePort
1354
- });
1355
- const ipc = IpcParentWithMessagePort$1.wrap(rawIpc);
1356
- handleIpc(ipc);
1357
- const rpc = createRpc(ipc);
1358
- messagePort.start();
1359
- return rpc;
1360
- };
1361
-
1362
- const create$1 = async ({
1363
- commandMap
1364
- }) => {
1365
- // TODO create a commandMap per rpc instance
1366
- register(commandMap);
1367
- const ipc = await listen$1(IpcChildWithModuleWorkerAndMessagePort$1);
1368
- handleIpc(ipc);
1369
- const rpc = createRpc(ipc);
1370
- return rpc;
1371
- };
1372
-
1373
- const createMockRpc = ({
1374
- commandMap
1375
- }) => {
1376
- const invocations = [];
1377
- const invoke = (method, ...params) => {
1378
- invocations.push([method, ...params]);
1379
- const command = commandMap[method];
1380
- if (!command) {
1381
- throw new Error(`command ${method} not found`);
1382
- }
1383
- return command(...params);
1384
- };
1385
- const mockRpc = {
1386
- invocations,
1387
- invoke,
1388
- invokeAndTransfer: invoke
1548
+ jsonrpc: Two,
1549
+ method,
1550
+ params
1389
1551
  };
1390
- return mockRpc;
1552
+ return message;
1391
1553
  };
1392
1554
 
1393
- const rpcs = Object.create(null);
1394
- const set$6 = (id, rpc) => {
1395
- rpcs[id] = rpc;
1396
- };
1397
- const get$3 = id => {
1398
- return rpcs[id];
1399
- };
1400
- const remove = id => {
1401
- delete rpcs[id];
1555
+ let id = 0;
1556
+ const create$3 = () => {
1557
+ return ++id;
1402
1558
  };
1403
1559
 
1404
- /* eslint-disable @typescript-eslint/explicit-function-return-type */
1405
- const create = rpcId => {
1560
+ const registerPromise = map => {
1561
+ const id = create$3();
1562
+ const {
1563
+ promise,
1564
+ resolve
1565
+ } = Promise.withResolvers();
1566
+ map[id] = resolve;
1406
1567
  return {
1568
+ id,
1569
+ promise
1570
+ };
1571
+ };
1572
+
1573
+ const invokeHelper = async (callbacks, ipc, method, params, useSendAndTransfer) => {
1574
+ const {
1575
+ id,
1576
+ promise
1577
+ } = registerPromise(callbacks);
1578
+ const message = create$4(id, method, params);
1579
+ if (useSendAndTransfer && ipc.sendAndTransfer) {
1580
+ ipc.sendAndTransfer(message);
1581
+ } else {
1582
+ ipc.send(message);
1583
+ }
1584
+ const responseMessage = await promise;
1585
+ return unwrapJsonRpcResult(responseMessage);
1586
+ };
1587
+ const createRpc = ipc => {
1588
+ const callbacks = Object.create(null);
1589
+ ipc._resolve = (id, response) => {
1590
+ const fn = callbacks[id];
1591
+ if (!fn) {
1592
+ console.warn(`callback ${id} may already be disposed`);
1593
+ return;
1594
+ }
1595
+ fn(response);
1596
+ delete callbacks[id];
1597
+ };
1598
+ const rpc = {
1407
1599
  async dispose() {
1408
- const rpc = get$3(rpcId);
1409
- await rpc.dispose();
1600
+ await ipc?.dispose();
1410
1601
  },
1411
- // @ts-ignore
1412
1602
  invoke(method, ...params) {
1413
- const rpc = get$3(rpcId);
1414
- // @ts-ignore
1415
- return rpc.invoke(method, ...params);
1603
+ return invokeHelper(callbacks, ipc, method, params, false);
1416
1604
  },
1417
- // @ts-ignore
1418
1605
  invokeAndTransfer(method, ...params) {
1419
- const rpc = get$3(rpcId);
1420
- // @ts-ignore
1421
- return rpc.invokeAndTransfer(method, ...params);
1422
- },
1423
- registerMockRpc(commandMap) {
1424
- const mockRpc = createMockRpc({
1425
- commandMap
1426
- });
1427
- set$6(rpcId, mockRpc);
1428
- // @ts-ignore
1429
- mockRpc[Symbol.dispose] = () => {
1430
- remove(rpcId);
1431
- };
1432
- // @ts-ignore
1433
- return mockRpc;
1434
- },
1435
- set(rpc) {
1436
- set$6(rpcId, rpc);
1437
- }
1438
- };
1439
- };
1440
-
1441
- const Status = 'status';
1442
-
1443
- const MaskIcon = 'MaskIcon';
1444
-
1445
- const Audio = 0;
1446
- const Button$1 = 1;
1447
- const Col = 2;
1448
- const ColGroup = 3;
1449
- const Div = 4;
1450
- const H1 = 5;
1451
- const Input = 6;
1452
- const Kbd = 7;
1453
- const Span = 8;
1454
- const Table = 9;
1455
- const TBody = 10;
1456
- const Td = 11;
1457
- const Text = 12;
1458
- const Th = 13;
1459
- const THead = 14;
1460
- const Tr = 15;
1461
- const I = 16;
1462
- const Img = 17;
1463
- const Root = 0;
1464
- const Ins = 20;
1465
- const Del = 21;
1466
- const H2 = 22;
1467
- const H3 = 23;
1468
- const H4 = 24;
1469
- const H5 = 25;
1470
- const H6 = 26;
1471
- const Article = 27;
1472
- const Aside = 28;
1473
- const Footer = 29;
1474
- const Header = 30;
1475
- const Nav = 40;
1476
- const Section = 41;
1477
- const Search = 42;
1478
- const Dd = 43;
1479
- const Dl = 44;
1480
- const Figcaption = 45;
1481
- const Figure = 46;
1482
- const Hr = 47;
1483
- const Li = 48;
1484
- const Ol = 49;
1485
- const P = 50;
1486
- const Pre = 51;
1487
- const A = 53;
1488
- const Abbr = 54;
1489
- const Br = 55;
1490
- const Cite = 56;
1491
- const Data = 57;
1492
- const Time = 58;
1493
- const Tfoot = 59;
1494
- const Ul = 60;
1495
- const Video = 61;
1496
- const TextArea = 62;
1497
- const Select = 63;
1498
- const Option = 64;
1499
- const Code = 65;
1500
- const Label = 66;
1501
- const Dt = 67;
1502
- const Iframe = 68;
1503
- const Main = 69;
1504
- const Strong = 70;
1505
- const Em = 71;
1506
- const Style = 72;
1507
- const Html = 73;
1508
- const Head = 74;
1509
- const Title = 75;
1510
- const Meta = 76;
1511
- const Canvas = 77;
1512
- const Form = 78;
1513
- const BlockQuote = 79;
1514
- const Quote = 80;
1515
- const Circle = 81;
1516
- const Defs = 82;
1517
- const Ellipse = 83;
1518
- const G = 84;
1519
- const Line = 85;
1520
- const Path = 86;
1521
- const Polygon = 87;
1522
- const Polyline = 88;
1523
- const Rect = 89;
1524
- const Svg = 90;
1525
- const Use = 91;
1526
- const Reference = 100;
1527
-
1528
- const VirtualDomElements = {
1529
- __proto__: null,
1530
- A,
1531
- Abbr,
1532
- Article,
1533
- Aside,
1534
- Audio,
1535
- BlockQuote,
1536
- Br,
1537
- Button: Button$1,
1538
- Canvas,
1539
- Circle,
1540
- Cite,
1541
- Code,
1542
- Col,
1543
- ColGroup,
1544
- Data,
1545
- Dd,
1546
- Defs,
1547
- Del,
1548
- Div,
1549
- Dl,
1550
- Dt,
1551
- Ellipse,
1552
- Em,
1553
- Figcaption,
1554
- Figure,
1555
- Footer,
1556
- Form,
1557
- G,
1558
- H1,
1559
- H2,
1560
- H3,
1561
- H4,
1562
- H5,
1563
- H6,
1564
- Head,
1565
- Header,
1566
- Hr,
1567
- Html,
1568
- I,
1569
- Iframe,
1570
- Img,
1571
- Input,
1572
- Ins,
1573
- Kbd,
1574
- Label,
1575
- Li,
1576
- Line,
1577
- Main,
1578
- Meta,
1579
- Nav,
1580
- Ol,
1581
- Option,
1582
- P,
1583
- Path,
1584
- Polygon,
1585
- Polyline,
1586
- Pre,
1587
- Quote,
1588
- Rect,
1589
- Reference,
1590
- Root,
1591
- Search,
1592
- Section,
1593
- Select,
1594
- Span,
1595
- Strong,
1596
- Style,
1597
- Svg,
1598
- TBody,
1599
- THead,
1600
- Table,
1601
- Td,
1602
- Text,
1603
- TextArea,
1604
- Tfoot,
1605
- Th,
1606
- Time,
1607
- Title,
1608
- Tr,
1609
- Ul,
1610
- Use,
1611
- Video
1606
+ return invokeHelper(callbacks, ipc, method, params, true);
1607
+ },
1608
+ // @ts-ignore
1609
+ ipc,
1610
+ /**
1611
+ * @deprecated
1612
+ */
1613
+ send(method, ...params) {
1614
+ const message = create$5(method, params);
1615
+ ipc.send(message);
1616
+ }
1617
+ };
1618
+ return rpc;
1612
1619
  };
1613
1620
 
1614
- const Button = 'event.button';
1615
- const ClientX = 'event.clientX';
1616
- const ClientY = 'event.clientY';
1617
- const TargetName = 'event.target.name';
1621
+ const requiresSocket = () => {
1622
+ return false;
1623
+ };
1624
+ const preparePrettyError = error => {
1625
+ return error;
1626
+ };
1627
+ const logError = () => {
1628
+ // handled by renderer worker
1629
+ };
1630
+ const handleMessage = event => {
1631
+ const actualRequiresSocket = event?.target?.requiresSocket || requiresSocket;
1632
+ const actualExecute = event?.target?.execute || execute;
1633
+ return handleJsonRpcMessage(event.target, event.data, actualExecute, event.target._resolve, preparePrettyError, logError, actualRequiresSocket);
1634
+ };
1618
1635
 
1619
- const ExtensionManagementWorker = 9006;
1620
- const RendererProcess = 1670;
1621
- const RendererWorker = 1;
1636
+ const handleIpc = ipc => {
1637
+ if ('addEventListener' in ipc) {
1638
+ ipc.addEventListener('message', handleMessage);
1639
+ } else if ('on' in ipc) {
1640
+ // deprecated
1641
+ ipc.on('message', handleMessage);
1642
+ }
1643
+ };
1622
1644
 
1623
- const SetDom2 = 'Viewlet.setDom2';
1624
- const SetFocusContext = 'Viewlet.setFocusContext';
1645
+ const listen$1 = async (module, options) => {
1646
+ const rawIpc = await module.listen(options);
1647
+ if (module.signal) {
1648
+ module.signal(rawIpc);
1649
+ }
1650
+ const ipc = module.wrap(rawIpc);
1651
+ return ipc;
1652
+ };
1653
+
1654
+ const create$2 = async ({
1655
+ commandMap,
1656
+ isMessagePortOpen = true,
1657
+ messagePort
1658
+ }) => {
1659
+ // TODO create a commandMap per rpc instance
1660
+ register(commandMap);
1661
+ const rawIpc = await IpcParentWithMessagePort$1.create({
1662
+ isMessagePortOpen,
1663
+ messagePort
1664
+ });
1665
+ const ipc = IpcParentWithMessagePort$1.wrap(rawIpc);
1666
+ handleIpc(ipc);
1667
+ const rpc = createRpc(ipc);
1668
+ messagePort.start();
1669
+ return rpc;
1670
+ };
1671
+
1672
+ const create$1 = async ({
1673
+ commandMap
1674
+ }) => {
1675
+ // TODO create a commandMap per rpc instance
1676
+ register(commandMap);
1677
+ const ipc = await listen$1(IpcChildWithModuleWorkerAndMessagePort$1);
1678
+ handleIpc(ipc);
1679
+ const rpc = createRpc(ipc);
1680
+ return rpc;
1681
+ };
1682
+
1683
+ const createMockRpc = ({
1684
+ commandMap
1685
+ }) => {
1686
+ const invocations = [];
1687
+ const invoke = (method, ...params) => {
1688
+ invocations.push([method, ...params]);
1689
+ const command = commandMap[method];
1690
+ if (!command) {
1691
+ throw new Error(`command ${method} not found`);
1692
+ }
1693
+ return command(...params);
1694
+ };
1695
+ const mockRpc = {
1696
+ invocations,
1697
+ invoke,
1698
+ invokeAndTransfer: invoke
1699
+ };
1700
+ return mockRpc;
1701
+ };
1702
+
1703
+ const rpcs = Object.create(null);
1704
+ const set$5 = (id, rpc) => {
1705
+ rpcs[id] = rpc;
1706
+ };
1707
+ const get$3 = id => {
1708
+ return rpcs[id];
1709
+ };
1710
+ const remove = id => {
1711
+ delete rpcs[id];
1712
+ };
1713
+
1714
+ /* eslint-disable @typescript-eslint/explicit-function-return-type */
1715
+ const create = rpcId => {
1716
+ return {
1717
+ async dispose() {
1718
+ const rpc = get$3(rpcId);
1719
+ await rpc.dispose();
1720
+ },
1721
+ // @ts-ignore
1722
+ invoke(method, ...params) {
1723
+ const rpc = get$3(rpcId);
1724
+ // @ts-ignore
1725
+ return rpc.invoke(method, ...params);
1726
+ },
1727
+ // @ts-ignore
1728
+ invokeAndTransfer(method, ...params) {
1729
+ const rpc = get$3(rpcId);
1730
+ // @ts-ignore
1731
+ return rpc.invokeAndTransfer(method, ...params);
1732
+ },
1733
+ registerMockRpc(commandMap) {
1734
+ const mockRpc = createMockRpc({
1735
+ commandMap
1736
+ });
1737
+ set$5(rpcId, mockRpc);
1738
+ // @ts-ignore
1739
+ mockRpc[Symbol.dispose] = () => {
1740
+ remove(rpcId);
1741
+ };
1742
+ // @ts-ignore
1743
+ return mockRpc;
1744
+ },
1745
+ set(rpc) {
1746
+ set$5(rpcId, rpc);
1747
+ }
1748
+ };
1749
+ };
1625
1750
 
1626
1751
  const {
1627
1752
  invoke: invoke$3,
1628
- set: set$5
1753
+ set: set$4
1629
1754
  } = create(ExtensionManagementWorker);
1630
1755
 
1631
1756
  const {
1632
1757
  invoke: invoke$2,
1633
- set: set$4
1758
+ set: set$3
1634
1759
  } = create(RendererProcess);
1635
1760
 
1636
1761
  const {
1637
1762
  invoke: invoke$1,
1638
- set: set$3
1763
+ set: set$2
1639
1764
  } = create(RendererWorker);
1640
1765
  const showContextMenu2 = async (uid, menuId, x, y, args) => {
1641
1766
  number(uid);
@@ -1741,6 +1866,27 @@ const handleContextMenu = async (state, button, x, y) => {
1741
1866
  return state;
1742
1867
  };
1743
1868
 
1869
+ let editorStatus;
1870
+ const get$2 = () => editorStatus;
1871
+ const applyUpdate = update => {
1872
+ if (update === undefined) {
1873
+ editorStatus = undefined;
1874
+ return editorStatus;
1875
+ }
1876
+ // Older editor workers omit these fields; retain their original display defaults.
1877
+ const next = {
1878
+ endOfLine: 'lf',
1879
+ insertSpaces: true,
1880
+ ...editorStatus,
1881
+ ...update
1882
+ };
1883
+ if (typeof next.column !== 'number' || typeof next.encoding !== 'string' || typeof next.endOfLine !== 'string' || typeof next.insertSpaces !== 'boolean' || typeof next.languageId !== 'string' || typeof next.line !== 'number' || typeof next.tabSize !== 'number') {
1884
+ throw new TypeError('The first editor status update must contain a complete status');
1885
+ }
1886
+ editorStatus = next;
1887
+ return editorStatus;
1888
+ };
1889
+
1744
1890
  const textItem = (name, text, ariaLabel, tooltip) => ({
1745
1891
  ariaLabel,
1746
1892
  command: '',
@@ -1770,6 +1916,156 @@ const getEditorStatusBarItems = status => {
1770
1916
  return [textItem(EditorPosition, `Ln ${line}, Col ${column}`, `Line ${line}, Column ${column}`, 'Go to Line/Column'), textItem(EditorIndentation, indentationLabel, indentationLabel, 'Select Indentation'), textItem(EditorEncoding, encodingLabel, `Encoding: ${encodingLabel}`, 'Select Encoding'), textItem(EditorEndOfLine, endOfLineLabel, `End of Line: ${endOfLineLabel}`, 'Select End of Line Sequence'), textItem(EditorLanguage, languageId, `Language: ${languageId}`, 'Select Language Mode')];
1771
1917
  };
1772
1918
 
1919
+ const dependencies = {
1920
+ [EditorEncoding]: ['encoding'],
1921
+ [EditorEndOfLine]: ['endOfLine'],
1922
+ [EditorIndentation]: ['insertSpaces', 'tabSize'],
1923
+ [EditorLanguage]: ['languageId'],
1924
+ [EditorPosition]: ['line', 'column']
1925
+ };
1926
+ const handleEditorStatusChanged = (state, editorStatus, previous = state) => {
1927
+ const {
1928
+ statusBarItemsRight
1929
+ } = state;
1930
+ const oldStatus = previous.editorStatus;
1931
+ if (!editorStatus) {
1932
+ if (!oldStatus) {
1933
+ return state;
1934
+ }
1935
+ return {
1936
+ ...state,
1937
+ editorStatus,
1938
+ statusBarItemsRight: statusBarItemsRight.filter(item => !isEditorStatus(item.name))
1939
+ };
1940
+ }
1941
+ const replacements = new Map();
1942
+ for (const item of getEditorStatusBarItems(editorStatus)) {
1943
+ if (!oldStatus || dependencies[item.name].some(key => oldStatus[key] !== editorStatus[key])) {
1944
+ replacements.set(item.name, item);
1945
+ }
1946
+ }
1947
+ if (replacements.size === 0) {
1948
+ return state;
1949
+ }
1950
+ const updatedItems = statusBarItemsRight.map(item => {
1951
+ const replacement = replacements.get(item.name);
1952
+ replacements.delete(item.name);
1953
+ return replacement || item;
1954
+ });
1955
+ const notificationIndex = updatedItems.findIndex(item => item.name === Notifications);
1956
+ updatedItems.splice(notificationIndex === -1 ? updatedItems.length : notificationIndex, 0, ...replacements.values());
1957
+ return {
1958
+ ...state,
1959
+ editorStatus,
1960
+ statusBarItemsRight: updatedItems
1961
+ };
1962
+ };
1963
+
1964
+ const renderIncremental = (oldState, newState) => {
1965
+ return renderItems(oldState, newState);
1966
+ };
1967
+
1968
+ const getRenderer = diffType => {
1969
+ switch (diffType) {
1970
+ case RenderIncremental:
1971
+ return renderIncremental;
1972
+ case RenderItems:
1973
+ return renderItems;
1974
+ default:
1975
+ throw new Error('unknown renderer');
1976
+ }
1977
+ };
1978
+
1979
+ const applyRender = (oldState, newState, diffResult) => {
1980
+ const commands = [];
1981
+ for (const item of diffResult) {
1982
+ const fn = getRenderer(item);
1983
+ const result = fn(oldState, newState);
1984
+ if (result.length > 0) {
1985
+ commands.push(result);
1986
+ }
1987
+ }
1988
+ return commands;
1989
+ };
1990
+
1991
+ const state = {
1992
+ connected: false
1993
+ };
1994
+ const isConnected = () => {
1995
+ const {
1996
+ connected
1997
+ } = state;
1998
+ return connected;
1999
+ };
2000
+ const invoke = (method, ...params) => {
2001
+ return invoke$2(method, ...params);
2002
+ };
2003
+ const set$1 = rpc => {
2004
+ set$3(rpc);
2005
+ state.connected = true;
2006
+ };
2007
+
2008
+ const renderDirect = async (uid, commands) => {
2009
+ const rendererWorkerCommands = commands.filter(command => command[0] === SetFocusContext);
2010
+ const rendererProcessCommands = commands.filter(command => command[0] !== SetFocusContext);
2011
+ const transactionId = await invoke('Viewlet.queueCommands', uid, rendererProcessCommands);
2012
+ return [...rendererWorkerCommands, ['Viewlet.commitPending', uid, transactionId]];
2013
+ };
2014
+ const render2 = (uid, diffResult) => {
2015
+ const {
2016
+ newState,
2017
+ oldState
2018
+ } = get$5(uid);
2019
+ set$6(uid, newState, newState);
2020
+ const commands = applyRender(oldState, newState, diffResult);
2021
+ if (!isConnected()) {
2022
+ return commands;
2023
+ }
2024
+ return renderDirect(uid, commands);
2025
+ };
2026
+
2027
+ const renderOutOfBand = async uid => {
2028
+ if (!isConnected()) {
2029
+ return;
2030
+ }
2031
+ const {
2032
+ newState
2033
+ } = get$5(uid);
2034
+ if (newState.initial) {
2035
+ return;
2036
+ }
2037
+ const diffResult = diff2(uid);
2038
+ if (diffResult.length === 0) {
2039
+ return;
2040
+ }
2041
+ const commands = await render2(uid, diffResult);
2042
+ if (commands.length === 0) {
2043
+ return;
2044
+ }
2045
+ await invoke('Viewlet.sendMultiple', commands);
2046
+ };
2047
+
2048
+ const handleEditorStatusChangedAll = async update => {
2049
+ const previous = {
2050
+ editorStatus: get$2()
2051
+ };
2052
+ const editorStatus = applyUpdate(update);
2053
+ const changedUids = [];
2054
+ for (const uid of getKeys()) {
2055
+ const {
2056
+ newState,
2057
+ oldState
2058
+ } = get$5(uid);
2059
+ const newerState = handleEditorStatusChanged(newState, editorStatus, previous);
2060
+ if (newState === newerState || oldState === newerState) {
2061
+ continue;
2062
+ }
2063
+ set$6(uid, oldState, newerState);
2064
+ changedUids.push(uid);
2065
+ }
2066
+ await Promise.all(changedUids.map(renderOutOfBand));
2067
+ };
2068
+
1773
2069
  const getAriaLabel = count => {
1774
2070
  if (count === 0) {
1775
2071
  return 'No Notifications';
@@ -1798,12 +2094,6 @@ const getNotificationsStatusBarItem = (enabled, count = 0) => {
1798
2094
  }];
1799
2095
  };
1800
2096
 
1801
- const ProblemsErrorIcon = 'ProblemsErrorIcon';
1802
- const ProblemsWarningIcon = 'ProblemsWarningIcon';
1803
- const StatusBarItem = 'StatusBarItem';
1804
- const StatusBarItemsLeft = 'StatusBarItemsLeft';
1805
- const StatusBarItemsRight = 'StatusBarItemsRight';
1806
-
1807
2097
  const getProblemsAriaLabel = (errorCount, warningCount) => {
1808
2098
  const parts = [];
1809
2099
  if (errorCount > 0) {
@@ -1985,205 +2275,6 @@ const handleItemsChanged = async state => {
1985
2275
  return handleExtensionsChanged(state);
1986
2276
  };
1987
2277
 
1988
- const mergeClassNames = (...classNames) => {
1989
- return classNames.filter(Boolean).join(' ');
1990
- };
1991
-
1992
- const text = data => {
1993
- return {
1994
- childCount: 0,
1995
- text: data,
1996
- type: Text
1997
- };
1998
- };
1999
-
2000
- new Set(Object.values(VirtualDomElements));
2001
-
2002
- const HandleContextMenu = 2;
2003
- const HandleClick = 11;
2004
-
2005
- const getTextVirtualDom = (element, name) => {
2006
- return [{
2007
- childCount: 1,
2008
- className: 'StatusBarItemLabel',
2009
- name,
2010
- type: Span
2011
- }, text(element.value)];
2012
- };
2013
- const getIconVirtualDom = (element, name) => {
2014
- return [{
2015
- childCount: 0,
2016
- className: mergeClassNames(MaskIcon, 'StatusBarIcon', element.value, element.spinning ? 'Spinning' : ''),
2017
- name,
2018
- type: Div
2019
- }];
2020
- };
2021
- const getStatusBarItemElementVirtualDom = (element, name) => {
2022
- if (element.type === 'text') {
2023
- return getTextVirtualDom(element, name);
2024
- }
2025
- if (element.type === 'icon') {
2026
- return getIconVirtualDom(element, name);
2027
- }
2028
- return [];
2029
- };
2030
-
2031
- const getStatusBarItemVirtualDom = statusBarItem => {
2032
- const {
2033
- ariaLabel,
2034
- elements,
2035
- name,
2036
- tooltip
2037
- } = statusBarItem;
2038
- const elementNodes = elements.flatMap(element => getStatusBarItemElementVirtualDom(element, name));
2039
- const buttonNode = {
2040
- ariaLabel,
2041
- childCount: elements.length,
2042
- className: StatusBarItem,
2043
- name,
2044
- tabIndex: -1,
2045
- title: tooltip,
2046
- type: Button$1
2047
- };
2048
- return [buttonNode, ...elementNodes];
2049
- };
2050
-
2051
- const getStatusBarItemsVirtualDom = (items, className) => {
2052
- if (items.length === 0) {
2053
- return [];
2054
- }
2055
- return [{
2056
- childCount: items.length,
2057
- className,
2058
- type: Div
2059
- }, ...items.flatMap(getStatusBarItemVirtualDom)];
2060
- };
2061
-
2062
- const emptyStatusBarItemsLeftDom = [{
2063
- childCount: 0,
2064
- className: StatusBarItemsLeft,
2065
- type: Div
2066
- }];
2067
- const getStatusBarItemsLeftDom = statusBarItemsLeft => {
2068
- if (statusBarItemsLeft.length === 0) {
2069
- return emptyStatusBarItemsLeftDom;
2070
- }
2071
- return getStatusBarItemsVirtualDom(statusBarItemsLeft, StatusBarItemsLeft);
2072
- };
2073
-
2074
- const getStatusBarItemsRightDom = statusBarItemsRight => {
2075
- return getStatusBarItemsVirtualDom(statusBarItemsRight, StatusBarItemsRight);
2076
- };
2077
-
2078
- const getChildCount = rightCount => {
2079
- return rightCount > 0 ? 2 : 1;
2080
- };
2081
- const getStatusBarVirtualDom = (statusBarItemsLeft, statusBarItemsRight) => {
2082
- const dom = [{
2083
- childCount: getChildCount(statusBarItemsRight.length),
2084
- className: 'StatusBar',
2085
- onClick: HandleClick,
2086
- onContextMenu: HandleContextMenu,
2087
- role: Status,
2088
- type: Div
2089
- }, ...getStatusBarItemsLeftDom(statusBarItemsLeft), ...getStatusBarItemsRightDom(statusBarItemsRight)];
2090
- return dom;
2091
- };
2092
-
2093
- const renderItems = (oldState, newState) => {
2094
- const {
2095
- statusBarItemsLeft,
2096
- statusBarItemsRight,
2097
- uid
2098
- } = newState;
2099
- const dom = getStatusBarVirtualDom(statusBarItemsLeft, statusBarItemsRight);
2100
- return [SetDom2, uid, dom];
2101
- };
2102
-
2103
- const renderIncremental = (oldState, newState) => {
2104
- return renderItems(oldState, newState);
2105
- };
2106
-
2107
- const getRenderer = diffType => {
2108
- switch (diffType) {
2109
- case RenderIncremental:
2110
- return renderIncremental;
2111
- case RenderItems:
2112
- return renderItems;
2113
- default:
2114
- throw new Error('unknown renderer');
2115
- }
2116
- };
2117
-
2118
- const applyRender = (oldState, newState, diffResult) => {
2119
- const commands = [];
2120
- for (const item of diffResult) {
2121
- const fn = getRenderer(item);
2122
- const result = fn(oldState, newState);
2123
- if (result.length > 0) {
2124
- commands.push(result);
2125
- }
2126
- }
2127
- return commands;
2128
- };
2129
-
2130
- const state = {
2131
- connected: false
2132
- };
2133
- const isConnected = () => {
2134
- const {
2135
- connected
2136
- } = state;
2137
- return connected;
2138
- };
2139
- const invoke = (method, ...params) => {
2140
- return invoke$2(method, ...params);
2141
- };
2142
- const set$2 = rpc => {
2143
- set$4(rpc);
2144
- state.connected = true;
2145
- };
2146
-
2147
- const renderDirect = async (uid, commands) => {
2148
- const rendererWorkerCommands = commands.filter(command => command[0] === SetFocusContext);
2149
- const rendererProcessCommands = commands.filter(command => command[0] !== SetFocusContext);
2150
- const transactionId = await invoke('Viewlet.queueCommands', uid, rendererProcessCommands);
2151
- return [...rendererWorkerCommands, ['Viewlet.commitPending', uid, transactionId]];
2152
- };
2153
- const render2 = (uid, diffResult) => {
2154
- const {
2155
- newState,
2156
- oldState
2157
- } = get$5(uid);
2158
- set$7(uid, newState, newState);
2159
- const commands = applyRender(oldState, newState, diffResult);
2160
- if (!isConnected()) {
2161
- return commands;
2162
- }
2163
- return renderDirect(uid, commands);
2164
- };
2165
-
2166
- const renderOutOfBand = async uid => {
2167
- if (!isConnected()) {
2168
- return;
2169
- }
2170
- const {
2171
- newState
2172
- } = get$5(uid);
2173
- if (newState.initial) {
2174
- return;
2175
- }
2176
- const diffResult = diff2(uid);
2177
- if (diffResult.length === 0) {
2178
- return;
2179
- }
2180
- const commands = await render2(uid, diffResult);
2181
- if (commands.length === 0) {
2182
- return;
2183
- }
2184
- await invoke('Viewlet.sendMultiple', commands);
2185
- };
2186
-
2187
2278
  const handleExtensionManagementChange = async () => {
2188
2279
  for (const uid of getKeys()) {
2189
2280
  const {
@@ -2194,7 +2285,7 @@ const handleExtensionManagementChange = async () => {
2194
2285
  if (newState === newerState || oldState === newerState) {
2195
2286
  continue;
2196
2287
  }
2197
- set$7(uid, oldState, {
2288
+ set$6(uid, oldState, {
2198
2289
  ...newState,
2199
2290
  ...newerState
2200
2291
  });
@@ -2221,15 +2312,15 @@ const handleNotificationCountChanged = (state, count) => {
2221
2312
  };
2222
2313
 
2223
2314
  let latestCount;
2224
- const get$2 = () => {
2315
+ const get$1 = () => {
2225
2316
  return latestCount;
2226
2317
  };
2227
- const set$1 = count => {
2318
+ const set = count => {
2228
2319
  latestCount = count;
2229
2320
  };
2230
2321
 
2231
2322
  const handleNotificationCountChangedAll = async count => {
2232
- set$1(count);
2323
+ set(count);
2233
2324
  for (const uid of getKeys()) {
2234
2325
  const {
2235
2326
  newState,
@@ -2239,7 +2330,7 @@ const handleNotificationCountChangedAll = async count => {
2239
2330
  if (newState === newerState || oldState === newerState) {
2240
2331
  continue;
2241
2332
  }
2242
- set$7(uid, oldState, newerState);
2333
+ set$6(uid, oldState, newerState);
2243
2334
  await renderOutOfBand(uid);
2244
2335
  }
2245
2336
  };
@@ -2254,61 +2345,10 @@ const handleExtensionManagementMessagePort = async port => {
2254
2345
  commandMap: commandMap$1,
2255
2346
  messagePort: port
2256
2347
  });
2257
- set$5(rpc);
2258
- };
2259
-
2260
- let editorStatus;
2261
- const get$1 = () => editorStatus;
2262
- const set = value => {
2263
- editorStatus = value;
2264
- };
2265
-
2266
- const equals = (oldStatus, newStatus) => {
2267
- if (!oldStatus || !newStatus) {
2268
- return oldStatus === newStatus;
2269
- }
2270
- return oldStatus.column === newStatus.column && oldStatus.endOfLine === newStatus.endOfLine && oldStatus.encoding === newStatus.encoding && oldStatus.insertSpaces === newStatus.insertSpaces && oldStatus.languageId === newStatus.languageId && oldStatus.line === newStatus.line && oldStatus.tabSize === newStatus.tabSize;
2271
- };
2272
- const updateItems = (items, status) => {
2273
- const remainingItems = items.filter(item => !isEditorStatus(item.name));
2274
- const editorItems = getEditorStatusBarItems(status);
2275
- if (editorItems.length === 0) {
2276
- return remainingItems;
2277
- }
2278
- const notificationIndex = remainingItems.findIndex(item => item.name === Notifications);
2279
- const insertIndex = notificationIndex === -1 ? remainingItems.length : notificationIndex;
2280
- return [...remainingItems.slice(0, insertIndex), ...editorItems, ...remainingItems.slice(insertIndex)];
2281
- };
2282
- const handleEditorStatusChanged = (state, editorStatus) => {
2283
- const {
2284
- editorStatus: oldEditorStatus,
2285
- statusBarItemsRight
2286
- } = state;
2287
- if (equals(oldEditorStatus, editorStatus)) {
2288
- return state;
2289
- }
2290
- return {
2291
- ...state,
2292
- editorStatus,
2293
- statusBarItemsRight: updateItems(statusBarItemsRight, editorStatus)
2294
- };
2348
+ set$4(rpc);
2295
2349
  };
2296
2350
 
2297
- const handleEditorStatusChangedAll = async editorStatus => {
2298
- set(editorStatus);
2299
- for (const uid of getKeys()) {
2300
- const {
2301
- newState,
2302
- oldState
2303
- } = get$5(uid);
2304
- const newerState = handleEditorStatusChanged(newState, editorStatus);
2305
- if (newState === newerState || oldState === newerState) {
2306
- continue;
2307
- }
2308
- set$7(uid, oldState, newerState);
2309
- await renderOutOfBand(uid);
2310
- }
2311
- };
2351
+ const supportsEditorStatusDeltas = () => true;
2312
2352
 
2313
2353
  const handleMessagePort = async (port, viewletCommandMap, setAsRendererProcess = true) => {
2314
2354
  const executeViewletCommand = async (uid, command, ...args) => {
@@ -2322,12 +2362,13 @@ const handleMessagePort = async (port, viewletCommandMap, setAsRendererProcess =
2322
2362
  const rpc = await create$2({
2323
2363
  commandMap: {
2324
2364
  'StatusBar.handleEditorStatusChanged': handleEditorStatusChangedAll,
2365
+ 'StatusBar.supportsEditorStatusDeltas': supportsEditorStatusDeltas,
2325
2366
  'Viewlet.executeViewletCommand': executeViewletCommand
2326
2367
  },
2327
2368
  messagePort: port
2328
2369
  });
2329
2370
  if (setAsRendererProcess) {
2330
- set$2(rpc);
2371
+ set$1(rpc);
2331
2372
  }
2332
2373
  };
2333
2374
 
@@ -2432,7 +2473,7 @@ const loadContent = async state => {
2432
2473
  platform,
2433
2474
  warningCount
2434
2475
  } = state;
2435
- const editorStatus = get$1();
2476
+ const editorStatus = get$2();
2436
2477
  const {
2437
2478
  builtinNotificationsEnabled,
2438
2479
  builtinProblemsEnabled,
@@ -2457,13 +2498,34 @@ const loadContent = async state => {
2457
2498
  statusBarItemsRight: statusBarItems.filter(item => isRight(item.name)),
2458
2499
  warningCount: 0
2459
2500
  };
2460
- const latestNotificationCount = get$2();
2501
+ const currentState = itemsVisible ? handleEditorStatusChanged(loadedState, get$2()) : loadedState;
2502
+ const latestNotificationCount = get$1();
2461
2503
  if (latestNotificationCount === undefined) {
2462
- return loadedState;
2504
+ return currentState;
2463
2505
  }
2464
- return handleNotificationCountChanged(loadedState, latestNotificationCount);
2506
+ return handleNotificationCountChanged(currentState, latestNotificationCount);
2465
2507
  };
2466
2508
 
2509
+ const refreshExtensionItems = wrapSerialAsyncCommand(async context => {
2510
+ const state = context.getState();
2511
+ const {
2512
+ statusBarItemsLeft
2513
+ } = state;
2514
+ const updated = await handleItemsChanged(state);
2515
+ if (updated === state) {
2516
+ return;
2517
+ }
2518
+ await context.updateState(current => {
2519
+ if (current.statusBarItemsLeft !== statusBarItemsLeft) {
2520
+ return current;
2521
+ }
2522
+ return {
2523
+ ...current,
2524
+ statusBarItemsLeft: updated.statusBarItemsLeft
2525
+ };
2526
+ });
2527
+ });
2528
+
2467
2529
  const renderEventListeners = () => {
2468
2530
  return [{
2469
2531
  name: HandleContextMenu,
@@ -2512,7 +2574,6 @@ const setComponentState = wrapCommand(applyComponentState);
2512
2574
 
2513
2575
  const handleDirectMessagePort = (port, setAsRendererProcess = true) => handleMessagePort(port, commandMap, setAsRendererProcess);
2514
2576
  const activateOnWorkspaceChange = wrapCommand(handleWorkspaceChange);
2515
- const refreshExtensionItems = wrapSerialCommand(handleItemsChanged);
2516
2577
  const handleWorkspaceChangeAndRefresh = async (uid, workspacePath) => {
2517
2578
  await activateOnWorkspaceChange(uid, workspacePath);
2518
2579
  await refreshExtensionItems(uid);
@@ -2521,13 +2582,15 @@ const commandMap = {
2521
2582
  'StatusBar.create': create$7,
2522
2583
  'StatusBar.diff2': diff2,
2523
2584
  'StatusBar.getCommandIds': getCommandIds,
2585
+ 'StatusBar.getComponentDom': getComponentDom,
2524
2586
  'StatusBar.getComponentState': getComponentState,
2525
- 'StatusBar.handleChange': wrapSerialCommand(handleItemsChanged),
2587
+ 'StatusBar.handleChange': refreshExtensionItems,
2526
2588
  'StatusBar.handleClick': wrapCommand(handleClick),
2527
2589
  'StatusBar.handleContextMenu': wrapCommand(handleContextMenu),
2590
+ 'StatusBar.handleEditorStatusChanged': handleEditorStatusChangedAll,
2528
2591
  'StatusBar.handleExtensionManagementMessagePort': handleExtensionManagementMessagePort,
2529
- 'StatusBar.handleExtensionsChanged': wrapCommand(handleExtensionsChanged),
2530
- 'StatusBar.handleItemsChanged': wrapSerialCommand(handleItemsChanged),
2592
+ 'StatusBar.handleExtensionsChanged': refreshExtensionItems,
2593
+ 'StatusBar.handleItemsChanged': refreshExtensionItems,
2531
2594
  'StatusBar.handleMessagePort': handleDirectMessagePort,
2532
2595
  'StatusBar.handleNotificationCountChanged': wrapCommand(handleNotificationCountChanged),
2533
2596
  'StatusBar.handleProblemsSummaryChange': wrapCommand(handleProblemsSummaryChange),
@@ -2542,6 +2605,7 @@ const commandMap = {
2542
2605
  'StatusBar.resize': wrapCommand(resize),
2543
2606
  'StatusBar.saveState': wrapGetter(saveState),
2544
2607
  'StatusBar.setComponentState': setComponentState,
2608
+ 'StatusBar.supportsEditorStatusDeltas': supportsEditorStatusDeltas,
2545
2609
  'StatusBar.terminate': terminate
2546
2610
  };
2547
2611
 
@@ -2549,7 +2613,7 @@ const initializeRenderWorker = async () => {
2549
2613
  const rpc = await create$1({
2550
2614
  commandMap: commandMap
2551
2615
  });
2552
- set$3(rpc);
2616
+ set$2(rpc);
2553
2617
  };
2554
2618
 
2555
2619
  const listen = async () => {