@instructure/ui-source-code-editor 8.53.3-snapshot-0 → 8.53.3-snapshot-6

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,9 +3,12 @@
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-0](https://github.com/instructure/instructure-ui/compare/v8.53.2...v8.53.3-snapshot-0) (2024-02-20)
6
+ ## [8.53.3-snapshot-6](https://github.com/instructure/instructure-ui/compare/v8.53.2...v8.53.3-snapshot-6) (2024-02-20)
7
7
 
8
- **Note:** Version bump only for package @instructure/ui-source-code-editor
8
+
9
+ ### Bug Fixes
10
+
11
+ * **ui-source-code-editor:** fix react-dom version detection ([465c10d](https://github.com/instructure/instructure-ui/commit/465c10d43543efe1dc6d3de07d5b0b311d4c27ea))
9
12
 
10
13
 
11
14
 
@@ -29,12 +29,7 @@ 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
- let reactdom;
33
- try {
34
- reactdom = require('react-dom/client');
35
- } catch {
36
- reactdom = require('react-dom');
37
- }
32
+ import ReactDOM from 'react-dom';
38
33
  function SearchPanel({
39
34
  view,
40
35
  searchConfig
@@ -100,16 +95,19 @@ function SearchPanel({
100
95
  export default function customSearch(searchConfig) {
101
96
  return searchConfig ? search({
102
97
  createPanel: view => {
98
+ var _SearchPanel;
103
99
  const dom = document.createElement('div');
104
100
  dom.style.padding = '8px';
105
- if ('createRoot' in reactdom) {
106
- const root = reactdom.createRoot(dom);
107
- root.render( /*#__PURE__*/React.createElement(SearchPanel, {
108
- view: view,
109
- searchConfig: searchConfig
110
- }));
101
+ if (!React.version.startsWith('16.')) {
102
+ import( /* webpackIgnore: true */'react-dom/client').then(r => {
103
+ const root = r.createRoot(dom);
104
+ root.render(_SearchPanel || (_SearchPanel = /*#__PURE__*/React.createElement(SearchPanel, {
105
+ view: view,
106
+ searchConfig: searchConfig
107
+ })));
108
+ }).catch(e => {});
111
109
  } else {
112
- reactdom.render( /*#__PURE__*/React.createElement(SearchPanel, {
110
+ ReactDOM.render( /*#__PURE__*/React.createElement(SearchPanel, {
113
111
  view: view,
114
112
  searchConfig: searchConfig
115
113
  }), dom);
@@ -1,19 +1,21 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
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
+ var _interopRequireWildcard2 = _interopRequireDefault(require("@babel/runtime/helpers/interopRequireWildcard"));
9
10
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
- var _react = _interopRequireWildcard(require("react"));
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,6 @@ 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
- let reactdom;
42
- try {
43
- reactdom = require('react-dom/client');
44
- } catch {
45
- reactdom = require('react-dom');
46
- }
47
43
  function SearchPanel({
48
44
  view,
49
45
  searchConfig
@@ -109,16 +105,19 @@ function SearchPanel({
109
105
  function customSearch(searchConfig) {
110
106
  return searchConfig ? (0, _search.search)({
111
107
  createPanel: view => {
108
+ var _SearchPanel;
112
109
  const dom = document.createElement('div');
113
110
  dom.style.padding = '8px';
114
- if ('createRoot' in reactdom) {
115
- const root = reactdom.createRoot(dom);
116
- root.render( /*#__PURE__*/_react.default.createElement(SearchPanel, {
117
- view: view,
118
- searchConfig: searchConfig
119
- }));
111
+ if (!_react.default.version.startsWith('16.')) {
112
+ Promise.resolve().then(() => (0, _interopRequireWildcard2.default)(require( /* webpackIgnore: true */'react-dom/client'))).then(r => {
113
+ const root = r.createRoot(dom);
114
+ root.render(_SearchPanel || (_SearchPanel = /*#__PURE__*/_react.default.createElement(SearchPanel, {
115
+ view: view,
116
+ searchConfig: searchConfig
117
+ })));
118
+ }).catch(e => {});
120
119
  } else {
121
- reactdom.render( /*#__PURE__*/_react.default.createElement(SearchPanel, {
120
+ _reactDom.default.render( /*#__PURE__*/_react.default.createElement(SearchPanel, {
122
121
  view: view,
123
122
  searchConfig: searchConfig
124
123
  }), dom);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-source-code-editor",
3
- "version": "8.53.3-snapshot-0",
3
+ "version": "8.53.3-snapshot-6",
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-0",
27
- "@instructure/ui-test-queries": "8.53.3-snapshot-0",
28
- "@instructure/ui-test-utils": "8.53.3-snapshot-0",
26
+ "@instructure/ui-babel-preset": "8.53.3-snapshot-6",
27
+ "@instructure/ui-test-queries": "8.53.3-snapshot-6",
28
+ "@instructure/ui-test-utils": "8.53.3-snapshot-6",
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-0",
48
- "@instructure/shared-types": "8.53.3-snapshot-0",
49
- "@instructure/ui-a11y-content": "8.53.3-snapshot-0",
50
- "@instructure/ui-buttons": "8.53.3-snapshot-0",
51
- "@instructure/ui-dom-utils": "8.53.3-snapshot-0",
52
- "@instructure/ui-i18n": "8.53.3-snapshot-0",
53
- "@instructure/ui-icons": "8.53.3-snapshot-0",
54
- "@instructure/ui-prop-types": "8.53.3-snapshot-0",
55
- "@instructure/ui-react-utils": "8.53.3-snapshot-0",
56
- "@instructure/ui-test-locator": "8.53.3-snapshot-0",
57
- "@instructure/ui-testable": "8.53.3-snapshot-0",
58
- "@instructure/ui-text-input": "8.53.3-snapshot-0",
59
- "@instructure/ui-themes": "8.53.3-snapshot-0",
60
- "@instructure/ui-utils": "8.53.3-snapshot-0",
47
+ "@instructure/emotion": "8.53.3-snapshot-6",
48
+ "@instructure/shared-types": "8.53.3-snapshot-6",
49
+ "@instructure/ui-a11y-content": "8.53.3-snapshot-6",
50
+ "@instructure/ui-buttons": "8.53.3-snapshot-6",
51
+ "@instructure/ui-dom-utils": "8.53.3-snapshot-6",
52
+ "@instructure/ui-i18n": "8.53.3-snapshot-6",
53
+ "@instructure/ui-icons": "8.53.3-snapshot-6",
54
+ "@instructure/ui-prop-types": "8.53.3-snapshot-6",
55
+ "@instructure/ui-react-utils": "8.53.3-snapshot-6",
56
+ "@instructure/ui-test-locator": "8.53.3-snapshot-6",
57
+ "@instructure/ui-testable": "8.53.3-snapshot-6",
58
+ "@instructure/ui-text-input": "8.53.3-snapshot-6",
59
+ "@instructure/ui-themes": "8.53.3-snapshot-6",
60
+ "@instructure/ui-utils": "8.53.3-snapshot-6",
61
61
  "@lezer/highlight": "1.1.6",
62
62
  "prop-types": "^15.8.1"
63
63
  },
@@ -40,12 +40,7 @@ import {
40
40
  IconSearchLine
41
41
  } from '@instructure/ui-icons'
42
42
 
43
- let reactdom: any
44
- try {
45
- reactdom = require('react-dom/client')
46
- } catch {
47
- reactdom = require('react-dom')
48
- }
43
+ import ReactDOM from 'react-dom'
49
44
 
50
45
  export type SearchConfig = {
51
46
  placeholder: string
@@ -144,11 +139,19 @@ export default function customSearch(searchConfig: SearchConfig | undefined) {
144
139
  createPanel: (view) => {
145
140
  const dom = document.createElement('div')
146
141
  dom.style.padding = '8px'
147
- if ('createRoot' in reactdom) {
148
- const root = reactdom.createRoot(dom)
149
- root.render(<SearchPanel view={view} searchConfig={searchConfig} />)
142
+ if (!React.version.startsWith('16.')) {
143
+ import(/* webpackIgnore: true */ 'react-dom/client')
144
+ .then((r) => {
145
+ const root = r.createRoot(dom)
146
+ root.render(
147
+ <SearchPanel view={view} searchConfig={searchConfig} />
148
+ )
149
+ })
150
+ .catch((e) => {
151
+ console.error(e)
152
+ })
150
153
  } else {
151
- reactdom.render(
154
+ ReactDOM.render(
152
155
  <SearchPanel view={view} searchConfig={searchConfig} />,
153
156
  dom
154
157
  )