@instructure/ui-source-code-editor 8.53.3-snapshot-2 → 8.53.3-snapshot-3

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 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-2](https://github.com/instructure/instructure-ui/compare/v8.53.2...v8.53.3-snapshot-2) (2024-02-16)
6
+ ## [8.53.3-snapshot-3](https://github.com/instructure/instructure-ui/compare/v8.53.2...v8.53.3-snapshot-3) (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,23 @@ function SearchPanel({
99
95
  export default function customSearch(searchConfig) {
100
96
  return searchConfig ? search({
101
97
  createPanel: view => {
102
- var _SearchPanel, _SearchPanel2;
98
+ var _SearchPanel;
103
99
  const dom = document.createElement('div');
104
100
  dom.style.padding = '8px';
105
- createRoot().then(res => {
106
- let err;
107
- try {
108
- const root = res.createRoot(dom);
101
+ if (!React.version.startsWith('16.')) {
102
+ import('react-dom/client').then(r => {
103
+ const root = r.createRoot(dom);
109
104
  root.render(_SearchPanel || (_SearchPanel = /*#__PURE__*/React.createElement(SearchPanel, {
110
105
  view: view,
111
106
  searchConfig: searchConfig
112
107
  })));
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
- });
108
+ }).catch(e => {});
109
+ } else {
110
+ ReactDOM.render( /*#__PURE__*/React.createElement(SearchPanel, {
111
+ view: view,
112
+ searchConfig: searchConfig
113
+ }), dom);
114
+ }
137
115
  return {
138
116
  dom
139
117
  };
@@ -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,23 @@ function SearchPanel({
109
105
  function customSearch(searchConfig) {
110
106
  return searchConfig ? (0, _search.search)({
111
107
  createPanel: view => {
112
- var _SearchPanel, _SearchPanel2;
108
+ var _SearchPanel;
113
109
  const dom = document.createElement('div');
114
110
  dom.style.padding = '8px';
115
- createRoot().then(res => {
116
- let err;
117
- try {
118
- const root = res.createRoot(dom);
111
+ if (!_react.default.version.startsWith('16.')) {
112
+ Promise.resolve().then(() => (0, _interopRequireWildcard2.default)(require('react-dom/client'))).then(r => {
113
+ const root = r.createRoot(dom);
119
114
  root.render(_SearchPanel || (_SearchPanel = /*#__PURE__*/_react.default.createElement(SearchPanel, {
120
115
  view: view,
121
116
  searchConfig: searchConfig
122
117
  })));
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
- });
118
+ }).catch(e => {});
119
+ } else {
120
+ _reactDom.default.render( /*#__PURE__*/_react.default.createElement(SearchPanel, {
121
+ view: view,
122
+ searchConfig: searchConfig
123
+ }), dom);
124
+ }
147
125
  return {
148
126
  dom
149
127
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-source-code-editor",
3
- "version": "8.53.3-snapshot-2",
3
+ "version": "8.53.3-snapshot-3",
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-2",
27
- "@instructure/ui-test-queries": "8.53.3-snapshot-2",
28
- "@instructure/ui-test-utils": "8.53.3-snapshot-2",
26
+ "@instructure/ui-babel-preset": "8.53.3-snapshot-3",
27
+ "@instructure/ui-test-queries": "8.53.3-snapshot-3",
28
+ "@instructure/ui-test-utils": "8.53.3-snapshot-3",
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-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",
47
+ "@instructure/emotion": "8.53.3-snapshot-3",
48
+ "@instructure/shared-types": "8.53.3-snapshot-3",
49
+ "@instructure/ui-a11y-content": "8.53.3-snapshot-3",
50
+ "@instructure/ui-buttons": "8.53.3-snapshot-3",
51
+ "@instructure/ui-dom-utils": "8.53.3-snapshot-3",
52
+ "@instructure/ui-i18n": "8.53.3-snapshot-3",
53
+ "@instructure/ui-icons": "8.53.3-snapshot-3",
54
+ "@instructure/ui-prop-types": "8.53.3-snapshot-3",
55
+ "@instructure/ui-react-utils": "8.53.3-snapshot-3",
56
+ "@instructure/ui-test-locator": "8.53.3-snapshot-3",
57
+ "@instructure/ui-testable": "8.53.3-snapshot-3",
58
+ "@instructure/ui-text-input": "8.53.3-snapshot-3",
59
+ "@instructure/ui-themes": "8.53.3-snapshot-3",
60
+ "@instructure/ui-utils": "8.53.3-snapshot-3",
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,23 @@ 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
- createRoot()
147
- .then((res) => {
148
- let err: unknown
149
- try {
150
- const root = res!.createRoot(dom)
142
+ if (!React.version.startsWith('16.')) {
143
+ import('react-dom/client')
144
+ .then((r) => {
145
+ const root = r.createRoot(dom)
151
146
  root.render(
152
147
  <SearchPanel view={view} searchConfig={searchConfig} />
153
148
  )
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
149
  })
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
- }
150
+ .catch((e) => {
151
+ console.error(e)
181
152
  })
182
- })
153
+ } else {
154
+ ReactDOM.render(
155
+ <SearchPanel view={view} searchConfig={searchConfig} />,
156
+ dom
157
+ )
158
+ }
183
159
  return { dom }
184
160
  }
185
161
  })