@lvce-editor/renderer-process 30.67.0 → 30.68.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.
- package/dist/rendererProcessMain.js +67 -19
- package/package.json +1 -1
|
@@ -1559,10 +1559,39 @@ const Web = 1;
|
|
|
1559
1559
|
const Electron$1 = 2;
|
|
1560
1560
|
const Remote = 3;
|
|
1561
1561
|
|
|
1562
|
+
const getConfiguredWorkerUrl = key => {
|
|
1563
|
+
if (typeof location === 'undefined' || typeof document === 'undefined') {
|
|
1564
|
+
return '';
|
|
1565
|
+
}
|
|
1566
|
+
const configElement = document.getElementById('Config');
|
|
1567
|
+
if (!configElement) {
|
|
1568
|
+
return '';
|
|
1569
|
+
}
|
|
1570
|
+
const text = configElement.textContent;
|
|
1571
|
+
if (!text) {
|
|
1572
|
+
return '';
|
|
1573
|
+
}
|
|
1574
|
+
const config = JSON.parse(text);
|
|
1575
|
+
if (key === 'workerUrls') {
|
|
1576
|
+
return config.workerUrls || {};
|
|
1577
|
+
}
|
|
1578
|
+
return config[key] || '';
|
|
1579
|
+
};
|
|
1580
|
+
|
|
1562
1581
|
/**
|
|
1563
1582
|
* @returns {number}
|
|
1564
1583
|
*/
|
|
1565
1584
|
const getPlatform = () => {
|
|
1585
|
+
const configuredPlatform = getConfiguredWorkerUrl('platform');
|
|
1586
|
+
if (configuredPlatform === 'electron') {
|
|
1587
|
+
return Electron$1;
|
|
1588
|
+
}
|
|
1589
|
+
if (configuredPlatform === 'web') {
|
|
1590
|
+
return Web;
|
|
1591
|
+
}
|
|
1592
|
+
if (configuredPlatform === 'remote') {
|
|
1593
|
+
return Remote;
|
|
1594
|
+
}
|
|
1566
1595
|
// @ts-expect-error
|
|
1567
1596
|
if (typeof PLATFORM !== 'undefined') {
|
|
1568
1597
|
// @ts-expect-error
|
|
@@ -1583,6 +1612,10 @@ const getPlatform = () => {
|
|
|
1583
1612
|
const platform = getPlatform();
|
|
1584
1613
|
|
|
1585
1614
|
const getAssetDir = () => {
|
|
1615
|
+
const configuredAssetDir = getConfiguredWorkerUrl('assetDir');
|
|
1616
|
+
if (configuredAssetDir) {
|
|
1617
|
+
return configuredAssetDir;
|
|
1618
|
+
}
|
|
1586
1619
|
// @ts-expect-error
|
|
1587
1620
|
if (typeof ASSET_DIR !== 'undefined') {
|
|
1588
1621
|
// @ts-expect-error
|
|
@@ -1595,22 +1628,6 @@ const getAssetDir = () => {
|
|
|
1595
1628
|
};
|
|
1596
1629
|
const assetDir = getAssetDir();
|
|
1597
1630
|
|
|
1598
|
-
const getConfiguredWorkerUrl = key => {
|
|
1599
|
-
if (typeof location === 'undefined' || typeof document === 'undefined') {
|
|
1600
|
-
return '';
|
|
1601
|
-
}
|
|
1602
|
-
const configElement = document.getElementById('Config');
|
|
1603
|
-
if (!configElement) {
|
|
1604
|
-
return '';
|
|
1605
|
-
}
|
|
1606
|
-
const text = configElement.textContent;
|
|
1607
|
-
if (!text) {
|
|
1608
|
-
return '';
|
|
1609
|
-
}
|
|
1610
|
-
const config = JSON.parse(text);
|
|
1611
|
-
return config[key] || '';
|
|
1612
|
-
};
|
|
1613
|
-
|
|
1614
1631
|
const getConfiguredRendererWorkerUrl = () => {
|
|
1615
1632
|
return getConfiguredWorkerUrl('rendererWorkerUrl');
|
|
1616
1633
|
};
|
|
@@ -1629,9 +1646,15 @@ const getName = platform => {
|
|
|
1629
1646
|
};
|
|
1630
1647
|
const launchRendererWorker = async () => {
|
|
1631
1648
|
const name = getName(platform);
|
|
1649
|
+
const url = new URL(rendererWorkerUrl, location.href);
|
|
1650
|
+
url.searchParams.set('config', JSON.stringify({
|
|
1651
|
+
assetDir: assetDir,
|
|
1652
|
+
platform: platform,
|
|
1653
|
+
workerUrls: getConfiguredWorkerUrl('workerUrls')
|
|
1654
|
+
}));
|
|
1632
1655
|
return launchWorker({
|
|
1633
1656
|
name,
|
|
1634
|
-
url:
|
|
1657
|
+
url: url.href
|
|
1635
1658
|
});
|
|
1636
1659
|
};
|
|
1637
1660
|
|
|
@@ -1951,6 +1974,19 @@ const dispose$l = async () => {
|
|
|
1951
1974
|
}
|
|
1952
1975
|
};
|
|
1953
1976
|
|
|
1977
|
+
const isAvailable = () => {
|
|
1978
|
+
const tauriWindow = window;
|
|
1979
|
+
return typeof tauriWindow.__TAURI__?.core?.invoke === 'function';
|
|
1980
|
+
};
|
|
1981
|
+
const toggleDevtools = async () => {
|
|
1982
|
+
const tauriWindow = window;
|
|
1983
|
+
const core = tauriWindow.__TAURI__?.core;
|
|
1984
|
+
if (!core) {
|
|
1985
|
+
throw new Error('Tauri is not available');
|
|
1986
|
+
}
|
|
1987
|
+
await core.invoke('toggle_devtools');
|
|
1988
|
+
};
|
|
1989
|
+
|
|
1954
1990
|
const getConfiguredDragAndDropWorkerUrl = () => {
|
|
1955
1991
|
const workerUrls = getConfiguredWorkerUrl('workerUrls');
|
|
1956
1992
|
return workerUrls?.['develop.dragAndDropWorkerPath'] || '';
|
|
@@ -4116,7 +4152,12 @@ const clear$3 = () => {
|
|
|
4116
4152
|
};
|
|
4117
4153
|
|
|
4118
4154
|
const getConfiguredEditorWorkerUrl = () => {
|
|
4119
|
-
|
|
4155
|
+
const editorWorkerUrl = getConfiguredWorkerUrl('editorWorkerUrl');
|
|
4156
|
+
if (editorWorkerUrl) {
|
|
4157
|
+
return editorWorkerUrl;
|
|
4158
|
+
}
|
|
4159
|
+
const workerUrls = getConfiguredWorkerUrl('workerUrls');
|
|
4160
|
+
return workerUrls?.['develop.editorWorkerPath'] || '';
|
|
4120
4161
|
};
|
|
4121
4162
|
|
|
4122
4163
|
const editorWorkerUrl = getConfiguredEditorWorkerUrl() || `${assetDir}/packages/renderer-worker/node_modules/@lvce-editor/editor-worker/dist/editorWorkerMain.js`;
|
|
@@ -4541,7 +4582,12 @@ const hydrate$2 = async () => {
|
|
|
4541
4582
|
};
|
|
4542
4583
|
|
|
4543
4584
|
const getConfiguredSyntaxHighlightingWorkerUrl = () => {
|
|
4544
|
-
|
|
4585
|
+
const syntaxHighlightingWorkerUrl = getConfiguredWorkerUrl('syntaxHighlightingWorkerUrl');
|
|
4586
|
+
if (syntaxHighlightingWorkerUrl) {
|
|
4587
|
+
return syntaxHighlightingWorkerUrl;
|
|
4588
|
+
}
|
|
4589
|
+
const workerUrls = getConfiguredWorkerUrl('workerUrls');
|
|
4590
|
+
return workerUrls?.['developer.syntaxHighlightingWorkerPath'] || '';
|
|
4545
4591
|
};
|
|
4546
4592
|
|
|
4547
4593
|
const syntaxHighlightingWorkerUrl = getConfiguredSyntaxHighlightingWorkerUrl() || `${assetDir}/packages/renderer-worker/node_modules/@lvce-editor/syntax-highlighting-worker/dist/syntaxHighlightingWorkerMain.js`;
|
|
@@ -11962,6 +12008,8 @@ const commandMap = {
|
|
|
11962
12008
|
'SessionReplay.getSession': getSession,
|
|
11963
12009
|
'SessionReplay.getStatus': getStatus$1,
|
|
11964
12010
|
'SessionReplay.openLocalFile': openLocalFile,
|
|
12011
|
+
'Tauri.isAvailable': isAvailable,
|
|
12012
|
+
'Tauri.toggleDevtools': toggleDevtools,
|
|
11965
12013
|
'TestFrameWork.checkConditionError': checkConditionError,
|
|
11966
12014
|
'TestFrameWork.checkMultiElementCondition': checkMultiElementCondition,
|
|
11967
12015
|
'TestFrameWork.checkSingleElementCondition': checkSingleElementCondition,
|