@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,234 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _highlight = require("@lezer/highlight");
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
+ /**
33
+ * ---
34
+ * private: true
35
+ * ---
36
+ * Generates the style object from the theme and provided additional information
37
+ * @param {Object} componentTheme The theme variable object.
38
+ * @param {Object} props the props of the component, the style is applied to
39
+ * @return {Object} The final style object, which will be used in the component
40
+ */
41
+ const generateStyle = (componentTheme, props, sharedTokens) => {
42
+ const attachment = props.attachment,
43
+ height = props.height,
44
+ width = props.width;
45
+ const attachmentBorderRadius = {
46
+ top: {
47
+ borderBottomLeftRadius: 0,
48
+ borderBottomRightRadius: 0
49
+ },
50
+ bottom: {
51
+ borderTopLeftRadius: 0,
52
+ borderTopRightRadius: 0
53
+ }
54
+ };
55
+ const attachmentVariants = {
56
+ top: {
57
+ marginBottom: 0,
58
+ marginTop: '0.25rem'
59
+ },
60
+ bottom: {
61
+ borderTopLeftRadius: 0,
62
+ borderTopRightRadius: 0,
63
+ marginBottom: '0.25rem'
64
+ }
65
+ };
66
+ const lineHeight = 1.4375;
67
+ return {
68
+ codeEditor: {
69
+ label: 'codeEditor',
70
+ position: 'relative',
71
+ boxSizing: 'border-box',
72
+ height: height || 'auto',
73
+ width
74
+ },
75
+ label: {
76
+ label: 'label',
77
+ height: '100%',
78
+ width: '100%'
79
+ },
80
+ codeEditorContainer: {
81
+ label: 'codeEditorContainer',
82
+ height: '100%',
83
+ width: '100%',
84
+ borderColor: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.borderColor,
85
+ borderStyle: 'solid',
86
+ borderWidth: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.borderWidth,
87
+ borderRadius: componentTheme.borderRadius,
88
+ marginBottom: '1rem',
89
+ ...(attachment && {
90
+ ...attachmentVariants[attachment],
91
+ ...attachmentBorderRadius[attachment]
92
+ })
93
+ },
94
+ theme: {
95
+ '&': {
96
+ overflow: 'hidden',
97
+ background: componentTheme.background,
98
+ fontFamily: componentTheme.fontFamily,
99
+ fontSize: componentTheme.fontSize,
100
+ color: componentTheme.color,
101
+ border: 0,
102
+ height: '100%',
103
+ width: '100%',
104
+ minHeight: `${lineHeight}rem`,
105
+ lineHeight,
106
+ borderRadius: componentTheme.borderRadius,
107
+ ...(attachment && {
108
+ ...attachmentBorderRadius[attachment]
109
+ })
110
+ },
111
+ '&.cm-editor.cm-focused': {
112
+ // Provide a simple default outline to make sure a focused
113
+ // editor is visually distinct. Can't leave the default behavior
114
+ // because that will apply to the content element, which is
115
+ // inside the scrollable container and doesn't include the
116
+ // gutters. We also can't use an 'auto' outline, since those
117
+ // are, for some reason, drawn behind the element content, which
118
+ // will cause things like the active line background to cover
119
+ // the outline (#297).
120
+ outline: `${componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.borderWidth} solid ${sharedTokens.focusOutline.infoColor}`
121
+ },
122
+ '.cm-content': {
123
+ padding: `${componentTheme.verticalPadding} 0`
124
+ },
125
+ '.cm-scroller': {
126
+ fontFamily: componentTheme.fontFamily,
127
+ lineHeight: 1.4375
128
+ },
129
+ '.cm-gutters': {
130
+ background: componentTheme.gutterBackground,
131
+ borderColor: componentTheme.borderColor
132
+ },
133
+ '.cm-line': {
134
+ padding: `0 ${componentTheme.horizontalPadding}`
135
+ },
136
+ '.cm-activeLine': {
137
+ backgroundColor: componentTheme.activeLineColor
138
+ },
139
+ '&.cm-focused .cm-cursor': {
140
+ borderLeftColor: componentTheme.color
141
+ },
142
+ '.cm-selectionBackground': {
143
+ background: 'transparent'
144
+ },
145
+ '.cm-selectionBackground, .cm-editor::selection': {
146
+ backgroundColor: componentTheme.focusedSelectionBackgroundColor + ' !important'
147
+ },
148
+ '.cm-placeholder': {
149
+ // for better contrast
150
+ color: componentTheme.placeholderBackgroundColor
151
+ }
152
+ },
153
+ highlightStyle: [
154
+ /**
155
+ * Copy of `defaultHighlightStyle` from '@codemirror/language'
156
+ */
157
+ // { tag: tags.meta, color: '#7a757a' },
158
+ {
159
+ tag: _highlight.tags.link,
160
+ textDecoration: 'underline'
161
+ }, {
162
+ tag: _highlight.tags.heading,
163
+ textDecoration: 'underline',
164
+ fontWeight: 'bold'
165
+ }, {
166
+ tag: _highlight.tags.emphasis,
167
+ fontStyle: 'italic'
168
+ }, {
169
+ tag: _highlight.tags.strong,
170
+ fontWeight: 'bold'
171
+ }, {
172
+ tag: _highlight.tags.strikethrough,
173
+ textDecoration: 'line-through'
174
+ }, {
175
+ tag: _highlight.tags.keyword,
176
+ color: componentTheme.tagKeywordColor
177
+ }, {
178
+ tag: [_highlight.tags.atom, _highlight.tags.bool, _highlight.tags.url, _highlight.tags.contentSeparator, _highlight.tags.labelName],
179
+ color: componentTheme.tagAtomColor
180
+ }, {
181
+ tag: [_highlight.tags.literal, _highlight.tags.inserted],
182
+ color: componentTheme.tagLiteralColor
183
+ }, {
184
+ tag: [_highlight.tags.string, _highlight.tags.deleted],
185
+ color: componentTheme.tagStringColor
186
+ },
187
+ // {
188
+ // tag: [tags.regexp, tags.escape, tags.special(tags.string)],
189
+ // color: '#e40'
190
+ // },
191
+ {
192
+ tag: _highlight.tags.definition(_highlight.tags.variableName),
193
+ color: componentTheme.tagDefinitionVariableNameColor
194
+ }, {
195
+ tag: _highlight.tags.local(_highlight.tags.variableName),
196
+ color: componentTheme.tagLocalVariableNameColor
197
+ },
198
+ // { tag: [tags.typeName, tags.namespace], color: '#085' },
199
+ {
200
+ tag: _highlight.tags.className,
201
+ color: componentTheme.tagClassNameColor
202
+ }, {
203
+ tag: [_highlight.tags.special(_highlight.tags.variableName), _highlight.tags.macroName],
204
+ color: componentTheme.tagSpecialVariableNameColor
205
+ }, {
206
+ tag: _highlight.tags.definition(_highlight.tags.propertyName),
207
+ color: componentTheme.tagDefinitionPropertyNameColor
208
+ }, {
209
+ tag: _highlight.tags.comment,
210
+ color: componentTheme.tagCommentColor
211
+ },
212
+ // { tag: tags.invalid, color: '#f00' },
213
+
214
+ /**
215
+ * Custom highlighting overrides
216
+ * (where original colors don't have enough contrast against #fff
217
+ * or active highlight background)
218
+ */
219
+ {
220
+ tag: _highlight.tags.meta,
221
+ color: componentTheme.tagMetaColor
222
+ }, {
223
+ tag: [_highlight.tags.regexp, _highlight.tags.escape, _highlight.tags.special(_highlight.tags.string)],
224
+ color: componentTheme.tagRegExpColor
225
+ }, {
226
+ tag: [_highlight.tags.typeName, _highlight.tags.namespace],
227
+ color: componentTheme.tagTypeNameColor
228
+ }, {
229
+ tag: _highlight.tags.invalid,
230
+ color: componentTheme.tagInvalidColor
231
+ }]
232
+ };
233
+ };
234
+ var _default = exports.default = generateStyle;
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  Object.defineProperty(exports, "SourceCodeEditor", {
7
7
  enumerable: true,
8
8
  get: function () {
9
- return _SourceCodeEditor.SourceCodeEditor;
9
+ return _v.SourceCodeEditor;
10
10
  }
11
11
  });
12
- var _SourceCodeEditor = require("./SourceCodeEditor");
12
+ var _v = require("../SourceCodeEditor/v1");
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "SourceCodeEditor", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _v.SourceCodeEditor;
10
+ }
11
+ });
12
+ var _v = require("../SourceCodeEditor/v2");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-source-code-editor",
3
- "version": "11.6.0",
3
+ "version": "11.6.1-snapshot-129",
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",
@@ -29,24 +29,24 @@
29
29
  "@codemirror/state": "^6.4.1",
30
30
  "@codemirror/view": "^6.34.1",
31
31
  "@lezer/highlight": "1.2.1",
32
- "@instructure/emotion": "11.6.0",
33
- "@instructure/shared-types": "11.6.0",
34
- "@instructure/ui-dom-utils": "11.6.0",
35
- "@instructure/ui-a11y-content": "11.6.0",
36
- "@instructure/ui-buttons": "11.6.0",
37
- "@instructure/ui-i18n": "11.6.0",
38
- "@instructure/ui-icons": "11.6.0",
39
- "@instructure/ui-react-utils": "11.6.0",
40
- "@instructure/ui-text-input": "11.6.0",
41
- "@instructure/ui-themes": "11.6.0",
42
- "@instructure/ui-utils": "11.6.0"
32
+ "@instructure/shared-types": "11.6.1-snapshot-129",
33
+ "@instructure/ui-a11y-content": "11.6.1-snapshot-129",
34
+ "@instructure/emotion": "11.6.1-snapshot-129",
35
+ "@instructure/ui-buttons": "11.6.1-snapshot-129",
36
+ "@instructure/ui-dom-utils": "11.6.1-snapshot-129",
37
+ "@instructure/ui-i18n": "11.6.1-snapshot-129",
38
+ "@instructure/ui-text-input": "11.6.1-snapshot-129",
39
+ "@instructure/ui-icons": "11.6.1-snapshot-129",
40
+ "@instructure/ui-themes": "11.6.1-snapshot-129",
41
+ "@instructure/ui-utils": "11.6.1-snapshot-129",
42
+ "@instructure/ui-react-utils": "11.6.1-snapshot-129"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@testing-library/jest-dom": "^6.6.3",
46
46
  "@testing-library/react": "15.0.7",
47
47
  "@testing-library/user-event": "^14.6.1",
48
48
  "vitest": "^3.2.2",
49
- "@instructure/ui-babel-preset": "11.6.0"
49
+ "@instructure/ui-babel-preset": "11.6.1-snapshot-129"
50
50
  },
51
51
  "peerDependencies": {
52
52
  "react": ">=18 <=19",
@@ -57,17 +57,39 @@
57
57
  },
58
58
  "sideEffects": false,
59
59
  "exports": {
60
- ".": {
61
- "types": "./types/index.d.ts",
62
- "import": "./es/index.js",
63
- "require": "./lib/index.js",
64
- "default": "./es/index.js"
65
- },
66
60
  "./lib/*": "./lib/*",
67
61
  "./es/*": "./es/*",
68
62
  "./types/*": "./types/*",
69
63
  "./package.json": "./package.json",
70
- "./src/*": "./src/*"
64
+ "./src/*": "./src/*",
65
+ ".": {
66
+ "src": "./src/exports/a.ts",
67
+ "types": "./types/exports/a.d.ts",
68
+ "import": "./es/exports/a.js",
69
+ "require": "./lib/exports/a.js",
70
+ "default": "./es/exports/a.js"
71
+ },
72
+ "./v11_6": {
73
+ "src": "./src/exports/a.ts",
74
+ "types": "./types/exports/a.d.ts",
75
+ "import": "./es/exports/a.js",
76
+ "require": "./lib/exports/a.js",
77
+ "default": "./es/exports/a.js"
78
+ },
79
+ "./v11_7": {
80
+ "src": "./src/exports/b.ts",
81
+ "types": "./types/exports/b.d.ts",
82
+ "import": "./es/exports/b.js",
83
+ "require": "./lib/exports/b.js",
84
+ "default": "./es/exports/b.js"
85
+ },
86
+ "./latest": {
87
+ "src": "./src/exports/b.ts",
88
+ "types": "./types/exports/b.d.ts",
89
+ "import": "./es/exports/b.js",
90
+ "require": "./lib/exports/b.js",
91
+ "default": "./es/exports/b.js"
92
+ }
71
93
  },
72
94
  "scripts": {
73
95
  "lint": "ui-scripts lint",
@@ -32,8 +32,8 @@ import {
32
32
  closeSearchPanel
33
33
  } from '@codemirror/search'
34
34
  import { EditorView } from '@codemirror/view'
35
- import { TextInput } from '@instructure/ui-text-input'
36
- import { IconButton } from '@instructure/ui-buttons'
35
+ import { TextInput } from '@instructure/ui-text-input/v11_6'
36
+ import { IconButton } from '@instructure/ui-buttons/v11_6'
37
37
  import {
38
38
  IconArrowOpenDownLine,
39
39
  IconArrowOpenUpLine,
@@ -87,7 +87,7 @@ import type { RequestAnimationFrameType } from '@instructure/ui-dom-utils'
87
87
  import { ScreenReaderContent } from '@instructure/ui-a11y-content'
88
88
  import { textDirectionContextConsumer } from '@instructure/ui-i18n'
89
89
 
90
- import { withStyle } from '@instructure/emotion'
90
+ import { withStyleLegacy as withStyle } from '@instructure/emotion'
91
91
 
92
92
  import customSearch from './SearchPanel'
93
93