@darajs/components 1.16.5 → 1.16.6-alpha.2

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 (69) hide show
  1. package/dist/dara_components-1.16.6a2-py3-none-any.whl +0 -0
  2. package/dist/index.css +120 -0
  3. package/dist/index.d.ts +1 -0
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +1 -0
  6. package/dist/index.js.map +1 -1
  7. package/dist/smart/code-editor.d.ts.map +1 -1
  8. package/dist/smart/code-editor.js +27 -2
  9. package/dist/smart/code-editor.js.map +1 -1
  10. package/dist/smart/index.d.ts +1 -0
  11. package/dist/smart/index.d.ts.map +1 -1
  12. package/dist/smart/index.js +1 -0
  13. package/dist/smart/index.js.map +1 -1
  14. package/dist/smart/ui-code-editor/code-editor.d.ts +118 -0
  15. package/dist/smart/ui-code-editor/code-editor.d.ts.map +1 -0
  16. package/dist/smart/ui-code-editor/code-editor.js +357 -0
  17. package/dist/smart/ui-code-editor/code-editor.js.map +1 -0
  18. package/dist/smart/ui-code-editor/codemirror-context.d.ts +18 -0
  19. package/dist/smart/ui-code-editor/codemirror-context.d.ts.map +1 -0
  20. package/dist/smart/ui-code-editor/codemirror-context.js +10 -0
  21. package/dist/smart/ui-code-editor/codemirror-context.js.map +1 -0
  22. package/dist/smart/ui-code-editor/extensions/argument-hints.d.ts +21 -0
  23. package/dist/smart/ui-code-editor/extensions/argument-hints.d.ts.map +1 -0
  24. package/dist/smart/ui-code-editor/extensions/argument-hints.js +250 -0
  25. package/dist/smart/ui-code-editor/extensions/argument-hints.js.map +1 -0
  26. package/dist/smart/ui-code-editor/extensions/code-folding.d.ts +3 -0
  27. package/dist/smart/ui-code-editor/extensions/code-folding.d.ts.map +1 -0
  28. package/dist/smart/ui-code-editor/extensions/code-folding.js +69 -0
  29. package/dist/smart/ui-code-editor/extensions/code-folding.js.map +1 -0
  30. package/dist/smart/ui-code-editor/extensions/json.d.ts +16 -0
  31. package/dist/smart/ui-code-editor/extensions/json.d.ts.map +1 -0
  32. package/dist/smart/ui-code-editor/extensions/json.js +29 -0
  33. package/dist/smart/ui-code-editor/extensions/json.js.map +1 -0
  34. package/dist/smart/ui-code-editor/extensions/lsp-utils.d.ts +39 -0
  35. package/dist/smart/ui-code-editor/extensions/lsp-utils.d.ts.map +1 -0
  36. package/dist/smart/ui-code-editor/extensions/lsp-utils.js +299 -0
  37. package/dist/smart/ui-code-editor/extensions/lsp-utils.js.map +1 -0
  38. package/dist/smart/ui-code-editor/extensions/markdown.d.ts +13 -0
  39. package/dist/smart/ui-code-editor/extensions/markdown.d.ts.map +1 -0
  40. package/dist/smart/ui-code-editor/extensions/markdown.js +19 -0
  41. package/dist/smart/ui-code-editor/extensions/markdown.js.map +1 -0
  42. package/dist/smart/ui-code-editor/extensions/python.d.ts +15 -0
  43. package/dist/smart/ui-code-editor/extensions/python.d.ts.map +1 -0
  44. package/dist/smart/ui-code-editor/extensions/python.js +21 -0
  45. package/dist/smart/ui-code-editor/extensions/python.js.map +1 -0
  46. package/dist/smart/ui-code-editor/extensions/shared.d.ts +48 -0
  47. package/dist/smart/ui-code-editor/extensions/shared.d.ts.map +1 -0
  48. package/dist/smart/ui-code-editor/extensions/shared.js +166 -0
  49. package/dist/smart/ui-code-editor/extensions/shared.js.map +1 -0
  50. package/dist/smart/ui-code-editor/extensions/sql.d.ts +14 -0
  51. package/dist/smart/ui-code-editor/extensions/sql.d.ts.map +1 -0
  52. package/dist/smart/ui-code-editor/extensions/sql.js +23 -0
  53. package/dist/smart/ui-code-editor/extensions/sql.js.map +1 -0
  54. package/dist/smart/ui-code-editor/index.d.ts +25 -0
  55. package/dist/smart/ui-code-editor/index.d.ts.map +1 -0
  56. package/dist/smart/ui-code-editor/index.js +25 -0
  57. package/dist/smart/ui-code-editor/index.js.map +1 -0
  58. package/dist/smart/ui-code-editor/types.d.ts +65 -0
  59. package/dist/smart/ui-code-editor/types.d.ts.map +1 -0
  60. package/dist/smart/ui-code-editor/types.js +5 -0
  61. package/dist/smart/ui-code-editor/types.js.map +1 -0
  62. package/dist/smart/ui-code-editor/utils.d.ts +16 -0
  63. package/dist/smart/ui-code-editor/utils.d.ts.map +1 -0
  64. package/dist/smart/ui-code-editor/utils.js +33 -0
  65. package/dist/smart/ui-code-editor/utils.js.map +1 -0
  66. package/dist/umd/dara.components.umd.js +35001 -31083
  67. package/dist/umd/style.css +750 -1
  68. package/package.json +28 -15
  69. package/dist/dara_components-1.16.5-py3-none-any.whl +0 -0
package/dist/index.css ADDED
@@ -0,0 +1,120 @@
1
+ /* CodeMirror hover tooltip root element */
2
+ .cm-tooltip {
3
+ border: none;
4
+ box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.08);
5
+ border-radius: 4px;
6
+ }
7
+
8
+ .cm-editor .cm-foldPlaceholder {
9
+ background-color: transparent;
10
+ font-size: 10px;
11
+ color: #8d9199;
12
+ }
13
+
14
+ .cm-editor .cm-selectionMatch {
15
+ background-color: #c4dffc; /* blue4 */
16
+ }
17
+
18
+ .cm-tooltip.cm-tooltip-autocomplete {
19
+ border-radius: 3px;
20
+ z-index: 101; /* default is 100, autocomplete should be on top of others */
21
+
22
+ /* theme.background */
23
+ background-color: rgb(248, 249, 255);
24
+
25
+ ul {
26
+ border-radius: 3px;
27
+
28
+ li[aria-selected='true'] {
29
+ color: unset !important;
30
+ /* theme.blue3 */
31
+ background-color: #d3e8f8 !important;
32
+ }
33
+ }
34
+
35
+ /* Styles and colors copied from VSCode base styles */
36
+ .cm-completionIcon {
37
+ user-select: none;
38
+
39
+ display: inline-block;
40
+
41
+ /* stylelint-disable-next-line font-family-no-missing-generic-family-keyword */
42
+ font: normal normal normal 16px/1 codicon;
43
+ -webkit-font-smoothing: antialiased;
44
+ -moz-osx-font-smoothing: grayscale;
45
+ text-align: center;
46
+ text-decoration: none;
47
+ text-rendering: auto;
48
+ vertical-align: middle;
49
+ }
50
+
51
+ .cm-completionIcon-class::after {
52
+ content: '';
53
+ color: #d67e00;
54
+ }
55
+
56
+ .cm-completionIcon-constant::after {
57
+ content: '';
58
+ color: #403f53;
59
+ }
60
+
61
+ .cm-completionIcon-enum::after {
62
+ content: '';
63
+ color: #d67e00;
64
+ }
65
+
66
+ .cm-completionIcon-function::after {
67
+ content: '';
68
+ color: #652d90;
69
+ }
70
+
71
+ .cm-completionIcon-interface::after {
72
+ content: '';
73
+ color: #007acc;
74
+ }
75
+
76
+ .cm-completionIcon-keyword::after {
77
+ content: '';
78
+ color: #403f53;
79
+ }
80
+
81
+ .cm-completionIcon-method::after {
82
+ content: '';
83
+ color: #652d90;
84
+ }
85
+
86
+ .cm-completionIcon-namespace::after {
87
+ content: '';
88
+ color: #403f53;
89
+ }
90
+
91
+ .cm-completionIcon-module::after {
92
+ content: '';
93
+ color: #403f53;
94
+ }
95
+
96
+ .cm-completionIcon-property::after {
97
+ content: '';
98
+ color: #403f53;
99
+ }
100
+
101
+ .cm-completionIcon-text::after {
102
+ content: '';
103
+ color: #403f53;
104
+ }
105
+
106
+ .cm-completionIcon-type::after {
107
+ content: '';
108
+ color: #403f53;
109
+ }
110
+
111
+ .cm-completionIcon-variable::after {
112
+ content: '';
113
+ color: #007acc;
114
+ }
115
+
116
+ .cm-completionIcon-reference::after {
117
+ content: '';
118
+ color: #403f53;
119
+ }
120
+ }
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import './index.css';
1
2
  export * from './common';
2
3
  export * from './plotting';
3
4
  export * from './smart';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../js/index.tsx"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../js/index.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAC;AAErB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC"}
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ import './index.css';
1
2
  export * from './common';
2
3
  export * from './plotting';
3
4
  export * from './smart';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../js/index.tsx"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../js/index.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAC;AAErB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"code-editor.d.ts","sourceRoot":"","sources":["../../js/smart/code-editor.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,QAAQ,EAA8C,MAAM,cAAc,CAAC;AAG1G,UAAU,eAAgB,SAAQ,oBAAoB;IAClD,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,UAAU,GAAG,KAAK,CAAC;CACrD;AAID;;;GAGG;AACH,iBAAS,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,GAAG,CAAC,OAAO,CAavD;AAED,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"code-editor.d.ts","sourceRoot":"","sources":["../../js/smart/code-editor.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,QAAQ,EAA8C,MAAM,cAAc,CAAC;AAQ1G,UAAU,eAAgB,SAAQ,oBAAoB;IAClD,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,UAAU,GAAG,KAAK,CAAC;CACrD;AAID;;;GAGG;AACH,iBAAS,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,GAAG,CAAC,OAAO,CAsCvD;AAED,eAAe,UAAU,CAAC"}
@@ -1,6 +1,11 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
+ import * as React from 'react';
2
3
  import { injectCss, useComponentStyles, useVariable } from '@darajs/core';
3
- import { CodeEditor as UICodeEditor } from '@darajs/ui-code-editor';
4
+ import { CodeEditor as UICodeEditor } from './ui-code-editor';
5
+ import { getJSONExtensions } from './ui-code-editor/extensions/json';
6
+ import { getMarkdownExtensions } from './ui-code-editor/extensions/markdown';
7
+ import { getPythonExtensions } from './ui-code-editor/extensions/python';
8
+ import { getSQLExtensions } from './ui-code-editor/extensions/sql';
4
9
  const StyledCodeEditor = injectCss(UICodeEditor);
5
10
  /**
6
11
  * A component that creates a CodeEditor. The script is stored in a variable and is updated
@@ -9,7 +14,27 @@ const StyledCodeEditor = injectCss(UICodeEditor);
9
14
  function CodeEditor(props) {
10
15
  const [style, css] = useComponentStyles(props);
11
16
  const [script, setScript] = useVariable(props.script);
12
- return (_jsx(StyledCodeEditor, { "$rawCss": css, initialScript: script, onChange: setScript, style: style, language: props.language }));
17
+ const onChange = React.useCallback((update) => {
18
+ if (update.docChanged) {
19
+ setScript(update.state.doc.toString());
20
+ }
21
+ }, [setScript]);
22
+ const extensions = React.useMemo(() => {
23
+ if (props.language === 'json') {
24
+ return getJSONExtensions();
25
+ }
26
+ if (props.language === 'python') {
27
+ return getPythonExtensions();
28
+ }
29
+ if (props.language === 'markdown') {
30
+ return getMarkdownExtensions();
31
+ }
32
+ if (props.language === 'sql') {
33
+ return getSQLExtensions();
34
+ }
35
+ return [];
36
+ }, [props.language]);
37
+ return (_jsx(StyledCodeEditor, { "$rawCss": css, initialValue: script, onChange: onChange, style: style, extensions: extensions }));
13
38
  }
14
39
  export default CodeEditor;
15
40
  //# sourceMappingURL=code-editor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"code-editor.js","sourceRoot":"","sources":["../../js/smart/code-editor.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAkC,SAAS,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC1G,OAAO,EAAE,UAAU,IAAI,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAOpE,MAAM,gBAAgB,GAAG,SAAS,CAAC,YAAY,CAAC,CAAC;AAEjD;;;GAGG;AACH,SAAS,UAAU,CAAC,KAAsB;IACtC,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAC/C,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAEtD,OAAO,CACH,KAAC,gBAAgB,eACJ,GAAG,EACZ,aAAa,EAAE,MAAM,EACrB,QAAQ,EAAE,SAAS,EACnB,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,KAAK,CAAC,QAAQ,GAC1B,CACL,CAAC;AACN,CAAC;AAED,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"code-editor.js","sourceRoot":"","sources":["../../js/smart/code-editor.tsx"],"names":[],"mappings":";AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAkC,SAAS,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE1G,OAAO,EAAE,UAAU,IAAI,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAOnE,MAAM,gBAAgB,GAAG,SAAS,CAAC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}
@@ -3,5 +3,6 @@ export { default as FilterStatusButton } from './filter-status-button/filter-sta
3
3
  export { default as HierarchySelector } from './hierarchy-selector/hierarchy-selector';
4
4
  export { default as HierarchyViewer } from './hierarchy-viewer/hierarchy-viewer';
5
5
  export { default as CodeEditor } from './code-editor';
6
+ export { CodeEditor as UiCodeEditor, argumentHints, closeArgumentsHintsTooltip, getDefaultExtensions, goToDefinitionExtension, getJSONExtensions, getMarkdownExtensions, getPythonExtensions, getSQLExtensions, } from './ui-code-editor';
6
7
  export { default as Chat } from './chat/chat';
7
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../js/smart/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AACtF,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;AAC5F,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AACvF,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACjF,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../js/smart/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AACtF,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;AAC5F,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AACvF,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACjF,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EACH,UAAU,IAAI,YAAY,EAC1B,aAAa,EACb,0BAA0B,EAC1B,oBAAoB,EACpB,uBAAuB,EACvB,iBAAiB,EACjB,qBAAqB,EACrB,mBAAmB,EACnB,gBAAgB,GACnB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,aAAa,CAAC"}
@@ -4,5 +4,6 @@ export { default as FilterStatusButton } from './filter-status-button/filter-sta
4
4
  export { default as HierarchySelector } from './hierarchy-selector/hierarchy-selector';
5
5
  export { default as HierarchyViewer } from './hierarchy-viewer/hierarchy-viewer';
6
6
  export { default as CodeEditor } from './code-editor';
7
+ export { CodeEditor as UiCodeEditor, argumentHints, closeArgumentsHintsTooltip, getDefaultExtensions, goToDefinitionExtension, getJSONExtensions, getMarkdownExtensions, getPythonExtensions, getSQLExtensions, } from './ui-code-editor';
7
8
  export { default as Chat } from './chat/chat';
8
9
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../js/smart/index.tsx"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AACtF,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;AAC5F,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AACvF,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACjF,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../js/smart/index.tsx"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AACtF,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;AAC5F,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AACvF,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACjF,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EACH,UAAU,IAAI,YAAY,EAC1B,aAAa,EACb,0BAA0B,EAC1B,oBAAoB,EACpB,uBAAuB,EACvB,iBAAiB,EACjB,qBAAqB,EACrB,mBAAmB,EACnB,gBAAgB,GACnB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,118 @@
1
+ import type { Extension } from '@codemirror/state';
2
+ import type { KeyBinding, ViewUpdate } from '@codemirror/view';
3
+ import { EditorView } from '@codemirror/view';
4
+ import '@vscode/codicons/dist/codicon.css';
5
+ import type { FunctionComponent } from 'react';
6
+ import React from 'react';
7
+ import type { Range } from 'vscode-languageserver-types';
8
+ import type { LSPDefinition, LspHoverResponse } from './types';
9
+ export interface ConfigurableHotkeys {
10
+ hotkeyBindings?: {
11
+ [key: string]: (e: KeyboardEvent, view: EditorView) => void;
12
+ };
13
+ focusMiddlewares?: (() => boolean)[];
14
+ allowInputs?: boolean;
15
+ }
16
+ export interface TooltipRenderProps {
17
+ lineNumber: number;
18
+ characterPos: number;
19
+ inspectedSubstring: string;
20
+ source?: string;
21
+ contents: LspHoverResponse['contents'];
22
+ }
23
+ type FocusState = 'soft' | 'hard';
24
+ export interface CodeEditorProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange' | 'onBlur'> {
25
+ /**
26
+ * The URI of the file being edited.
27
+ * Should be in the format `file:///path/to/file#cellId`, cellId being optional
28
+ */
29
+ uri?: string;
30
+ /**
31
+ * The class name to apply to the editor wrapper
32
+ */
33
+ className?: string;
34
+ /**
35
+ * The extensions to apply to the editor
36
+ */
37
+ extensions?: Extension;
38
+ /**
39
+ * Styles to apply directly to the editor rather than the wrapper around it
40
+ */
41
+ editorStyle?: React.CSSProperties;
42
+ /**
43
+ * The initial text value of the editor
44
+ */
45
+ initialValue?: string;
46
+ /**
47
+ * Whether the editor should be disabled
48
+ */
49
+ disabled?: boolean;
50
+ /**
51
+ * Whether to disable the LSP features
52
+ */
53
+ enableLsp?: boolean;
54
+ /**
55
+ * Whether the editor should be read-only
56
+ */
57
+ readOnly?: boolean;
58
+ /**
59
+ * The type of focus on the editor, hard is editable mode, soft just browseable
60
+ */
61
+ focusType?: FocusState;
62
+ /**
63
+ * The style to apply to the editor wrapper
64
+ */
65
+ style?: React.CSSProperties;
66
+ /**
67
+ * Whether the editor should be focused on load
68
+ */
69
+ focusOnLoad?: boolean;
70
+ /**
71
+ * The onFocus handler
72
+ */
73
+ onFocus?: () => void;
74
+ /**
75
+ * The onBlur handler
76
+ */
77
+ onBlur?: (ev: FocusEvent, view: EditorView) => void;
78
+ /**
79
+ * The onChange handler
80
+ */
81
+ onChange?: (update: ViewUpdate) => void;
82
+ /**
83
+ * Callback to handle go to definition
84
+ */
85
+ onGoToDefinition?: (defs: LSPDefinition[]) => void;
86
+ /**
87
+ * The initial position in the document to select
88
+ */
89
+ initialPosition?: Range;
90
+ /**
91
+ * The configurable hotkeys to apply to the editor wrapper
92
+ */
93
+ configurableHotkeys?: ConfigurableHotkeys;
94
+ /**
95
+ * The data-testid to apply to the editor wrapper
96
+ */
97
+ dataTestId?: string;
98
+ /**
99
+ * The keymap precedence to apply to the editor
100
+ */
101
+ keymapPrecedence?: KeyBinding[];
102
+ /**
103
+ * Render props for the tooltip
104
+ */
105
+ tooltipRenderer?: (props: TooltipRenderProps) => React.ReactNode;
106
+ /**
107
+ * Whether the editor should be updated if initial value changes
108
+ */
109
+ shouldSyncInitialValue?: boolean;
110
+ }
111
+ /**
112
+ * Base CodeEditor component.
113
+ * Should not depend on studio-specific contexts or hooks as it will eventually be moved into Dara.
114
+ * Studio-specific functionality should be implemented as extensions or configured via props, injected in StudioEditor.
115
+ */
116
+ declare const CodeEditor: FunctionComponent<CodeEditorProps>;
117
+ export default CodeEditor;
118
+ //# sourceMappingURL=code-editor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"code-editor.d.ts","sourceRoot":"","sources":["../../../js/smart/ui-code-editor/code-editor.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,KAAK,EAAgC,UAAU,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC7F,OAAO,EAAE,UAAU,EAAkC,MAAM,kBAAkB,CAAC;AAC9E,OAAO,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,KAA+C,MAAM,OAAO,CAAC;AAGpE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAWzD,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAsC/D,MAAM,WAAW,mBAAmB;IAChC,cAAc,CAAC,EAAE;QACb,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE,UAAU,KAAK,IAAI,CAAC;KAC/D,CAAC;IACF,gBAAgB,CAAC,EAAE,CAAC,MAAM,OAAO,CAAC,EAAE,CAAC;IACrC,WAAW,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,kBAAkB;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,gBAAgB,CAAC,UAAU,CAAC,CAAC;CAC1C;AAED,KAAK,UAAU,GAAG,MAAM,GAAG,M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