@instructure/ui-source-code-editor 11.6.0 → 11.6.1-snapshot-129

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.
Files changed (78) hide show
  1. package/CHANGELOG.md +40 -293
  2. package/es/SourceCodeEditor/{SearchPanel.js → v1/SearchPanel.js} +2 -2
  3. package/es/SourceCodeEditor/{index.js → v1/index.js} +1 -1
  4. package/es/SourceCodeEditor/v2/SearchPanel.js +118 -0
  5. package/es/SourceCodeEditor/v2/customKeybinding.js +100 -0
  6. package/es/SourceCodeEditor/v2/index.js +535 -0
  7. package/es/SourceCodeEditor/v2/props.js +28 -0
  8. package/es/SourceCodeEditor/v2/styles.js +228 -0
  9. package/es/{index.js → exports/a.js} +1 -1
  10. package/{src/index.ts → es/exports/b.js} +1 -2
  11. package/lib/SourceCodeEditor/{SearchPanel.js → v1/SearchPanel.js} +8 -8
  12. package/lib/SourceCodeEditor/{index.js → v1/index.js} +1 -1
  13. package/lib/SourceCodeEditor/v2/SearchPanel.js +126 -0
  14. package/lib/SourceCodeEditor/v2/customKeybinding.js +105 -0
  15. package/lib/SourceCodeEditor/v2/index.js +541 -0
  16. package/lib/SourceCodeEditor/v2/props.js +33 -0
  17. package/lib/SourceCodeEditor/v2/styles.js +234 -0
  18. package/lib/{index.js → exports/a.js} +2 -2
  19. package/lib/exports/b.js +12 -0
  20. package/package.json +42 -20
  21. package/src/SourceCodeEditor/{SearchPanel.tsx → v1/SearchPanel.tsx} +2 -2
  22. package/src/SourceCodeEditor/{index.tsx → v1/index.tsx} +1 -1
  23. package/src/SourceCodeEditor/v2/README.md +799 -0
  24. package/src/SourceCodeEditor/v2/SearchPanel.tsx +150 -0
  25. package/src/SourceCodeEditor/v2/customKeybinding.ts +125 -0
  26. package/src/SourceCodeEditor/v2/index.tsx +685 -0
  27. package/src/SourceCodeEditor/v2/props.ts +263 -0
  28. package/src/SourceCodeEditor/v2/styles.ts +239 -0
  29. package/src/exports/a.ts +25 -0
  30. package/src/exports/b.ts +25 -0
  31. package/tsconfig.build.tsbuildinfo +1 -1
  32. package/types/SourceCodeEditor/v1/SearchPanel.d.ts.map +1 -0
  33. package/types/SourceCodeEditor/v1/customKeybinding.d.ts.map +1 -0
  34. package/types/SourceCodeEditor/v1/index.d.ts.map +1 -0
  35. package/types/SourceCodeEditor/v1/props.d.ts.map +1 -0
  36. package/types/SourceCodeEditor/v1/styles.d.ts.map +1 -0
  37. package/types/SourceCodeEditor/v1/theme.d.ts.map +1 -0
  38. package/types/SourceCodeEditor/v2/SearchPanel.d.ts +7 -0
  39. package/types/SourceCodeEditor/v2/SearchPanel.d.ts.map +1 -0
  40. package/types/SourceCodeEditor/v2/customKeybinding.d.ts +4 -0
  41. package/types/SourceCodeEditor/v2/customKeybinding.d.ts.map +1 -0
  42. package/types/SourceCodeEditor/v2/index.d.ts +103 -0
  43. package/types/SourceCodeEditor/v2/index.d.ts.map +1 -0
  44. package/types/SourceCodeEditor/v2/props.d.ts +142 -0
  45. package/types/SourceCodeEditor/v2/props.d.ts.map +1 -0
  46. package/types/SourceCodeEditor/v2/styles.d.ts +14 -0
  47. package/types/SourceCodeEditor/v2/styles.d.ts.map +1 -0
  48. package/types/exports/a.d.ts +3 -0
  49. package/types/exports/a.d.ts.map +1 -0
  50. package/types/exports/b.d.ts +3 -0
  51. package/types/exports/b.d.ts.map +1 -0
  52. package/types/SourceCodeEditor/SearchPanel.d.ts.map +0 -1
  53. package/types/SourceCodeEditor/customKeybinding.d.ts.map +0 -1
  54. package/types/SourceCodeEditor/index.d.ts.map +0 -1
  55. package/types/SourceCodeEditor/props.d.ts.map +0 -1
  56. package/types/SourceCodeEditor/styles.d.ts.map +0 -1
  57. package/types/SourceCodeEditor/theme.d.ts.map +0 -1
  58. package/types/index.d.ts +0 -3
  59. package/types/index.d.ts.map +0 -1
  60. /package/es/SourceCodeEditor/{customKeybinding.js → v1/customKeybinding.js} +0 -0
  61. /package/es/SourceCodeEditor/{props.js → v1/props.js} +0 -0
  62. /package/es/SourceCodeEditor/{styles.js → v1/styles.js} +0 -0
  63. /package/es/SourceCodeEditor/{theme.js → v1/theme.js} +0 -0
  64. /package/lib/SourceCodeEditor/{customKeybinding.js → v1/customKeybinding.js} +0 -0
  65. /package/lib/SourceCodeEditor/{props.js → v1/props.js} +0 -0
  66. /package/lib/SourceCodeEditor/{styles.js → v1/styles.js} +0 -0
  67. /package/lib/SourceCodeEditor/{theme.js → v1/theme.js} +0 -0
  68. /package/src/SourceCodeEditor/{README.md → v1/README.md} +0 -0
  69. /package/src/SourceCodeEditor/{customKeybinding.ts → v1/customKeybinding.ts} +0 -0
  70. /package/src/SourceCodeEditor/{props.ts → v1/props.ts} +0 -0
  71. /package/src/SourceCodeEditor/{styles.ts → v1/styles.ts} +0 -0
  72. /package/src/SourceCodeEditor/{theme.ts → v1/theme.ts} +0 -0
  73. /package/types/SourceCodeEditor/{SearchPanel.d.ts → v1/SearchPanel.d.ts} +0 -0
  74. /package/types/SourceCodeEditor/{customKeybinding.d.ts → v1/customKeybinding.d.ts} +0 -0
  75. /package/types/SourceCodeEditor/{index.d.ts → v1/index.d.ts} +0 -0
  76. /package/types/SourceCodeEditor/{props.d.ts → v1/props.d.ts} +0 -0
  77. /package/types/SourceCodeEditor/{styles.d.ts → v1/styles.d.ts} +0 -0
  78. /package/types/SourceCodeEditor/{theme.d.ts → v1/theme.d.ts} +0 -0
@@ -0,0 +1,228 @@
1
+ /*
2
+ * The MIT License (MIT)
3
+ *
4
+ * Copyright (c) 2015 - present Instructure, Inc.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+
25
+ import { tags } from '@lezer/highlight';
26
+ /**
27
+ * ---
28
+ * private: true
29
+ * ---
30
+ * Generates the style object from the theme and provided additional information
31
+ * @param {Object} componentTheme The theme variable object.
32
+ * @param {Object} props the props of the component, the style is applied to
33
+ * @return {Object} The final style object, which will be used in the component
34
+ */
35
+ const generateStyle = (componentTheme, props, sharedTokens) => {
36
+ const attachment = props.attachment,
37
+ height = props.height,
38
+ width = props.width;
39
+ const attachmentBorderRadius = {
40
+ top: {
41
+ borderBottomLeftRadius: 0,
42
+ borderBottomRightRadius: 0
43
+ },
44
+ bottom: {
45
+ borderTopLeftRadius: 0,
46
+ borderTopRightRadius: 0
47
+ }
48
+ };
49
+ const attachmentVariants = {
50
+ top: {
51
+ marginBottom: 0,
52
+ marginTop: '0.25rem'
53
+ },
54
+ bottom: {
55
+ borderTopLeftRadius: 0,
56
+ borderTopRightRadius: 0,
57
+ marginBottom: '0.25rem'
58
+ }
59
+ };
60
+ const lineHeight = 1.4375;
61
+ return {
62
+ codeEditor: {
63
+ label: 'codeEditor',
64
+ position: 'relative',
65
+ boxSizing: 'border-box',
66
+ height: height || 'auto',
67
+ width
68
+ },
69
+ label: {
70
+ label: 'label',
71
+ height: '100%',
72
+ width: '100%'
73
+ },
74
+ codeEditorContainer: {
75
+ label: 'codeEditorContainer',
76
+ height: '100%',
77
+ width: '100%',
78
+ borderColor: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.borderColor,
79
+ borderStyle: 'solid',
80
+ borderWidth: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.borderWidth,
81
+ borderRadius: componentTheme.borderRadius,
82
+ marginBottom: '1rem',
83
+ ...(attachment && {
84
+ ...attachmentVariants[attachment],
85
+ ...attachmentBorderRadius[attachment]
86
+ })
87
+ },
88
+ theme: {
89
+ '&': {
90
+ overflow: 'hidden',
91
+ background: componentTheme.background,
92
+ fontFamily: componentTheme.fontFamily,
93
+ fontSize: componentTheme.fontSize,
94
+ color: componentTheme.color,
95
+ border: 0,
96
+ height: '100%',
97
+ width: '100%',
98
+ minHeight: `${lineHeight}rem`,
99
+ lineHeight,
100
+ borderRadius: componentTheme.borderRadius,
101
+ ...(attachment && {
102
+ ...attachmentBorderRadius[attachment]
103
+ })
104
+ },
105
+ '&.cm-editor.cm-focused': {
106
+ // Provide a simple default outline to make sure a focused
107
+ // editor is visually distinct. Can't leave the default behavior
108
+ // because that will apply to the content element, which is
109
+ // inside the scrollable container and doesn't include the
110
+ // gutters. We also can't use an 'auto' outline, since those
111
+ // are, for some reason, drawn behind the element content, which
112
+ // will cause things like the active line background to cover
113
+ // the outline (#297).
114
+ outline: `${componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.borderWidth} solid ${sharedTokens.focusOutline.infoColor}`
115
+ },
116
+ '.cm-content': {
117
+ padding: `${componentTheme.verticalPadding} 0`
118
+ },
119
+ '.cm-scroller': {
120
+ fontFamily: componentTheme.fontFamily,
121
+ lineHeight: 1.4375
122
+ },
123
+ '.cm-gutters': {
124
+ background: componentTheme.gutterBackground,
125
+ borderColor: componentTheme.borderColor
126
+ },
127
+ '.cm-line': {
128
+ padding: `0 ${componentTheme.horizontalPadding}`
129
+ },
130
+ '.cm-activeLine': {
131
+ backgroundColor: componentTheme.activeLineColor
132
+ },
133
+ '&.cm-focused .cm-cursor': {
134
+ borderLeftColor: componentTheme.color
135
+ },
136
+ '.cm-selectionBackground': {
137
+ background: 'transparent'
138
+ },
139
+ '.cm-selectionBackground, .cm-editor::selection': {
140
+ backgroundColor: componentTheme.focusedSelectionBackgroundColor + ' !important'
141
+ },
142
+ '.cm-placeholder': {
143
+ // for better contrast
144
+ color: componentTheme.placeholderBackgroundColor
145
+ }
146
+ },
147
+ highlightStyle: [
148
+ /**
149
+ * Copy of `defaultHighlightStyle` from '@codemirror/language'
150
+ */
151
+ // { tag: tags.meta, color: '#7a757a' },
152
+ {
153
+ tag: tags.link,
154
+ textDecoration: 'underline'
155
+ }, {
156
+ tag: tags.heading,
157
+ textDecoration: 'underline',
158
+ fontWeight: 'bold'
159
+ }, {
160
+ tag: tags.emphasis,
161
+ fontStyle: 'italic'
162
+ }, {
163
+ tag: tags.strong,
164
+ fontWeight: 'bold'
165
+ }, {
166
+ tag: tags.strikethrough,
167
+ textDecoration: 'line-through'
168
+ }, {
169
+ tag: tags.keyword,
170
+ color: componentTheme.tagKeywordColor
171
+ }, {
172
+ tag: [tags.atom, tags.bool, tags.url, tags.contentSeparator, tags.labelName],
173
+ color: componentTheme.tagAtomColor
174
+ }, {
175
+ tag: [tags.literal, tags.inserted],
176
+ color: componentTheme.tagLiteralColor
177
+ }, {
178
+ tag: [tags.string, tags.deleted],
179
+ color: componentTheme.tagStringColor
180
+ },
181
+ // {
182
+ // tag: [tags.regexp, tags.escape, tags.special(tags.string)],
183
+ // color: '#e40'
184
+ // },
185
+ {
186
+ tag: tags.definition(tags.variableName),
187
+ color: componentTheme.tagDefinitionVariableNameColor
188
+ }, {
189
+ tag: tags.local(tags.variableName),
190
+ color: componentTheme.tagLocalVariableNameColor
191
+ },
192
+ // { tag: [tags.typeName, tags.namespace], color: '#085' },
193
+ {
194
+ tag: tags.className,
195
+ color: componentTheme.tagClassNameColor
196
+ }, {
197
+ tag: [tags.special(tags.variableName), tags.macroName],
198
+ color: componentTheme.tagSpecialVariableNameColor
199
+ }, {
200
+ tag: tags.definition(tags.propertyName),
201
+ color: componentTheme.tagDefinitionPropertyNameColor
202
+ }, {
203
+ tag: tags.comment,
204
+ color: componentTheme.tagCommentColor
205
+ },
206
+ // { tag: tags.invalid, color: '#f00' },
207
+
208
+ /**
209
+ * Custom highlighting overrides
210
+ * (where original colors don't have enough contrast against #fff
211
+ * or active highlight background)
212
+ */
213
+ {
214
+ tag: tags.meta,
215
+ color: componentTheme.tagMetaColor
216
+ }, {
217
+ tag: [tags.regexp, tags.escape, tags.special(tags.string)],
218
+ color: componentTheme.tagRegExpColor
219
+ }, {
220
+ tag: [tags.typeName, tags.namespace],
221
+ color: componentTheme.tagTypeNameColor
222
+ }, {
223
+ tag: tags.invalid,
224
+ color: componentTheme.tagInvalidColor
225
+ }]
226
+ };
227
+ };
228
+ export default generateStyle;
@@ -21,4 +21,4 @@
21
21
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
22
  * SOFTWARE.
23
23
  */
24
- export { SourceCodeEditor } from "./SourceCodeEditor/index.js";
24
+ export { SourceCodeEditor } from "../SourceCodeEditor/v1/index.js";
@@ -21,5 +21,4 @@
21
21
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
22
  * SOFTWARE.
23
23
  */
24
- export { SourceCodeEditor } from './SourceCodeEditor'
25
- export type { SourceCodeEditorProps } from './SourceCodeEditor/props'
24
+ export { SourceCodeEditor } from "../SourceCodeEditor/v2/index.js";
@@ -8,11 +8,11 @@ exports.default = customSearch;
8
8
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
9
9
  var _react = require("react");
10
10
  var _search = require("@codemirror/search");
11
- var _TextInput = require("@instructure/ui-text-input/lib/TextInput");
12
- var _IconButton = require("@instructure/ui-buttons/lib/IconButton");
13
- var _IconArrowOpenDownLine = require("@instructure/ui-icons/lib/IconArrowOpenDownLine.js");
14
- var _IconArrowOpenUpLine2 = require("@instructure/ui-icons/lib/IconArrowOpenUpLine.js");
15
- var _IconSearchLine2 = require("@instructure/ui-icons/lib/IconSearchLine.js");
11
+ var _v11_ = require("@instructure/ui-text-input/v11_6");
12
+ var _v11_2 = require("@instructure/ui-buttons/v11_6");
13
+ var _IconArrowOpenDownLine = require("@instructure/ui-icons/lib/generated/IconArrowOpenDownLine.js");
14
+ var _IconArrowOpenUpLine2 = require("@instructure/ui-icons/lib/generated/IconArrowOpenUpLine.js");
15
+ var _IconSearchLine2 = require("@instructure/ui-icons/lib/generated/IconSearchLine.js");
16
16
  var _client = require("react-dom/client");
17
17
  var _jsxRuntime = require("@emotion/react/jsx-runtime");
18
18
  var _IconSearchLine, _IconArrowOpenDownLin, _IconArrowOpenUpLine;
@@ -74,7 +74,7 @@ function SearchPanel({
74
74
  handleHighlightSearch(searchQueryStr);
75
75
  (0, _search.findPrevious)(view);
76
76
  };
77
- return (0, _jsxRuntime.jsx)(_TextInput.TextInput, {
77
+ return (0, _jsxRuntime.jsx)(_v11_.TextInput, {
78
78
  renderLabel: "",
79
79
  inputRef: r => {
80
80
  setTimeout(() => r === null || r === void 0 ? void 0 : r.focus(), 0);
@@ -90,14 +90,14 @@ function SearchPanel({
90
90
  size: "x-small"
91
91
  })),
92
92
  renderAfterInput: (0, _jsxRuntime.jsxs)("span", {
93
- children: [(0, _jsxRuntime.jsx)(_IconButton.IconButton, {
93
+ children: [(0, _jsxRuntime.jsx)(_v11_2.IconButton, {
94
94
  size: "small",
95
95
  withBorder: false,
96
96
  withBackground: false,
97
97
  onClick: handleFindNext,
98
98
  screenReaderLabel: searchConfig.nextResultLabel,
99
99
  children: _IconArrowOpenDownLin || (_IconArrowOpenDownLin = (0, _jsxRuntime.jsx)(_IconArrowOpenDownLine.IconArrowOpenDownLine, {}))
100
- }), (0, _jsxRuntime.jsx)(_IconButton.IconButton, {
100
+ }), (0, _jsxRuntime.jsx)(_v11_2.IconButton, {
101
101
  size: "small",
102
102
  withBorder: false,
103
103
  withBackground: false,
@@ -66,7 +66,7 @@ var _dec, _dec2, _dec3, _class, _SourceCodeEditor;
66
66
  category: components
67
67
  ---
68
68
  **/
69
- let SourceCodeEditor = exports.SourceCodeEditor = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec3 = (0, _textDirectionContextConsumer.textDirectionContextConsumer)(), _dec(_class = _dec2(_class = _dec3(_class = (_SourceCodeEditor = class SourceCodeEditor extends _react.Component {
69
+ let SourceCodeEditor = exports.SourceCodeEditor = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0, _emotion.withStyleLegacy)(_styles.default, _theme.default), _dec3 = (0, _textDirectionContextConsumer.textDirectionContextConsumer)(), _dec(_class = _dec2(_class = _dec3(_class = (_SourceCodeEditor = class SourceCodeEditor extends _react.Component {
70
70
  addAnimationFrame(callback) {
71
71
  if (typeof callback === 'function') {
72
72
  this._raf.push((0, _requestAnimationFrame.requestAnimationFrame)(callback));
@@ -0,0 +1,126 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = customSearch;
8
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
9
+ var _react = require("react");
10
+ var _search = require("@codemirror/search");
11
+ var _latest = require("@instructure/ui-text-input/latest");
12
+ var _latest2 = require("@instructure/ui-buttons/latest");
13
+ var _IconArrowOpenDownLine = require("@instructure/ui-icons/lib/generated/IconArrowOpenDownLine.js");
14
+ var _IconArrowOpenUpLine2 = require("@instructure/ui-icons/lib/generated/IconArrowOpenUpLine.js");
15
+ var _IconSearchLine2 = require("@instructure/ui-icons/lib/generated/IconSearchLine.js");
16
+ var _client = require("react-dom/client");
17
+ var _jsxRuntime = require("@emotion/react/jsx-runtime");
18
+ var _IconSearchLine, _IconArrowOpenDownLin, _IconArrowOpenUpLine;
19
+ /*
20
+ * The MIT License (MIT)
21
+ *
22
+ * Copyright (c) 2015 - present Instructure, Inc.
23
+ *
24
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
25
+ * of this software and associated documentation files (the "Software"), to deal
26
+ * in the Software without restriction, including without limitation the rights
27
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
28
+ * copies of the Software, and to permit persons to whom the Software is
29
+ * furnished to do so, subject to the following conditions:
30
+ *
31
+ * The above copyright notice and this permission notice shall be included in all
32
+ * copies or substantial portions of the Software.
33
+ *
34
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
35
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
36
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
37
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
38
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
39
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
40
+ * SOFTWARE.
41
+ */
42
+ function SearchPanel({
43
+ view,
44
+ searchConfig
45
+ }) {
46
+ const _useState = (0, _react.useState)(''),
47
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
48
+ searchQueryStr = _useState2[0],
49
+ setSearchQueryStr = _useState2[1];
50
+ const handleChange = (_e, value) => {
51
+ setSearchQueryStr(value);
52
+ handleHighlightSearch(value);
53
+ };
54
+ const handleHighlightSearch = searchStr => {
55
+ view.dispatch({
56
+ effects: _search.setSearchQuery.of(new _search.SearchQuery({
57
+ search: searchStr
58
+ }))
59
+ });
60
+ };
61
+ const handleKeyDown = e => {
62
+ if (e.key !== 'Enter') return;
63
+ if (!e.shiftKey) handleFindNext();else handleFindPrev();
64
+ };
65
+ const handleKeyUp = e => {
66
+ if (e.key !== 'Escape') return;
67
+ (0, _search.closeSearchPanel)(view);
68
+ };
69
+ const handleFindNext = () => {
70
+ handleHighlightSearch(searchQueryStr);
71
+ (0, _search.findNext)(view);
72
+ };
73
+ const handleFindPrev = () => {
74
+ handleHighlightSearch(searchQueryStr);
75
+ (0, _search.findPrevious)(view);
76
+ };
77
+ return (0, _jsxRuntime.jsx)(_latest.TextInput, {
78
+ renderLabel: "",
79
+ inputRef: r => {
80
+ setTimeout(() => r === null || r === void 0 ? void 0 : r.focus(), 0);
81
+ },
82
+ size: "small",
83
+ display: "inline-block",
84
+ width: "20rem",
85
+ placeholder: searchConfig.placeholder,
86
+ onChange: handleChange,
87
+ onKeyDown: handleKeyDown,
88
+ onKeyUp: handleKeyUp,
89
+ renderBeforeInput: _IconSearchLine || (_IconSearchLine = (0, _jsxRuntime.jsx)(_IconSearchLine2.IconSearchLine, {
90
+ size: "x-small"
91
+ })),
92
+ renderAfterInput: (0, _jsxRuntime.jsxs)("span", {
93
+ children: [(0, _jsxRuntime.jsx)(_latest2.IconButton, {
94
+ size: "small",
95
+ withBorder: false,
96
+ withBackground: false,
97
+ onClick: handleFindNext,
98
+ screenReaderLabel: searchConfig.nextResultLabel,
99
+ children: _IconArrowOpenDownLin || (_IconArrowOpenDownLin = (0, _jsxRuntime.jsx)(_IconArrowOpenDownLine.IconArrowOpenDownLine, {}))
100
+ }), (0, _jsxRuntime.jsx)(_latest2.IconButton, {
101
+ size: "small",
102
+ withBorder: false,
103
+ withBackground: false,
104
+ onClick: handleFindPrev,
105
+ screenReaderLabel: searchConfig.prevResultLabel,
106
+ children: _IconArrowOpenUpLine || (_IconArrowOpenUpLine = (0, _jsxRuntime.jsx)(_IconArrowOpenUpLine2.IconArrowOpenUpLine, {}))
107
+ })]
108
+ })
109
+ });
110
+ }
111
+ function customSearch(searchConfig) {
112
+ return searchConfig ? (0, _search.search)({
113
+ createPanel: view => {
114
+ const dom = document.createElement('div');
115
+ dom.style.padding = '8px';
116
+ const root = (0, _client.createRoot)(dom);
117
+ root.render((0, _jsxRuntime.jsx)(SearchPanel, {
118
+ view: view,
119
+ searchConfig: searchConfig
120
+ }));
121
+ return {
122
+ dom
123
+ };
124
+ }
125
+ }) : [];
126
+ }
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.rtlHorizontalArrowKeymap = void 0;
7
+ var _commands = require("@codemirror/commands");
8
+ /*
9
+ * The MIT License (MIT)
10
+ *
11
+ * Copyright (c) 2015 - present Instructure, Inc.
12
+ *
13
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
14
+ * of this software and associated documentation files (the "Software"), to deal
15
+ * in the Software without restriction, including without limitation the rights
16
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17
+ * copies of the Software, and to permit persons to whom the Software is
18
+ * furnished to do so, subject to the following conditions:
19
+ *
20
+ * The above copyright notice and this permission notice shall be included in all
21
+ * copies or substantial portions of the Software.
22
+ *
23
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29
+ * SOFTWARE.
30
+ */
31
+
32
+ const rtlHorizontalArrowKeymap = exports.rtlHorizontalArrowKeymap = [
33
+ // Left/Start/Forward
34
+ {
35
+ key: 'ArrowLeft',
36
+ run: _commands.cursorCharRight,
37
+ shift: _commands.selectCharRight,
38
+ preventDefault: true
39
+ }, {
40
+ key: 'Mod-ArrowLeft',
41
+ mac: 'Alt-ArrowLeft',
42
+ run: _commands.cursorGroupRight,
43
+ shift: _commands.selectGroupRight
44
+ }, {
45
+ key: 'Alt-ArrowLeft',
46
+ mac: 'Ctrl-ArrowLeft',
47
+ run: _commands.cursorSyntaxRight,
48
+ shift: _commands.selectSyntaxRight
49
+ }, {
50
+ mac: 'Cmd-ArrowLeft',
51
+ run: _commands.cursorLineBoundaryRight,
52
+ shift: _commands.selectLineBoundaryRight
53
+ }, {
54
+ key: 'Home',
55
+ run: _commands.cursorLineBoundaryForward,
56
+ shift: _commands.selectLineBoundaryForward
57
+ },
58
+ // Right/End/Backward
59
+ {
60
+ key: 'ArrowRight',
61
+ run: _commands.cursorCharLeft,
62
+ shift: _commands.selectCharLeft,
63
+ preventDefault: true
64
+ }, {
65
+ key: 'Mod-ArrowRight',
66
+ mac: 'Alt-ArrowRight',
67
+ run: _commands.cursorGroupLeft,
68
+ shift: _commands.selectGroupLeft
69
+ }, {
70
+ key: 'Alt-ArrowRight',
71
+ mac: 'Ctrl-ArrowRight',
72
+ run: _commands.cursorSyntaxLeft,
73
+ shift: _commands.selectSyntaxLeft
74
+ }, {
75
+ mac: 'Cmd-ArrowRight',
76
+ run: _commands.cursorLineBoundaryLeft,
77
+ shift: _commands.selectLineBoundaryLeft
78
+ }, {
79
+ key: 'End',
80
+ run: _commands.cursorLineBoundaryBackward,
81
+ shift: _commands.selectLineBoundaryBackward
82
+ },
83
+ // Delete/Backspace
84
+ {
85
+ key: 'Delete',
86
+ run: _commands.deleteCharBackward
87
+ }, {
88
+ key: 'Mod-Delete',
89
+ mac: 'Alt-Delete',
90
+ run: _commands.deleteGroupBackward
91
+ }, {
92
+ key: 'Backspace',
93
+ run: _commands.deleteCharForward,
94
+ shift: _commands.deleteCharForward
95
+ }, {
96
+ key: 'Mod-Backspace',
97
+ mac: 'Alt-Backspace',
98
+ run: _commands.deleteGroupForward
99
+ }, {
100
+ mac: 'Mod-Delete',
101
+ run: _commands.deleteToLineStart
102
+ }, {
103
+ mac: 'Mod-Backspace',
104
+ run: _commands.deleteToLineEnd
105
+ }];