@instructure/ui-source-code-editor 8.53.3-snapshot-5 → 8.53.3-snapshot-7

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,12 +3,9 @@
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-5](https://github.com/instructure/instructure-ui/compare/v8.53.2...v8.53.3-snapshot-5) (2024-02-21)
6
+ ## [8.53.3-snapshot-7](https://github.com/instructure/instructure-ui/compare/v8.53.2...v8.53.3-snapshot-7) (2024-02-23)
7
7
 
8
-
9
- ### Bug Fixes
10
-
11
- * **ui-source-code-editor:** make search panel work with older react versions ([a9b1f1a](https://github.com/instructure/instructure-ui/commit/a9b1f1ab5dd620cc93a59909d395387537e16895))
8
+ **Note:** Version bump only for package @instructure/ui-source-code-editor
12
9
 
13
10
 
14
11
 
@@ -29,7 +29,12 @@ 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
- import ReactDOM from 'react-dom';
32
+ let reactdom;
33
+ try {
34
+ reactdom = require('react-dom/client');
35
+ } catch {
36
+ reactdom = require('react-dom');
37
+ }
33
38
  function SearchPanel({
34
39
  view,
35
40
  searchConfig
@@ -95,21 +100,16 @@ function SearchPanel({
95
100
  export default function customSearch(searchConfig) {
96
101
  return searchConfig ? search({
97
102
  createPanel: view => {
98
- var _SearchPanel;
99
103
  const dom = document.createElement('div');
100
104
  dom.style.padding = '8px';
101
- const reactVersionMajor = Number(React.version.split('.')[0]);
102
- if (reactVersionMajor >= 18) {
103
- // webpack tries to evaluate imports compile time which would lead to an error on older react versions
104
- import( /* webpackIgnore: true */'react-dom/client').then(r => {
105
- const root = r.createRoot(dom);
106
- root.render(_SearchPanel || (_SearchPanel = /*#__PURE__*/React.createElement(SearchPanel, {
107
- view: view,
108
- searchConfig: searchConfig
109
- })));
110
- }).catch(e => {});
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
+ }));
111
111
  } else {
112
- ReactDOM.render( /*#__PURE__*/React.createElement(SearchPanel, {
112
+ reactdom.render( /*#__PURE__*/React.createElement(SearchPanel, {
113
113
  view: view,
114
114
  searchConfig: searchConfig
115
115
  }), dom);
@@ -1,21 +1,19 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- var _interopRequireWildcard3 = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
+ var _interopRequireWildcard = 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"));
10
9
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
- var _react = _interopRequireWildcard3(require("react"));
10
+ var _react = _interopRequireWildcard(require("react"));
12
11
  var _search = require("@codemirror/search");
13
12
  var _TextInput = require("@instructure/ui-text-input/lib/TextInput");
14
13
  var _IconButton = require("@instructure/ui-buttons/lib/IconButton");
15
14
  var _IconArrowOpenDownLine = require("@instructure/ui-icons/lib/IconArrowOpenDownLine.js");
16
15
  var _IconArrowOpenUpLine2 = require("@instructure/ui-icons/lib/IconArrowOpenUpLine.js");
17
16
  var _IconSearchLine2 = require("@instructure/ui-icons/lib/IconSearchLine.js");
18
- var _reactDom = _interopRequireDefault(require("react-dom"));
19
17
  var _IconSearchLine, _IconArrowOpenDownLin, _IconArrowOpenUpLine;
20
18
  /*
21
19
  * The MIT License (MIT)
@@ -40,6 +38,12 @@ var _IconSearchLine, _IconArrowOpenDownLin, _IconArrowOpenUpLine;
40
38
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
41
39
  * SOFTWARE.
42
40
  */
41
+ let reactdom;
42
+ try {
43
+ reactdom = require('react-dom/client');
44
+ } catch {
45
+ reactdom = require('react-dom');
46
+ }
43
47
  function SearchPanel({
44
48
  view,
45
49
  searchConfig
@@ -105,21 +109,16 @@ function SearchPanel({
105
109
  function customSearch(searchConfig) {
106
110
  return searchConfig ? (0, _search.search)({
107
111
  createPanel: view => {
108
- var _SearchPanel;
109
112
  const dom = document.createElement('div');
110
113
  dom.style.padding = '8px';
111
- const reactVersionMajor = Number(_react.default.version.split('.')[0]);
112
- if (reactVersionMajor >= 18) {
113
- // webpack tries to evaluate imports compile time which would lead to an error on older react versions
114
- Promise.resolve().then(() => (0, _interopRequireWildcard2.default)(require( /* webpackIgnore: true */'react-dom/client'))).then(r => {
115
- const root = r.createRoot(dom);
116
- root.render(_SearchPanel || (_SearchPanel = /*#__PURE__*/_react.default.createElement(SearchPanel, {
117
- view: view,
118
- searchConfig: searchConfig
119
- })));
120
- }).catch(e => {});
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
+ }));
121
120
  } else {
122
- _reactDom.default.render( /*#__PURE__*/_react.default.createElement(SearchPanel, {
121
+ reactdom.render( /*#__PURE__*/_react.default.createElement(SearchPanel, {
123
122
  view: view,
124
123
  searchConfig: searchConfig
125
124
  }), 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-5",
3
+ "version": "8.53.3-snapshot-7",
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-5",
27
- "@instructure/ui-test-queries": "8.53.3-snapshot-5",
28
- "@instructure/ui-test-utils": "8.53.3-snapshot-5",
26
+ "@instructure/ui-babel-preset": "8.53.3-snapshot-7",
27
+ "@instructure/ui-test-queries": "8.53.3-snapshot-7",
28
+ "@instructure/ui-test-utils": "8.53.3-snapshot-7",
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-5",
48
- "@instructure/shared-types": "8.53.3-snapshot-5",
49
- "@instructure/ui-a11y-content": "8.53.3-snapshot-5",
50
- "@instructure/ui-buttons": "8.53.3-snapshot-5",
51
- "@instructure/ui-dom-utils": "8.53.3-snapshot-5",
52
- "@instructure/ui-i18n": "8.53.3-snapshot-5",
53
- "@instructure/ui-icons": "8.53.3-snapshot-5",
54
- "@instructure/ui-prop-types": "8.53.3-snapshot-5",
55
- "@instructure/ui-react-utils": "8.53.3-snapshot-5",
56
- "@instructure/ui-test-locator": "8.53.3-snapshot-5",
57
- "@instructure/ui-testable": "8.53.3-snapshot-5",
58
- "@instructure/ui-text-input": "8.53.3-snapshot-5",
59
- "@instructure/ui-themes": "8.53.3-snapshot-5",
60
- "@instructure/ui-utils": "8.53.3-snapshot-5",
47
+ "@instructure/emotion": "8.53.3-snapshot-7",
48
+ "@instructure/shared-types": "8.53.3-snapshot-7",
49
+ "@instructure/ui-a11y-content": "8.53.3-snapshot-7",
50
+ "@instructure/ui-buttons": "8.53.3-snapshot-7",
51
+ "@instructure/ui-dom-utils": "8.53.3-snapshot-7",
52
+ "@instructure/ui-i18n": "8.53.3-snapshot-7",
53
+ "@instructure/ui-icons": "8.53.3-snapshot-7",
54
+ "@instructure/ui-prop-types": "8.53.3-snapshot-7",
55
+ "@instructure/ui-react-utils": "8.53.3-snapshot-7",
56
+ "@instructure/ui-test-locator": "8.53.3-snapshot-7",
57
+ "@instructure/ui-testable": "8.53.3-snapshot-7",
58
+ "@instructure/ui-text-input": "8.53.3-snapshot-7",
59
+ "@instructure/ui-themes": "8.53.3-snapshot-7",
60
+ "@instructure/ui-utils": "8.53.3-snapshot-7",
61
61
  "@lezer/highlight": "1.1.6",
62
62
  "prop-types": "^15.8.1"
63
63
  },
@@ -40,7 +40,12 @@ import {
40
40
  IconSearchLine
41
41
  } from '@instructure/ui-icons'
42
42
 
43
- import ReactDOM from 'react-dom'
43
+ let reactdom: any
44
+ try {
45
+ reactdom = require('react-dom/client')
46
+ } catch {
47
+ reactdom = require('react-dom')
48
+ }
44
49
 
45
50
  export type SearchConfig = {
46
51
  placeholder: string
@@ -139,21 +144,11 @@ export default function customSearch(searchConfig: SearchConfig | undefined) {
139
144
  createPanel: (view) => {
140
145
  const dom = document.createElement('div')
141
146
  dom.style.padding = '8px'
142
- const reactVersionMajor = Number(React.version.split('.')[0])
143
- if (reactVersionMajor >= 18) {
144
- // webpack tries to evaluate imports compile time which would lead to an error on older react versions
145
- import(/* webpackIgnore: true */ 'react-dom/client')
146
- .then((r) => {
147
- const root = r.createRoot(dom)
148
- root.render(
149
- <SearchPanel view={view} searchConfig={searchConfig} />
150
- )
151
- })
152
- .catch((e) => {
153
- console.error(e)
154
- })
147
+ if ('createRoot' in reactdom) {
148
+ const root = reactdom.createRoot(dom)
149
+ root.render(<SearchPanel view={view} searchConfig={searchConfig} />)
155
150
  } else {
156
- ReactDOM.render(
151
+ reactdom.render(
157
152
  <SearchPanel view={view} searchConfig={searchConfig} />,
158
153
  dom
159
154
  )