@instructure/ui-source-code-editor 8.53.2-snapshot-3 → 8.53.3-snapshot-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 +12 -1
- package/es/SourceCodeEditor/SearchPanel.js +38 -18
- package/lib/SourceCodeEditor/SearchPanel.js +41 -20
- package/package.json +18 -18
- package/src/SourceCodeEditor/SearchPanel.tsx +41 -14
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/SourceCodeEditor/SearchPanel.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,18 @@
|
|
|
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
|
-
## [8.53.
|
|
6
|
+
## [8.53.3-snapshot-2](https://github.com/instructure/instructure-ui/compare/v8.53.2...v8.53.3-snapshot-2) (2024-02-16)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **ui-source-code-editor:** fix react-dom version detection ([465c10d](https://github.com/instructure/instructure-ui/commit/465c10d43543efe1dc6d3de07d5b0b311d4c27ea))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [8.53.2](https://github.com/instructure/instructure-ui/compare/v8.53.1...v8.53.2) (2024-02-15)
|
|
7
18
|
|
|
8
19
|
|
|
9
20
|
### Bug Fixes
|
|
@@ -29,12 +29,11 @@ import { setSearchQuery, search, findNext, findPrevious, SearchQuery, closeSearc
|
|
|
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
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
32
|
+
import ReactDOM from 'react-dom';
|
|
33
|
+
const createRoot = async () => {
|
|
34
|
+
// eslint-disable-next-line import/no-unresolved
|
|
35
|
+
return import('react-dom/client');
|
|
36
|
+
};
|
|
38
37
|
function SearchPanel({
|
|
39
38
|
view,
|
|
40
39
|
searchConfig
|
|
@@ -100,20 +99,41 @@ function SearchPanel({
|
|
|
100
99
|
export default function customSearch(searchConfig) {
|
|
101
100
|
return searchConfig ? search({
|
|
102
101
|
createPanel: view => {
|
|
102
|
+
var _SearchPanel, _SearchPanel2;
|
|
103
103
|
const dom = document.createElement('div');
|
|
104
104
|
dom.style.padding = '8px';
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
|
|
105
|
+
createRoot().then(res => {
|
|
106
|
+
let err;
|
|
107
|
+
try {
|
|
108
|
+
const root = res.createRoot(dom);
|
|
109
|
+
root.render(_SearchPanel || (_SearchPanel = /*#__PURE__*/React.createElement(SearchPanel, {
|
|
110
|
+
view: view,
|
|
111
|
+
searchConfig: searchConfig
|
|
112
|
+
})));
|
|
113
|
+
} catch (error) {
|
|
114
|
+
err = error;
|
|
115
|
+
}
|
|
116
|
+
// this timeout is needed because Root.render() seems to cause
|
|
117
|
+
// prop validation to be emitted a frame later
|
|
118
|
+
setTimeout(() => {
|
|
119
|
+
if (err) {}
|
|
120
|
+
});
|
|
121
|
+
}).catch(() => {
|
|
122
|
+
// react-dom/client does not exist, its React 16 or 17
|
|
123
|
+
let error;
|
|
124
|
+
setTimeout(() => {
|
|
125
|
+
try {
|
|
126
|
+
ReactDOM.render(_SearchPanel2 || (_SearchPanel2 = /*#__PURE__*/React.createElement(SearchPanel, {
|
|
127
|
+
view: view,
|
|
128
|
+
searchConfig: searchConfig
|
|
129
|
+
})), dom);
|
|
130
|
+
} catch (e) {
|
|
131
|
+
// catch unhandled errors
|
|
132
|
+
error = e;
|
|
133
|
+
}
|
|
134
|
+
if (error) {}
|
|
135
|
+
});
|
|
136
|
+
});
|
|
117
137
|
return {
|
|
118
138
|
dom
|
|
119
139
|
};
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
var
|
|
4
|
+
var _interopRequireWildcard3 = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.default = customSearch;
|
|
9
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
|
-
var
|
|
10
|
+
var _interopRequireWildcard2 = _interopRequireDefault(require("@babel/runtime/helpers/interopRequireWildcard"));
|
|
11
|
+
var _react = _interopRequireWildcard3(require("react"));
|
|
11
12
|
var _search = require("@codemirror/search");
|
|
12
13
|
var _TextInput = require("@instructure/ui-text-input/lib/TextInput");
|
|
13
14
|
var _IconButton = require("@instructure/ui-buttons/lib/IconButton");
|
|
14
15
|
var _IconArrowOpenDownLine = require("@instructure/ui-icons/lib/IconArrowOpenDownLine.js");
|
|
15
16
|
var _IconArrowOpenUpLine2 = require("@instructure/ui-icons/lib/IconArrowOpenUpLine.js");
|
|
16
17
|
var _IconSearchLine2 = require("@instructure/ui-icons/lib/IconSearchLine.js");
|
|
18
|
+
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
17
19
|
var _IconSearchLine, _IconArrowOpenDownLin, _IconArrowOpenUpLine;
|
|
18
20
|
/*
|
|
19
21
|
* The MIT License (MIT)
|
|
@@ -38,12 +40,10 @@ var _IconSearchLine, _IconArrowOpenDownLin, _IconArrowOpenUpLine;
|
|
|
38
40
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
39
41
|
* SOFTWARE.
|
|
40
42
|
*/
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
reactdom = require('react-dom');
|
|
46
|
-
}
|
|
43
|
+
const createRoot = async () => {
|
|
44
|
+
// eslint-disable-next-line import/no-unresolved
|
|
45
|
+
return Promise.resolve().then(() => (0, _interopRequireWildcard2.default)(require('react-dom/client')));
|
|
46
|
+
};
|
|
47
47
|
function SearchPanel({
|
|
48
48
|
view,
|
|
49
49
|
searchConfig
|
|
@@ -109,20 +109,41 @@ function SearchPanel({
|
|
|
109
109
|
function customSearch(searchConfig) {
|
|
110
110
|
return searchConfig ? (0, _search.search)({
|
|
111
111
|
createPanel: view => {
|
|
112
|
+
var _SearchPanel, _SearchPanel2;
|
|
112
113
|
const dom = document.createElement('div');
|
|
113
114
|
dom.style.padding = '8px';
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}
|
|
125
|
-
|
|
115
|
+
createRoot().then(res => {
|
|
116
|
+
let err;
|
|
117
|
+
try {
|
|
118
|
+
const root = res.createRoot(dom);
|
|
119
|
+
root.render(_SearchPanel || (_SearchPanel = /*#__PURE__*/_react.default.createElement(SearchPanel, {
|
|
120
|
+
view: view,
|
|
121
|
+
searchConfig: searchConfig
|
|
122
|
+
})));
|
|
123
|
+
} catch (error) {
|
|
124
|
+
err = error;
|
|
125
|
+
}
|
|
126
|
+
// this timeout is needed because Root.render() seems to cause
|
|
127
|
+
// prop validation to be emitted a frame later
|
|
128
|
+
setTimeout(() => {
|
|
129
|
+
if (err) {}
|
|
130
|
+
});
|
|
131
|
+
}).catch(() => {
|
|
132
|
+
// react-dom/client does not exist, its React 16 or 17
|
|
133
|
+
let error;
|
|
134
|
+
setTimeout(() => {
|
|
135
|
+
try {
|
|
136
|
+
_reactDom.default.render(_SearchPanel2 || (_SearchPanel2 = /*#__PURE__*/_react.default.createElement(SearchPanel, {
|
|
137
|
+
view: view,
|
|
138
|
+
searchConfig: searchConfig
|
|
139
|
+
})), dom);
|
|
140
|
+
} catch (e) {
|
|
141
|
+
// catch unhandled errors
|
|
142
|
+
error = e;
|
|
143
|
+
}
|
|
144
|
+
if (error) {}
|
|
145
|
+
});
|
|
146
|
+
});
|
|
126
147
|
return {
|
|
127
148
|
dom
|
|
128
149
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-source-code-editor",
|
|
3
|
-
"version": "8.53.
|
|
3
|
+
"version": "8.53.3-snapshot-2",
|
|
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,9 +23,9 @@
|
|
|
23
23
|
},
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@instructure/ui-babel-preset": "8.53.
|
|
27
|
-
"@instructure/ui-test-queries": "8.53.
|
|
28
|
-
"@instructure/ui-test-utils": "8.53.
|
|
26
|
+
"@instructure/ui-babel-preset": "8.53.3-snapshot-2",
|
|
27
|
+
"@instructure/ui-test-queries": "8.53.3-snapshot-2",
|
|
28
|
+
"@instructure/ui-test-utils": "8.53.3-snapshot-2",
|
|
29
29
|
"@testing-library/jest-dom": "^6.1.4",
|
|
30
30
|
"@testing-library/react": "^14.0.0"
|
|
31
31
|
},
|
|
@@ -44,20 +44,20 @@
|
|
|
44
44
|
"@codemirror/search": "^6.5.4",
|
|
45
45
|
"@codemirror/state": "^6.3.0",
|
|
46
46
|
"@codemirror/view": "^6.21.3",
|
|
47
|
-
"@instructure/emotion": "8.53.
|
|
48
|
-
"@instructure/shared-types": "8.53.
|
|
49
|
-
"@instructure/ui-a11y-content": "8.53.
|
|
50
|
-
"@instructure/ui-buttons": "8.53.
|
|
51
|
-
"@instructure/ui-dom-utils": "8.53.
|
|
52
|
-
"@instructure/ui-i18n": "8.53.
|
|
53
|
-
"@instructure/ui-icons": "8.53.
|
|
54
|
-
"@instructure/ui-prop-types": "8.53.
|
|
55
|
-
"@instructure/ui-react-utils": "8.53.
|
|
56
|
-
"@instructure/ui-test-locator": "8.53.
|
|
57
|
-
"@instructure/ui-testable": "8.53.
|
|
58
|
-
"@instructure/ui-text-input": "8.53.
|
|
59
|
-
"@instructure/ui-themes": "8.53.
|
|
60
|
-
"@instructure/ui-utils": "8.53.
|
|
47
|
+
"@instructure/emotion": "8.53.3-snapshot-2",
|
|
48
|
+
"@instructure/shared-types": "8.53.3-snapshot-2",
|
|
49
|
+
"@instructure/ui-a11y-content": "8.53.3-snapshot-2",
|
|
50
|
+
"@instructure/ui-buttons": "8.53.3-snapshot-2",
|
|
51
|
+
"@instructure/ui-dom-utils": "8.53.3-snapshot-2",
|
|
52
|
+
"@instructure/ui-i18n": "8.53.3-snapshot-2",
|
|
53
|
+
"@instructure/ui-icons": "8.53.3-snapshot-2",
|
|
54
|
+
"@instructure/ui-prop-types": "8.53.3-snapshot-2",
|
|
55
|
+
"@instructure/ui-react-utils": "8.53.3-snapshot-2",
|
|
56
|
+
"@instructure/ui-test-locator": "8.53.3-snapshot-2",
|
|
57
|
+
"@instructure/ui-testable": "8.53.3-snapshot-2",
|
|
58
|
+
"@instructure/ui-text-input": "8.53.3-snapshot-2",
|
|
59
|
+
"@instructure/ui-themes": "8.53.3-snapshot-2",
|
|
60
|
+
"@instructure/ui-utils": "8.53.3-snapshot-2",
|
|
61
61
|
"@lezer/highlight": "1.1.6",
|
|
62
62
|
"prop-types": "^15.8.1"
|
|
63
63
|
},
|
|
@@ -40,11 +40,10 @@ import {
|
|
|
40
40
|
IconSearchLine
|
|
41
41
|
} from '@instructure/ui-icons'
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
reactdom = require('react-dom')
|
|
43
|
+
import ReactDOM from 'react-dom'
|
|
44
|
+
const createRoot = async () => {
|
|
45
|
+
// eslint-disable-next-line import/no-unresolved
|
|
46
|
+
return import('react-dom/client')
|
|
48
47
|
}
|
|
49
48
|
|
|
50
49
|
export type SearchConfig = {
|
|
@@ -144,15 +143,43 @@ export default function customSearch(searchConfig: SearchConfig | undefined) {
|
|
|
144
143
|
createPanel: (view) => {
|
|
145
144
|
const dom = document.createElement('div')
|
|
146
145
|
dom.style.padding = '8px'
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
146
|
+
createRoot()
|
|
147
|
+
.then((res) => {
|
|
148
|
+
let err: unknown
|
|
149
|
+
try {
|
|
150
|
+
const root = res!.createRoot(dom)
|
|
151
|
+
root.render(
|
|
152
|
+
<SearchPanel view={view} searchConfig={searchConfig} />
|
|
153
|
+
)
|
|
154
|
+
} catch (error) {
|
|
155
|
+
err = error
|
|
156
|
+
}
|
|
157
|
+
// this timeout is needed because Root.render() seems to cause
|
|
158
|
+
// prop validation to be emitted a frame later
|
|
159
|
+
setTimeout(() => {
|
|
160
|
+
if (err) {
|
|
161
|
+
console.error(err)
|
|
162
|
+
}
|
|
163
|
+
})
|
|
164
|
+
})
|
|
165
|
+
.catch(() => {
|
|
166
|
+
// react-dom/client does not exist, its React 16 or 17
|
|
167
|
+
let error: unknown
|
|
168
|
+
setTimeout(() => {
|
|
169
|
+
try {
|
|
170
|
+
ReactDOM.render(
|
|
171
|
+
<SearchPanel view={view} searchConfig={searchConfig} />,
|
|
172
|
+
dom
|
|
173
|
+
)
|
|
174
|
+
} catch (e) {
|
|
175
|
+
// catch unhandled errors
|
|
176
|
+
error = e
|
|
177
|
+
}
|
|
178
|
+
if (error) {
|
|
179
|
+
console.error(error)
|
|
180
|
+
}
|
|
181
|
+
})
|
|
182
|
+
})
|
|
156
183
|
return { dom }
|
|
157
184
|
}
|
|
158
185
|
})
|