@lvce-editor/renderer-process 17.1.0 → 18.1.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 +111 -71
- package/package.json +1 -1
|
@@ -2621,7 +2621,27 @@ const getAssetDir = () => {
|
|
|
2621
2621
|
};
|
|
2622
2622
|
const assetDir = getAssetDir();
|
|
2623
2623
|
|
|
2624
|
-
const
|
|
2624
|
+
const getConfiguredWorkerUrl = key => {
|
|
2625
|
+
if (typeof location === 'undefined' || typeof document === 'undefined') {
|
|
2626
|
+
return '';
|
|
2627
|
+
}
|
|
2628
|
+
const configElement = document.getElementById('Config');
|
|
2629
|
+
if (!configElement) {
|
|
2630
|
+
return '';
|
|
2631
|
+
}
|
|
2632
|
+
const text = configElement.textContent;
|
|
2633
|
+
if (!text) {
|
|
2634
|
+
return '';
|
|
2635
|
+
}
|
|
2636
|
+
const config = JSON.parse(text);
|
|
2637
|
+
return config[key] || '';
|
|
2638
|
+
};
|
|
2639
|
+
|
|
2640
|
+
const getConfiguredRendererWorkerUrl = () => {
|
|
2641
|
+
return getConfiguredWorkerUrl('rendererWorkerUrl');
|
|
2642
|
+
};
|
|
2643
|
+
|
|
2644
|
+
const rendererWorkerUrl = getConfiguredRendererWorkerUrl() || `${assetDir}/packages/renderer-worker/src/rendererWorkerMain.ts`;
|
|
2625
2645
|
|
|
2626
2646
|
const getName = platform => {
|
|
2627
2647
|
switch (platform) {
|
|
@@ -8100,72 +8120,6 @@ const handleContextMenu$1 = event => {
|
|
|
8100
8120
|
return ['handleContextMenu', button, clientX, clientY];
|
|
8101
8121
|
};
|
|
8102
8122
|
|
|
8103
|
-
const create$5 = () => {
|
|
8104
|
-
// TODO set aria label for title bar menu
|
|
8105
|
-
// TODO add tests for aria properties
|
|
8106
|
-
const $Viewlet = document.createElement('div');
|
|
8107
|
-
$Viewlet.id = 'TitleBar';
|
|
8108
|
-
$Viewlet.className = 'Viewlet TitleBar';
|
|
8109
|
-
$Viewlet.ariaLabel = 'Title Bar';
|
|
8110
|
-
$Viewlet.role = ContentInfo;
|
|
8111
|
-
return {
|
|
8112
|
-
$TitleBar: $Viewlet,
|
|
8113
|
-
$Viewlet
|
|
8114
|
-
};
|
|
8115
|
-
};
|
|
8116
|
-
const attachEvents = state => {
|
|
8117
|
-
const {
|
|
8118
|
-
$Viewlet
|
|
8119
|
-
} = state;
|
|
8120
|
-
attachEvents$9($Viewlet, {
|
|
8121
|
-
[ContextMenu]: handleContextMenu$1
|
|
8122
|
-
});
|
|
8123
|
-
};
|
|
8124
|
-
const activeClassName = 'TitleBarActive';
|
|
8125
|
-
const setFocused = (state, isFocused) => {
|
|
8126
|
-
const {
|
|
8127
|
-
$Viewlet
|
|
8128
|
-
} = state;
|
|
8129
|
-
$Viewlet.classList.toggle(activeClassName, isFocused);
|
|
8130
|
-
};
|
|
8131
|
-
|
|
8132
|
-
const ViewletTitleBar = {
|
|
8133
|
-
__proto__: null,
|
|
8134
|
-
attachEvents,
|
|
8135
|
-
create: create$5,
|
|
8136
|
-
setFocused
|
|
8137
|
-
};
|
|
8138
|
-
|
|
8139
|
-
/**
|
|
8140
|
-
*
|
|
8141
|
-
* @param {MouseEvent} event
|
|
8142
|
-
*/
|
|
8143
|
-
const handleTitleBarButtonsClick = event => {
|
|
8144
|
-
const {
|
|
8145
|
-
target
|
|
8146
|
-
} = event;
|
|
8147
|
-
return ['handleClick', target.className];
|
|
8148
|
-
};
|
|
8149
|
-
const returnValue$1 = true;
|
|
8150
|
-
|
|
8151
|
-
const ViewletTitleBarButtonsEvents = {
|
|
8152
|
-
__proto__: null,
|
|
8153
|
-
handleTitleBarButtonsClick,
|
|
8154
|
-
returnValue: returnValue$1
|
|
8155
|
-
};
|
|
8156
|
-
|
|
8157
|
-
const ViewletTitleBarButtons = {
|
|
8158
|
-
__proto__: null,
|
|
8159
|
-
Events: ViewletTitleBarButtonsEvents
|
|
8160
|
-
};
|
|
8161
|
-
|
|
8162
|
-
const Events = {};
|
|
8163
|
-
|
|
8164
|
-
const ViewletTitleBarIcon = {
|
|
8165
|
-
__proto__: null,
|
|
8166
|
-
Events
|
|
8167
|
-
};
|
|
8168
|
-
|
|
8169
8123
|
const isInsideTitleBarMenu = $Element => {
|
|
8170
8124
|
return $Element.classList.contains('MenuItem') || $Element.classList.contains('Menu') || $Element.classList.contains('TitleBarTopLevelEntry') || $Element.classList.contains('TitleBarMenuBar');
|
|
8171
8125
|
};
|
|
@@ -8507,6 +8461,79 @@ const ViewletTitleBarMenuBar = {
|
|
|
8507
8461
|
setMenus
|
|
8508
8462
|
};
|
|
8509
8463
|
|
|
8464
|
+
const create$5 = () => {
|
|
8465
|
+
// TODO set aria label for title bar menu
|
|
8466
|
+
// TODO add tests for aria properties
|
|
8467
|
+
const $Viewlet = document.createElement('div');
|
|
8468
|
+
$Viewlet.id = 'TitleBar';
|
|
8469
|
+
$Viewlet.className = 'Viewlet TitleBar';
|
|
8470
|
+
$Viewlet.ariaLabel = 'Title Bar';
|
|
8471
|
+
$Viewlet.role = ContentInfo;
|
|
8472
|
+
return {
|
|
8473
|
+
$TitleBar: $Viewlet,
|
|
8474
|
+
$Viewlet
|
|
8475
|
+
};
|
|
8476
|
+
};
|
|
8477
|
+
const attachEvents = state => {
|
|
8478
|
+
const {
|
|
8479
|
+
$Viewlet
|
|
8480
|
+
} = state;
|
|
8481
|
+
attachEvents$9($Viewlet, {
|
|
8482
|
+
[ContextMenu]: handleContextMenu$1
|
|
8483
|
+
});
|
|
8484
|
+
};
|
|
8485
|
+
const activeClassName = 'TitleBarActive';
|
|
8486
|
+
const setFocused = (state, isFocused) => {
|
|
8487
|
+
const {
|
|
8488
|
+
$Viewlet
|
|
8489
|
+
} = state;
|
|
8490
|
+
$Viewlet.classList.toggle(activeClassName, isFocused);
|
|
8491
|
+
};
|
|
8492
|
+
|
|
8493
|
+
const ViewletTitleBar = {
|
|
8494
|
+
__proto__: null,
|
|
8495
|
+
Events: ViewletTitleBarMenuBarEvents,
|
|
8496
|
+
attachEvents,
|
|
8497
|
+
closeMenu,
|
|
8498
|
+
create: create$5,
|
|
8499
|
+
dispose: dispose$4,
|
|
8500
|
+
focus: focus$2,
|
|
8501
|
+
openMenu,
|
|
8502
|
+
setFocused,
|
|
8503
|
+
setFocusedIndex,
|
|
8504
|
+
setMenus
|
|
8505
|
+
};
|
|
8506
|
+
|
|
8507
|
+
/**
|
|
8508
|
+
*
|
|
8509
|
+
* @param {MouseEvent} event
|
|
8510
|
+
*/
|
|
8511
|
+
const handleTitleBarButtonsClick = event => {
|
|
8512
|
+
const {
|
|
8513
|
+
target
|
|
8514
|
+
} = event;
|
|
8515
|
+
return ['handleClick', target.className];
|
|
8516
|
+
};
|
|
8517
|
+
const returnValue$1 = true;
|
|
8518
|
+
|
|
8519
|
+
const ViewletTitleBarButtonsEvents = {
|
|
8520
|
+
__proto__: null,
|
|
8521
|
+
handleTitleBarButtonsClick,
|
|
8522
|
+
returnValue: returnValue$1
|
|
8523
|
+
};
|
|
8524
|
+
|
|
8525
|
+
const ViewletTitleBarButtons = {
|
|
8526
|
+
__proto__: null,
|
|
8527
|
+
Events: ViewletTitleBarButtonsEvents
|
|
8528
|
+
};
|
|
8529
|
+
|
|
8530
|
+
const Events = {};
|
|
8531
|
+
|
|
8532
|
+
const ViewletTitleBarIcon = {
|
|
8533
|
+
__proto__: null,
|
|
8534
|
+
Events
|
|
8535
|
+
};
|
|
8536
|
+
|
|
8510
8537
|
const create$4 = () => {
|
|
8511
8538
|
const $Viewlet = document.createElement('div');
|
|
8512
8539
|
$Viewlet.className = 'Viewlet TitleBarTitle';
|
|
@@ -8803,7 +8830,7 @@ const create$3 = (id, uid = id) => {
|
|
|
8803
8830
|
const createFunctionalRoot = (id, uid = id, hasFunctionalEvents) => {
|
|
8804
8831
|
let module = state$1.modules[id];
|
|
8805
8832
|
if (hasFunctionalEvents) {
|
|
8806
|
-
module
|
|
8833
|
+
module ||= {};
|
|
8807
8834
|
}
|
|
8808
8835
|
if (!module) {
|
|
8809
8836
|
throw new Error(`module not found: ${id}`);
|
|
@@ -9686,7 +9713,11 @@ const commandMap = {
|
|
|
9686
9713
|
'WindowTitle.set': set$1
|
|
9687
9714
|
};
|
|
9688
9715
|
|
|
9689
|
-
const
|
|
9716
|
+
const getConfiguredEditorWorkerUrl = () => {
|
|
9717
|
+
return getConfiguredWorkerUrl('editorWorkerUrl');
|
|
9718
|
+
};
|
|
9719
|
+
|
|
9720
|
+
const editorWorkerUrl = getConfiguredEditorWorkerUrl() || `${assetDir}/packages/renderer-worker/node_modules/@lvce-editor/editor-worker/dist/editorWorkerMain.js`;
|
|
9690
9721
|
|
|
9691
9722
|
const launchEditorWorker = async port => {
|
|
9692
9723
|
const ipc = await create$A({
|
|
@@ -9709,7 +9740,11 @@ const hydrate$2 = async () => {
|
|
|
9709
9740
|
await promise;
|
|
9710
9741
|
};
|
|
9711
9742
|
|
|
9712
|
-
const
|
|
9743
|
+
const getConfiguredExtensionHostWorkerUrl = () => {
|
|
9744
|
+
return getConfiguredWorkerUrl('extensionHostWorkerUrl');
|
|
9745
|
+
};
|
|
9746
|
+
|
|
9747
|
+
const extensionHostWorkerUrl = getConfiguredExtensionHostWorkerUrl() || `${assetDir}/packages/renderer-worker/node_modules/@lvce-editor/extension-host-worker/dist/extensionHostWorkerMain.js`;
|
|
9713
9748
|
|
|
9714
9749
|
const launchExtensionHostWorker = async port => {
|
|
9715
9750
|
const name = isElectron ? 'Extension Host (Electron)' : 'Extension Host';
|
|
@@ -9734,7 +9769,11 @@ const hydrate$1 = async () => {
|
|
|
9734
9769
|
await promise;
|
|
9735
9770
|
};
|
|
9736
9771
|
|
|
9737
|
-
const
|
|
9772
|
+
const getConfiguredSyntaxHighlightingWorkerUrl = () => {
|
|
9773
|
+
return getConfiguredWorkerUrl('syntaxHighlightingWorkerUrl');
|
|
9774
|
+
};
|
|
9775
|
+
|
|
9776
|
+
const syntaxHighlightingWorkerUrl = getConfiguredSyntaxHighlightingWorkerUrl() || `${assetDir}/packages/renderer-worker/node_modules/@lvce-editor/syntax-highlighting-worker/dist/syntaxHighlightingWorkerMain.js`;
|
|
9738
9777
|
|
|
9739
9778
|
const launchSyntaxHighlightingWorker = async port => {
|
|
9740
9779
|
const ipc = await create$A({
|
|
@@ -10133,6 +10172,7 @@ const main = async () => {
|
|
|
10133
10172
|
state$1.modules[EditorRename] = ViewletEditorRename;
|
|
10134
10173
|
state$1.modules[EditorSourceActions] = ViewletEditorSourceActions;
|
|
10135
10174
|
state$1.modules[FindWidget] = ViewletFindWidget;
|
|
10175
|
+
state$1.modules[TitleBar] = ViewletTitleBar;
|
|
10136
10176
|
// TODO this is discovered very late
|
|
10137
10177
|
await launchWorkers();
|
|
10138
10178
|
setIpc(RendererWorker);
|