@lvce-editor/renderer-process 30.60.1 → 30.60.2

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.
@@ -1556,7 +1556,7 @@ const launchRendererWorker = async () => {
1556
1556
  };
1557
1557
 
1558
1558
  const selector = 'script.RendererWorkerTrace';
1559
- const state$h = {
1559
+ const state$i = {
1560
1560
  enabled: false,
1561
1561
  entries: []
1562
1562
  };
@@ -1606,14 +1606,14 @@ const isCommand = value => {
1606
1606
  };
1607
1607
  const initialize = search => {
1608
1608
  const searchParams = new URLSearchParams(search);
1609
- state$h.enabled = searchParams.has('traceRendererWorker');
1610
- state$h.entries = [];
1609
+ state$i.enabled = searchParams.has('traceRendererWorker');
1610
+ state$i.entries = [];
1611
1611
  };
1612
1612
  const record = (direction, method, params) => {
1613
- if (!state$h.enabled) {
1613
+ if (!state$i.enabled) {
1614
1614
  return;
1615
1615
  }
1616
- state$h.entries.push({
1616
+ state$i.entries.push({
1617
1617
  direction,
1618
1618
  method,
1619
1619
  params: serialize(params),
@@ -1621,7 +1621,7 @@ const record = (direction, method, params) => {
1621
1621
  });
1622
1622
  };
1623
1623
  const listen$1 = rpc => {
1624
- if (!state$h.enabled) {
1624
+ if (!state$i.enabled) {
1625
1625
  return;
1626
1626
  }
1627
1627
  const ipc = rpc.ipc;
@@ -1636,7 +1636,7 @@ const listen$1 = rpc => {
1636
1636
  });
1637
1637
  };
1638
1638
  const exportToDom = () => {
1639
- if (!state$h.enabled) {
1639
+ if (!state$i.enabled) {
1640
1640
  return;
1641
1641
  }
1642
1642
  const existing = document.querySelector(selector);
@@ -1644,7 +1644,7 @@ const exportToDom = () => {
1644
1644
  script.className = 'RendererWorkerTrace';
1645
1645
  script.type = 'application/json';
1646
1646
  script.textContent = JSON.stringify({
1647
- entries: state$h.entries,
1647
+ entries: state$i.entries,
1648
1648
  version: 1
1649
1649
  });
1650
1650
  if (!existing) {
@@ -1652,42 +1652,42 @@ const exportToDom = () => {
1652
1652
  }
1653
1653
  };
1654
1654
  const scheduleExport = () => {
1655
- if (!state$h.enabled) {
1655
+ if (!state$i.enabled) {
1656
1656
  return;
1657
1657
  }
1658
1658
  queueMicrotask(exportToDom);
1659
1659
  };
1660
1660
 
1661
- const state$g = {
1661
+ const state$h = {
1662
1662
  rpc: undefined
1663
1663
  };
1664
1664
  const hydrate$4 = async () => {
1665
1665
  const result = await launchRendererWorker();
1666
1666
  if (isError(result)) {
1667
- state$g.rpc = undefined;
1667
+ state$h.rpc = undefined;
1668
1668
  return result;
1669
1669
  }
1670
- state$g.rpc = result.value;
1670
+ state$h.rpc = result.value;
1671
1671
  listen$1(result.value);
1672
1672
  return success(undefined);
1673
1673
  };
1674
1674
  const send$1 = (method, ...params) => {
1675
1675
  record('sent', method, params);
1676
1676
  // @ts-ignore
1677
- state$g.rpc.send(method, ...params);
1677
+ state$h.rpc.send(method, ...params);
1678
1678
  };
1679
1679
  const invoke$1 = (method, ...params) => {
1680
1680
  record('sent', method, params);
1681
1681
  // @ts-ignore
1682
- return state$g.rpc.invoke(method, ...params);
1682
+ return state$h.rpc.invoke(method, ...params);
1683
1683
  };
1684
1684
  const invokeAndTransfer = (method, ...params) => {
1685
1685
  record('sent', method, params);
1686
1686
  // @ts-ignore
1687
- return state$g.rpc.invokeAndTransfer(method, ...params);
1687
+ return state$h.rpc.invokeAndTransfer(method, ...params);
1688
1688
  };
1689
1689
 
1690
- const state$f = {
1690
+ const state$g = {
1691
1691
  client: undefined,
1692
1692
  enabled: false,
1693
1693
  lastError: '',
@@ -1697,38 +1697,38 @@ const state$f = {
1697
1697
  const workerUrl = new URL('sessionReplayWorkerMain.js', import.meta.url);
1698
1698
  const reloadMessage = 'Reload the window to start session replay with the complete DOM command history';
1699
1699
  const report = error => {
1700
- state$f.lastError = error instanceof Error ? error.message : String(error);
1701
- state$f.stopObserving?.();
1702
- state$f.stopObserving = undefined;
1703
- console.warn(`Session replay: ${state$f.lastError}`);
1700
+ state$g.lastError = error instanceof Error ? error.message : String(error);
1701
+ state$g.stopObserving?.();
1702
+ state$g.stopObserving = undefined;
1703
+ console.warn(`Session replay: ${state$g.lastError}`);
1704
1704
  };
1705
1705
 
1706
1706
  // Retain snapshot recording for older renderer workers during dependency rollout.
1707
1707
  const configure = async options => {
1708
- state$f.stopObserving?.();
1709
- state$f.stopObserving = undefined;
1710
- state$f.enabled = false;
1711
- if (state$f.client) {
1708
+ state$g.stopObserving?.();
1709
+ state$g.stopObserving = undefined;
1710
+ state$g.enabled = false;
1711
+ if (state$g.client) {
1712
1712
  try {
1713
- await state$f.client.invoke('stop');
1713
+ await state$g.client.invoke('stop');
1714
1714
  } catch (error) {
1715
1715
  report(error);
1716
1716
  }
1717
1717
  // Live channels still need their proxy after capture stops.
1718
- if (!state$f.proxy) {
1719
- state$f.client.dispose();
1720
- state$f.client = undefined;
1718
+ if (!state$g.proxy) {
1719
+ state$g.client.dispose();
1720
+ state$g.client = undefined;
1721
1721
  }
1722
1722
  }
1723
1723
  if (!options.local && !options.upload) return '';
1724
- if (state$f.proxy) throw new Error(reloadMessage);
1725
- state$f.lastError = '';
1724
+ if (state$g.proxy) throw new Error(reloadMessage);
1725
+ state$g.lastError = '';
1726
1726
  const client = createClient(workerUrl);
1727
1727
  try {
1728
1728
  const id = await client.invoke('start', options);
1729
- state$f.stopObserving = observe(document, (type, data) => client.invoke('record', type, data), report);
1730
- state$f.client = client;
1731
- state$f.enabled = true;
1729
+ state$g.stopObserving = observe(document, (type, data) => client.invoke('record', type, data), report);
1730
+ state$g.client = client;
1731
+ state$g.enabled = true;
1732
1732
  return id;
1733
1733
  } catch (error) {
1734
1734
  client.dispose();
@@ -1736,7 +1736,7 @@ const configure = async options => {
1736
1736
  }
1737
1737
  };
1738
1738
  const configureProxy = async (options, port) => {
1739
- if (state$f.client || !options.local && !options.upload) {
1739
+ if (state$g.client || !options.local && !options.upload) {
1740
1740
  port.close();
1741
1741
  throw new Error(reloadMessage);
1742
1742
  }
@@ -1749,25 +1749,25 @@ const configureProxy = async (options, port) => {
1749
1749
  commandMap: commandMapRef,
1750
1750
  messagePort: proxyPort
1751
1751
  });
1752
- const original = state$g.rpc;
1753
- state$g.rpc = {
1752
+ const original = state$h.rpc;
1753
+ state$h.rpc = {
1754
1754
  ...rpc,
1755
1755
  async dispose() {
1756
1756
  try {
1757
1757
  await rpc.dispose();
1758
1758
  } finally {
1759
1759
  client.dispose();
1760
- state$f.client = undefined;
1761
- state$f.enabled = false;
1762
- state$f.proxy = false;
1760
+ state$g.client = undefined;
1761
+ state$g.enabled = false;
1762
+ state$g.proxy = false;
1763
1763
  await original?.dispose();
1764
1764
  }
1765
1765
  }
1766
1766
  };
1767
- state$f.client = client;
1768
- state$f.enabled = true;
1769
- state$f.proxy = true;
1770
- state$f.lastError = '';
1767
+ state$g.client = client;
1768
+ state$g.enabled = true;
1769
+ state$g.proxy = true;
1770
+ state$g.lastError = '';
1771
1771
  return id;
1772
1772
  } catch (error) {
1773
1773
  proxyPort?.close();
@@ -1777,21 +1777,21 @@ const configureProxy = async (options, port) => {
1777
1777
  }
1778
1778
  };
1779
1779
  const getSession = async () => {
1780
- if (!state$f.enabled || !state$f.client) throw new Error('Session replay is disabled in settings');
1781
- return state$f.client.invoke('export');
1780
+ if (!state$g.enabled || !state$g.client) throw new Error('Session replay is disabled in settings');
1781
+ return state$g.client.invoke('export');
1782
1782
  };
1783
1783
  const getStatus = async () => {
1784
- if (!state$f.client) return {
1784
+ if (!state$g.client) return {
1785
1785
  enabled: false,
1786
- error: state$f.lastError
1786
+ error: state$g.lastError
1787
1787
  };
1788
1788
  return {
1789
- enabled: state$f.enabled,
1790
- ...(await state$f.client.invoke('status')),
1791
- captureError: state$f.lastError
1789
+ enabled: state$g.enabled,
1790
+ ...(await state$g.client.invoke('status')),
1791
+ captureError: state$g.lastError
1792
1792
  };
1793
1793
  };
1794
- const flush = async () => state$f.client?.invoke('flush');
1794
+ const flush = async () => state$g.client?.invoke('flush');
1795
1795
  const openLocalFile = async () => {
1796
1796
  const input = document.createElement('input');
1797
1797
  input.type = 'file';
@@ -1911,25 +1911,25 @@ const confirm = message => {
1911
1911
  return window.confirm(message);
1912
1912
  };
1913
1913
 
1914
- const state$e = {
1914
+ const state$f = {
1915
1915
  styleSheets: Object.create(null),
1916
1916
  texts: Object.create(null)
1917
1917
  };
1918
1918
  const set$b = (id, sheet) => {
1919
- state$e.styleSheets[id] = sheet;
1919
+ state$f.styleSheets[id] = sheet;
1920
1920
  };
1921
1921
  const get$a = id => {
1922
- return state$e.styleSheets[id];
1922
+ return state$f.styleSheets[id];
1923
1923
  };
1924
1924
  const setText$2 = (id, text) => {
1925
- state$e.texts[id] = text;
1925
+ state$f.texts[id] = text;
1926
1926
  };
1927
1927
  const getText = id => {
1928
- return state$e.texts[id];
1928
+ return state$f.texts[id];
1929
1929
  };
1930
1930
  const remove$4 = id => {
1931
- delete state$e.styleSheets[id];
1932
- delete state$e.texts[id];
1931
+ delete state$f.styleSheets[id];
1932
+ delete state$f.texts[id];
1933
1933
  };
1934
1934
 
1935
1935
  const addCssStyleSheet = (id, text) => {
@@ -2124,7 +2124,7 @@ const createIdGenerator = () => {
2124
2124
  };
2125
2125
  const create$A = createIdGenerator();
2126
2126
 
2127
- const state$d = Object.create(null);
2127
+ const state$e = Object.create(null);
2128
2128
  const retainString = (item, index) => {
2129
2129
  const value = new Promise(resolve => {
2130
2130
  item.getAsString(resolve);
@@ -2175,25 +2175,25 @@ const retainItems = dataTransfer => {
2175
2175
  };
2176
2176
  const addItems = items => {
2177
2177
  const id = create$A();
2178
- state$d[id] = items;
2178
+ state$e[id] = items;
2179
2179
  return id;
2180
2180
  };
2181
2181
  const add$2 = dataTransfer => {
2182
2182
  return addItems(retainItems(dataTransfer));
2183
2183
  };
2184
2184
  const acquire$2 = id => {
2185
- const items = state$d[id];
2185
+ const items = state$e[id];
2186
2186
  if (!items) {
2187
2187
  throw new Error(`Drop data not found: ${id}`);
2188
2188
  }
2189
- delete state$d[id];
2189
+ delete state$e[id];
2190
2190
  return items;
2191
2191
  };
2192
2192
 
2193
- const state$c = Object.create(null);
2193
+ const state$d = Object.create(null);
2194
2194
  const acquire$1 = id => {
2195
- const promise = state$c[id];
2196
- delete state$c[id];
2195
+ const promise = state$d[id];
2196
+ delete state$d[id];
2197
2197
  return promise;
2198
2198
  };
2199
2199
  const getFileHandles = async ids => {
@@ -2203,7 +2203,7 @@ const getFileHandles = async ids => {
2203
2203
  };
2204
2204
  const add$1 = promise => {
2205
2205
  const id = create$A();
2206
- state$c[id] = promise;
2206
+ state$d[id] = promise;
2207
2207
  return id;
2208
2208
  };
2209
2209
  const addFileHandle$1 = fileHandle => {
@@ -2394,14 +2394,14 @@ const getEventListenerArgs = (params, event) => {
2394
2394
  return serialized;
2395
2395
  };
2396
2396
 
2397
- const state$b = {
2397
+ const state$c = {
2398
2398
  ipc: undefined
2399
2399
  };
2400
2400
  const getIpc = () => {
2401
- return state$b.ipc;
2401
+ return state$c.ipc;
2402
2402
  };
2403
2403
  const setIpc = value => {
2404
- state$b.ipc = value;
2404
+ state$c.ipc = value;
2405
2405
  };
2406
2406
 
2407
2407
  const nameAnonymousFunction$1 = (fn, name) => {
@@ -3931,26 +3931,26 @@ const launchDragAndDropWorker = async () => {
3931
3931
  }
3932
3932
  };
3933
3933
 
3934
- const state$a = {
3934
+ const state$b = {
3935
3935
  rpc: undefined
3936
3936
  };
3937
3937
  const hydrate$3 = async () => {
3938
3938
  const result = await launchDragAndDropWorker();
3939
3939
  if (isError(result)) {
3940
- state$a.rpc = undefined;
3940
+ state$b.rpc = undefined;
3941
3941
  return result;
3942
3942
  }
3943
- state$a.rpc = result.value;
3943
+ state$b.rpc = result.value;
3944
3944
  return success(undefined);
3945
3945
  };
3946
3946
  const handleMessagePort$1 = async port => {
3947
- if (!state$a.rpc) {
3947
+ if (!state$b.rpc) {
3948
3948
  const result = await hydrate$3();
3949
3949
  if (isError(result)) {
3950
3950
  throw result.error;
3951
3951
  }
3952
3952
  }
3953
- const rpc = state$a.rpc;
3953
+ const rpc = state$b.rpc;
3954
3954
  if (!rpc) {
3955
3955
  throw new Error('Drag And Drop Worker failed to initialize');
3956
3956
  }
@@ -4651,7 +4651,7 @@ const create$Button = (label, icon) => {
4651
4651
  };
4652
4652
 
4653
4653
  // TODO this file is not needed when all elements are position fixed
4654
- const state$9 = {
4654
+ const state$a = {
4655
4655
  $Widgets: undefined,
4656
4656
  widgetSet: new Set()
4657
4657
  };
@@ -4663,20 +4663,20 @@ const create$Widgets = () => {
4663
4663
  };
4664
4664
  const append$1 = $Element => {
4665
4665
  // TODO should not call append in the first place if it is already in DOM
4666
- if (state$9.widgetSet.has($Element)) {
4666
+ if (state$a.widgetSet.has($Element)) {
4667
4667
  return;
4668
4668
  }
4669
- state$9.widgetSet.add($Element);
4670
- if (state$9.$Widgets) {
4669
+ state$a.widgetSet.add($Element);
4670
+ if (state$a.$Widgets) {
4671
4671
  // @ts-expect-error
4672
- state$9.$Widgets.append($Element);
4672
+ state$a.$Widgets.append($Element);
4673
4673
  } else {
4674
4674
  // @ts-expect-error
4675
- state$9.$Widgets = create$Widgets();
4675
+ state$a.$Widgets = create$Widgets();
4676
4676
  // @ts-expect-error
4677
- state$9.$Widgets.append($Element);
4677
+ state$a.$Widgets.append($Element);
4678
4678
  // @ts-expect-error
4679
- document.body.append(state$9.$Widgets);
4679
+ document.body.append(state$a.$Widgets);
4680
4680
  }
4681
4681
  };
4682
4682
  const remove$1 = $Element => {
@@ -4684,16 +4684,19 @@ const remove$1 = $Element => {
4684
4684
  // TODO $Element should always be defined
4685
4685
  return;
4686
4686
  }
4687
- state$9.widgetSet.delete($Element);
4687
+ state$a.widgetSet.delete($Element);
4688
4688
  $Element.remove();
4689
4689
  // TODO state.$Widgets should always be defined at this point
4690
- if (state$9.widgetSet.size === 0 && state$9.$Widgets) {
4690
+ if (state$a.widgetSet.size === 0 && state$a.$Widgets) {
4691
4691
  // @ts-expect-error
4692
- state$9.$Widgets.remove();
4693
- state$9.$Widgets = undefined;
4692
+ state$a.$Widgets.remove();
4693
+ state$a.$Widgets = undefined;
4694
4694
  }
4695
4695
  };
4696
4696
 
4697
+ const state$9 = {
4698
+ nextNotificationId: 0
4699
+ };
4697
4700
  const handleCloseClick = event => {
4698
4701
  const $CloseButton = event.currentTarget;
4699
4702
  remove$1($CloseButton.parentNode);
@@ -4714,6 +4717,7 @@ const create$Notification = message => {
4714
4717
  const $NotificationMessage = create$NotificationMessage(message);
4715
4718
  const $CloseButton = create$CloseButton();
4716
4719
  const $Notification = document.createElement('div');
4720
+ $Notification.id = `Notification-${++state$9.nextNotificationId}`;
4717
4721
  $Notification.className = 'Notification';
4718
4722
  $Notification.append($NotificationMessage, $CloseButton);
4719
4723
  return $Notification;
@@ -4727,9 +4731,10 @@ const create$s = (type, message, parentUid) => {
4727
4731
  if ($Parent) {
4728
4732
  $Notification.style.position = 'absolute';
4729
4733
  $Parent.append($Notification);
4730
- return;
4734
+ return $Notification.id;
4731
4735
  }
4732
4736
  append$1($Notification);
4737
+ return $Notification.id;
4733
4738
  };
4734
4739
  const findIndex$1 = $Child => {
4735
4740
  const $Parent = $Child.parentNode;
@@ -4761,6 +4766,7 @@ const create$NotificationWithOptions = (message, options) => {
4761
4766
  $NotificationOptions.append($NotificationOption);
4762
4767
  }
4763
4768
  const $Notification = document.createElement('div');
4769
+ $Notification.id = `Notification-${++state$9.nextNotificationId}`;
4764
4770
  $Notification.className = 'Notification';
4765
4771
  $Notification.append($NotificationMessage, $CloseButton, $NotificationOptions);
4766
4772
  $Notification.onclick = handleNotificationClick;
@@ -4769,9 +4775,13 @@ const create$NotificationWithOptions = (message, options) => {
4769
4775
  const createWithOptions = (type, message, options) => {
4770
4776
  const $Notification = create$NotificationWithOptions(message, options);
4771
4777
  append$1($Notification);
4778
+ return $Notification.id;
4772
4779
  };
4773
4780
  const dispose$h = id => {
4774
- // const $Notification = state.$Notifications
4781
+ const $Notification = document.getElementById(id);
4782
+ if ($Notification?.classList.contains('Notification')) {
4783
+ remove$1($Notification);
4784
+ }
4775
4785
  };
4776
4786
 
4777
4787
  const createObjectUrl = blob => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/renderer-process",
3
- "version": "30.60.1",
3
+ "version": "30.60.2",
4
4
  "keywords": [
5
5
  "lvce-editor",
6
6
  "renderer-process"