@instructure/ui-source-code-editor 11.7.10 → 11.7.11-pr-snapshot-1794841957152

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 (37) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/es/SourceCodeEditor/v1/SearchPanel.js +81 -104
  3. package/es/SourceCodeEditor/v1/customKeybinding.js +85 -98
  4. package/es/SourceCodeEditor/v1/index.js +463 -507
  5. package/es/SourceCodeEditor/v1/props.js +30 -28
  6. package/es/SourceCodeEditor/v1/styles.js +198 -222
  7. package/es/SourceCodeEditor/v1/theme.js +19 -53
  8. package/es/SourceCodeEditor/v2/SearchPanel.js +81 -109
  9. package/es/SourceCodeEditor/v2/customKeybinding.js +85 -98
  10. package/es/SourceCodeEditor/v2/index.js +519 -545
  11. package/es/SourceCodeEditor/v2/props.js +30 -28
  12. package/es/SourceCodeEditor/v2/styles.js +208 -232
  13. package/es/exports/a.js +1 -24
  14. package/es/exports/b.js +1 -24
  15. package/package.json +16 -22
  16. package/src/SourceCodeEditor/v1/index.tsx +10 -5
  17. package/src/SourceCodeEditor/v2/index.tsx +47 -12
  18. package/tsconfig.build.json +0 -1
  19. package/tsconfig.build.tsbuildinfo +1 -1
  20. package/types/SourceCodeEditor/v1/index.d.ts +3 -1
  21. package/types/SourceCodeEditor/v1/index.d.ts.map +1 -1
  22. package/types/SourceCodeEditor/v2/index.d.ts +6 -1
  23. package/types/SourceCodeEditor/v2/index.d.ts.map +1 -1
  24. package/lib/SourceCodeEditor/v1/SearchPanel.js +0 -119
  25. package/lib/SourceCodeEditor/v1/customKeybinding.js +0 -105
  26. package/lib/SourceCodeEditor/v1/index.js +0 -550
  27. package/lib/SourceCodeEditor/v1/props.js +0 -33
  28. package/lib/SourceCodeEditor/v1/styles.js +0 -230
  29. package/lib/SourceCodeEditor/v1/theme.js +0 -60
  30. package/lib/SourceCodeEditor/v2/SearchPanel.js +0 -125
  31. package/lib/SourceCodeEditor/v2/customKeybinding.js +0 -105
  32. package/lib/SourceCodeEditor/v2/index.js +0 -591
  33. package/lib/SourceCodeEditor/v2/props.js +0 -33
  34. package/lib/SourceCodeEditor/v2/styles.js +0 -240
  35. package/lib/exports/a.js +0 -12
  36. package/lib/exports/b.js +0 -12
  37. package/lib/package.json +0 -1
@@ -1,240 +0,0 @@
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 {
43
- attachment,
44
- height,
45
- width
46
- } = props;
47
- const attachmentBorderRadius = {
48
- top: {
49
- borderBottomLeftRadius: 0,
50
- borderBottomRightRadius: 0
51
- },
52
- bottom: {
53
- borderTopLeftRadius: 0,
54
- borderTopRightRadius: 0
55
- }
56
- };
57
- const attachmentVariants = {
58
- top: {
59
- marginBottom: 0,
60
- marginTop: '0.25rem'
61
- },
62
- bottom: {
63
- borderTopLeftRadius: 0,
64
- borderTopRightRadius: 0,
65
- marginBottom: '0.25rem'
66
- }
67
- };
68
- const lineHeight = 1.4375;
69
- return {
70
- codeEditor: {
71
- label: 'codeEditor',
72
- position: 'relative',
73
- boxSizing: 'border-box',
74
- height: height || 'auto',
75
- width
76
- },
77
- label: {
78
- label: 'label',
79
- height: '100%',
80
- width: '100%'
81
- },
82
- codeEditorContainer: {
83
- label: 'codeEditorContainer',
84
- height: '100%',
85
- width: '100%',
86
- borderColor: componentTheme?.borderColor,
87
- borderStyle: 'solid',
88
- borderWidth: componentTheme?.borderWidth,
89
- borderRadius: componentTheme.borderRadius,
90
- marginBottom: '1rem',
91
- ...(attachment && {
92
- ...attachmentVariants[attachment],
93
- ...attachmentBorderRadius[attachment]
94
- })
95
- },
96
- theme: {
97
- '&': {
98
- overflow: 'hidden',
99
- background: componentTheme.background,
100
- fontFamily: componentTheme.fontFamily,
101
- fontSize: componentTheme.fontSize,
102
- color: componentTheme.color,
103
- border: 0,
104
- height: '100%',
105
- width: '100%',
106
- minHeight: `${lineHeight}rem`,
107
- lineHeight,
108
- borderRadius: componentTheme.borderRadius,
109
- ...(attachment && {
110
- ...attachmentBorderRadius[attachment]
111
- })
112
- },
113
- '&.cm-editor.cm-focused': {
114
- // Provide a simple default outline to make sure a focused
115
- // editor is visually distinct. Can't leave the default behavior
116
- // because that will apply to the content element, which is
117
- // inside the scrollable container and doesn't include the
118
- // gutters. We also can't use an 'auto' outline, since those
119
- // are, for some reason, drawn behind the element content, which
120
- // will cause things like the active line background to cover
121
- // the outline (#297).
122
- outline: `${componentTheme?.borderWidth} solid ${sharedTokens.focusOutline.infoColor}`
123
- },
124
- '.cm-content': {
125
- padding: `${componentTheme.verticalPadding} 0`
126
- },
127
- '.cm-scroller': {
128
- fontFamily: componentTheme.fontFamily,
129
- lineHeight: 1.4375
130
- },
131
- '.cm-gutters': {
132
- background: componentTheme.gutterBackground,
133
- borderColor: componentTheme.borderColor
134
- },
135
- '.cm-line': {
136
- padding: `0 ${componentTheme.horizontalPadding}`
137
- },
138
- '.cm-activeLine': {
139
- backgroundColor: componentTheme.activeLineColor
140
- },
141
- '&.cm-focused .cm-cursor': {
142
- borderLeftColor: componentTheme.color
143
- },
144
- '.cm-selectionBackground': {
145
- background: 'transparent'
146
- },
147
- '.cm-selectionBackground, .cm-editor::selection': {
148
- backgroundColor: componentTheme.focusedSelectionBackgroundColor + ' !important'
149
- },
150
- '.cm-placeholder': {
151
- // for better contrast
152
- color: componentTheme.placeholderBackgroundColor
153
- },
154
- '.cm-panels': {
155
- backgroundColor: componentTheme.background,
156
- color: componentTheme.color
157
- }
158
- },
159
- highlightStyle: [
160
- /**
161
- * Copy of `defaultHighlightStyle` from '@codemirror/language'
162
- */
163
- // { tag: tags.meta, color: '#7a757a' },
164
- {
165
- tag: _highlight.tags.link,
166
- textDecoration: 'underline'
167
- }, {
168
- tag: _highlight.tags.heading,
169
- textDecoration: 'underline',
170
- fontWeight: 'bold'
171
- }, {
172
- tag: _highlight.tags.emphasis,
173
- fontStyle: 'italic'
174
- }, {
175
- tag: _highlight.tags.strong,
176
- fontWeight: 'bold'
177
- }, {
178
- tag: _highlight.tags.strikethrough,
179
- textDecoration: 'line-through'
180
- }, {
181
- tag: _highlight.tags.keyword,
182
- color: componentTheme.tagKeywordColor
183
- }, {
184
- tag: [_highlight.tags.atom, _highlight.tags.bool, _highlight.tags.url, _highlight.tags.contentSeparator, _highlight.tags.labelName],
185
- color: componentTheme.tagAtomColor
186
- }, {
187
- tag: [_highlight.tags.literal, _highlight.tags.inserted],
188
- color: componentTheme.tagLiteralColor
189
- }, {
190
- tag: [_highlight.tags.string, _highlight.tags.deleted],
191
- color: componentTheme.tagStringColor
192
- },
193
- // {
194
- // tag: [tags.regexp, tags.escape, tags.special(tags.string)],
195
- // color: '#e40'
196
- // },
197
- {
198
- tag: _highlight.tags.definition(_highlight.tags.variableName),
199
- color: componentTheme.tagDefinitionVariableNameColor
200
- }, {
201
- tag: _highlight.tags.local(_highlight.tags.variableName),
202
- color: componentTheme.tagLocalVariableNameColor
203
- },
204
- // { tag: [tags.typeName, tags.namespace], color: '#085' },
205
- {
206
- tag: _highlight.tags.className,
207
- color: componentTheme.tagClassNameColor
208
- }, {
209
- tag: [_highlight.tags.special(_highlight.tags.variableName), _highlight.tags.macroName],
210
- color: componentTheme.tagSpecialVariableNameColor
211
- }, {
212
- tag: _highlight.tags.definition(_highlight.tags.propertyName),
213
- color: componentTheme.tagDefinitionPropertyNameColor
214
- }, {
215
- tag: _highlight.tags.comment,
216
- color: componentTheme.tagCommentColor
217
- },
218
- // { tag: tags.invalid, color: '#f00' },
219
-
220
- /**
221
- * Custom highlighting overrides
222
- * (where original colors don't have enough contrast against #fff
223
- * or active highlight background)
224
- */
225
- {
226
- tag: _highlight.tags.meta,
227
- color: componentTheme.tagMetaColor
228
- }, {
229
- tag: [_highlight.tags.regexp, _highlight.tags.escape, _highlight.tags.special(_highlight.tags.string)],
230
- color: componentTheme.tagRegExpColor
231
- }, {
232
- tag: [_highlight.tags.typeName, _highlight.tags.namespace],
233
- color: componentTheme.tagTypeNameColor
234
- }, {
235
- tag: _highlight.tags.invalid,
236
- color: componentTheme.tagInvalidColor
237
- }]
238
- };
239
- };
240
- var _default = exports.default = generateStyle;
package/lib/exports/a.js DELETED
@@ -1,12 +0,0 @@
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 _index.SourceCodeEditor;
10
- }
11
- });
12
- var _index = require("../SourceCodeEditor/v1/index.js");
package/lib/exports/b.js DELETED
@@ -1,12 +0,0 @@
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 _index.SourceCodeEditor;
10
- }
11
- });
12
- var _index = require("../SourceCodeEditor/v2/index.js");
package/lib/package.json DELETED
@@ -1 +0,0 @@
1
- {"type":"commonjs"}