@lvce-editor/about-view 7.2.0 → 7.3.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/aboutWorkerMain.js +631 -429
- package/package.json +1 -1
package/dist/aboutWorkerMain.js
CHANGED
|
@@ -1,3 +1,277 @@
|
|
|
1
|
+
const toCommandId = key => {
|
|
2
|
+
const dotIndex = key.indexOf('.');
|
|
3
|
+
return key.slice(dotIndex + 1);
|
|
4
|
+
};
|
|
5
|
+
const create$a = () => {
|
|
6
|
+
const states = Object.create(null);
|
|
7
|
+
const commandMapRef = {};
|
|
8
|
+
return {
|
|
9
|
+
clear() {
|
|
10
|
+
for (const key of Object.keys(states)) {
|
|
11
|
+
delete states[key];
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
diff(uid, modules, numbers) {
|
|
15
|
+
const {
|
|
16
|
+
oldState,
|
|
17
|
+
scheduledState
|
|
18
|
+
} = states[uid];
|
|
19
|
+
const diffResult = [];
|
|
20
|
+
for (let i = 0; i < modules.length; i++) {
|
|
21
|
+
const fn = modules[i];
|
|
22
|
+
if (!fn(oldState, scheduledState)) {
|
|
23
|
+
diffResult.push(numbers[i]);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return diffResult;
|
|
27
|
+
},
|
|
28
|
+
dispose(uid) {
|
|
29
|
+
delete states[uid];
|
|
30
|
+
},
|
|
31
|
+
get(uid) {
|
|
32
|
+
return states[uid];
|
|
33
|
+
},
|
|
34
|
+
getCommandIds() {
|
|
35
|
+
const keys = Object.keys(commandMapRef);
|
|
36
|
+
const ids = keys.map(toCommandId);
|
|
37
|
+
return ids;
|
|
38
|
+
},
|
|
39
|
+
getKeys() {
|
|
40
|
+
return Object.keys(states).map(Number);
|
|
41
|
+
},
|
|
42
|
+
registerCommands(commandMap) {
|
|
43
|
+
Object.assign(commandMapRef, commandMap);
|
|
44
|
+
},
|
|
45
|
+
set(uid, oldState, newState, scheduledState) {
|
|
46
|
+
states[uid] = {
|
|
47
|
+
newState,
|
|
48
|
+
oldState,
|
|
49
|
+
scheduledState: scheduledState ?? newState
|
|
50
|
+
};
|
|
51
|
+
},
|
|
52
|
+
wrapCommand(fn) {
|
|
53
|
+
const wrapped = async (uid, ...args) => {
|
|
54
|
+
const {
|
|
55
|
+
newState,
|
|
56
|
+
oldState
|
|
57
|
+
} = states[uid];
|
|
58
|
+
const newerState = await fn(newState, ...args);
|
|
59
|
+
if (oldState === newerState || newState === newerState) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const latestOld = states[uid];
|
|
63
|
+
const latestNew = {
|
|
64
|
+
...latestOld.newState,
|
|
65
|
+
...newerState
|
|
66
|
+
};
|
|
67
|
+
states[uid] = {
|
|
68
|
+
newState: latestNew,
|
|
69
|
+
oldState: latestOld.oldState,
|
|
70
|
+
scheduledState: latestNew
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
return wrapped;
|
|
74
|
+
},
|
|
75
|
+
wrapGetter(fn) {
|
|
76
|
+
const wrapped = (uid, ...args) => {
|
|
77
|
+
const {
|
|
78
|
+
newState
|
|
79
|
+
} = states[uid];
|
|
80
|
+
return fn(newState, ...args);
|
|
81
|
+
};
|
|
82
|
+
return wrapped;
|
|
83
|
+
},
|
|
84
|
+
wrapLoadContent(fn) {
|
|
85
|
+
const wrapped = async (uid, ...args) => {
|
|
86
|
+
const {
|
|
87
|
+
newState,
|
|
88
|
+
oldState
|
|
89
|
+
} = states[uid];
|
|
90
|
+
const result = await fn(newState, ...args);
|
|
91
|
+
const {
|
|
92
|
+
error,
|
|
93
|
+
state
|
|
94
|
+
} = result;
|
|
95
|
+
if (oldState === state || newState === state) {
|
|
96
|
+
return {
|
|
97
|
+
error
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
const latestOld = states[uid];
|
|
101
|
+
const latestNew = {
|
|
102
|
+
...latestOld.newState,
|
|
103
|
+
...state
|
|
104
|
+
};
|
|
105
|
+
states[uid] = {
|
|
106
|
+
newState: latestNew,
|
|
107
|
+
oldState: latestOld.oldState,
|
|
108
|
+
scheduledState: latestNew
|
|
109
|
+
};
|
|
110
|
+
return {
|
|
111
|
+
error
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
return wrapped;
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
const {
|
|
120
|
+
dispose: dispose$1,
|
|
121
|
+
get: get$2,
|
|
122
|
+
getCommandIds,
|
|
123
|
+
registerCommands,
|
|
124
|
+
set: set$3,
|
|
125
|
+
wrapCommand
|
|
126
|
+
} = create$a();
|
|
127
|
+
|
|
128
|
+
const create$9 = uid => {
|
|
129
|
+
const state = {
|
|
130
|
+
focusId: 0,
|
|
131
|
+
lines: [],
|
|
132
|
+
productName: '',
|
|
133
|
+
uid
|
|
134
|
+
};
|
|
135
|
+
set$3(uid, state, state);
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
const RenderFocus = 2;
|
|
139
|
+
const RenderFocusContext = 4;
|
|
140
|
+
const RenderAbout = 3;
|
|
141
|
+
|
|
142
|
+
const diffType$2 = RenderAbout;
|
|
143
|
+
const isEqual$2 = (oldState, newState) => {
|
|
144
|
+
return oldState.productName === newState.productName && JSON.stringify(oldState.lines) === JSON.stringify(newState.lines);
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
const diffType$1 = RenderFocus;
|
|
148
|
+
const isEqual$1 = (oldState, newState) => {
|
|
149
|
+
return oldState.focusId === newState.focusId;
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
const diffType = RenderFocusContext;
|
|
153
|
+
const isEqual = (oldState, newState) => {
|
|
154
|
+
return oldState.focusId === newState.focusId;
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
const modules = [isEqual$2, isEqual$1, isEqual];
|
|
158
|
+
const numbers = [diffType$2, diffType$1, diffType];
|
|
159
|
+
|
|
160
|
+
const diff = (oldState, newState) => {
|
|
161
|
+
const diffResult = [];
|
|
162
|
+
for (let i = 0; i < modules.length; i++) {
|
|
163
|
+
const fn = modules[i];
|
|
164
|
+
if (!fn(oldState, newState)) {
|
|
165
|
+
diffResult.push(numbers[i]);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return diffResult;
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
const diff2 = uid => {
|
|
172
|
+
const {
|
|
173
|
+
oldState,
|
|
174
|
+
scheduledState
|
|
175
|
+
} = get$2(uid);
|
|
176
|
+
const diffResult = diff(oldState, scheduledState);
|
|
177
|
+
return diffResult;
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
const dispose = uid => {
|
|
181
|
+
dispose$1(uid);
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
const None = 0;
|
|
185
|
+
const Ok$2 = 1;
|
|
186
|
+
const Copy$2 = 2;
|
|
187
|
+
|
|
188
|
+
const getNextFocus = focusId => {
|
|
189
|
+
switch (focusId) {
|
|
190
|
+
case Copy$2:
|
|
191
|
+
return Ok$2;
|
|
192
|
+
case Ok$2:
|
|
193
|
+
return Copy$2;
|
|
194
|
+
default:
|
|
195
|
+
return None;
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
const focusNext = state => {
|
|
200
|
+
const {
|
|
201
|
+
focusId
|
|
202
|
+
} = state;
|
|
203
|
+
return {
|
|
204
|
+
...state,
|
|
205
|
+
focusId: getNextFocus(focusId)
|
|
206
|
+
};
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
const getPreviousFocus = focusId => {
|
|
210
|
+
switch (focusId) {
|
|
211
|
+
case Copy$2:
|
|
212
|
+
return Ok$2;
|
|
213
|
+
case Ok$2:
|
|
214
|
+
return Copy$2;
|
|
215
|
+
default:
|
|
216
|
+
return None;
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
const focusPrevious = state => {
|
|
221
|
+
const {
|
|
222
|
+
focusId
|
|
223
|
+
} = state;
|
|
224
|
+
return {
|
|
225
|
+
...state,
|
|
226
|
+
focusId: getPreviousFocus(focusId)
|
|
227
|
+
};
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
const Button$2 = 1;
|
|
231
|
+
const Div = 4;
|
|
232
|
+
const Text = 12;
|
|
233
|
+
const Br = 55;
|
|
234
|
+
|
|
235
|
+
const TargetName = 'event.target.name';
|
|
236
|
+
|
|
237
|
+
const Tab = 2;
|
|
238
|
+
const Escape = 8;
|
|
239
|
+
|
|
240
|
+
const Shift = 1 << 10 >>> 0;
|
|
241
|
+
|
|
242
|
+
const FileSystemWorker = 209;
|
|
243
|
+
const RendererWorker = 1;
|
|
244
|
+
|
|
245
|
+
const mergeClassNames = (...classNames) => {
|
|
246
|
+
return classNames.filter(Boolean).join(' ');
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
const text = data => {
|
|
250
|
+
return {
|
|
251
|
+
childCount: 0,
|
|
252
|
+
text: data,
|
|
253
|
+
type: Text
|
|
254
|
+
};
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
const FocusAbout = 4;
|
|
258
|
+
|
|
259
|
+
const getKeyBindings = () => {
|
|
260
|
+
return [{
|
|
261
|
+
command: 'About.handleClickClose',
|
|
262
|
+
key: Escape,
|
|
263
|
+
when: FocusAbout
|
|
264
|
+
}, {
|
|
265
|
+
command: 'About.focusNext',
|
|
266
|
+
key: Tab,
|
|
267
|
+
when: FocusAbout
|
|
268
|
+
}, {
|
|
269
|
+
command: 'About.focusPrevious',
|
|
270
|
+
key: Tab | Shift,
|
|
271
|
+
when: FocusAbout
|
|
272
|
+
}];
|
|
273
|
+
};
|
|
274
|
+
|
|
1
275
|
const normalizeLine = line => {
|
|
2
276
|
if (line.startsWith('Error: ')) {
|
|
3
277
|
return line.slice('Error: '.length);
|
|
@@ -368,10 +642,104 @@ const IpcChildWithModuleWorkerAndMessagePort$1 = {
|
|
|
368
642
|
listen: listen$6,
|
|
369
643
|
wrap: wrap$e
|
|
370
644
|
};
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
645
|
+
const addListener = (emitter, type, callback) => {
|
|
646
|
+
if ('addEventListener' in emitter) {
|
|
647
|
+
emitter.addEventListener(type, callback);
|
|
648
|
+
} else {
|
|
649
|
+
emitter.on(type, callback);
|
|
650
|
+
}
|
|
651
|
+
};
|
|
652
|
+
const removeListener = (emitter, type, callback) => {
|
|
653
|
+
if ('removeEventListener' in emitter) {
|
|
654
|
+
emitter.removeEventListener(type, callback);
|
|
655
|
+
} else {
|
|
656
|
+
emitter.off(type, callback);
|
|
657
|
+
}
|
|
658
|
+
};
|
|
659
|
+
const getFirstEvent = (eventEmitter, eventMap) => {
|
|
660
|
+
const {
|
|
661
|
+
promise,
|
|
662
|
+
resolve
|
|
663
|
+
} = Promise.withResolvers();
|
|
664
|
+
const listenerMap = Object.create(null);
|
|
665
|
+
const cleanup = value => {
|
|
666
|
+
for (const event of Object.keys(eventMap)) {
|
|
667
|
+
removeListener(eventEmitter, event, listenerMap[event]);
|
|
668
|
+
}
|
|
669
|
+
resolve(value);
|
|
670
|
+
};
|
|
671
|
+
for (const [event, type] of Object.entries(eventMap)) {
|
|
672
|
+
const listener = event => {
|
|
673
|
+
cleanup({
|
|
674
|
+
event,
|
|
675
|
+
type
|
|
676
|
+
});
|
|
677
|
+
};
|
|
678
|
+
addListener(eventEmitter, event, listener);
|
|
679
|
+
listenerMap[event] = listener;
|
|
680
|
+
}
|
|
681
|
+
return promise;
|
|
682
|
+
};
|
|
683
|
+
const Message$1 = 3;
|
|
684
|
+
const create$5$1 = async ({
|
|
685
|
+
isMessagePortOpen,
|
|
686
|
+
messagePort
|
|
687
|
+
}) => {
|
|
688
|
+
if (!isMessagePort(messagePort)) {
|
|
689
|
+
throw new IpcError('port must be of type MessagePort');
|
|
690
|
+
}
|
|
691
|
+
if (isMessagePortOpen) {
|
|
692
|
+
return messagePort;
|
|
693
|
+
}
|
|
694
|
+
const eventPromise = getFirstEvent(messagePort, {
|
|
695
|
+
message: Message$1
|
|
696
|
+
});
|
|
697
|
+
messagePort.start();
|
|
698
|
+
const {
|
|
699
|
+
event,
|
|
700
|
+
type
|
|
701
|
+
} = await eventPromise;
|
|
702
|
+
if (type !== Message$1) {
|
|
703
|
+
throw new IpcError('Failed to wait for ipc message');
|
|
704
|
+
}
|
|
705
|
+
if (event.data !== readyMessage) {
|
|
706
|
+
throw new IpcError('unexpected first message');
|
|
707
|
+
}
|
|
708
|
+
return messagePort;
|
|
709
|
+
};
|
|
710
|
+
const signal$1 = messagePort => {
|
|
711
|
+
messagePort.start();
|
|
712
|
+
};
|
|
713
|
+
class IpcParentWithMessagePort extends Ipc {
|
|
714
|
+
getData = getData$2;
|
|
715
|
+
send(message) {
|
|
716
|
+
this._rawIpc.postMessage(message);
|
|
717
|
+
}
|
|
718
|
+
sendAndTransfer(message) {
|
|
719
|
+
const transfer = getTransferrables(message);
|
|
720
|
+
this._rawIpc.postMessage(message, transfer);
|
|
721
|
+
}
|
|
722
|
+
dispose() {
|
|
723
|
+
this._rawIpc.close();
|
|
724
|
+
}
|
|
725
|
+
onMessage(callback) {
|
|
726
|
+
this._rawIpc.addEventListener('message', callback);
|
|
727
|
+
}
|
|
728
|
+
onClose(callback) {}
|
|
729
|
+
}
|
|
730
|
+
const wrap$5 = messagePort => {
|
|
731
|
+
return new IpcParentWithMessagePort(messagePort);
|
|
732
|
+
};
|
|
733
|
+
const IpcParentWithMessagePort$1 = {
|
|
734
|
+
__proto__: null,
|
|
735
|
+
create: create$5$1,
|
|
736
|
+
signal: signal$1,
|
|
737
|
+
wrap: wrap$5
|
|
738
|
+
};
|
|
739
|
+
|
|
740
|
+
class CommandNotFoundError extends Error {
|
|
741
|
+
constructor(command) {
|
|
742
|
+
super(`Command not found ${command}`);
|
|
375
743
|
this.name = 'CommandNotFoundError';
|
|
376
744
|
}
|
|
377
745
|
}
|
|
@@ -392,7 +760,7 @@ const execute = (command, ...args) => {
|
|
|
392
760
|
|
|
393
761
|
const Two$1 = '2.0';
|
|
394
762
|
const callbacks = Object.create(null);
|
|
395
|
-
const get$
|
|
763
|
+
const get$1 = id => {
|
|
396
764
|
return callbacks[id];
|
|
397
765
|
};
|
|
398
766
|
const remove$1 = id => {
|
|
@@ -541,7 +909,7 @@ const warn = (...args) => {
|
|
|
541
909
|
console.warn(...args);
|
|
542
910
|
};
|
|
543
911
|
const resolve = (id, response) => {
|
|
544
|
-
const fn = get$
|
|
912
|
+
const fn = get$1(id);
|
|
545
913
|
if (!fn) {
|
|
546
914
|
console.log(response);
|
|
547
915
|
warn(`callback ${id} may already be disposed`);
|
|
@@ -604,7 +972,7 @@ const getErrorResponse = (id, error, preparePrettyError, logError) => {
|
|
|
604
972
|
const errorProperty = getErrorProperty(error, prettyError);
|
|
605
973
|
return create$1$1(id, errorProperty);
|
|
606
974
|
};
|
|
607
|
-
const create$
|
|
975
|
+
const create$8 = (message, result) => {
|
|
608
976
|
return {
|
|
609
977
|
id: message.id,
|
|
610
978
|
jsonrpc: Two$1,
|
|
@@ -613,7 +981,7 @@ const create$7 = (message, result) => {
|
|
|
613
981
|
};
|
|
614
982
|
const getSuccessResponse = (message, result) => {
|
|
615
983
|
const resultProperty = result ?? null;
|
|
616
|
-
return create$
|
|
984
|
+
return create$8(message, resultProperty);
|
|
617
985
|
};
|
|
618
986
|
const getErrorResponseSimple = (id, error) => {
|
|
619
987
|
return {
|
|
@@ -707,7 +1075,7 @@ const handleJsonRpcMessage = async (...args) => {
|
|
|
707
1075
|
|
|
708
1076
|
const Two = '2.0';
|
|
709
1077
|
|
|
710
|
-
const create$
|
|
1078
|
+
const create$7 = (method, params) => {
|
|
711
1079
|
return {
|
|
712
1080
|
jsonrpc: Two,
|
|
713
1081
|
method,
|
|
@@ -715,7 +1083,7 @@ const create$6 = (method, params) => {
|
|
|
715
1083
|
};
|
|
716
1084
|
};
|
|
717
1085
|
|
|
718
|
-
const create$
|
|
1086
|
+
const create$6 = (id, method, params) => {
|
|
719
1087
|
const message = {
|
|
720
1088
|
id,
|
|
721
1089
|
jsonrpc: Two,
|
|
@@ -726,12 +1094,12 @@ const create$5 = (id, method, params) => {
|
|
|
726
1094
|
};
|
|
727
1095
|
|
|
728
1096
|
let id = 0;
|
|
729
|
-
const create$
|
|
1097
|
+
const create$5 = () => {
|
|
730
1098
|
return ++id;
|
|
731
1099
|
};
|
|
732
1100
|
|
|
733
1101
|
const registerPromise = map => {
|
|
734
|
-
const id = create$
|
|
1102
|
+
const id = create$5();
|
|
735
1103
|
const {
|
|
736
1104
|
promise,
|
|
737
1105
|
resolve
|
|
@@ -748,7 +1116,7 @@ const invokeHelper = async (callbacks, ipc, method, params, useSendAndTransfer)
|
|
|
748
1116
|
id,
|
|
749
1117
|
promise
|
|
750
1118
|
} = registerPromise(callbacks);
|
|
751
|
-
const message = create$
|
|
1119
|
+
const message = create$6(id, method, params);
|
|
752
1120
|
if (useSendAndTransfer && ipc.sendAndTransfer) {
|
|
753
1121
|
ipc.sendAndTransfer(message);
|
|
754
1122
|
} else {
|
|
@@ -778,436 +1146,250 @@ const createRpc = ipc => {
|
|
|
778
1146
|
invokeAndTransfer(method, ...params) {
|
|
779
1147
|
return invokeHelper(callbacks, ipc, method, params, true);
|
|
780
1148
|
},
|
|
781
|
-
// @ts-ignore
|
|
782
|
-
ipc,
|
|
783
|
-
/**
|
|
784
|
-
* @deprecated
|
|
785
|
-
*/
|
|
786
|
-
send(method, ...params) {
|
|
787
|
-
const message = create$
|
|
788
|
-
ipc.send(message);
|
|
789
|
-
}
|
|
790
|
-
};
|
|
791
|
-
return rpc;
|
|
792
|
-
};
|
|
793
|
-
|
|
794
|
-
const requiresSocket = () => {
|
|
795
|
-
return false;
|
|
796
|
-
};
|
|
797
|
-
const preparePrettyError = error => {
|
|
798
|
-
return error;
|
|
799
|
-
};
|
|
800
|
-
const logError = () => {
|
|
801
|
-
// handled by renderer worker
|
|
802
|
-
};
|
|
803
|
-
const handleMessage = event => {
|
|
804
|
-
const actualRequiresSocket = event?.target?.requiresSocket || requiresSocket;
|
|
805
|
-
const actualExecute = event?.target?.execute || execute;
|
|
806
|
-
return handleJsonRpcMessage(event.target, event.data, actualExecute, event.target._resolve, preparePrettyError, logError, actualRequiresSocket);
|
|
807
|
-
};
|
|
808
|
-
|
|
809
|
-
const handleIpc = ipc => {
|
|
810
|
-
if ('addEventListener' in ipc) {
|
|
811
|
-
ipc.addEventListener('message', handleMessage);
|
|
812
|
-
} else if ('on' in ipc) {
|
|
813
|
-
// deprecated
|
|
814
|
-
ipc.on('message', handleMessage);
|
|
815
|
-
}
|
|
816
|
-
};
|
|
817
|
-
|
|
818
|
-
const listen$1 = async (module, options) => {
|
|
819
|
-
const rawIpc = await module.listen(options);
|
|
820
|
-
if (module.signal) {
|
|
821
|
-
module.signal(rawIpc);
|
|
822
|
-
}
|
|
823
|
-
const ipc = module.wrap(rawIpc);
|
|
824
|
-
return ipc;
|
|
825
|
-
};
|
|
826
|
-
|
|
827
|
-
const create$3 = async ({
|
|
828
|
-
commandMap
|
|
829
|
-
}) => {
|
|
830
|
-
// TODO create a commandMap per rpc instance
|
|
831
|
-
register(commandMap);
|
|
832
|
-
const ipc = await listen$1(IpcChildWithModuleWorkerAndMessagePort$1);
|
|
833
|
-
handleIpc(ipc);
|
|
834
|
-
const rpc = createRpc(ipc);
|
|
835
|
-
return rpc;
|
|
836
|
-
};
|
|
837
|
-
|
|
838
|
-
const createMockRpc = ({
|
|
839
|
-
commandMap
|
|
840
|
-
}) => {
|
|
841
|
-
const invocations = [];
|
|
842
|
-
const invoke = (method, ...params) => {
|
|
843
|
-
invocations.push([method, ...params]);
|
|
844
|
-
const command = commandMap[method];
|
|
845
|
-
if (!command) {
|
|
846
|
-
throw new Error(`command ${method} not found`);
|
|
847
|
-
}
|
|
848
|
-
return command(...params);
|
|
849
|
-
};
|
|
850
|
-
const mockRpc = {
|
|
851
|
-
invocations,
|
|
852
|
-
invoke,
|
|
853
|
-
invokeAndTransfer: invoke
|
|
854
|
-
};
|
|
855
|
-
return mockRpc;
|
|
856
|
-
};
|
|
857
|
-
|
|
858
|
-
const rpcs = Object.create(null);
|
|
859
|
-
const set$2 = (id, rpc) => {
|
|
860
|
-
rpcs[id] = rpc;
|
|
861
|
-
};
|
|
862
|
-
const get$1 = id => {
|
|
863
|
-
return rpcs[id];
|
|
864
|
-
};
|
|
865
|
-
const remove = id => {
|
|
866
|
-
delete rpcs[id];
|
|
867
|
-
};
|
|
868
|
-
|
|
869
|
-
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
|
870
|
-
const create$2 = rpcId => {
|
|
871
|
-
return {
|
|
872
|
-
async dispose() {
|
|
873
|
-
const rpc = get$1(rpcId);
|
|
874
|
-
await rpc.dispose();
|
|
875
|
-
},
|
|
876
|
-
// @ts-ignore
|
|
877
|
-
invoke(method, ...params) {
|
|
878
|
-
const rpc = get$1(rpcId);
|
|
879
|
-
// @ts-ignore
|
|
880
|
-
return rpc.invoke(method, ...params);
|
|
881
|
-
},
|
|
882
|
-
// @ts-ignore
|
|
883
|
-
invokeAndTransfer(method, ...params) {
|
|
884
|
-
const rpc = get$1(rpcId);
|
|
885
|
-
// @ts-ignore
|
|
886
|
-
return rpc.invokeAndTransfer(method, ...params);
|
|
887
|
-
},
|
|
888
|
-
registerMockRpc(commandMap) {
|
|
889
|
-
const mockRpc = createMockRpc({
|
|
890
|
-
commandMap
|
|
891
|
-
});
|
|
892
|
-
set$2(rpcId, mockRpc);
|
|
893
|
-
// @ts-ignore
|
|
894
|
-
mockRpc[Symbol.dispose] = () => {
|
|
895
|
-
remove(rpcId);
|
|
896
|
-
};
|
|
897
|
-
// @ts-ignore
|
|
898
|
-
return mockRpc;
|
|
899
|
-
},
|
|
900
|
-
set(rpc) {
|
|
901
|
-
set$2(rpcId, rpc);
|
|
902
|
-
}
|
|
903
|
-
};
|
|
904
|
-
};
|
|
905
|
-
|
|
906
|
-
const Button$2 = 1;
|
|
907
|
-
const Div = 4;
|
|
908
|
-
const Text = 12;
|
|
909
|
-
const Br = 55;
|
|
910
|
-
|
|
911
|
-
const TargetName = 'event.target.name';
|
|
912
|
-
|
|
913
|
-
const Tab = 2;
|
|
914
|
-
const Escape = 8;
|
|
915
|
-
|
|
916
|
-
const Shift = 1 << 10 >>> 0;
|
|
917
|
-
|
|
918
|
-
const RendererWorker = 1;
|
|
919
|
-
|
|
920
|
-
const {
|
|
921
|
-
invoke,
|
|
922
|
-
set: set$1
|
|
923
|
-
} = create$2(RendererWorker);
|
|
924
|
-
const getElectronVersion$1 = async () => {
|
|
925
|
-
return invoke('Process.getElectronVersion');
|
|
926
|
-
};
|
|
927
|
-
const getNodeVersion$1 = async () => {
|
|
928
|
-
return invoke('Process.getNodeVersion');
|
|
929
|
-
};
|
|
930
|
-
const getChromeVersion$1 = async () => {
|
|
931
|
-
return invoke('Process.getChromeVersion');
|
|
932
|
-
};
|
|
933
|
-
const getV8Version$1 = async () => {
|
|
934
|
-
return invoke('Process.getV8Version');
|
|
935
|
-
};
|
|
936
|
-
const setFocus = key => {
|
|
937
|
-
return invoke('Focus.setFocus', key);
|
|
938
|
-
};
|
|
939
|
-
const closeWidget$1 = async widgetId => {
|
|
940
|
-
return invoke('Viewlet.closeWidget', widgetId);
|
|
941
|
-
};
|
|
942
|
-
const writeClipBoardText = async text => {
|
|
943
|
-
await invoke('ClipBoard.writeText', /* text */text);
|
|
944
|
-
};
|
|
945
|
-
const showMessageBox$1 = async options => {
|
|
946
|
-
return invoke('ElectronDialog.showMessageBox', options);
|
|
947
|
-
};
|
|
948
|
-
const openWidget = async name => {
|
|
949
|
-
await invoke('Viewlet.openWidget', name);
|
|
950
|
-
};
|
|
951
|
-
const getWindowId$1 = async () => {
|
|
952
|
-
return invoke('GetWindowId.getWindowId');
|
|
953
|
-
};
|
|
954
|
-
|
|
955
|
-
const toCommandId = key => {
|
|
956
|
-
const dotIndex = key.indexOf('.');
|
|
957
|
-
return key.slice(dotIndex + 1);
|
|
958
|
-
};
|
|
959
|
-
const create$1 = () => {
|
|
960
|
-
const states = Object.create(null);
|
|
961
|
-
const commandMapRef = {};
|
|
962
|
-
return {
|
|
963
|
-
clear() {
|
|
964
|
-
for (const key of Object.keys(states)) {
|
|
965
|
-
delete states[key];
|
|
966
|
-
}
|
|
967
|
-
},
|
|
968
|
-
diff(uid, modules, numbers) {
|
|
969
|
-
const {
|
|
970
|
-
newState,
|
|
971
|
-
oldState
|
|
972
|
-
} = states[uid];
|
|
973
|
-
const diffResult = [];
|
|
974
|
-
for (let i = 0; i < modules.length; i++) {
|
|
975
|
-
const fn = modules[i];
|
|
976
|
-
if (!fn(oldState, newState)) {
|
|
977
|
-
diffResult.push(numbers[i]);
|
|
978
|
-
}
|
|
979
|
-
}
|
|
980
|
-
return diffResult;
|
|
981
|
-
},
|
|
982
|
-
dispose(uid) {
|
|
983
|
-
delete states[uid];
|
|
984
|
-
},
|
|
985
|
-
get(uid) {
|
|
986
|
-
return states[uid];
|
|
987
|
-
},
|
|
988
|
-
getCommandIds() {
|
|
989
|
-
const keys = Object.keys(commandMapRef);
|
|
990
|
-
const ids = keys.map(toCommandId);
|
|
991
|
-
return ids;
|
|
992
|
-
},
|
|
993
|
-
getKeys() {
|
|
994
|
-
return Object.keys(states).map(key => {
|
|
995
|
-
return Number.parseFloat(key);
|
|
996
|
-
});
|
|
997
|
-
},
|
|
998
|
-
registerCommands(commandMap) {
|
|
999
|
-
Object.assign(commandMapRef, commandMap);
|
|
1000
|
-
},
|
|
1001
|
-
set(uid, oldState, newState) {
|
|
1002
|
-
states[uid] = {
|
|
1003
|
-
newState,
|
|
1004
|
-
oldState
|
|
1005
|
-
};
|
|
1006
|
-
},
|
|
1007
|
-
wrapCommand(fn) {
|
|
1008
|
-
const wrapped = async (uid, ...args) => {
|
|
1009
|
-
const {
|
|
1010
|
-
newState,
|
|
1011
|
-
oldState
|
|
1012
|
-
} = states[uid];
|
|
1013
|
-
const newerState = await fn(newState, ...args);
|
|
1014
|
-
if (oldState === newerState || newState === newerState) {
|
|
1015
|
-
return;
|
|
1016
|
-
}
|
|
1017
|
-
const latestOld = states[uid];
|
|
1018
|
-
const latestNew = {
|
|
1019
|
-
...latestOld.newState,
|
|
1020
|
-
...newerState
|
|
1021
|
-
};
|
|
1022
|
-
states[uid] = {
|
|
1023
|
-
newState: latestNew,
|
|
1024
|
-
oldState: latestOld.oldState
|
|
1025
|
-
};
|
|
1026
|
-
};
|
|
1027
|
-
return wrapped;
|
|
1028
|
-
},
|
|
1029
|
-
wrapGetter(fn) {
|
|
1030
|
-
const wrapped = (uid, ...args) => {
|
|
1031
|
-
const {
|
|
1032
|
-
newState
|
|
1033
|
-
} = states[uid];
|
|
1034
|
-
return fn(newState, ...args);
|
|
1035
|
-
};
|
|
1036
|
-
return wrapped;
|
|
1037
|
-
},
|
|
1038
|
-
wrapLoadContent(fn) {
|
|
1039
|
-
const wrapped = async (uid, ...args) => {
|
|
1040
|
-
const {
|
|
1041
|
-
newState,
|
|
1042
|
-
oldState
|
|
1043
|
-
} = states[uid];
|
|
1044
|
-
const result = await fn(newState, ...args);
|
|
1045
|
-
const {
|
|
1046
|
-
error,
|
|
1047
|
-
state
|
|
1048
|
-
} = result;
|
|
1049
|
-
if (oldState === state || newState === state) {
|
|
1050
|
-
return {
|
|
1051
|
-
error
|
|
1052
|
-
};
|
|
1053
|
-
}
|
|
1054
|
-
const latestOld = states[uid];
|
|
1055
|
-
const latestNew = {
|
|
1056
|
-
...latestOld.newState,
|
|
1057
|
-
...state
|
|
1058
|
-
};
|
|
1059
|
-
states[uid] = {
|
|
1060
|
-
newState: latestNew,
|
|
1061
|
-
oldState: latestOld.oldState
|
|
1062
|
-
};
|
|
1063
|
-
return {
|
|
1064
|
-
error
|
|
1065
|
-
};
|
|
1066
|
-
};
|
|
1067
|
-
return wrapped;
|
|
1068
|
-
}
|
|
1069
|
-
};
|
|
1070
|
-
};
|
|
1071
|
-
|
|
1072
|
-
const {
|
|
1073
|
-
dispose: dispose$1,
|
|
1074
|
-
get,
|
|
1075
|
-
getCommandIds,
|
|
1076
|
-
registerCommands,
|
|
1077
|
-
set,
|
|
1078
|
-
wrapCommand
|
|
1079
|
-
} = create$1();
|
|
1080
|
-
|
|
1081
|
-
const create = uid => {
|
|
1082
|
-
const state = {
|
|
1083
|
-
focusId: 0,
|
|
1084
|
-
lines: [],
|
|
1085
|
-
productName: '',
|
|
1086
|
-
uid
|
|
1149
|
+
// @ts-ignore
|
|
1150
|
+
ipc,
|
|
1151
|
+
/**
|
|
1152
|
+
* @deprecated
|
|
1153
|
+
*/
|
|
1154
|
+
send(method, ...params) {
|
|
1155
|
+
const message = create$7(method, params);
|
|
1156
|
+
ipc.send(message);
|
|
1157
|
+
}
|
|
1087
1158
|
};
|
|
1088
|
-
|
|
1159
|
+
return rpc;
|
|
1089
1160
|
};
|
|
1090
1161
|
|
|
1091
|
-
const
|
|
1092
|
-
|
|
1093
|
-
const RenderAbout = 3;
|
|
1094
|
-
|
|
1095
|
-
const diffType$2 = RenderAbout;
|
|
1096
|
-
const isEqual$2 = (oldState, newState) => {
|
|
1097
|
-
return oldState.productName === newState.productName && JSON.stringify(oldState.lines) === JSON.stringify(newState.lines);
|
|
1162
|
+
const requiresSocket = () => {
|
|
1163
|
+
return false;
|
|
1098
1164
|
};
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
const isEqual$1 = (oldState, newState) => {
|
|
1102
|
-
return oldState.focusId === newState.focusId;
|
|
1165
|
+
const preparePrettyError = error => {
|
|
1166
|
+
return error;
|
|
1103
1167
|
};
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1168
|
+
const logError = () => {
|
|
1169
|
+
// handled by renderer worker
|
|
1170
|
+
};
|
|
1171
|
+
const handleMessage = event => {
|
|
1172
|
+
const actualRequiresSocket = event?.target?.requiresSocket || requiresSocket;
|
|
1173
|
+
const actualExecute = event?.target?.execute || execute;
|
|
1174
|
+
return handleJsonRpcMessage(event.target, event.data, actualExecute, event.target._resolve, preparePrettyError, logError, actualRequiresSocket);
|
|
1108
1175
|
};
|
|
1109
1176
|
|
|
1110
|
-
const
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
const fn = modules[i];
|
|
1117
|
-
if (!fn(oldState, newState)) {
|
|
1118
|
-
diffResult.push(numbers[i]);
|
|
1119
|
-
}
|
|
1177
|
+
const handleIpc = ipc => {
|
|
1178
|
+
if ('addEventListener' in ipc) {
|
|
1179
|
+
ipc.addEventListener('message', handleMessage);
|
|
1180
|
+
} else if ('on' in ipc) {
|
|
1181
|
+
// deprecated
|
|
1182
|
+
ipc.on('message', handleMessage);
|
|
1120
1183
|
}
|
|
1121
|
-
return diffResult;
|
|
1122
1184
|
};
|
|
1123
1185
|
|
|
1124
|
-
const
|
|
1125
|
-
const
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
}
|
|
1129
|
-
const
|
|
1130
|
-
return
|
|
1186
|
+
const listen$1 = async (module, options) => {
|
|
1187
|
+
const rawIpc = await module.listen(options);
|
|
1188
|
+
if (module.signal) {
|
|
1189
|
+
module.signal(rawIpc);
|
|
1190
|
+
}
|
|
1191
|
+
const ipc = module.wrap(rawIpc);
|
|
1192
|
+
return ipc;
|
|
1131
1193
|
};
|
|
1132
1194
|
|
|
1133
|
-
const
|
|
1134
|
-
|
|
1195
|
+
const create$4 = async ({
|
|
1196
|
+
commandMap,
|
|
1197
|
+
isMessagePortOpen = true,
|
|
1198
|
+
messagePort
|
|
1199
|
+
}) => {
|
|
1200
|
+
// TODO create a commandMap per rpc instance
|
|
1201
|
+
register(commandMap);
|
|
1202
|
+
const rawIpc = await IpcParentWithMessagePort$1.create({
|
|
1203
|
+
isMessagePortOpen,
|
|
1204
|
+
messagePort
|
|
1205
|
+
});
|
|
1206
|
+
const ipc = IpcParentWithMessagePort$1.wrap(rawIpc);
|
|
1207
|
+
handleIpc(ipc);
|
|
1208
|
+
const rpc = createRpc(ipc);
|
|
1209
|
+
messagePort.start();
|
|
1210
|
+
return rpc;
|
|
1135
1211
|
};
|
|
1136
1212
|
|
|
1137
|
-
const
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1213
|
+
const create$3 = async ({
|
|
1214
|
+
commandMap,
|
|
1215
|
+
isMessagePortOpen,
|
|
1216
|
+
send
|
|
1217
|
+
}) => {
|
|
1218
|
+
const {
|
|
1219
|
+
port1,
|
|
1220
|
+
port2
|
|
1221
|
+
} = new MessageChannel();
|
|
1222
|
+
await send(port1);
|
|
1223
|
+
return create$4({
|
|
1224
|
+
commandMap,
|
|
1225
|
+
isMessagePortOpen,
|
|
1226
|
+
messagePort: port2
|
|
1227
|
+
});
|
|
1150
1228
|
};
|
|
1151
1229
|
|
|
1152
|
-
const
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1230
|
+
const createSharedLazyRpc = factory => {
|
|
1231
|
+
let rpcPromise;
|
|
1232
|
+
const getOrCreate = () => {
|
|
1233
|
+
if (!rpcPromise) {
|
|
1234
|
+
rpcPromise = factory();
|
|
1235
|
+
}
|
|
1236
|
+
return rpcPromise;
|
|
1237
|
+
};
|
|
1156
1238
|
return {
|
|
1157
|
-
|
|
1158
|
-
|
|
1239
|
+
async dispose() {
|
|
1240
|
+
const rpc = await getOrCreate();
|
|
1241
|
+
await rpc.dispose();
|
|
1242
|
+
},
|
|
1243
|
+
async invoke(method, ...params) {
|
|
1244
|
+
const rpc = await getOrCreate();
|
|
1245
|
+
return rpc.invoke(method, ...params);
|
|
1246
|
+
},
|
|
1247
|
+
async invokeAndTransfer(method, ...params) {
|
|
1248
|
+
const rpc = await getOrCreate();
|
|
1249
|
+
return rpc.invokeAndTransfer(method, ...params);
|
|
1250
|
+
},
|
|
1251
|
+
async send(method, ...params) {
|
|
1252
|
+
const rpc = await getOrCreate();
|
|
1253
|
+
rpc.send(method, ...params);
|
|
1254
|
+
}
|
|
1159
1255
|
};
|
|
1160
1256
|
};
|
|
1161
1257
|
|
|
1162
|
-
const
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1258
|
+
const create$2 = async ({
|
|
1259
|
+
commandMap,
|
|
1260
|
+
isMessagePortOpen,
|
|
1261
|
+
send
|
|
1262
|
+
}) => {
|
|
1263
|
+
return createSharedLazyRpc(() => {
|
|
1264
|
+
return create$3({
|
|
1265
|
+
commandMap,
|
|
1266
|
+
isMessagePortOpen,
|
|
1267
|
+
send
|
|
1268
|
+
});
|
|
1269
|
+
});
|
|
1171
1270
|
};
|
|
1172
1271
|
|
|
1173
|
-
const
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1272
|
+
const create$1 = async ({
|
|
1273
|
+
commandMap
|
|
1274
|
+
}) => {
|
|
1275
|
+
// TODO create a commandMap per rpc instance
|
|
1276
|
+
register(commandMap);
|
|
1277
|
+
const ipc = await listen$1(IpcChildWithModuleWorkerAndMessagePort$1);
|
|
1278
|
+
handleIpc(ipc);
|
|
1279
|
+
const rpc = createRpc(ipc);
|
|
1280
|
+
return rpc;
|
|
1281
|
+
};
|
|
1282
|
+
|
|
1283
|
+
const createMockRpc = ({
|
|
1284
|
+
commandMap
|
|
1285
|
+
}) => {
|
|
1286
|
+
const invocations = [];
|
|
1287
|
+
const invoke = (method, ...params) => {
|
|
1288
|
+
invocations.push([method, ...params]);
|
|
1289
|
+
const command = commandMap[method];
|
|
1290
|
+
if (!command) {
|
|
1291
|
+
throw new Error(`command ${method} not found`);
|
|
1292
|
+
}
|
|
1293
|
+
return command(...params);
|
|
1180
1294
|
};
|
|
1295
|
+
const mockRpc = {
|
|
1296
|
+
invocations,
|
|
1297
|
+
invoke,
|
|
1298
|
+
invokeAndTransfer: invoke
|
|
1299
|
+
};
|
|
1300
|
+
return mockRpc;
|
|
1181
1301
|
};
|
|
1182
1302
|
|
|
1183
|
-
const
|
|
1184
|
-
|
|
1303
|
+
const rpcs = Object.create(null);
|
|
1304
|
+
const set$2 = (id, rpc) => {
|
|
1305
|
+
rpcs[id] = rpc;
|
|
1306
|
+
};
|
|
1307
|
+
const get = id => {
|
|
1308
|
+
return rpcs[id];
|
|
1309
|
+
};
|
|
1310
|
+
const remove = id => {
|
|
1311
|
+
delete rpcs[id];
|
|
1185
1312
|
};
|
|
1186
1313
|
|
|
1187
|
-
|
|
1314
|
+
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
|
1315
|
+
const create = rpcId => {
|
|
1188
1316
|
return {
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1317
|
+
async dispose() {
|
|
1318
|
+
const rpc = get(rpcId);
|
|
1319
|
+
await rpc.dispose();
|
|
1320
|
+
},
|
|
1321
|
+
// @ts-ignore
|
|
1322
|
+
invoke(method, ...params) {
|
|
1323
|
+
const rpc = get(rpcId);
|
|
1324
|
+
// @ts-ignore
|
|
1325
|
+
return rpc.invoke(method, ...params);
|
|
1326
|
+
},
|
|
1327
|
+
// @ts-ignore
|
|
1328
|
+
invokeAndTransfer(method, ...params) {
|
|
1329
|
+
const rpc = get(rpcId);
|
|
1330
|
+
// @ts-ignore
|
|
1331
|
+
return rpc.invokeAndTransfer(method, ...params);
|
|
1332
|
+
},
|
|
1333
|
+
registerMockRpc(commandMap) {
|
|
1334
|
+
const mockRpc = createMockRpc({
|
|
1335
|
+
commandMap
|
|
1336
|
+
});
|
|
1337
|
+
set$2(rpcId, mockRpc);
|
|
1338
|
+
// @ts-ignore
|
|
1339
|
+
mockRpc[Symbol.dispose] = () => {
|
|
1340
|
+
remove(rpcId);
|
|
1341
|
+
};
|
|
1342
|
+
// @ts-ignore
|
|
1343
|
+
return mockRpc;
|
|
1344
|
+
},
|
|
1345
|
+
set(rpc) {
|
|
1346
|
+
set$2(rpcId, rpc);
|
|
1347
|
+
}
|
|
1192
1348
|
};
|
|
1193
1349
|
};
|
|
1194
1350
|
|
|
1195
|
-
const
|
|
1351
|
+
const {
|
|
1352
|
+
set: set$1
|
|
1353
|
+
} = create(FileSystemWorker);
|
|
1196
1354
|
|
|
1197
|
-
const
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1355
|
+
const {
|
|
1356
|
+
invoke,
|
|
1357
|
+
invokeAndTransfer,
|
|
1358
|
+
set
|
|
1359
|
+
} = create(RendererWorker);
|
|
1360
|
+
const getElectronVersion$1 = async () => {
|
|
1361
|
+
return invoke('Process.getElectronVersion');
|
|
1362
|
+
};
|
|
1363
|
+
const getNodeVersion$1 = async () => {
|
|
1364
|
+
return invoke('Process.getNodeVersion');
|
|
1365
|
+
};
|
|
1366
|
+
const getChromeVersion$1 = async () => {
|
|
1367
|
+
return invoke('Process.getChromeVersion');
|
|
1368
|
+
};
|
|
1369
|
+
const getV8Version$1 = async () => {
|
|
1370
|
+
return invoke('Process.getV8Version');
|
|
1371
|
+
};
|
|
1372
|
+
const sendMessagePortToFileSystemWorker = async (port, rpcId) => {
|
|
1373
|
+
const command = 'FileSystem.handleMessagePort';
|
|
1374
|
+
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToFileSystemWorker', port, command, rpcId);
|
|
1375
|
+
};
|
|
1376
|
+
const setFocus = key => {
|
|
1377
|
+
return invoke('Focus.setFocus', key);
|
|
1378
|
+
};
|
|
1379
|
+
const closeWidget$1 = async widgetId => {
|
|
1380
|
+
return invoke('Viewlet.closeWidget', widgetId);
|
|
1381
|
+
};
|
|
1382
|
+
const writeClipBoardText = async text => {
|
|
1383
|
+
await invoke('ClipBoard.writeText', /* text */text);
|
|
1384
|
+
};
|
|
1385
|
+
const showMessageBox$1 = async options => {
|
|
1386
|
+
return invoke('ElectronDialog.showMessageBox', options);
|
|
1387
|
+
};
|
|
1388
|
+
const openWidget = async name => {
|
|
1389
|
+
await invoke('Viewlet.openWidget', name);
|
|
1390
|
+
};
|
|
1391
|
+
const getWindowId$1 = async () => {
|
|
1392
|
+
return invoke('GetWindowId.getWindowId');
|
|
1211
1393
|
};
|
|
1212
1394
|
|
|
1213
1395
|
const closeWidget = closeWidget$1;
|
|
@@ -1496,7 +1678,7 @@ const ranges$1 = [{
|
|
|
1496
1678
|
some: inSomeMonths
|
|
1497
1679
|
}, {
|
|
1498
1680
|
divisor: year,
|
|
1499
|
-
limit:
|
|
1681
|
+
limit: Infinity,
|
|
1500
1682
|
one: inOneYear,
|
|
1501
1683
|
some: inSomeYears
|
|
1502
1684
|
}];
|
|
@@ -1537,7 +1719,7 @@ const ranges = [{
|
|
|
1537
1719
|
some: someMonthsAgo
|
|
1538
1720
|
}, {
|
|
1539
1721
|
divisor: year,
|
|
1540
|
-
limit:
|
|
1722
|
+
limit: Infinity,
|
|
1541
1723
|
one: oneYearAgo,
|
|
1542
1724
|
some: someYearsAgo
|
|
1543
1725
|
}];
|
|
@@ -1569,7 +1751,7 @@ const formatAboutDate = (isoDate, now) => {
|
|
|
1569
1751
|
|
|
1570
1752
|
const getBrowser = () => {
|
|
1571
1753
|
// @ts-ignore
|
|
1572
|
-
return
|
|
1754
|
+
return navigator.userAgent;
|
|
1573
1755
|
};
|
|
1574
1756
|
|
|
1575
1757
|
const version = '0.0.0-dev';
|
|
@@ -1585,10 +1767,10 @@ const getDetailStringWeb = () => {
|
|
|
1585
1767
|
const getElectronVersion = getElectronVersion$1;
|
|
1586
1768
|
const getNodeVersion = getNodeVersion$1;
|
|
1587
1769
|
const getChromeVersion = getChromeVersion$1;
|
|
1588
|
-
const getVersion = () => {
|
|
1770
|
+
const getVersion = async () => {
|
|
1589
1771
|
return version;
|
|
1590
1772
|
};
|
|
1591
|
-
const getCommit = () => {
|
|
1773
|
+
const getCommit = async () => {
|
|
1592
1774
|
return commit;
|
|
1593
1775
|
};
|
|
1594
1776
|
const getV8Version = getV8Version$1;
|
|
@@ -1596,14 +1778,18 @@ const getDate = () => {
|
|
|
1596
1778
|
return commitDate;
|
|
1597
1779
|
};
|
|
1598
1780
|
const productNameLong$1 = 'Lvce Editor - OSS';
|
|
1781
|
+
const getProductNameLong$1 = async () => {
|
|
1782
|
+
return productNameLong$1;
|
|
1783
|
+
};
|
|
1599
1784
|
|
|
1600
|
-
const loadContent2 = state => {
|
|
1785
|
+
const loadContent2 = async state => {
|
|
1601
1786
|
const lines = getDetailStringWeb();
|
|
1787
|
+
const productName = await getProductNameLong$1();
|
|
1602
1788
|
return {
|
|
1603
1789
|
...state,
|
|
1604
1790
|
focusId: Ok$2,
|
|
1605
1791
|
lines,
|
|
1606
|
-
productName
|
|
1792
|
+
productName
|
|
1607
1793
|
};
|
|
1608
1794
|
};
|
|
1609
1795
|
|
|
@@ -1803,7 +1989,7 @@ const getFocusSelector = focusId => {
|
|
|
1803
1989
|
|
|
1804
1990
|
const renderFocus = (oldState, newState) => {
|
|
1805
1991
|
const name = getFocusSelector(newState.focusId);
|
|
1806
|
-
return ['Viewlet.
|
|
1992
|
+
return ['Viewlet.focusSelector', `[name="${name}"]`];
|
|
1807
1993
|
};
|
|
1808
1994
|
|
|
1809
1995
|
const renderFocusContext = (oldState, newState) => {
|
|
@@ -1834,11 +2020,11 @@ const applyRender = (oldState, newState, diffResult) => {
|
|
|
1834
2020
|
|
|
1835
2021
|
const doRender = (uid, diffResult) => {
|
|
1836
2022
|
const {
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
} = get(uid);
|
|
1840
|
-
set(uid,
|
|
1841
|
-
const commands = applyRender(oldState,
|
|
2023
|
+
oldState,
|
|
2024
|
+
scheduledState
|
|
2025
|
+
} = get$2(uid);
|
|
2026
|
+
set$3(uid, scheduledState, scheduledState);
|
|
2027
|
+
const commands = applyRender(oldState, scheduledState, diffResult);
|
|
1842
2028
|
return commands;
|
|
1843
2029
|
};
|
|
1844
2030
|
|
|
@@ -1928,7 +2114,7 @@ const showAbout = async platform => {
|
|
|
1928
2114
|
};
|
|
1929
2115
|
|
|
1930
2116
|
const commandMap = {
|
|
1931
|
-
'About.create': create,
|
|
2117
|
+
'About.create': create$9,
|
|
1932
2118
|
'About.diff2': diff2,
|
|
1933
2119
|
'About.dispose': dispose,
|
|
1934
2120
|
'About.focusNext': wrapCommand(focusNext),
|
|
@@ -1947,14 +2133,30 @@ const commandMap = {
|
|
|
1947
2133
|
'About.showAboutElectron': showAboutElectron
|
|
1948
2134
|
};
|
|
1949
2135
|
|
|
1950
|
-
const
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
2136
|
+
const send = async port => {
|
|
2137
|
+
await sendMessagePortToFileSystemWorker(port, 0);
|
|
2138
|
+
};
|
|
2139
|
+
const initializeFileSystemWorker = async () => {
|
|
2140
|
+
const rpc = await create$2({
|
|
2141
|
+
commandMap: {},
|
|
2142
|
+
send
|
|
1954
2143
|
});
|
|
1955
2144
|
set$1(rpc);
|
|
1956
2145
|
};
|
|
1957
2146
|
|
|
2147
|
+
const initializeRendererWorker = async () => {
|
|
2148
|
+
const rpc = await create$1({
|
|
2149
|
+
commandMap: commandMap
|
|
2150
|
+
});
|
|
2151
|
+
set(rpc);
|
|
2152
|
+
};
|
|
2153
|
+
|
|
2154
|
+
const listen = async () => {
|
|
2155
|
+
registerCommands(commandMap);
|
|
2156
|
+
await initializeRendererWorker();
|
|
2157
|
+
await initializeFileSystemWorker();
|
|
2158
|
+
};
|
|
2159
|
+
|
|
1958
2160
|
const main = async () => {
|
|
1959
2161
|
await listen();
|
|
1960
2162
|
};
|