@instructure/ui-source-code-editor 8.53.3-snapshot-2 → 8.53.3-snapshot-4
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 +1 -1
- package/es/SourceCodeEditor/SearchPanel.js +12 -33
- package/lib/SourceCodeEditor/SearchPanel.js +13 -34
- package/package.json +18 -18
- package/src/SourceCodeEditor/SearchPanel.tsx +13 -36
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/SourceCodeEditor/SearchPanel.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
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.3-snapshot-
|
|
6
|
+
## [8.53.3-snapshot-4](https://github.com/instructure/instructure-ui/compare/v8.53.2...v8.53.3-snapshot-4) (2024-02-19)
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
### Bug Fixes
|
|
@@ -30,10 +30,6 @@ 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
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
|
-
};
|
|
37
33
|
function SearchPanel({
|
|
38
34
|
view,
|
|
39
35
|
searchConfig
|
|
@@ -99,41 +95,24 @@ function SearchPanel({
|
|
|
99
95
|
export default function customSearch(searchConfig) {
|
|
100
96
|
return searchConfig ? search({
|
|
101
97
|
createPanel: view => {
|
|
102
|
-
var _SearchPanel
|
|
98
|
+
var _SearchPanel;
|
|
103
99
|
const dom = document.createElement('div');
|
|
104
100
|
dom.style.padding = '8px';
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
const root =
|
|
101
|
+
if (!React.version.startsWith('16.')) {
|
|
102
|
+
const path = 'react-dom/client';
|
|
103
|
+
import(path).then(r => {
|
|
104
|
+
const root = r.createRoot(dom);
|
|
109
105
|
root.render(_SearchPanel || (_SearchPanel = /*#__PURE__*/React.createElement(SearchPanel, {
|
|
110
106
|
view: view,
|
|
111
107
|
searchConfig: searchConfig
|
|
112
108
|
})));
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
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
|
-
});
|
|
109
|
+
}).catch(e => {});
|
|
110
|
+
} else {
|
|
111
|
+
ReactDOM.render( /*#__PURE__*/React.createElement(SearchPanel, {
|
|
112
|
+
view: view,
|
|
113
|
+
searchConfig: searchConfig
|
|
114
|
+
}), dom);
|
|
115
|
+
}
|
|
137
116
|
return {
|
|
138
117
|
dom
|
|
139
118
|
};
|
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.default = customSearch;
|
|
9
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
9
|
var _interopRequireWildcard2 = _interopRequireDefault(require("@babel/runtime/helpers/interopRequireWildcard"));
|
|
10
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
11
|
var _react = _interopRequireWildcard3(require("react"));
|
|
12
12
|
var _search = require("@codemirror/search");
|
|
13
13
|
var _TextInput = require("@instructure/ui-text-input/lib/TextInput");
|
|
@@ -40,10 +40,6 @@ var _IconSearchLine, _IconArrowOpenDownLin, _IconArrowOpenUpLine;
|
|
|
40
40
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
41
41
|
* SOFTWARE.
|
|
42
42
|
*/
|
|
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
43
|
function SearchPanel({
|
|
48
44
|
view,
|
|
49
45
|
searchConfig
|
|
@@ -109,41 +105,24 @@ function SearchPanel({
|
|
|
109
105
|
function customSearch(searchConfig) {
|
|
110
106
|
return searchConfig ? (0, _search.search)({
|
|
111
107
|
createPanel: view => {
|
|
112
|
-
var _SearchPanel
|
|
108
|
+
var _SearchPanel;
|
|
113
109
|
const dom = document.createElement('div');
|
|
114
110
|
dom.style.padding = '8px';
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
const root =
|
|
111
|
+
if (!_react.default.version.startsWith('16.')) {
|
|
112
|
+
const path = 'react-dom/client';
|
|
113
|
+
(specifier => new Promise(r => r(`${specifier}`)).then(s => (0, _interopRequireWildcard2.default)(require(s))))(path).then(r => {
|
|
114
|
+
const root = r.createRoot(dom);
|
|
119
115
|
root.render(_SearchPanel || (_SearchPanel = /*#__PURE__*/_react.default.createElement(SearchPanel, {
|
|
120
116
|
view: view,
|
|
121
117
|
searchConfig: searchConfig
|
|
122
118
|
})));
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
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
|
-
});
|
|
119
|
+
}).catch(e => {});
|
|
120
|
+
} else {
|
|
121
|
+
_reactDom.default.render( /*#__PURE__*/_react.default.createElement(SearchPanel, {
|
|
122
|
+
view: view,
|
|
123
|
+
searchConfig: searchConfig
|
|
124
|
+
}), dom);
|
|
125
|
+
}
|
|
147
126
|
return {
|
|
148
127
|
dom
|
|
149
128
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-source-code-editor",
|
|
3
|
-
"version": "8.53.3-snapshot-
|
|
3
|
+
"version": "8.53.3-snapshot-4",
|
|
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.3-snapshot-
|
|
27
|
-
"@instructure/ui-test-queries": "8.53.3-snapshot-
|
|
28
|
-
"@instructure/ui-test-utils": "8.53.3-snapshot-
|
|
26
|
+
"@instructure/ui-babel-preset": "8.53.3-snapshot-4",
|
|
27
|
+
"@instructure/ui-test-queries": "8.53.3-snapshot-4",
|
|
28
|
+
"@instructure/ui-test-utils": "8.53.3-snapshot-4",
|
|
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.3-snapshot-
|
|
48
|
-
"@instructure/shared-types": "8.53.3-snapshot-
|
|
49
|
-
"@instructure/ui-a11y-content": "8.53.3-snapshot-
|
|
50
|
-
"@instructure/ui-buttons": "8.53.3-snapshot-
|
|
51
|
-
"@instructure/ui-dom-utils": "8.53.3-snapshot-
|
|
52
|
-
"@instructure/ui-i18n": "8.53.3-snapshot-
|
|
53
|
-
"@instructure/ui-icons": "8.53.3-snapshot-
|
|
54
|
-
"@instructure/ui-prop-types": "8.53.3-snapshot-
|
|
55
|
-
"@instructure/ui-react-utils": "8.53.3-snapshot-
|
|
56
|
-
"@instructure/ui-test-locator": "8.53.3-snapshot-
|
|
57
|
-
"@instructure/ui-testable": "8.53.3-snapshot-
|
|
58
|
-
"@instructure/ui-text-input": "8.53.3-snapshot-
|
|
59
|
-
"@instructure/ui-themes": "8.53.3-snapshot-
|
|
60
|
-
"@instructure/ui-utils": "8.53.3-snapshot-
|
|
47
|
+
"@instructure/emotion": "8.53.3-snapshot-4",
|
|
48
|
+
"@instructure/shared-types": "8.53.3-snapshot-4",
|
|
49
|
+
"@instructure/ui-a11y-content": "8.53.3-snapshot-4",
|
|
50
|
+
"@instructure/ui-buttons": "8.53.3-snapshot-4",
|
|
51
|
+
"@instructure/ui-dom-utils": "8.53.3-snapshot-4",
|
|
52
|
+
"@instructure/ui-i18n": "8.53.3-snapshot-4",
|
|
53
|
+
"@instructure/ui-icons": "8.53.3-snapshot-4",
|
|
54
|
+
"@instructure/ui-prop-types": "8.53.3-snapshot-4",
|
|
55
|
+
"@instructure/ui-react-utils": "8.53.3-snapshot-4",
|
|
56
|
+
"@instructure/ui-test-locator": "8.53.3-snapshot-4",
|
|
57
|
+
"@instructure/ui-testable": "8.53.3-snapshot-4",
|
|
58
|
+
"@instructure/ui-text-input": "8.53.3-snapshot-4",
|
|
59
|
+
"@instructure/ui-themes": "8.53.3-snapshot-4",
|
|
60
|
+
"@instructure/ui-utils": "8.53.3-snapshot-4",
|
|
61
61
|
"@lezer/highlight": "1.1.6",
|
|
62
62
|
"prop-types": "^15.8.1"
|
|
63
63
|
},
|
|
@@ -41,10 +41,6 @@ import {
|
|
|
41
41
|
} from '@instructure/ui-icons'
|
|
42
42
|
|
|
43
43
|
import ReactDOM from 'react-dom'
|
|
44
|
-
const createRoot = async () => {
|
|
45
|
-
// eslint-disable-next-line import/no-unresolved
|
|
46
|
-
return import('react-dom/client')
|
|
47
|
-
}
|
|
48
44
|
|
|
49
45
|
export type SearchConfig = {
|
|
50
46
|
placeholder: string
|
|
@@ -143,43 +139,24 @@ export default function customSearch(searchConfig: SearchConfig | undefined) {
|
|
|
143
139
|
createPanel: (view) => {
|
|
144
140
|
const dom = document.createElement('div')
|
|
145
141
|
dom.style.padding = '8px'
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
const root =
|
|
142
|
+
if (!React.version.startsWith('16.')) {
|
|
143
|
+
const path = 'react-dom/client'
|
|
144
|
+
import(path)
|
|
145
|
+
.then((r) => {
|
|
146
|
+
const root = r.createRoot(dom)
|
|
151
147
|
root.render(
|
|
152
148
|
<SearchPanel view={view} searchConfig={searchConfig} />
|
|
153
149
|
)
|
|
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
150
|
})
|
|
164
|
-
|
|
165
|
-
|
|
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
|
-
}
|
|
151
|
+
.catch((e) => {
|
|
152
|
+
console.error(e)
|
|
181
153
|
})
|
|
182
|
-
|
|
154
|
+
} else {
|
|
155
|
+
ReactDOM.render(
|
|
156
|
+
<SearchPanel view={view} searchConfig={searchConfig} />,
|
|
157
|
+
dom
|
|
158
|
+
)
|
|
159
|
+
}
|
|
183
160
|
return { dom }
|
|
184
161
|
}
|
|
185
162
|
})
|