@lvce-editor/output-view 2.6.0 → 2.8.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/outputViewWorkerMain.js +68 -62
- package/package.json +1 -1
|
@@ -54,49 +54,6 @@ class VError extends Error {
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
class AssertionError extends Error {
|
|
58
|
-
constructor(message) {
|
|
59
|
-
super(message);
|
|
60
|
-
this.name = 'AssertionError';
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
const Object$1 = 1;
|
|
64
|
-
const Number$1 = 2;
|
|
65
|
-
const Array$1 = 3;
|
|
66
|
-
const String$1 = 4;
|
|
67
|
-
const Boolean$1 = 5;
|
|
68
|
-
const Function = 6;
|
|
69
|
-
const Null = 7;
|
|
70
|
-
const Unknown = 8;
|
|
71
|
-
const getType = value => {
|
|
72
|
-
switch (typeof value) {
|
|
73
|
-
case 'number':
|
|
74
|
-
return Number$1;
|
|
75
|
-
case 'function':
|
|
76
|
-
return Function;
|
|
77
|
-
case 'string':
|
|
78
|
-
return String$1;
|
|
79
|
-
case 'object':
|
|
80
|
-
if (value === null) {
|
|
81
|
-
return Null;
|
|
82
|
-
}
|
|
83
|
-
if (Array.isArray(value)) {
|
|
84
|
-
return Array$1;
|
|
85
|
-
}
|
|
86
|
-
return Object$1;
|
|
87
|
-
case 'boolean':
|
|
88
|
-
return Boolean$1;
|
|
89
|
-
default:
|
|
90
|
-
return Unknown;
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
const number = value => {
|
|
94
|
-
const type = getType(value);
|
|
95
|
-
if (type !== Number$1) {
|
|
96
|
-
throw new AssertionError('expected value to be of type number');
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
|
|
100
57
|
const isMessagePort = value => {
|
|
101
58
|
return value && value instanceof MessagePort;
|
|
102
59
|
};
|
|
@@ -1028,6 +985,7 @@ const createMockRpc = ({
|
|
|
1028
985
|
return mockRpc;
|
|
1029
986
|
};
|
|
1030
987
|
|
|
988
|
+
const Log = 'log';
|
|
1031
989
|
const ToolBar = 'toolbar';
|
|
1032
990
|
|
|
1033
991
|
const Button = 1;
|
|
@@ -1129,6 +1087,49 @@ const unwatchFile = async watchId => {
|
|
|
1129
1087
|
await invoke$2('FileSystem.unwatchFile', watchId);
|
|
1130
1088
|
};
|
|
1131
1089
|
|
|
1090
|
+
class AssertionError extends Error {
|
|
1091
|
+
constructor(message) {
|
|
1092
|
+
super(message);
|
|
1093
|
+
this.name = 'AssertionError';
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
const Object$1 = 1;
|
|
1097
|
+
const Number$1 = 2;
|
|
1098
|
+
const Array$1 = 3;
|
|
1099
|
+
const String$1 = 4;
|
|
1100
|
+
const Boolean$1 = 5;
|
|
1101
|
+
const Function = 6;
|
|
1102
|
+
const Null = 7;
|
|
1103
|
+
const Unknown = 8;
|
|
1104
|
+
const getType = value => {
|
|
1105
|
+
switch (typeof value) {
|
|
1106
|
+
case 'number':
|
|
1107
|
+
return Number$1;
|
|
1108
|
+
case 'function':
|
|
1109
|
+
return Function;
|
|
1110
|
+
case 'string':
|
|
1111
|
+
return String$1;
|
|
1112
|
+
case 'object':
|
|
1113
|
+
if (value === null) {
|
|
1114
|
+
return Null;
|
|
1115
|
+
}
|
|
1116
|
+
if (Array.isArray(value)) {
|
|
1117
|
+
return Array$1;
|
|
1118
|
+
}
|
|
1119
|
+
return Object$1;
|
|
1120
|
+
case 'boolean':
|
|
1121
|
+
return Boolean$1;
|
|
1122
|
+
default:
|
|
1123
|
+
return Unknown;
|
|
1124
|
+
}
|
|
1125
|
+
};
|
|
1126
|
+
const number = value => {
|
|
1127
|
+
const type = getType(value);
|
|
1128
|
+
if (type !== Number$1) {
|
|
1129
|
+
throw new AssertionError('expected value to be of type number');
|
|
1130
|
+
}
|
|
1131
|
+
};
|
|
1132
|
+
|
|
1132
1133
|
const {
|
|
1133
1134
|
invoke: invoke$1,
|
|
1134
1135
|
invokeAndTransfer,
|
|
@@ -2010,6 +2011,8 @@ const getLineDom = parts => {
|
|
|
2010
2011
|
return [lineNode, ...children];
|
|
2011
2012
|
};
|
|
2012
2013
|
|
|
2014
|
+
const Focusable = 0;
|
|
2015
|
+
|
|
2013
2016
|
const getContentDom = (lines, error) => {
|
|
2014
2017
|
if (error) {
|
|
2015
2018
|
return [];
|
|
@@ -2017,23 +2020,30 @@ const getContentDom = (lines, error) => {
|
|
|
2017
2020
|
return [{
|
|
2018
2021
|
childCount: lines.length,
|
|
2019
2022
|
className: OutputContent,
|
|
2020
|
-
role:
|
|
2021
|
-
tabIndex:
|
|
2023
|
+
role: Log,
|
|
2024
|
+
tabIndex: Focusable,
|
|
2022
2025
|
type: Div
|
|
2023
2026
|
}, ...lines.flatMap(getLineDom)];
|
|
2024
2027
|
};
|
|
2025
2028
|
|
|
2026
2029
|
const LogFileNotFound = 1;
|
|
2027
2030
|
|
|
2031
|
+
const messageNode = {
|
|
2032
|
+
childCount: 1,
|
|
2033
|
+
className: Message,
|
|
2034
|
+
tabIndex: Focusable,
|
|
2035
|
+
type: Div
|
|
2036
|
+
};
|
|
2028
2037
|
const getLogFileNotFoundDom = () => {
|
|
2029
|
-
return [
|
|
2030
|
-
childCount: 1,
|
|
2031
|
-
className: Message,
|
|
2032
|
-
tabIndex: 0,
|
|
2033
|
-
type: Div
|
|
2034
|
-
}, text(logFileNotFound())];
|
|
2038
|
+
return [messageNode, text(logFileNotFound())];
|
|
2035
2039
|
};
|
|
2036
2040
|
|
|
2041
|
+
const errorNode = {
|
|
2042
|
+
childCount: 1,
|
|
2043
|
+
className: Error$1,
|
|
2044
|
+
tabIndex: Focusable,
|
|
2045
|
+
type: Div
|
|
2046
|
+
};
|
|
2037
2047
|
const getErrorDom = (errorCode, error) => {
|
|
2038
2048
|
if (!error) {
|
|
2039
2049
|
return [];
|
|
@@ -2041,12 +2051,7 @@ const getErrorDom = (errorCode, error) => {
|
|
|
2041
2051
|
if (errorCode === LogFileNotFound) {
|
|
2042
2052
|
return getLogFileNotFoundDom();
|
|
2043
2053
|
}
|
|
2044
|
-
return [
|
|
2045
|
-
childCount: 1,
|
|
2046
|
-
className: Error$1,
|
|
2047
|
-
tabIndex: 0,
|
|
2048
|
-
type: Div
|
|
2049
|
-
}, text(error)];
|
|
2054
|
+
return [errorNode, text(error)];
|
|
2050
2055
|
};
|
|
2051
2056
|
|
|
2052
2057
|
const getOutputVirtualDom = (lines, errorCode, error) => {
|
|
@@ -2131,13 +2136,14 @@ const getActionButtonsVirtualDom = buttons => {
|
|
|
2131
2136
|
return buttons.flatMap(getActionButtonVirtualDom);
|
|
2132
2137
|
};
|
|
2133
2138
|
|
|
2139
|
+
const filterNode = {
|
|
2140
|
+
childCount: 1,
|
|
2141
|
+
className: Filter,
|
|
2142
|
+
type: Div
|
|
2143
|
+
};
|
|
2134
2144
|
const getFilterVirtualDom = () => {
|
|
2135
2145
|
const placeholder = filter();
|
|
2136
|
-
return [{
|
|
2137
|
-
childCount: 1,
|
|
2138
|
-
className: Filter,
|
|
2139
|
-
type: Div
|
|
2140
|
-
}, {
|
|
2146
|
+
return [filterNode, {
|
|
2141
2147
|
childCount: 0,
|
|
2142
2148
|
className: mergeClassNames(InputBox, FilterInput),
|
|
2143
2149
|
name: Filter$2,
|