@instructure/ui-source-code-editor 8.33.1 → 8.33.2
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/CHANGELOG.md +4 -0
- package/es/SourceCodeEditor/SourceCodeEditorLocator.js +5 -10
- package/es/SourceCodeEditor/customKeybinding.js +7 -3
- package/es/SourceCodeEditor/index.js +42 -122
- package/es/SourceCodeEditor/props.js +3 -1
- package/es/SourceCodeEditor/styles.js +11 -7
- package/es/SourceCodeEditor/theme.js +5 -5
- package/lib/SourceCodeEditor/SourceCodeEditorLocator.js +3 -13
- package/lib/SourceCodeEditor/customKeybinding.js +7 -5
- package/lib/SourceCodeEditor/index.js +37 -153
- package/lib/SourceCodeEditor/props.js +3 -5
- package/lib/SourceCodeEditor/styles.js +10 -8
- package/lib/SourceCodeEditor/theme.js +5 -6
- package/lib/index.js +0 -1
- package/package.json +15 -15
- package/tsconfig.build.tsbuildinfo +1 -1
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
|
-
import { tags } from '@lezer/highlight';
|
|
25
24
|
|
|
25
|
+
import { tags } from '@lezer/highlight';
|
|
26
26
|
/**
|
|
27
27
|
* ---
|
|
28
28
|
* private: true
|
|
@@ -67,7 +67,8 @@ const generateStyle = (componentTheme, props) => {
|
|
|
67
67
|
borderWidth: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.borderWidth,
|
|
68
68
|
borderRadius: componentTheme.borderRadius,
|
|
69
69
|
marginBottom: '1rem',
|
|
70
|
-
...(attachment && {
|
|
70
|
+
...(attachment && {
|
|
71
|
+
...attachmentVariants[attachment],
|
|
71
72
|
...attachmentBorderRadius[attachment]
|
|
72
73
|
})
|
|
73
74
|
},
|
|
@@ -83,7 +84,8 @@ const generateStyle = (componentTheme, props) => {
|
|
|
83
84
|
lineHeight: 1.4375,
|
|
84
85
|
minHeight: '1.4375rem',
|
|
85
86
|
borderRadius: componentTheme.borderRadius,
|
|
86
|
-
...(attachment && {
|
|
87
|
+
...(attachment && {
|
|
88
|
+
...attachmentBorderRadius[attachment]
|
|
87
89
|
})
|
|
88
90
|
},
|
|
89
91
|
'&.cm-editor.cm-focused': {
|
|
@@ -155,7 +157,8 @@ const generateStyle = (componentTheme, props) => {
|
|
|
155
157
|
}, {
|
|
156
158
|
tag: [tags.string, tags.deleted],
|
|
157
159
|
color: '#a11'
|
|
158
|
-
},
|
|
160
|
+
},
|
|
161
|
+
// {
|
|
159
162
|
// tag: [tags.regexp, tags.escape, tags.special(tags.string)],
|
|
160
163
|
// color: '#e40'
|
|
161
164
|
// },
|
|
@@ -165,7 +168,8 @@ const generateStyle = (componentTheme, props) => {
|
|
|
165
168
|
}, {
|
|
166
169
|
tag: tags.local(tags.variableName),
|
|
167
170
|
color: '#30a'
|
|
168
|
-
},
|
|
171
|
+
},
|
|
172
|
+
// { tag: [tags.typeName, tags.namespace], color: '#085' },
|
|
169
173
|
{
|
|
170
174
|
tag: tags.className,
|
|
171
175
|
color: '#167'
|
|
@@ -178,7 +182,8 @@ const generateStyle = (componentTheme, props) => {
|
|
|
178
182
|
}, {
|
|
179
183
|
tag: tags.comment,
|
|
180
184
|
color: '#940'
|
|
181
|
-
},
|
|
185
|
+
},
|
|
186
|
+
// { tag: tags.invalid, color: '#f00' },
|
|
182
187
|
|
|
183
188
|
/**
|
|
184
189
|
* Custom highlighting overrides
|
|
@@ -200,5 +205,4 @@ const generateStyle = (componentTheme, props) => {
|
|
|
200
205
|
}]
|
|
201
206
|
};
|
|
202
207
|
};
|
|
203
|
-
|
|
204
208
|
export default generateStyle;
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
*/
|
|
30
30
|
const generateComponentTheme = theme => {
|
|
31
31
|
const colors = theme.colors,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
borders = theme.borders,
|
|
33
|
+
typography = theme.typography,
|
|
34
|
+
spacing = theme.spacing;
|
|
35
35
|
const componentVariables = {
|
|
36
36
|
fontFamily: typography === null || typography === void 0 ? void 0 : typography.fontFamilyMonospace,
|
|
37
37
|
fontSize: typography === null || typography === void 0 ? void 0 : typography.fontSizeSmall,
|
|
@@ -45,8 +45,8 @@ const generateComponentTheme = theme => {
|
|
|
45
45
|
horizontalPadding: spacing === null || spacing === void 0 ? void 0 : spacing.xSmall,
|
|
46
46
|
verticalPadding: spacing === null || spacing === void 0 ? void 0 : spacing.xxSmall
|
|
47
47
|
};
|
|
48
|
-
return {
|
|
48
|
+
return {
|
|
49
|
+
...componentVariables
|
|
49
50
|
};
|
|
50
51
|
};
|
|
51
|
-
|
|
52
52
|
export default generateComponentTheme;
|
|
@@ -4,13 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.SourceCodeEditorLocator = void 0;
|
|
7
|
-
|
|
8
7
|
var _locator = require("@instructure/ui-test-locator/lib/utils/locator.js");
|
|
9
|
-
|
|
10
8
|
var _uiTestQueries = require("@instructure/ui-test-queries");
|
|
11
|
-
|
|
12
9
|
var _index = require("./index");
|
|
13
|
-
|
|
14
10
|
/*
|
|
15
11
|
* The MIT License (MIT)
|
|
16
12
|
*
|
|
@@ -34,57 +30,51 @@ var _index = require("./index");
|
|
|
34
30
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
35
31
|
* SOFTWARE.
|
|
36
32
|
*/
|
|
33
|
+
|
|
37
34
|
// @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
38
35
|
const SourceCodeEditorLocator = (0, _locator.locator)(_index.SourceCodeEditor.selector, {
|
|
39
36
|
findContainer: async function () {
|
|
40
37
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
41
38
|
args[_key] = arguments[_key];
|
|
42
39
|
}
|
|
43
|
-
|
|
44
40
|
return await (0, _uiTestQueries.find)('[class$=-codeEditorContainer]', ...args);
|
|
45
41
|
},
|
|
46
42
|
findLabel: async function () {
|
|
47
43
|
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
48
44
|
args[_key2] = arguments[_key2];
|
|
49
45
|
}
|
|
50
|
-
|
|
51
46
|
return await (0, _uiTestQueries.find)('[class$=-screenReaderContent]', ...args);
|
|
52
47
|
},
|
|
53
48
|
findInput: async function () {
|
|
54
49
|
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
55
50
|
args[_key3] = arguments[_key3];
|
|
56
51
|
}
|
|
57
|
-
|
|
58
52
|
return await (0, _uiTestQueries.find)('[role="textbox"]', ...args);
|
|
59
53
|
},
|
|
60
54
|
findGutter: async function () {
|
|
61
55
|
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
62
56
|
args[_key4] = arguments[_key4];
|
|
63
57
|
}
|
|
64
|
-
|
|
65
58
|
return await (0, _uiTestQueries.find)('.cm-gutter', ...args);
|
|
66
59
|
},
|
|
67
60
|
findScroller: async function () {
|
|
68
61
|
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
|
69
62
|
args[_key5] = arguments[_key5];
|
|
70
63
|
}
|
|
71
|
-
|
|
72
64
|
return await (0, _uiTestQueries.find)('.cm-scroller', ...args);
|
|
73
65
|
},
|
|
74
66
|
findAllLines: async function () {
|
|
75
67
|
for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
|
76
68
|
args[_key6] = arguments[_key6];
|
|
77
69
|
}
|
|
78
|
-
|
|
79
70
|
return await (0, _uiTestQueries.findAll)('.cm-line', ...args);
|
|
80
71
|
},
|
|
81
72
|
findAllGutterElements: async function () {
|
|
82
73
|
for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
|
|
83
74
|
args[_key7] = arguments[_key7];
|
|
84
75
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
76
|
+
const allGutterElements = await (0, _uiTestQueries.findAll)('.cm-gutterElement', ...args);
|
|
77
|
+
// first gutter element is always a placeholder
|
|
88
78
|
allGutterElements.shift();
|
|
89
79
|
return allGutterElements;
|
|
90
80
|
}
|
|
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.rtlHorizontalArrowKeymap = void 0;
|
|
7
|
-
|
|
8
7
|
var _commands = require("@codemirror/commands");
|
|
9
|
-
|
|
10
8
|
/*
|
|
11
9
|
* The MIT License (MIT)
|
|
12
10
|
*
|
|
@@ -30,7 +28,9 @@ var _commands = require("@codemirror/commands");
|
|
|
30
28
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
31
29
|
* SOFTWARE.
|
|
32
30
|
*/
|
|
33
|
-
|
|
31
|
+
|
|
32
|
+
const rtlHorizontalArrowKeymap = [
|
|
33
|
+
// Left/Start/Forward
|
|
34
34
|
{
|
|
35
35
|
key: 'ArrowLeft',
|
|
36
36
|
run: _commands.cursorCharRight,
|
|
@@ -54,7 +54,8 @@ const rtlHorizontalArrowKeymap = [// Left/Start/Forward
|
|
|
54
54
|
key: 'Home',
|
|
55
55
|
run: _commands.cursorLineBoundaryForward,
|
|
56
56
|
shift: _commands.selectLineBoundaryForward
|
|
57
|
-
},
|
|
57
|
+
},
|
|
58
|
+
// Right/End/Backward
|
|
58
59
|
{
|
|
59
60
|
key: 'ArrowRight',
|
|
60
61
|
run: _commands.cursorCharLeft,
|
|
@@ -78,7 +79,8 @@ const rtlHorizontalArrowKeymap = [// Left/Start/Forward
|
|
|
78
79
|
key: 'End',
|
|
79
80
|
run: _commands.cursorLineBoundaryBackward,
|
|
80
81
|
shift: _commands.selectLineBoundaryBackward
|
|
81
|
-
},
|
|
82
|
+
},
|
|
83
|
+
// Delete/Backspace
|
|
82
84
|
{
|
|
83
85
|
key: 'Delete',
|
|
84
86
|
run: _commands.deleteCharBackward
|