@lvce-editor/renderer-process 30.81.6 → 30.81.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/rendererProcessMain.js +192 -115
- package/package.json +1 -1
|
@@ -1474,15 +1474,15 @@ const commandMapRef = {};
|
|
|
1474
1474
|
|
|
1475
1475
|
const workers$1 = new Map();
|
|
1476
1476
|
const metadataById = new Map();
|
|
1477
|
-
const state$
|
|
1477
|
+
const state$p = {
|
|
1478
1478
|
generation: 0,
|
|
1479
1479
|
nextId: 0
|
|
1480
1480
|
};
|
|
1481
|
-
const getGeneration = () => state$
|
|
1481
|
+
const getGeneration = () => state$p.generation;
|
|
1482
1482
|
const createRuntimeName = (name, parentName) => {
|
|
1483
|
-
state$
|
|
1484
|
-
const id = `worker-${state$
|
|
1485
|
-
const runtimeId = `worker-${String(state$
|
|
1483
|
+
state$p.nextId++;
|
|
1484
|
+
const id = `worker-${state$p.nextId}`;
|
|
1485
|
+
const runtimeId = `worker-${String(state$p.nextId).padStart(2, '0')}`;
|
|
1486
1486
|
let parent;
|
|
1487
1487
|
if (parentName) {
|
|
1488
1488
|
parent = metadataById.values().find(worker => worker.name === parentName);
|
|
@@ -1500,8 +1500,8 @@ const createRuntimeName = (name, parentName) => {
|
|
|
1500
1500
|
metadataById.set(id, metadata);
|
|
1501
1501
|
return metadata;
|
|
1502
1502
|
};
|
|
1503
|
-
const track = (worker, startedIn = state$
|
|
1504
|
-
if (startedIn !== state$
|
|
1503
|
+
const track = (worker, startedIn = state$p.generation, trackedWorker) => {
|
|
1504
|
+
if (startedIn !== state$p.generation) {
|
|
1505
1505
|
worker.terminate();
|
|
1506
1506
|
throw new Error('Worker launch canceled by application restart');
|
|
1507
1507
|
}
|
|
@@ -1535,7 +1535,7 @@ const terminate$1 = id => {
|
|
|
1535
1535
|
};
|
|
1536
1536
|
const getWorkers$1 = () => workers$1.values().toArray();
|
|
1537
1537
|
const terminateAll = () => {
|
|
1538
|
-
state$
|
|
1538
|
+
state$p.generation++;
|
|
1539
1539
|
const retiring = workers$1.keys().toArray();
|
|
1540
1540
|
workers$1.clear();
|
|
1541
1541
|
metadataById.clear();
|
|
@@ -1671,8 +1671,8 @@ const launchRendererWorker = async () => {
|
|
|
1671
1671
|
});
|
|
1672
1672
|
};
|
|
1673
1673
|
|
|
1674
|
-
const selector = 'script.RendererWorkerTrace';
|
|
1675
|
-
const state$
|
|
1674
|
+
const selector$1 = 'script.RendererWorkerTrace';
|
|
1675
|
+
const state$o = {
|
|
1676
1676
|
enabled: false,
|
|
1677
1677
|
entries: []
|
|
1678
1678
|
};
|
|
@@ -1722,14 +1722,14 @@ const isCommand = value => {
|
|
|
1722
1722
|
};
|
|
1723
1723
|
const initialize$1 = search => {
|
|
1724
1724
|
const searchParams = new URLSearchParams(search);
|
|
1725
|
-
state$
|
|
1726
|
-
state$
|
|
1725
|
+
state$o.enabled = searchParams.has('traceRendererWorker');
|
|
1726
|
+
state$o.entries = [];
|
|
1727
1727
|
};
|
|
1728
1728
|
const record = (direction, method, params) => {
|
|
1729
|
-
if (!state$
|
|
1729
|
+
if (!state$o.enabled) {
|
|
1730
1730
|
return;
|
|
1731
1731
|
}
|
|
1732
|
-
state$
|
|
1732
|
+
state$o.entries.push({
|
|
1733
1733
|
direction,
|
|
1734
1734
|
method,
|
|
1735
1735
|
params: serialize(params),
|
|
@@ -1737,7 +1737,7 @@ const record = (direction, method, params) => {
|
|
|
1737
1737
|
});
|
|
1738
1738
|
};
|
|
1739
1739
|
const listen$1 = rpc => {
|
|
1740
|
-
if (!state$
|
|
1740
|
+
if (!state$o.enabled) {
|
|
1741
1741
|
return;
|
|
1742
1742
|
}
|
|
1743
1743
|
const ipc = rpc.ipc;
|
|
@@ -1752,15 +1752,15 @@ const listen$1 = rpc => {
|
|
|
1752
1752
|
});
|
|
1753
1753
|
};
|
|
1754
1754
|
const exportToDom = () => {
|
|
1755
|
-
if (!state$
|
|
1755
|
+
if (!state$o.enabled) {
|
|
1756
1756
|
return;
|
|
1757
1757
|
}
|
|
1758
|
-
const existing = document.querySelector(selector);
|
|
1758
|
+
const existing = document.querySelector(selector$1);
|
|
1759
1759
|
const script = existing || document.createElement('script');
|
|
1760
1760
|
script.className = 'RendererWorkerTrace';
|
|
1761
1761
|
script.type = 'application/json';
|
|
1762
1762
|
script.textContent = JSON.stringify({
|
|
1763
|
-
entries: state$
|
|
1763
|
+
entries: state$o.entries,
|
|
1764
1764
|
version: 1
|
|
1765
1765
|
});
|
|
1766
1766
|
if (!existing) {
|
|
@@ -1768,49 +1768,49 @@ const exportToDom = () => {
|
|
|
1768
1768
|
}
|
|
1769
1769
|
};
|
|
1770
1770
|
const scheduleExport = () => {
|
|
1771
|
-
if (!state$
|
|
1771
|
+
if (!state$o.enabled) {
|
|
1772
1772
|
return;
|
|
1773
1773
|
}
|
|
1774
1774
|
queueMicrotask(exportToDom);
|
|
1775
1775
|
};
|
|
1776
1776
|
|
|
1777
|
-
const state$
|
|
1777
|
+
const state$n = {
|
|
1778
1778
|
rpc: undefined
|
|
1779
1779
|
};
|
|
1780
1780
|
const hydrate$4 = async () => {
|
|
1781
1781
|
const result = await launchRendererWorker();
|
|
1782
1782
|
if (isError(result)) {
|
|
1783
|
-
state$
|
|
1783
|
+
state$n.rpc = undefined;
|
|
1784
1784
|
return result;
|
|
1785
1785
|
}
|
|
1786
|
-
state$
|
|
1786
|
+
state$n.rpc = result.value;
|
|
1787
1787
|
listen$1(result.value);
|
|
1788
1788
|
return success(undefined);
|
|
1789
1789
|
};
|
|
1790
1790
|
|
|
1791
1791
|
// TODO needed?
|
|
1792
|
-
const dispose$
|
|
1793
|
-
const rpc = state$
|
|
1794
|
-
state$
|
|
1792
|
+
const dispose$q = async () => {
|
|
1793
|
+
const rpc = state$n.rpc;
|
|
1794
|
+
state$n.rpc = undefined;
|
|
1795
1795
|
await rpc?.dispose();
|
|
1796
1796
|
};
|
|
1797
1797
|
const send$1 = (method, ...params) => {
|
|
1798
1798
|
record('sent', method, params);
|
|
1799
1799
|
// @ts-ignore
|
|
1800
|
-
state$
|
|
1800
|
+
state$n.rpc.send(method, ...params);
|
|
1801
1801
|
};
|
|
1802
1802
|
const invoke$1 = (method, ...params) => {
|
|
1803
1803
|
record('sent', method, params);
|
|
1804
1804
|
// @ts-ignore
|
|
1805
|
-
return state$
|
|
1805
|
+
return state$n.rpc.invoke(method, ...params);
|
|
1806
1806
|
};
|
|
1807
1807
|
const invokeAndTransfer = (method, ...params) => {
|
|
1808
1808
|
record('sent', method, params);
|
|
1809
1809
|
// @ts-ignore
|
|
1810
|
-
return state$
|
|
1810
|
+
return state$n.rpc.invokeAndTransfer(method, ...params);
|
|
1811
1811
|
};
|
|
1812
1812
|
|
|
1813
|
-
const state$
|
|
1813
|
+
const state$m = {
|
|
1814
1814
|
client: undefined,
|
|
1815
1815
|
enabled: false,
|
|
1816
1816
|
lastError: '',
|
|
@@ -1820,38 +1820,38 @@ const state$l = {
|
|
|
1820
1820
|
const workerUrl = new URL('sessionReplayWorkerMain.js', import.meta.url);
|
|
1821
1821
|
const reloadMessage = 'Reload the window to start session replay with the complete DOM command history';
|
|
1822
1822
|
const report = error => {
|
|
1823
|
-
state$
|
|
1824
|
-
state$
|
|
1825
|
-
state$
|
|
1826
|
-
console.warn(`Session replay: ${state$
|
|
1823
|
+
state$m.lastError = error instanceof Error ? error.message : String(error);
|
|
1824
|
+
state$m.stopObserving?.();
|
|
1825
|
+
state$m.stopObserving = undefined;
|
|
1826
|
+
console.warn(`Session replay: ${state$m.lastError}`);
|
|
1827
1827
|
};
|
|
1828
1828
|
|
|
1829
1829
|
// Retain snapshot recording for older renderer workers during dependency rollout.
|
|
1830
1830
|
const configure$1 = async options => {
|
|
1831
|
-
state$
|
|
1832
|
-
state$
|
|
1833
|
-
state$
|
|
1834
|
-
if (state$
|
|
1831
|
+
state$m.stopObserving?.();
|
|
1832
|
+
state$m.stopObserving = undefined;
|
|
1833
|
+
state$m.enabled = false;
|
|
1834
|
+
if (state$m.client) {
|
|
1835
1835
|
try {
|
|
1836
|
-
await state$
|
|
1836
|
+
await state$m.client.invoke('stop');
|
|
1837
1837
|
} catch (error) {
|
|
1838
1838
|
report(error);
|
|
1839
1839
|
}
|
|
1840
1840
|
// Live channels still need their proxy after capture stops.
|
|
1841
|
-
if (!state$
|
|
1842
|
-
state$
|
|
1843
|
-
state$
|
|
1841
|
+
if (!state$m.proxy) {
|
|
1842
|
+
state$m.client.dispose();
|
|
1843
|
+
state$m.client = undefined;
|
|
1844
1844
|
}
|
|
1845
1845
|
}
|
|
1846
1846
|
if (!options.local && !options.upload) return '';
|
|
1847
|
-
if (state$
|
|
1848
|
-
state$
|
|
1847
|
+
if (state$m.proxy) throw new Error(reloadMessage);
|
|
1848
|
+
state$m.lastError = '';
|
|
1849
1849
|
const client = createClient(workerUrl);
|
|
1850
1850
|
try {
|
|
1851
1851
|
const id = await client.invoke('start', options);
|
|
1852
|
-
state$
|
|
1853
|
-
state$
|
|
1854
|
-
state$
|
|
1852
|
+
state$m.stopObserving = observe(document, (type, data) => client.invoke('record', type, data), report);
|
|
1853
|
+
state$m.client = client;
|
|
1854
|
+
state$m.enabled = true;
|
|
1855
1855
|
return id;
|
|
1856
1856
|
} catch (error) {
|
|
1857
1857
|
client.dispose();
|
|
@@ -1859,7 +1859,7 @@ const configure$1 = async options => {
|
|
|
1859
1859
|
}
|
|
1860
1860
|
};
|
|
1861
1861
|
const configureProxy = async (options, port) => {
|
|
1862
|
-
if (state$
|
|
1862
|
+
if (state$m.client || !options.local && !options.upload) {
|
|
1863
1863
|
port.close();
|
|
1864
1864
|
throw new Error(reloadMessage);
|
|
1865
1865
|
}
|
|
@@ -1872,25 +1872,25 @@ const configureProxy = async (options, port) => {
|
|
|
1872
1872
|
commandMap: commandMapRef,
|
|
1873
1873
|
messagePort: proxyPort
|
|
1874
1874
|
});
|
|
1875
|
-
const original = state$
|
|
1876
|
-
state$
|
|
1875
|
+
const original = state$n.rpc;
|
|
1876
|
+
state$n.rpc = {
|
|
1877
1877
|
...rpc,
|
|
1878
1878
|
async dispose() {
|
|
1879
1879
|
try {
|
|
1880
1880
|
await rpc.dispose();
|
|
1881
1881
|
} finally {
|
|
1882
1882
|
client.dispose();
|
|
1883
|
-
state$
|
|
1884
|
-
state$
|
|
1885
|
-
state$
|
|
1883
|
+
state$m.client = undefined;
|
|
1884
|
+
state$m.enabled = false;
|
|
1885
|
+
state$m.proxy = false;
|
|
1886
1886
|
await original?.dispose();
|
|
1887
1887
|
}
|
|
1888
1888
|
}
|
|
1889
1889
|
};
|
|
1890
|
-
state$
|
|
1891
|
-
state$
|
|
1892
|
-
state$
|
|
1893
|
-
state$
|
|
1890
|
+
state$m.client = client;
|
|
1891
|
+
state$m.enabled = true;
|
|
1892
|
+
state$m.proxy = true;
|
|
1893
|
+
state$m.lastError = '';
|
|
1894
1894
|
return id;
|
|
1895
1895
|
} catch (error) {
|
|
1896
1896
|
proxyPort?.close();
|
|
@@ -1900,21 +1900,21 @@ const configureProxy = async (options, port) => {
|
|
|
1900
1900
|
}
|
|
1901
1901
|
};
|
|
1902
1902
|
const getSession = async () => {
|
|
1903
|
-
if (!state$
|
|
1904
|
-
return state$
|
|
1903
|
+
if (!state$m.enabled || !state$m.client) throw new Error('Session replay is disabled in settings');
|
|
1904
|
+
return state$m.client.invoke('export');
|
|
1905
1905
|
};
|
|
1906
1906
|
const getStatus$1 = async () => {
|
|
1907
|
-
if (!state$
|
|
1907
|
+
if (!state$m.client) return {
|
|
1908
1908
|
enabled: false,
|
|
1909
|
-
error: state$
|
|
1909
|
+
error: state$m.lastError
|
|
1910
1910
|
};
|
|
1911
1911
|
return {
|
|
1912
|
-
enabled: state$
|
|
1913
|
-
...(await state$
|
|
1914
|
-
captureError: state$
|
|
1912
|
+
enabled: state$m.enabled,
|
|
1913
|
+
...(await state$m.client.invoke('status')),
|
|
1914
|
+
captureError: state$m.lastError
|
|
1915
1915
|
};
|
|
1916
1916
|
};
|
|
1917
|
-
const flush = async () => state$
|
|
1917
|
+
const flush = async () => state$m.client?.invoke('flush');
|
|
1918
1918
|
const openLocalFile = async () => {
|
|
1919
1919
|
const input = document.createElement('input');
|
|
1920
1920
|
input.type = 'file';
|
|
@@ -1971,13 +1971,13 @@ const initializeLayout = async href => {
|
|
|
1971
1971
|
}
|
|
1972
1972
|
return true;
|
|
1973
1973
|
};
|
|
1974
|
-
const dispose$
|
|
1975
|
-
state$
|
|
1976
|
-
state$
|
|
1977
|
-
const client = state$
|
|
1978
|
-
state$
|
|
1979
|
-
state$
|
|
1980
|
-
state$
|
|
1974
|
+
const dispose$p = async () => {
|
|
1975
|
+
state$m.stopObserving?.();
|
|
1976
|
+
state$m.stopObserving = undefined;
|
|
1977
|
+
const client = state$m.client;
|
|
1978
|
+
state$m.client = undefined;
|
|
1979
|
+
state$m.enabled = false;
|
|
1980
|
+
state$m.proxy = false;
|
|
1981
1981
|
if (client) {
|
|
1982
1982
|
try {
|
|
1983
1983
|
await client.invoke('flush');
|
|
@@ -2049,7 +2049,7 @@ const apply = (uid, args) => {
|
|
|
2049
2049
|
for (const index of indices) scaled[index] *= view.speed;
|
|
2050
2050
|
return scaled;
|
|
2051
2051
|
};
|
|
2052
|
-
const dispose$
|
|
2052
|
+
const dispose$o = uid => {
|
|
2053
2053
|
views.delete(uid);
|
|
2054
2054
|
};
|
|
2055
2055
|
|
|
@@ -2089,10 +2089,10 @@ const measurePrefix = (text, offset, fontWeight, fontSize, fontFamily, letterSpa
|
|
|
2089
2089
|
};
|
|
2090
2090
|
|
|
2091
2091
|
const pendingInputs = new Set();
|
|
2092
|
-
const state$
|
|
2092
|
+
const state$l = {
|
|
2093
2093
|
shortcut: undefined
|
|
2094
2094
|
};
|
|
2095
|
-
const hasPending = () => Boolean(state$
|
|
2095
|
+
const hasPending = () => Boolean(state$l.shortcut || pendingInputs.size > 0);
|
|
2096
2096
|
const settle = async result => {
|
|
2097
2097
|
try {
|
|
2098
2098
|
await result;
|
|
@@ -2110,7 +2110,7 @@ const runAfterShortcut = async (previous, run) => {
|
|
|
2110
2110
|
};
|
|
2111
2111
|
const runInput = run => {
|
|
2112
2112
|
// Inputs in the same burst run concurrently so the worker can coalesce renders.
|
|
2113
|
-
const result = runAfterShortcut(state$
|
|
2113
|
+
const result = runAfterShortcut(state$l.shortcut, run);
|
|
2114
2114
|
const settled = settle(result);
|
|
2115
2115
|
pendingInputs.add(settled);
|
|
2116
2116
|
void removeInput(settled);
|
|
@@ -2122,15 +2122,15 @@ const runAfterInputs = async (earlier, run) => {
|
|
|
2122
2122
|
};
|
|
2123
2123
|
const clearShortcut = async settled => {
|
|
2124
2124
|
await settled;
|
|
2125
|
-
if (state$
|
|
2125
|
+
if (state$l.shortcut === settled) state$l.shortcut = undefined;
|
|
2126
2126
|
};
|
|
2127
2127
|
const runShortcut = run => {
|
|
2128
2128
|
// Snapshot only earlier input; later input waits for this shortcut instead.
|
|
2129
2129
|
const earlier = [...pendingInputs];
|
|
2130
|
-
if (state$
|
|
2130
|
+
if (state$l.shortcut) earlier.push(state$l.shortcut);
|
|
2131
2131
|
const result = runAfterInputs(earlier, run);
|
|
2132
2132
|
const settled = settle(result);
|
|
2133
|
-
state$
|
|
2133
|
+
state$l.shortcut = settled;
|
|
2134
2134
|
void clearShortcut(settled);
|
|
2135
2135
|
return result;
|
|
2136
2136
|
};
|
|
@@ -2637,7 +2637,7 @@ const createIdGenerator = () => {
|
|
|
2637
2637
|
};
|
|
2638
2638
|
const create$z = createIdGenerator();
|
|
2639
2639
|
|
|
2640
|
-
const state$
|
|
2640
|
+
const state$k = Object.create(null);
|
|
2641
2641
|
const retainString = (item, index) => {
|
|
2642
2642
|
const value = new Promise(resolve => {
|
|
2643
2643
|
item.getAsString(resolve);
|
|
@@ -2688,25 +2688,25 @@ const retainItems = dataTransfer => {
|
|
|
2688
2688
|
};
|
|
2689
2689
|
const addItems = items => {
|
|
2690
2690
|
const id = create$z();
|
|
2691
|
-
state$
|
|
2691
|
+
state$k[id] = items;
|
|
2692
2692
|
return id;
|
|
2693
2693
|
};
|
|
2694
2694
|
const add$2 = dataTransfer => {
|
|
2695
2695
|
return addItems(retainItems(dataTransfer));
|
|
2696
2696
|
};
|
|
2697
2697
|
const acquire$2 = id => {
|
|
2698
|
-
const items = state$
|
|
2698
|
+
const items = state$k[id];
|
|
2699
2699
|
if (!items) {
|
|
2700
2700
|
throw new Error(`Drop data not found: ${id}`);
|
|
2701
2701
|
}
|
|
2702
|
-
delete state$
|
|
2702
|
+
delete state$k[id];
|
|
2703
2703
|
return items;
|
|
2704
2704
|
};
|
|
2705
2705
|
|
|
2706
|
-
const state$
|
|
2706
|
+
const state$j = Object.create(null);
|
|
2707
2707
|
const acquire$1 = id => {
|
|
2708
|
-
const promise = state$
|
|
2709
|
-
delete state$
|
|
2708
|
+
const promise = state$j[id];
|
|
2709
|
+
delete state$j[id];
|
|
2710
2710
|
return promise;
|
|
2711
2711
|
};
|
|
2712
2712
|
const getFileHandles = async ids => {
|
|
@@ -2716,7 +2716,7 @@ const getFileHandles = async ids => {
|
|
|
2716
2716
|
};
|
|
2717
2717
|
const add$1 = promise => {
|
|
2718
2718
|
const id = create$z();
|
|
2719
|
-
state$
|
|
2719
|
+
state$j[id] = promise;
|
|
2720
2720
|
return id;
|
|
2721
2721
|
};
|
|
2722
2722
|
const addFileHandle$1 = fileHandle => {
|
|
@@ -2910,14 +2910,14 @@ const getEventListenerArgs = (params, event) => {
|
|
|
2910
2910
|
return serialized;
|
|
2911
2911
|
};
|
|
2912
2912
|
|
|
2913
|
-
const state$
|
|
2913
|
+
const state$i = {
|
|
2914
2914
|
ipc: undefined
|
|
2915
2915
|
};
|
|
2916
2916
|
const getIpc = () => {
|
|
2917
|
-
return state$
|
|
2917
|
+
return state$i.ipc;
|
|
2918
2918
|
};
|
|
2919
2919
|
const setIpc = value => {
|
|
2920
|
-
state$
|
|
2920
|
+
state$i.ipc = value;
|
|
2921
2921
|
};
|
|
2922
2922
|
|
|
2923
2923
|
const nameAnonymousFunction$1 = (fn, name) => {
|
|
@@ -4654,34 +4654,34 @@ const launchDragAndDropWorker = async () => {
|
|
|
4654
4654
|
}
|
|
4655
4655
|
};
|
|
4656
4656
|
|
|
4657
|
-
const state$
|
|
4657
|
+
const state$h = {
|
|
4658
4658
|
rpc: undefined
|
|
4659
4659
|
};
|
|
4660
4660
|
const hydrate$3 = async () => {
|
|
4661
4661
|
const result = await launchDragAndDropWorker();
|
|
4662
4662
|
if (isError(result)) {
|
|
4663
|
-
state$
|
|
4663
|
+
state$h.rpc = undefined;
|
|
4664
4664
|
return result;
|
|
4665
4665
|
}
|
|
4666
|
-
state$
|
|
4666
|
+
state$h.rpc = result.value;
|
|
4667
4667
|
return success(undefined);
|
|
4668
4668
|
};
|
|
4669
4669
|
const handleMessagePort$1 = async port => {
|
|
4670
|
-
if (!state$
|
|
4670
|
+
if (!state$h.rpc) {
|
|
4671
4671
|
const result = await hydrate$3();
|
|
4672
4672
|
if (isError(result)) {
|
|
4673
4673
|
throw result.error;
|
|
4674
4674
|
}
|
|
4675
4675
|
}
|
|
4676
|
-
const rpc = state$
|
|
4676
|
+
const rpc = state$h.rpc;
|
|
4677
4677
|
if (!rpc) {
|
|
4678
4678
|
throw new Error('Drag And Drop Worker failed to initialize');
|
|
4679
4679
|
}
|
|
4680
4680
|
await rpc.invokeAndTransfer('DragAndDrop.handleMessagePort', port);
|
|
4681
4681
|
};
|
|
4682
|
-
const dispose$
|
|
4683
|
-
const rpc = state$
|
|
4684
|
-
state$
|
|
4682
|
+
const dispose$n = async () => {
|
|
4683
|
+
const rpc = state$h.rpc;
|
|
4684
|
+
state$h.rpc = undefined;
|
|
4685
4685
|
await rpc?.dispose();
|
|
4686
4686
|
};
|
|
4687
4687
|
|
|
@@ -4740,12 +4740,12 @@ const unregisterView = uid => {
|
|
|
4740
4740
|
viewRpcIds.delete(uid);
|
|
4741
4741
|
};
|
|
4742
4742
|
|
|
4743
|
-
const state$
|
|
4743
|
+
const state$g = {
|
|
4744
4744
|
snapshot: undefined
|
|
4745
4745
|
};
|
|
4746
|
-
const get$7 = () => state$
|
|
4746
|
+
const get$7 = () => state$g.snapshot;
|
|
4747
4747
|
const set$9 = value => {
|
|
4748
|
-
state$
|
|
4748
|
+
state$g.snapshot = value;
|
|
4749
4749
|
};
|
|
4750
4750
|
|
|
4751
4751
|
const ipcs = Object.create(null);
|
|
@@ -5168,7 +5168,7 @@ const create$t = async ({
|
|
|
5168
5168
|
// @ts-ignore
|
|
5169
5169
|
return module.create(options);
|
|
5170
5170
|
};
|
|
5171
|
-
const dispose$
|
|
5171
|
+
const dispose$m = id => {
|
|
5172
5172
|
const worker = remove$3(id);
|
|
5173
5173
|
if (worker) {
|
|
5174
5174
|
remove$6(worker);
|
|
@@ -5299,32 +5299,32 @@ const launchWorkers = async () => {
|
|
|
5299
5299
|
return success(undefined);
|
|
5300
5300
|
};
|
|
5301
5301
|
|
|
5302
|
-
const state$
|
|
5302
|
+
const state$f = {
|
|
5303
5303
|
renderer: undefined
|
|
5304
5304
|
};
|
|
5305
5305
|
const configure = options => {
|
|
5306
5306
|
const cache = options?.cache;
|
|
5307
|
-
state$
|
|
5307
|
+
state$f.renderer = cache?.dom > 0 || cache?.text > 0 ? createRenderer(options) : undefined;
|
|
5308
5308
|
};
|
|
5309
5309
|
const render = (nodes, eventMap = {}, newEventMap = {}) => {
|
|
5310
|
-
return state$
|
|
5310
|
+
return state$f.renderer?.render(nodes, eventMap, newEventMap) || render$1(nodes, eventMap, newEventMap);
|
|
5311
5311
|
};
|
|
5312
5312
|
const renderInto = (parent, nodes, eventMap = {}, newEventMap = {}) => {
|
|
5313
|
-
if (state$
|
|
5314
|
-
state$
|
|
5313
|
+
if (state$f.renderer) {
|
|
5314
|
+
state$f.renderer.renderInto(parent, nodes, eventMap, newEventMap);
|
|
5315
5315
|
return;
|
|
5316
5316
|
}
|
|
5317
5317
|
renderInto$1(parent, nodes, eventMap);
|
|
5318
5318
|
};
|
|
5319
5319
|
const applyPatch$1 = (element, patches, eventMap = {}, id = 0) => {
|
|
5320
|
-
if (state$
|
|
5321
|
-
state$
|
|
5320
|
+
if (state$f.renderer) {
|
|
5321
|
+
state$f.renderer.applyPatch(element, patches, eventMap, id);
|
|
5322
5322
|
return;
|
|
5323
5323
|
}
|
|
5324
5324
|
applyPatch$2(element, patches, eventMap, id);
|
|
5325
5325
|
};
|
|
5326
|
-
const dispose$
|
|
5327
|
-
state$
|
|
5326
|
+
const dispose$l = root => {
|
|
5327
|
+
state$f.renderer?.dispose(root);
|
|
5328
5328
|
};
|
|
5329
5329
|
|
|
5330
5330
|
const applyPatch = (element, patches, eventMap = {}, id = 0) => {
|
|
@@ -5337,6 +5337,81 @@ const attachEvents$7 = ($Node, eventMap) => {
|
|
|
5337
5337
|
}
|
|
5338
5338
|
};
|
|
5339
5339
|
|
|
5340
|
+
const selector = 'textarea[name="composer"]';
|
|
5341
|
+
const state$e = {
|
|
5342
|
+
handled: false
|
|
5343
|
+
};
|
|
5344
|
+
const hasFocus = () => !!document.activeElement && document.activeElement !== document.body && document.activeElement !== document.documentElement;
|
|
5345
|
+
const dispose$k = viewletId => {
|
|
5346
|
+
const pending = state$e.pending;
|
|
5347
|
+
if (pending && pending.id === viewletId) pending.cancel();
|
|
5348
|
+
};
|
|
5349
|
+
|
|
5350
|
+
// The route's composer can arrive after the initial workbench frame.
|
|
5351
|
+
const focus$d = viewletId => {
|
|
5352
|
+
if (state$e.handled || !/(?:^|\/)chat\/?$/.test(location.pathname)) {
|
|
5353
|
+
return;
|
|
5354
|
+
}
|
|
5355
|
+
if (!get$b(viewletId)?.state.$Viewlet.querySelector(selector)) {
|
|
5356
|
+
return;
|
|
5357
|
+
}
|
|
5358
|
+
state$e.handled = true;
|
|
5359
|
+
if (hasFocus()) {
|
|
5360
|
+
return;
|
|
5361
|
+
}
|
|
5362
|
+
let cancelled = false;
|
|
5363
|
+
let mutations;
|
|
5364
|
+
let sizes;
|
|
5365
|
+
let observed;
|
|
5366
|
+
const cancel = () => {
|
|
5367
|
+
cancelled = true;
|
|
5368
|
+
document.removeEventListener('focusin', cancel, true);
|
|
5369
|
+
mutations?.disconnect();
|
|
5370
|
+
sizes?.disconnect();
|
|
5371
|
+
state$e.pending = undefined;
|
|
5372
|
+
};
|
|
5373
|
+
state$e.pending = {
|
|
5374
|
+
cancel,
|
|
5375
|
+
id: viewletId
|
|
5376
|
+
};
|
|
5377
|
+
document.addEventListener('focusin', cancel, {
|
|
5378
|
+
capture: true
|
|
5379
|
+
});
|
|
5380
|
+
const tryFocus = () => {
|
|
5381
|
+
if (cancelled) return;
|
|
5382
|
+
const input = get$b(viewletId)?.state.$Viewlet.querySelector(selector);
|
|
5383
|
+
if (hasFocus() || !(input instanceof HTMLTextAreaElement)) {
|
|
5384
|
+
cancel();
|
|
5385
|
+
return;
|
|
5386
|
+
}
|
|
5387
|
+
if (input.isConnected && input.getClientRects().length > 0) {
|
|
5388
|
+
input.focus({
|
|
5389
|
+
preventScroll: true
|
|
5390
|
+
});
|
|
5391
|
+
if (document.activeElement === input) {
|
|
5392
|
+
cancel();
|
|
5393
|
+
return;
|
|
5394
|
+
}
|
|
5395
|
+
}
|
|
5396
|
+
// A detached or hidden first render is not the user's focus opportunity.
|
|
5397
|
+
// Watch actual mounting/layout rather than consuming it after a frame count.
|
|
5398
|
+
mutations ??= new MutationObserver(tryFocus);
|
|
5399
|
+
sizes ??= new ResizeObserver(tryFocus);
|
|
5400
|
+
mutations.observe(document.body, {
|
|
5401
|
+
attributeFilter: ['class', 'style', 'hidden', 'disabled', 'inert'],
|
|
5402
|
+
attributes: true,
|
|
5403
|
+
childList: true,
|
|
5404
|
+
subtree: true
|
|
5405
|
+
});
|
|
5406
|
+
if (observed !== input) {
|
|
5407
|
+
sizes.disconnect();
|
|
5408
|
+
sizes.observe(input);
|
|
5409
|
+
observed = input;
|
|
5410
|
+
}
|
|
5411
|
+
};
|
|
5412
|
+
requestAnimationFrame(() => requestAnimationFrame(tryFocus));
|
|
5413
|
+
};
|
|
5414
|
+
|
|
5340
5415
|
const state$d = {
|
|
5341
5416
|
styleSheets: Object.create(null),
|
|
5342
5417
|
texts: Object.create(null)
|
|
@@ -10296,6 +10371,7 @@ const setDom2 = (viewletId, dom) => {
|
|
|
10296
10371
|
$Viewlet: $NewViewlet
|
|
10297
10372
|
}
|
|
10298
10373
|
});
|
|
10374
|
+
focus$d(viewletId);
|
|
10299
10375
|
};
|
|
10300
10376
|
const setTreePatches = (uid, patches) => {
|
|
10301
10377
|
if (patches.length === 0) {
|
|
@@ -10390,11 +10466,12 @@ const commitPending = (uid, transactionId) => {
|
|
|
10390
10466
|
executeCommands(take(uid, transactionId, getFocusVersion()));
|
|
10391
10467
|
};
|
|
10392
10468
|
const dispose$4 = id => {
|
|
10469
|
+
dispose$k(id);
|
|
10393
10470
|
try {
|
|
10394
10471
|
number(id);
|
|
10395
10472
|
restoreComponentDom(id);
|
|
10396
10473
|
dispose$j(id);
|
|
10397
|
-
dispose$
|
|
10474
|
+
dispose$o(id);
|
|
10398
10475
|
unregisterView(id);
|
|
10399
10476
|
dispose$i(id);
|
|
10400
10477
|
const instance = get$b(id);
|
|
@@ -10405,7 +10482,7 @@ const dispose$4 = id => {
|
|
|
10405
10482
|
if (instance.factory.dispose) {
|
|
10406
10483
|
instance.factory.dispose(instance.state);
|
|
10407
10484
|
}
|
|
10408
|
-
dispose$
|
|
10485
|
+
dispose$l(instance.state.$Viewlet);
|
|
10409
10486
|
if (instance.state.$Viewlet?.isConnected) {
|
|
10410
10487
|
instance.state.$Viewlet.remove();
|
|
10411
10488
|
}
|
|
@@ -10742,9 +10819,9 @@ const restart = async () => {
|
|
|
10742
10819
|
const snapshot = await invoke$1('Reload.prepareHotReload');
|
|
10743
10820
|
set$9(snapshot);
|
|
10744
10821
|
await invoke$1('Reload.retire');
|
|
10745
|
-
await dispose$o();
|
|
10746
10822
|
await dispose$p();
|
|
10747
|
-
await dispose$
|
|
10823
|
+
await dispose$q();
|
|
10824
|
+
await dispose$n();
|
|
10748
10825
|
terminateAll();
|
|
10749
10826
|
clear$2();
|
|
10750
10827
|
clear$4();
|
|
@@ -12808,7 +12885,7 @@ const commandMap = {
|
|
|
12808
12885
|
'HotReload.request': request,
|
|
12809
12886
|
'InitData.getInitData': getInitData,
|
|
12810
12887
|
'IpcParent.create': create$t,
|
|
12811
|
-
'IpcParent.dispose': dispose$
|
|
12888
|
+
'IpcParent.dispose': dispose$m,
|
|
12812
12889
|
'KeyBindings.setIdentifiers': setIdentifiers,
|
|
12813
12890
|
'Layout.getBounds': getBounds,
|
|
12814
12891
|
'Location.getHref': getHref,
|