@instructure/ui-source-code-editor 10.25.0 → 10.25.1-pr-snapshot-1757941125745
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 +11 -0
- package/es/SourceCodeEditor/SearchPanel.js +7 -21
- package/es/SourceCodeEditor/index.js +6 -6
- package/es/SourceCodeEditor/props.js +1 -33
- package/lib/SourceCodeEditor/SearchPanel.js +6 -21
- package/lib/SourceCodeEditor/index.js +5 -5
- package/lib/SourceCodeEditor/props.js +1 -34
- package/package.json +16 -19
- package/src/SourceCodeEditor/SearchPanel.tsx +7 -24
- package/src/SourceCodeEditor/index.tsx +2 -4
- package/src/SourceCodeEditor/props.ts +1 -51
- package/tsconfig.build.json +0 -2
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/SourceCodeEditor/SearchPanel.d.ts.map +1 -1
- package/types/SourceCodeEditor/index.d.ts +0 -29
- package/types/SourceCodeEditor/index.d.ts.map +1 -1
- package/types/SourceCodeEditor/props.d.ts +2 -3
- package/types/SourceCodeEditor/props.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [10.25.1-pr-snapshot-1757941125745](https://github.com/instructure/instructure-ui/compare/v10.25.0...v10.25.1-pr-snapshot-1757941125745) (2025-09-15)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **many:** remove prop-types; add support for react 19 and upgrade docs app to use it ([22311c7](https://github.com/instructure/instructure-ui/commit/22311c7bcf52d4e7b094c60c92192e5c85eac6c2))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# [10.25.0](https://github.com/instructure/instructure-ui/compare/v10.24.2...v10.25.0) (2025-09-09)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @instructure/ui-source-code-editor
|
|
@@ -24,12 +24,12 @@ var _IconSearchLine, _IconArrowOpenDownLin, _IconArrowOpenUpLine;
|
|
|
24
24
|
* SOFTWARE.
|
|
25
25
|
*/
|
|
26
26
|
|
|
27
|
-
import {
|
|
27
|
+
import { useState } from 'react';
|
|
28
28
|
import { setSearchQuery, search, findNext, findPrevious, SearchQuery, closeSearchPanel } from '@codemirror/search';
|
|
29
29
|
import { TextInput } from '@instructure/ui-text-input';
|
|
30
30
|
import { IconButton } from '@instructure/ui-buttons';
|
|
31
31
|
import { IconArrowOpenDownLine, IconArrowOpenUpLine, IconSearchLine } from '@instructure/ui-icons';
|
|
32
|
-
import
|
|
32
|
+
import { createRoot } from 'react-dom/client';
|
|
33
33
|
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
34
34
|
function SearchPanel({
|
|
35
35
|
view,
|
|
@@ -103,27 +103,13 @@ function SearchPanel({
|
|
|
103
103
|
export default function customSearch(searchConfig) {
|
|
104
104
|
return searchConfig ? search({
|
|
105
105
|
createPanel: view => {
|
|
106
|
-
var _SearchPanel;
|
|
107
106
|
const dom = document.createElement('div');
|
|
108
107
|
dom.style.padding = '8px';
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
import(/* webpackIgnore: true */ /* @vite-ignore */module).then(r => {
|
|
115
|
-
const root = r.createRoot(dom);
|
|
116
|
-
root.render(_SearchPanel || (_SearchPanel = _jsx(SearchPanel, {
|
|
117
|
-
view: view,
|
|
118
|
-
searchConfig: searchConfig
|
|
119
|
-
})));
|
|
120
|
-
}).catch(e => {});
|
|
121
|
-
} else {
|
|
122
|
-
ReactDOM.render(_jsx(SearchPanel, {
|
|
123
|
-
view: view,
|
|
124
|
-
searchConfig: searchConfig
|
|
125
|
-
}), dom);
|
|
126
|
-
}
|
|
108
|
+
const root = createRoot(dom);
|
|
109
|
+
root.render(_jsx(SearchPanel, {
|
|
110
|
+
view: view,
|
|
111
|
+
searchConfig: searchConfig
|
|
112
|
+
}));
|
|
127
113
|
return {
|
|
128
114
|
dom
|
|
129
115
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
2
|
const _excluded = ["label", "styles"];
|
|
3
|
-
var _dec, _dec2, _dec3,
|
|
3
|
+
var _dec, _dec2, _dec3, _class, _SourceCodeEditor;
|
|
4
4
|
/*
|
|
5
5
|
* The MIT License (MIT)
|
|
6
6
|
*
|
|
@@ -43,7 +43,6 @@ import { shell } from '@codemirror/legacy-modes/mode/shell';
|
|
|
43
43
|
import { yaml } from '@codemirror/legacy-modes/mode/yaml';
|
|
44
44
|
// import { oneDarkTheme, oneDarkHighlightStyle } from '@codemirror/theme-one-dark'
|
|
45
45
|
|
|
46
|
-
import { testable } from '@instructure/ui-testable';
|
|
47
46
|
import { omitProps, passthroughProps, withDeterministicId } from '@instructure/ui-react-utils';
|
|
48
47
|
import { requestAnimationFrame } from '@instructure/ui-dom-utils';
|
|
49
48
|
import { ScreenReaderContent } from '@instructure/ui-a11y-content';
|
|
@@ -53,14 +52,14 @@ import customSearch from './SearchPanel';
|
|
|
53
52
|
import generateStyle from './styles';
|
|
54
53
|
import generateComponentTheme from './theme';
|
|
55
54
|
import { rtlHorizontalArrowKeymap } from './customKeybinding';
|
|
56
|
-
import {
|
|
55
|
+
import { allowedProps } from './props';
|
|
57
56
|
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
58
57
|
/**
|
|
59
58
|
---
|
|
60
59
|
category: components
|
|
61
60
|
---
|
|
62
61
|
**/
|
|
63
|
-
let SourceCodeEditor = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, generateComponentTheme), _dec3 = textDirectionContextConsumer(),
|
|
62
|
+
let SourceCodeEditor = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, generateComponentTheme), _dec3 = textDirectionContextConsumer(), _dec(_class = _dec2(_class = _dec3(_class = (_SourceCodeEditor = class SourceCodeEditor extends Component {
|
|
64
63
|
addAnimationFrame(callback) {
|
|
65
64
|
if (typeof callback === 'function') {
|
|
66
65
|
this._raf.push(requestAnimationFrame(callback));
|
|
@@ -500,6 +499,7 @@ let SourceCodeEditor = (_dec = withDeterministicId(), _dec2 = withStyle(generate
|
|
|
500
499
|
styles = _this$props6.styles,
|
|
501
500
|
restProps = _objectWithoutProperties(_this$props6, _excluded);
|
|
502
501
|
return _jsx("div", {
|
|
502
|
+
"data-cid": "SourceCodeEditor",
|
|
503
503
|
ref: this.handleRef,
|
|
504
504
|
css: styles === null || styles === void 0 ? void 0 : styles.codeEditor,
|
|
505
505
|
...passthroughProps(omitProps(restProps, SourceCodeEditor.allowedProps)),
|
|
@@ -515,7 +515,7 @@ let SourceCodeEditor = (_dec = withDeterministicId(), _dec2 = withStyle(generate
|
|
|
515
515
|
})
|
|
516
516
|
});
|
|
517
517
|
}
|
|
518
|
-
}, _SourceCodeEditor.displayName = "SourceCodeEditor", _SourceCodeEditor.componentId = 'SourceCodeEditor', _SourceCodeEditor.
|
|
518
|
+
}, _SourceCodeEditor.displayName = "SourceCodeEditor", _SourceCodeEditor.componentId = 'SourceCodeEditor', _SourceCodeEditor.allowedProps = allowedProps, _SourceCodeEditor.defaultProps = {
|
|
519
519
|
language: 'jsx',
|
|
520
520
|
readOnly: false,
|
|
521
521
|
editable: true,
|
|
@@ -531,6 +531,6 @@ let SourceCodeEditor = (_dec = withDeterministicId(), _dec2 = withStyle(generate
|
|
|
531
531
|
indentWithTab: false,
|
|
532
532
|
defaultValue: '',
|
|
533
533
|
height: 'auto'
|
|
534
|
-
}, _SourceCodeEditor)) || _class) || _class) || _class)
|
|
534
|
+
}, _SourceCodeEditor)) || _class) || _class) || _class);
|
|
535
535
|
export default SourceCodeEditor;
|
|
536
536
|
export { SourceCodeEditor };
|
|
@@ -22,39 +22,7 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
import PropTypes from 'prop-types';
|
|
26
|
-
import { controllable } from '@instructure/ui-prop-types';
|
|
27
|
-
const propTypes = {
|
|
28
|
-
label: PropTypes.string.isRequired,
|
|
29
|
-
language: PropTypes.oneOf(['sh', 'js', 'json', 'javascript', 'jsx', 'shell', 'css', 'html', 'markdown', 'yaml', 'yml', 'bash']),
|
|
30
|
-
readOnly: PropTypes.bool,
|
|
31
|
-
editable: PropTypes.bool,
|
|
32
|
-
lineNumbers: PropTypes.bool,
|
|
33
|
-
foldGutter: PropTypes.bool,
|
|
34
|
-
highlightActiveLineGutter: PropTypes.bool,
|
|
35
|
-
highlightActiveLine: PropTypes.bool,
|
|
36
|
-
lineWrapping: PropTypes.bool,
|
|
37
|
-
autofocus: PropTypes.bool,
|
|
38
|
-
spellcheck: PropTypes.bool,
|
|
39
|
-
direction: PropTypes.oneOf(['ltr', 'rtl']),
|
|
40
|
-
rtlMoveVisually: PropTypes.bool,
|
|
41
|
-
indentOnLoad: PropTypes.bool,
|
|
42
|
-
indentWithTab: PropTypes.bool,
|
|
43
|
-
indentUnit: PropTypes.string,
|
|
44
|
-
defaultValue: PropTypes.string,
|
|
45
|
-
value: controllable(PropTypes.string, 'onChange', 'defaultValue'),
|
|
46
|
-
onChange: PropTypes.func,
|
|
47
|
-
onFocus: PropTypes.func,
|
|
48
|
-
onBlur: PropTypes.func,
|
|
49
|
-
attachment: PropTypes.oneOf(['bottom', 'top']),
|
|
50
|
-
height: PropTypes.string,
|
|
51
|
-
width: PropTypes.string,
|
|
52
|
-
// darkTheme: PropTypes.bool,
|
|
53
|
-
elementRef: PropTypes.func,
|
|
54
|
-
containerRef: PropTypes.func,
|
|
55
|
-
searchConfig: PropTypes.object
|
|
56
|
-
};
|
|
57
25
|
const allowedProps = ['label', 'language', 'readOnly', 'editable', 'lineNumbers', 'foldGutter', 'highlightActiveLineGutter', 'highlightActiveLine', 'lineWrapping', 'autofocus', 'spellcheck', 'direction', 'rtlMoveVisually', 'indentOnLoad', 'indentWithTab', 'indentUnit', 'defaultValue', 'value', 'onChange', 'onFocus', 'onBlur', 'attachment', 'height', 'width',
|
|
58
26
|
// 'darkTheme',
|
|
59
27
|
'elementRef', 'containerRef', 'searchConfig'];
|
|
60
|
-
export {
|
|
28
|
+
export { allowedProps };
|
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = customSearch;
|
|
8
|
-
var _interopRequireWildcard2 = _interopRequireDefault(require("@babel/runtime/helpers/interopRequireWildcard"));
|
|
9
8
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
9
|
var _react = require("react");
|
|
11
10
|
var _search = require("@codemirror/search");
|
|
@@ -14,7 +13,7 @@ var _IconButton = require("@instructure/ui-buttons/lib/IconButton");
|
|
|
14
13
|
var _IconArrowOpenDownLine = require("@instructure/ui-icons/lib/IconArrowOpenDownLine.js");
|
|
15
14
|
var _IconArrowOpenUpLine2 = require("@instructure/ui-icons/lib/IconArrowOpenUpLine.js");
|
|
16
15
|
var _IconSearchLine2 = require("@instructure/ui-icons/lib/IconSearchLine.js");
|
|
17
|
-
var
|
|
16
|
+
var _client = require("react-dom/client");
|
|
18
17
|
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
19
18
|
var _IconSearchLine, _IconArrowOpenDownLin, _IconArrowOpenUpLine;
|
|
20
19
|
/*
|
|
@@ -112,27 +111,13 @@ function SearchPanel({
|
|
|
112
111
|
function customSearch(searchConfig) {
|
|
113
112
|
return searchConfig ? (0, _search.search)({
|
|
114
113
|
createPanel: view => {
|
|
115
|
-
var _SearchPanel;
|
|
116
114
|
const dom = document.createElement('div');
|
|
117
115
|
dom.style.padding = '8px';
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
(specifier => new Promise(r => r(`${specifier}`)).then(s => (0, _interopRequireWildcard2.default)(require(s))))(/* webpackIgnore: true */ /* @vite-ignore */module).then(r => {
|
|
124
|
-
const root = r.createRoot(dom);
|
|
125
|
-
root.render(_SearchPanel || (_SearchPanel = (0, _jsxRuntime.jsx)(SearchPanel, {
|
|
126
|
-
view: view,
|
|
127
|
-
searchConfig: searchConfig
|
|
128
|
-
})));
|
|
129
|
-
}).catch(e => {});
|
|
130
|
-
} else {
|
|
131
|
-
_reactDom.default.render((0, _jsxRuntime.jsx)(SearchPanel, {
|
|
132
|
-
view: view,
|
|
133
|
-
searchConfig: searchConfig
|
|
134
|
-
}), dom);
|
|
135
|
-
}
|
|
116
|
+
const root = (0, _client.createRoot)(dom);
|
|
117
|
+
root.render((0, _jsxRuntime.jsx)(SearchPanel, {
|
|
118
|
+
view: view,
|
|
119
|
+
searchConfig: searchConfig
|
|
120
|
+
}));
|
|
136
121
|
return {
|
|
137
122
|
dom
|
|
138
123
|
};
|
|
@@ -22,7 +22,6 @@ var _langMarkdown = require("@codemirror/lang-markdown");
|
|
|
22
22
|
var _langJson = require("@codemirror/lang-json");
|
|
23
23
|
var _shell = require("@codemirror/legacy-modes/mode/shell");
|
|
24
24
|
var _yaml = require("@codemirror/legacy-modes/mode/yaml");
|
|
25
|
-
var _testable = require("@instructure/ui-testable/lib/testable.js");
|
|
26
25
|
var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
|
|
27
26
|
var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
|
|
28
27
|
var _withDeterministicId = require("@instructure/ui-react-utils/lib/DeterministicIdContext/withDeterministicId.js");
|
|
@@ -37,7 +36,7 @@ var _customKeybinding = require("./customKeybinding");
|
|
|
37
36
|
var _props = require("./props");
|
|
38
37
|
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
39
38
|
const _excluded = ["label", "styles"];
|
|
40
|
-
var _dec, _dec2, _dec3,
|
|
39
|
+
var _dec, _dec2, _dec3, _class, _SourceCodeEditor;
|
|
41
40
|
/*
|
|
42
41
|
* The MIT License (MIT)
|
|
43
42
|
*
|
|
@@ -67,7 +66,7 @@ var _dec, _dec2, _dec3, _dec4, _class, _SourceCodeEditor;
|
|
|
67
66
|
category: components
|
|
68
67
|
---
|
|
69
68
|
**/
|
|
70
|
-
let SourceCodeEditor = exports.SourceCodeEditor = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec3 = (0, _textDirectionContextConsumer.textDirectionContextConsumer)(),
|
|
69
|
+
let SourceCodeEditor = exports.SourceCodeEditor = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec3 = (0, _textDirectionContextConsumer.textDirectionContextConsumer)(), _dec(_class = _dec2(_class = _dec3(_class = (_SourceCodeEditor = class SourceCodeEditor extends _react.Component {
|
|
71
70
|
addAnimationFrame(callback) {
|
|
72
71
|
if (typeof callback === 'function') {
|
|
73
72
|
this._raf.push((0, _requestAnimationFrame.requestAnimationFrame)(callback));
|
|
@@ -507,6 +506,7 @@ let SourceCodeEditor = exports.SourceCodeEditor = (_dec = (0, _withDeterministic
|
|
|
507
506
|
styles = _this$props6.styles,
|
|
508
507
|
restProps = (0, _objectWithoutProperties2.default)(_this$props6, _excluded);
|
|
509
508
|
return (0, _jsxRuntime.jsx)("div", {
|
|
509
|
+
"data-cid": "SourceCodeEditor",
|
|
510
510
|
ref: this.handleRef,
|
|
511
511
|
css: styles === null || styles === void 0 ? void 0 : styles.codeEditor,
|
|
512
512
|
...(0, _passthroughProps.passthroughProps)((0, _omitProps.omitProps)(restProps, SourceCodeEditor.allowedProps)),
|
|
@@ -522,7 +522,7 @@ let SourceCodeEditor = exports.SourceCodeEditor = (_dec = (0, _withDeterministic
|
|
|
522
522
|
})
|
|
523
523
|
});
|
|
524
524
|
}
|
|
525
|
-
}, _SourceCodeEditor.displayName = "SourceCodeEditor", _SourceCodeEditor.componentId = 'SourceCodeEditor', _SourceCodeEditor.
|
|
525
|
+
}, _SourceCodeEditor.displayName = "SourceCodeEditor", _SourceCodeEditor.componentId = 'SourceCodeEditor', _SourceCodeEditor.allowedProps = _props.allowedProps, _SourceCodeEditor.defaultProps = {
|
|
526
526
|
language: 'jsx',
|
|
527
527
|
readOnly: false,
|
|
528
528
|
editable: true,
|
|
@@ -538,5 +538,5 @@ let SourceCodeEditor = exports.SourceCodeEditor = (_dec = (0, _withDeterministic
|
|
|
538
538
|
indentWithTab: false,
|
|
539
539
|
defaultValue: '',
|
|
540
540
|
height: 'auto'
|
|
541
|
-
}, _SourceCodeEditor)) || _class) || _class) || _class)
|
|
541
|
+
}, _SourceCodeEditor)) || _class) || _class) || _class);
|
|
542
542
|
var _default = exports.default = SourceCodeEditor;
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
|
-
exports.
|
|
8
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
var _controllable = require("@instructure/ui-prop-types/lib/controllable.js");
|
|
6
|
+
exports.allowedProps = void 0;
|
|
10
7
|
/*
|
|
11
8
|
* The MIT License (MIT)
|
|
12
9
|
*
|
|
@@ -31,36 +28,6 @@ var _controllable = require("@instructure/ui-prop-types/lib/controllable.js");
|
|
|
31
28
|
* SOFTWARE.
|
|
32
29
|
*/
|
|
33
30
|
|
|
34
|
-
const propTypes = exports.propTypes = {
|
|
35
|
-
label: _propTypes.default.string.isRequired,
|
|
36
|
-
language: _propTypes.default.oneOf(['sh', 'js', 'json', 'javascript', 'jsx', 'shell', 'css', 'html', 'markdown', 'yaml', 'yml', 'bash']),
|
|
37
|
-
readOnly: _propTypes.default.bool,
|
|
38
|
-
editable: _propTypes.default.bool,
|
|
39
|
-
lineNumbers: _propTypes.default.bool,
|
|
40
|
-
foldGutter: _propTypes.default.bool,
|
|
41
|
-
highlightActiveLineGutter: _propTypes.default.bool,
|
|
42
|
-
highlightActiveLine: _propTypes.default.bool,
|
|
43
|
-
lineWrapping: _propTypes.default.bool,
|
|
44
|
-
autofocus: _propTypes.default.bool,
|
|
45
|
-
spellcheck: _propTypes.default.bool,
|
|
46
|
-
direction: _propTypes.default.oneOf(['ltr', 'rtl']),
|
|
47
|
-
rtlMoveVisually: _propTypes.default.bool,
|
|
48
|
-
indentOnLoad: _propTypes.default.bool,
|
|
49
|
-
indentWithTab: _propTypes.default.bool,
|
|
50
|
-
indentUnit: _propTypes.default.string,
|
|
51
|
-
defaultValue: _propTypes.default.string,
|
|
52
|
-
value: (0, _controllable.controllable)(_propTypes.default.string, 'onChange', 'defaultValue'),
|
|
53
|
-
onChange: _propTypes.default.func,
|
|
54
|
-
onFocus: _propTypes.default.func,
|
|
55
|
-
onBlur: _propTypes.default.func,
|
|
56
|
-
attachment: _propTypes.default.oneOf(['bottom', 'top']),
|
|
57
|
-
height: _propTypes.default.string,
|
|
58
|
-
width: _propTypes.default.string,
|
|
59
|
-
// darkTheme: PropTypes.bool,
|
|
60
|
-
elementRef: _propTypes.default.func,
|
|
61
|
-
containerRef: _propTypes.default.func,
|
|
62
|
-
searchConfig: _propTypes.default.object
|
|
63
|
-
};
|
|
64
31
|
const allowedProps = exports.allowedProps = ['label', 'language', 'readOnly', 'editable', 'lineNumbers', 'foldGutter', 'highlightActiveLineGutter', 'highlightActiveLine', 'lineWrapping', 'autofocus', 'spellcheck', 'direction', 'rtlMoveVisually', 'indentOnLoad', 'indentWithTab', 'indentUnit', 'defaultValue', 'value', 'onChange', 'onFocus', 'onBlur', 'attachment', 'height', 'width',
|
|
65
32
|
// 'darkTheme',
|
|
66
33
|
'elementRef', 'containerRef', 'searchConfig'];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-source-code-editor",
|
|
3
|
-
"version": "10.25.
|
|
3
|
+
"version": "10.25.1-pr-snapshot-1757941125745",
|
|
4
4
|
"description": "A UI component library made by Instructure Inc.",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
},
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@instructure/ui-babel-preset": "10.25.
|
|
26
|
+
"@instructure/ui-babel-preset": "10.25.1-pr-snapshot-1757941125745",
|
|
27
27
|
"@testing-library/jest-dom": "^6.6.3",
|
|
28
28
|
"@testing-library/react": "^16.0.1",
|
|
29
29
|
"@testing-library/user-event": "^14.6.1",
|
|
@@ -44,25 +44,22 @@
|
|
|
44
44
|
"@codemirror/search": "^6.5.6",
|
|
45
45
|
"@codemirror/state": "^6.4.1",
|
|
46
46
|
"@codemirror/view": "^6.34.1",
|
|
47
|
-
"@instructure/emotion": "10.25.
|
|
48
|
-
"@instructure/shared-types": "10.25.
|
|
49
|
-
"@instructure/ui-a11y-content": "10.25.
|
|
50
|
-
"@instructure/ui-buttons": "10.25.
|
|
51
|
-
"@instructure/ui-dom-utils": "10.25.
|
|
52
|
-
"@instructure/ui-i18n": "10.25.
|
|
53
|
-
"@instructure/ui-icons": "10.25.
|
|
54
|
-
"@instructure/ui-
|
|
55
|
-
"@instructure/ui-
|
|
56
|
-
"@instructure/ui-
|
|
57
|
-
"@instructure/ui-
|
|
58
|
-
"@
|
|
59
|
-
"@instructure/ui-utils": "10.25.0",
|
|
60
|
-
"@lezer/highlight": "1.2.1",
|
|
61
|
-
"prop-types": "^15.8.1"
|
|
47
|
+
"@instructure/emotion": "10.25.1-pr-snapshot-1757941125745",
|
|
48
|
+
"@instructure/shared-types": "10.25.1-pr-snapshot-1757941125745",
|
|
49
|
+
"@instructure/ui-a11y-content": "10.25.1-pr-snapshot-1757941125745",
|
|
50
|
+
"@instructure/ui-buttons": "10.25.1-pr-snapshot-1757941125745",
|
|
51
|
+
"@instructure/ui-dom-utils": "10.25.1-pr-snapshot-1757941125745",
|
|
52
|
+
"@instructure/ui-i18n": "10.25.1-pr-snapshot-1757941125745",
|
|
53
|
+
"@instructure/ui-icons": "10.25.1-pr-snapshot-1757941125745",
|
|
54
|
+
"@instructure/ui-react-utils": "10.25.1-pr-snapshot-1757941125745",
|
|
55
|
+
"@instructure/ui-text-input": "10.25.1-pr-snapshot-1757941125745",
|
|
56
|
+
"@instructure/ui-themes": "10.25.1-pr-snapshot-1757941125745",
|
|
57
|
+
"@instructure/ui-utils": "10.25.1-pr-snapshot-1757941125745",
|
|
58
|
+
"@lezer/highlight": "1.2.1"
|
|
62
59
|
},
|
|
63
60
|
"peerDependencies": {
|
|
64
|
-
"react": ">=
|
|
65
|
-
"react-dom": ">=
|
|
61
|
+
"react": ">=18 <=19",
|
|
62
|
+
"react-dom": ">=18 <=19"
|
|
66
63
|
},
|
|
67
64
|
"publishConfig": {
|
|
68
65
|
"access": "public"
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
import {
|
|
25
|
+
import { useState } from 'react'
|
|
26
26
|
import {
|
|
27
27
|
setSearchQuery,
|
|
28
28
|
search,
|
|
@@ -40,7 +40,7 @@ import {
|
|
|
40
40
|
IconSearchLine
|
|
41
41
|
} from '@instructure/ui-icons'
|
|
42
42
|
|
|
43
|
-
import
|
|
43
|
+
import { createRoot } from 'react-dom/client'
|
|
44
44
|
|
|
45
45
|
export type SearchConfig = {
|
|
46
46
|
placeholder: string
|
|
@@ -99,7 +99,7 @@ function SearchPanel({
|
|
|
99
99
|
return (
|
|
100
100
|
<TextInput
|
|
101
101
|
renderLabel=""
|
|
102
|
-
inputRef={(r) => {
|
|
102
|
+
inputRef={(r: HTMLInputElement | null) => {
|
|
103
103
|
setTimeout(() => r?.focus(), 0)
|
|
104
104
|
}}
|
|
105
105
|
size="small"
|
|
@@ -142,27 +142,10 @@ export default function customSearch(searchConfig: SearchConfig | undefined) {
|
|
|
142
142
|
createPanel: (view) => {
|
|
143
143
|
const dom = document.createElement('div')
|
|
144
144
|
dom.style.padding = '8px'
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
// Vite errors out during build in React v16/17
|
|
150
|
-
import(/* webpackIgnore: true */ /* @vite-ignore */ module)
|
|
151
|
-
.then((r) => {
|
|
152
|
-
const root = r.createRoot(dom)
|
|
153
|
-
root.render(
|
|
154
|
-
<SearchPanel view={view} searchConfig={searchConfig} />
|
|
155
|
-
)
|
|
156
|
-
})
|
|
157
|
-
.catch((e) => {
|
|
158
|
-
console.error(e)
|
|
159
|
-
})
|
|
160
|
-
} else {
|
|
161
|
-
ReactDOM.render(
|
|
162
|
-
<SearchPanel view={view} searchConfig={searchConfig} />,
|
|
163
|
-
dom
|
|
164
|
-
)
|
|
165
|
-
}
|
|
145
|
+
|
|
146
|
+
const root = createRoot(dom)
|
|
147
|
+
root.render(<SearchPanel view={view} searchConfig={searchConfig} />)
|
|
148
|
+
|
|
166
149
|
return { dom }
|
|
167
150
|
}
|
|
168
151
|
})
|
|
@@ -76,7 +76,6 @@ import { shell } from '@codemirror/legacy-modes/mode/shell'
|
|
|
76
76
|
import { yaml } from '@codemirror/legacy-modes/mode/yaml'
|
|
77
77
|
// import { oneDarkTheme, oneDarkHighlightStyle } from '@codemirror/theme-one-dark'
|
|
78
78
|
|
|
79
|
-
import { testable } from '@instructure/ui-testable'
|
|
80
79
|
import {
|
|
81
80
|
omitProps,
|
|
82
81
|
passthroughProps,
|
|
@@ -97,7 +96,7 @@ import generateComponentTheme from './theme'
|
|
|
97
96
|
|
|
98
97
|
import { rtlHorizontalArrowKeymap } from './customKeybinding'
|
|
99
98
|
|
|
100
|
-
import {
|
|
99
|
+
import { allowedProps } from './props'
|
|
101
100
|
import type { SourceCodeEditorProps } from './props'
|
|
102
101
|
|
|
103
102
|
/**
|
|
@@ -108,11 +107,9 @@ category: components
|
|
|
108
107
|
@withDeterministicId()
|
|
109
108
|
@withStyle(generateStyle, generateComponentTheme)
|
|
110
109
|
@textDirectionContextConsumer()
|
|
111
|
-
@testable()
|
|
112
110
|
class SourceCodeEditor extends Component<SourceCodeEditorProps> {
|
|
113
111
|
static readonly componentId = 'SourceCodeEditor'
|
|
114
112
|
|
|
115
|
-
static propTypes = propTypes
|
|
116
113
|
static allowedProps = allowedProps
|
|
117
114
|
static defaultProps = {
|
|
118
115
|
language: 'jsx',
|
|
@@ -666,6 +663,7 @@ class SourceCodeEditor extends Component<SourceCodeEditorProps> {
|
|
|
666
663
|
|
|
667
664
|
return (
|
|
668
665
|
<div
|
|
666
|
+
data-cid="SourceCodeEditor"
|
|
669
667
|
ref={this.handleRef}
|
|
670
668
|
css={styles?.codeEditor}
|
|
671
669
|
{...passthroughProps(
|
|
@@ -22,14 +22,9 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
import PropTypes from 'prop-types'
|
|
26
|
-
|
|
27
25
|
import type { TagStyle } from '@codemirror/language'
|
|
28
26
|
|
|
29
|
-
import { controllable } from '@instructure/ui-prop-types'
|
|
30
|
-
|
|
31
27
|
import type {
|
|
32
|
-
PropValidators,
|
|
33
28
|
CodeEditorTheme,
|
|
34
29
|
OtherHTMLAttributes
|
|
35
30
|
} from '@instructure/shared-types'
|
|
@@ -233,51 +228,6 @@ type SourceCodeEditorStyle = ComponentStyle<
|
|
|
233
228
|
theme: StyleObject
|
|
234
229
|
highlightStyle: TagStyle[]
|
|
235
230
|
}
|
|
236
|
-
|
|
237
|
-
const propTypes: PropValidators<PropKeys> = {
|
|
238
|
-
label: PropTypes.string.isRequired,
|
|
239
|
-
language: PropTypes.oneOf([
|
|
240
|
-
'sh',
|
|
241
|
-
'js',
|
|
242
|
-
'json',
|
|
243
|
-
'javascript',
|
|
244
|
-
'jsx',
|
|
245
|
-
'shell',
|
|
246
|
-
'css',
|
|
247
|
-
'html',
|
|
248
|
-
'markdown',
|
|
249
|
-
'yaml',
|
|
250
|
-
'yml',
|
|
251
|
-
'bash'
|
|
252
|
-
]),
|
|
253
|
-
readOnly: PropTypes.bool,
|
|
254
|
-
editable: PropTypes.bool,
|
|
255
|
-
lineNumbers: PropTypes.bool,
|
|
256
|
-
foldGutter: PropTypes.bool,
|
|
257
|
-
highlightActiveLineGutter: PropTypes.bool,
|
|
258
|
-
highlightActiveLine: PropTypes.bool,
|
|
259
|
-
lineWrapping: PropTypes.bool,
|
|
260
|
-
autofocus: PropTypes.bool,
|
|
261
|
-
spellcheck: PropTypes.bool,
|
|
262
|
-
direction: PropTypes.oneOf(['ltr', 'rtl']),
|
|
263
|
-
rtlMoveVisually: PropTypes.bool,
|
|
264
|
-
indentOnLoad: PropTypes.bool,
|
|
265
|
-
indentWithTab: PropTypes.bool,
|
|
266
|
-
indentUnit: PropTypes.string,
|
|
267
|
-
defaultValue: PropTypes.string,
|
|
268
|
-
value: controllable(PropTypes.string, 'onChange', 'defaultValue'),
|
|
269
|
-
onChange: PropTypes.func,
|
|
270
|
-
onFocus: PropTypes.func,
|
|
271
|
-
onBlur: PropTypes.func,
|
|
272
|
-
attachment: PropTypes.oneOf(['bottom', 'top']),
|
|
273
|
-
height: PropTypes.string,
|
|
274
|
-
width: PropTypes.string,
|
|
275
|
-
// darkTheme: PropTypes.bool,
|
|
276
|
-
elementRef: PropTypes.func,
|
|
277
|
-
containerRef: PropTypes.func,
|
|
278
|
-
searchConfig: PropTypes.object
|
|
279
|
-
}
|
|
280
|
-
|
|
281
231
|
const allowedProps: AllowedPropKeys = [
|
|
282
232
|
'label',
|
|
283
233
|
'language',
|
|
@@ -310,4 +260,4 @@ const allowedProps: AllowedPropKeys = [
|
|
|
310
260
|
]
|
|
311
261
|
|
|
312
262
|
export type { SourceCodeEditorProps, SourceCodeEditorStyle }
|
|
313
|
-
export {
|
|
263
|
+
export { allowedProps }
|
package/tsconfig.build.json
CHANGED
|
@@ -17,9 +17,7 @@
|
|
|
17
17
|
{ "path": "../ui-a11y-content/tsconfig.build.json" },
|
|
18
18
|
{ "path": "../ui-dom-utils/tsconfig.build.json" },
|
|
19
19
|
{ "path": "../ui-i18n/tsconfig.build.json" },
|
|
20
|
-
{ "path": "../ui-prop-types/tsconfig.build.json" },
|
|
21
20
|
{ "path": "../ui-react-utils/tsconfig.build.json" },
|
|
22
|
-
{ "path": "../ui-testable/tsconfig.build.json" },
|
|
23
21
|
{ "path": "../ui-utils/tsconfig.build.json" }
|
|
24
22
|
]
|
|
25
23
|
}
|