@api-client/ui 0.5.16 → 0.5.18
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/.github/instructions/lit-best-practices.instructions.md +1 -0
- package/build/src/elements/code-editor/code-editor.d.ts +1 -1
- package/build/src/elements/code-editor/code-editor.d.ts.map +1 -1
- package/build/src/elements/code-editor/code-editor.js.map +1 -1
- package/build/src/elements/code-editor/internals/CodeEditor.d.ts +20 -1
- package/build/src/elements/code-editor/internals/CodeEditor.d.ts.map +1 -1
- package/build/src/elements/code-editor/internals/CodeEditor.js +67 -2
- package/build/src/elements/code-editor/internals/CodeEditor.js.map +1 -1
- package/build/src/elements/code-editor/internals/CodeEditor.styles.d.ts.map +1 -1
- package/build/src/elements/code-editor/internals/CodeEditor.styles.js +8 -2
- package/build/src/elements/code-editor/internals/CodeEditor.styles.js.map +1 -1
- package/build/src/elements/code-editor/internals/types.d.ts +4 -0
- package/build/src/elements/code-editor/internals/types.d.ts.map +1 -1
- package/build/src/elements/code-editor/internals/types.js.map +1 -1
- package/demo/elements/code-editor/CodeEditorDemo.ts +8 -0
- package/package.json +1 -1
- package/src/elements/code-editor/code-editor.ts +6 -1
- package/src/elements/code-editor/internals/CodeEditor.styles.ts +8 -2
- package/src/elements/code-editor/internals/CodeEditor.ts +55 -2
- package/src/elements/code-editor/internals/types.ts +5 -0
- package/test/elements/autocomplete/autocomplete-input.spec.ts +71 -70
- package/test/elements/code-editor/code-editor.accessibility.test.ts +325 -0
- package/test/elements/code-editor/code-editor.test.ts +577 -0
|
@@ -73,6 +73,7 @@ You are an expert developer in web components using the Lit library and Material
|
|
|
73
73
|
```bash
|
|
74
74
|
npm test -- --files=".tmp/test/**/[test file name].test.js"
|
|
75
75
|
```
|
|
76
|
+
- Prefer the Assert API over the Expect API for assertions. The Assert API is more performant and provides better error messages.
|
|
76
77
|
|
|
77
78
|
## Component Demoing
|
|
78
79
|
|
|
@@ -9,6 +9,6 @@ declare global {
|
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
export default CodeEditorElement;
|
|
12
|
-
export type { Suggestion, FunctionInsertEvent, SuggestionInsertEvent } from './internals/types.js';
|
|
12
|
+
export type { Suggestion, FunctionInsertEvent, SuggestionInsertEvent, FunctionDocumentationEvent, } from './internals/types.js';
|
|
13
13
|
export type { FunctionSchema, FunctionParameter } from '@pawel-up/jexl/schemas/types.js';
|
|
14
14
|
//# sourceMappingURL=code-editor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-editor.d.ts","sourceRoot":"","sources":["../../../../src/elements/code-editor/code-editor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,KAAK,CAAA;AAE5C,OAAO,OAAO,MAAM,2BAA2B,CAAA;AAG/C,qBACa,iBAAkB,SAAQ,OAAO;IAC5C,OAAgB,MAAM,EAAE,iBAAiB,EAAE,CAAW;CACvD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,aAAa,EAAE,iBAAiB,CAAA;KACjC;CACF;AAED,eAAe,iBAAiB,CAAA;AAChC,YAAY,
|
|
1
|
+
{"version":3,"file":"code-editor.d.ts","sourceRoot":"","sources":["../../../../src/elements/code-editor/code-editor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,KAAK,CAAA;AAE5C,OAAO,OAAO,MAAM,2BAA2B,CAAA;AAG/C,qBACa,iBAAkB,SAAQ,OAAO;IAC5C,OAAgB,MAAM,EAAE,iBAAiB,EAAE,CAAW;CACvD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,aAAa,EAAE,iBAAiB,CAAA;KACjC;CACF;AAED,eAAe,iBAAiB,CAAA;AAChC,YAAY,EACV,UAAU,EACV,mBAAmB,EACnB,qBAAqB,EACrB,0BAA0B,GAC3B,MAAM,sBAAsB,CAAA;AAC7B,YAAY,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-editor.js","sourceRoot":"","sources":["../../../../src/elements/code-editor/code-editor.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,OAAO,MAAM,2BAA2B,CAAA;AAC/C,OAAO,MAAM,MAAM,kCAAkC,CAAA;IAGxC,iBAAiB;4BAD7B,aAAa,CAAC,aAAa,CAAC;;;;sBACU,OAAO;iCAAf,SAAQ,WAAO;;;;YAA9C,6KAEC;;;;QADC,MAAM,CAAU,MAAM,GAAwB,CAAC,MAAM,CAAC,CAAA;;YAD3C,uDAAiB;;;;;SAAjB,iBAAiB;AAU9B,eAAe,iBAAiB,CAAA","sourcesContent":["import type { CSSResultOrNative } from 'lit'\nimport { customElement } from 'lit/decorators.js'\nimport Element from './internals/CodeEditor.js'\nimport styles from './internals/CodeEditor.styles.js'\n\n@customElement('code-editor')\nexport class CodeEditorElement extends Element {\n static override styles: CSSResultOrNative[] = [styles]\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'code-editor': CodeEditorElement\n }\n}\n\nexport default CodeEditorElement\nexport type {
|
|
1
|
+
{"version":3,"file":"code-editor.js","sourceRoot":"","sources":["../../../../src/elements/code-editor/code-editor.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,OAAO,MAAM,2BAA2B,CAAA;AAC/C,OAAO,MAAM,MAAM,kCAAkC,CAAA;IAGxC,iBAAiB;4BAD7B,aAAa,CAAC,aAAa,CAAC;;;;sBACU,OAAO;iCAAf,SAAQ,WAAO;;;;YAA9C,6KAEC;;;;QADC,MAAM,CAAU,MAAM,GAAwB,CAAC,MAAM,CAAC,CAAA;;YAD3C,uDAAiB;;;;;SAAjB,iBAAiB;AAU9B,eAAe,iBAAiB,CAAA","sourcesContent":["import type { CSSResultOrNative } from 'lit'\nimport { customElement } from 'lit/decorators.js'\nimport Element from './internals/CodeEditor.js'\nimport styles from './internals/CodeEditor.styles.js'\n\n@customElement('code-editor')\nexport class CodeEditorElement extends Element {\n static override styles: CSSResultOrNative[] = [styles]\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'code-editor': CodeEditorElement\n }\n}\n\nexport default CodeEditorElement\nexport type {\n Suggestion,\n FunctionInsertEvent,\n SuggestionInsertEvent,\n FunctionDocumentationEvent,\n} from './internals/types.js'\nexport type { FunctionSchema, FunctionParameter } from '@pawel-up/jexl/schemas/types.js'\n"]}
|
|
@@ -2,6 +2,7 @@ import { LitElement, PropertyValues, TemplateResult } from 'lit';
|
|
|
2
2
|
import type { FunctionSchema } from '@pawel-up/jexl/schemas/types.js';
|
|
3
3
|
import type { Suggestion } from './types.js';
|
|
4
4
|
import { SuggestionMatchDecorator } from './SuggestionMatchDecorator.js';
|
|
5
|
+
import '../../../md/button/ui-button.js';
|
|
5
6
|
/**
|
|
6
7
|
* A CodeMirror 6 based editor component that supports function autocomplete and suggestion placeholders.
|
|
7
8
|
*
|
|
@@ -14,6 +15,7 @@ import { SuggestionMatchDecorator } from './SuggestionMatchDecorator.js';
|
|
|
14
15
|
*
|
|
15
16
|
* @fires function-insert - When a function is inserted
|
|
16
17
|
* @fires suggestion-insert - When a suggestion is inserted
|
|
18
|
+
* @fires function-documentation - When documentation is requested for a function
|
|
17
19
|
* @fires input - When the editor content changes
|
|
18
20
|
* @fires change - When the editor loses focus and content has changed
|
|
19
21
|
*/
|
|
@@ -26,30 +28,37 @@ export default class CodeEditor extends LitElement {
|
|
|
26
28
|
static shadowRootOptions: ShadowRootInit;
|
|
27
29
|
/**
|
|
28
30
|
* The label text displayed as placeholder/floating label
|
|
31
|
+
* @attribute
|
|
29
32
|
*/
|
|
30
33
|
accessor label: string;
|
|
31
34
|
/**
|
|
32
35
|
* Supporting text displayed below the editor
|
|
36
|
+
* @attribute
|
|
33
37
|
*/
|
|
34
38
|
accessor supportingText: string;
|
|
35
39
|
/**
|
|
36
40
|
* Whether the component is disabled
|
|
41
|
+
* @attribute
|
|
37
42
|
*/
|
|
38
43
|
accessor disabled: boolean;
|
|
39
44
|
/**
|
|
40
45
|
* Whether the component is in an invalid state
|
|
46
|
+
* @attribute
|
|
41
47
|
*/
|
|
42
48
|
accessor invalid: boolean;
|
|
43
49
|
/**
|
|
44
50
|
* The name attribute for form integration
|
|
51
|
+
* @attribute
|
|
45
52
|
*/
|
|
46
53
|
accessor name: string;
|
|
47
54
|
/**
|
|
48
55
|
* Whether the input is required
|
|
56
|
+
* @attribute
|
|
49
57
|
*/
|
|
50
58
|
accessor required: boolean;
|
|
51
59
|
/**
|
|
52
60
|
* Placeholder text shown when editor is empty
|
|
61
|
+
* @attribute
|
|
53
62
|
*/
|
|
54
63
|
accessor placeholder: string;
|
|
55
64
|
/**
|
|
@@ -71,8 +80,14 @@ export default class CodeEditor extends LitElement {
|
|
|
71
80
|
accessor darkTheme: boolean;
|
|
72
81
|
/**
|
|
73
82
|
* Programming language for syntax highlighting
|
|
83
|
+
* @attribute
|
|
74
84
|
*/
|
|
75
85
|
accessor language: string;
|
|
86
|
+
/**
|
|
87
|
+
* Whether to show documentation links/buttons in function tooltips and autocomplete
|
|
88
|
+
* @attribute show-documentation
|
|
89
|
+
*/
|
|
90
|
+
accessor showDocumentation: boolean;
|
|
76
91
|
private accessor editorContainer;
|
|
77
92
|
private accessor hasContent;
|
|
78
93
|
private accessor isEditorFocus;
|
|
@@ -118,7 +133,7 @@ export default class CodeEditor extends LitElement {
|
|
|
118
133
|
* Creates a styled HTML element to display function documentation.
|
|
119
134
|
* This is used for both hover tooltips and autocomplete info panels.
|
|
120
135
|
*/
|
|
121
|
-
|
|
136
|
+
protected createFunctionInfoElement(fn: FunctionSchema): HTMLElement;
|
|
122
137
|
/**
|
|
123
138
|
* Format function call with parameters
|
|
124
139
|
*/
|
|
@@ -143,6 +158,10 @@ export default class CodeEditor extends LitElement {
|
|
|
143
158
|
* Dispatch suggestion insert event
|
|
144
159
|
*/
|
|
145
160
|
private dispatchSuggestionInsert;
|
|
161
|
+
/**
|
|
162
|
+
* Dispatch function documentation event
|
|
163
|
+
*/
|
|
164
|
+
private dispatchFunctionDocumentation;
|
|
146
165
|
/**
|
|
147
166
|
* Focus the editor
|
|
148
167
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeEditor.d.ts","sourceRoot":"","sources":["../../../../../src/elements/code-editor/internals/CodeEditor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,UAAU,EAAE,cAAc,EAAE,cAAc,EAAW,MAAM,KAAK,CAAA;AA0B/E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAA;AAGrE,OAAO,KAAK,EAAuB,UAAU,
|
|
1
|
+
{"version":3,"file":"CodeEditor.d.ts","sourceRoot":"","sources":["../../../../../src/elements/code-editor/internals/CodeEditor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,UAAU,EAAE,cAAc,EAAE,cAAc,EAAW,MAAM,KAAK,CAAA;AA0B/E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAA;AAGrE,OAAO,KAAK,EAAuB,UAAU,EAAqD,MAAM,YAAY,CAAA;AACpH,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAA;AAExE,OAAO,iCAAiC,CAAA;AAExC;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,UAAU;;IAChD;;;OAGG;IACH,OAAgB,iBAAiB,EAAE,cAAc,CAGhD;IAED;;;OAGG;IAEH,QAAQ,CAAC,KAAK,SAAK;IAEnB;;;OAGG;IAEH,QAAQ,CAAC,cAAc,SAAK;IAE5B;;;OAGG;IAEH,QAAQ,CAAC,QAAQ,UAAQ;IAEzB;;;OAGG;IAEH,QAAQ,CAAC,OAAO,UAAQ;IAExB;;;OAGG;IAEH,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AAE,EAAE,cAAc,GAAG,WAAW;IAqFpE;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAiB1B;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAe3B;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAU1B;;OAEG;IACH,OAAO,CAAC,iBAAiB;IASzB;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAQ9B;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAQhC;;OAEG;IACH,OAAO,CAAC,6BAA6B;IAQrC;;OAEG;IACM,KAAK,IAAI,IAAI;IAItB;;OAEG;IACH,YAAY,IAAI;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IAMnD;;OAEG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAUrB,MAAM,IAAI,cAAc;CAgBlC"}
|
|
@@ -14,6 +14,7 @@ import { EditorView, Decoration, ViewPlugin, hoverTooltip, } from '@codemirror/v
|
|
|
14
14
|
import { getTypeStringFromSchema } from '@pawel-up/jexl/schemas/utils.js';
|
|
15
15
|
import { functionLinter } from './Linter.js';
|
|
16
16
|
import { SuggestionMatchDecorator } from './SuggestionMatchDecorator.js';
|
|
17
|
+
import '../../../md/button/ui-button.js';
|
|
17
18
|
let CodeEditor = (() => {
|
|
18
19
|
let _classSuper = LitElement;
|
|
19
20
|
let _instanceExtraInitializers = [];
|
|
@@ -51,6 +52,9 @@ let CodeEditor = (() => {
|
|
|
51
52
|
let _language_decorators;
|
|
52
53
|
let _language_initializers = [];
|
|
53
54
|
let _language_extraInitializers = [];
|
|
55
|
+
let _showDocumentation_decorators;
|
|
56
|
+
let _showDocumentation_initializers = [];
|
|
57
|
+
let _showDocumentation_extraInitializers = [];
|
|
54
58
|
let _editorContainer_decorators;
|
|
55
59
|
let _editorContainer_initializers = [];
|
|
56
60
|
let _editorContainer_extraInitializers = [];
|
|
@@ -75,6 +79,7 @@ let CodeEditor = (() => {
|
|
|
75
79
|
_suggestions_decorators = [property({ type: Array, attribute: false })];
|
|
76
80
|
_darkTheme_decorators = [property({ type: Boolean, attribute: 'dark-theme' })];
|
|
77
81
|
_language_decorators = [property({ type: String })];
|
|
82
|
+
_showDocumentation_decorators = [property({ type: Boolean, attribute: 'show-documentation' })];
|
|
78
83
|
_editorContainer_decorators = [query('.editor-container')];
|
|
79
84
|
_hasContent_decorators = [state()];
|
|
80
85
|
_isEditorFocus_decorators = [state()];
|
|
@@ -90,6 +95,7 @@ let CodeEditor = (() => {
|
|
|
90
95
|
__esDecorate(this, null, _suggestions_decorators, { kind: "accessor", name: "suggestions", static: false, private: false, access: { has: obj => "suggestions" in obj, get: obj => obj.suggestions, set: (obj, value) => { obj.suggestions = value; } }, metadata: _metadata }, _suggestions_initializers, _suggestions_extraInitializers);
|
|
91
96
|
__esDecorate(this, null, _darkTheme_decorators, { kind: "accessor", name: "darkTheme", static: false, private: false, access: { has: obj => "darkTheme" in obj, get: obj => obj.darkTheme, set: (obj, value) => { obj.darkTheme = value; } }, metadata: _metadata }, _darkTheme_initializers, _darkTheme_extraInitializers);
|
|
92
97
|
__esDecorate(this, null, _language_decorators, { kind: "accessor", name: "language", static: false, private: false, access: { has: obj => "language" in obj, get: obj => obj.language, set: (obj, value) => { obj.language = value; } }, metadata: _metadata }, _language_initializers, _language_extraInitializers);
|
|
98
|
+
__esDecorate(this, null, _showDocumentation_decorators, { kind: "accessor", name: "showDocumentation", static: false, private: false, access: { has: obj => "showDocumentation" in obj, get: obj => obj.showDocumentation, set: (obj, value) => { obj.showDocumentation = value; } }, metadata: _metadata }, _showDocumentation_initializers, _showDocumentation_extraInitializers);
|
|
93
99
|
__esDecorate(this, null, _editorContainer_decorators, { kind: "accessor", name: "editorContainer", static: false, private: false, access: { has: obj => "editorContainer" in obj, get: obj => obj.editorContainer, set: (obj, value) => { obj.editorContainer = value; } }, metadata: _metadata }, _editorContainer_initializers, _editorContainer_extraInitializers);
|
|
94
100
|
__esDecorate(this, null, _hasContent_decorators, { kind: "accessor", name: "hasContent", static: false, private: false, access: { has: obj => "hasContent" in obj, get: obj => obj.hasContent, set: (obj, value) => { obj.hasContent = value; } }, metadata: _metadata }, _hasContent_initializers, _hasContent_extraInitializers);
|
|
95
101
|
__esDecorate(this, null, _isEditorFocus_decorators, { kind: "accessor", name: "isEditorFocus", static: false, private: false, access: { has: obj => "isEditorFocus" in obj, get: obj => obj.isEditorFocus, set: (obj, value) => { obj.isEditorFocus = value; } }, metadata: _metadata }, _isEditorFocus_initializers, _isEditorFocus_extraInitializers);
|
|
@@ -106,60 +112,72 @@ let CodeEditor = (() => {
|
|
|
106
112
|
#label_accessor_storage = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _label_initializers, ''
|
|
107
113
|
/**
|
|
108
114
|
* Supporting text displayed below the editor
|
|
115
|
+
* @attribute
|
|
109
116
|
*/
|
|
110
117
|
));
|
|
111
118
|
/**
|
|
112
119
|
* The label text displayed as placeholder/floating label
|
|
120
|
+
* @attribute
|
|
113
121
|
*/
|
|
114
122
|
get label() { return this.#label_accessor_storage; }
|
|
115
123
|
set label(value) { this.#label_accessor_storage = value; }
|
|
116
124
|
#supportingText_accessor_storage = (__runInitializers(this, _label_extraInitializers), __runInitializers(this, _supportingText_initializers, ''
|
|
117
125
|
/**
|
|
118
126
|
* Whether the component is disabled
|
|
127
|
+
* @attribute
|
|
119
128
|
*/
|
|
120
129
|
));
|
|
121
130
|
/**
|
|
122
131
|
* Supporting text displayed below the editor
|
|
132
|
+
* @attribute
|
|
123
133
|
*/
|
|
124
134
|
get supportingText() { return this.#supportingText_accessor_storage; }
|
|
125
135
|
set supportingText(value) { this.#supportingText_accessor_storage = value; }
|
|
126
136
|
#disabled_accessor_storage = (__runInitializers(this, _supportingText_extraInitializers), __runInitializers(this, _disabled_initializers, false
|
|
127
137
|
/**
|
|
128
138
|
* Whether the component is in an invalid state
|
|
139
|
+
* @attribute
|
|
129
140
|
*/
|
|
130
141
|
));
|
|
131
142
|
/**
|
|
132
143
|
* Whether the component is disabled
|
|
144
|
+
* @attribute
|
|
133
145
|
*/
|
|
134
146
|
get disabled() { return this.#disabled_accessor_storage; }
|
|
135
147
|
set disabled(value) { this.#disabled_accessor_storage = value; }
|
|
136
148
|
#invalid_accessor_storage = (__runInitializers(this, _disabled_extraInitializers), __runInitializers(this, _invalid_initializers, false
|
|
137
149
|
/**
|
|
138
150
|
* The name attribute for form integration
|
|
151
|
+
* @attribute
|
|
139
152
|
*/
|
|
140
153
|
));
|
|
141
154
|
/**
|
|
142
155
|
* Whether the component is in an invalid state
|
|
156
|
+
* @attribute
|
|
143
157
|
*/
|
|
144
158
|
get invalid() { return this.#invalid_accessor_storage; }
|
|
145
159
|
set invalid(value) { this.#invalid_accessor_storage = value; }
|
|
146
160
|
#name_accessor_storage = (__runInitializers(this, _invalid_extraInitializers), __runInitializers(this, _name_initializers, ''
|
|
147
161
|
/**
|
|
148
162
|
* Whether the input is required
|
|
163
|
+
* @attribute
|
|
149
164
|
*/
|
|
150
165
|
));
|
|
151
166
|
/**
|
|
152
167
|
* The name attribute for form integration
|
|
168
|
+
* @attribute
|
|
153
169
|
*/
|
|
154
170
|
get name() { return this.#name_accessor_storage; }
|
|
155
171
|
set name(value) { this.#name_accessor_storage = value; }
|
|
156
172
|
#required_accessor_storage = (__runInitializers(this, _name_extraInitializers), __runInitializers(this, _required_initializers, false
|
|
157
173
|
/**
|
|
158
174
|
* Placeholder text shown when editor is empty
|
|
175
|
+
* @attribute
|
|
159
176
|
*/
|
|
160
177
|
));
|
|
161
178
|
/**
|
|
162
179
|
* Whether the input is required
|
|
180
|
+
* @attribute
|
|
163
181
|
*/
|
|
164
182
|
get required() { return this.#required_accessor_storage; }
|
|
165
183
|
set required(value) { this.#required_accessor_storage = value; }
|
|
@@ -170,6 +188,7 @@ let CodeEditor = (() => {
|
|
|
170
188
|
));
|
|
171
189
|
/**
|
|
172
190
|
* Placeholder text shown when editor is empty
|
|
191
|
+
* @attribute
|
|
173
192
|
*/
|
|
174
193
|
get placeholder() { return this.#placeholder_accessor_storage; }
|
|
175
194
|
set placeholder(value) { this.#placeholder_accessor_storage = value; }
|
|
@@ -214,6 +233,7 @@ let CodeEditor = (() => {
|
|
|
214
233
|
#darkTheme_accessor_storage = (__runInitializers(this, _suggestions_extraInitializers), __runInitializers(this, _darkTheme_initializers, false
|
|
215
234
|
/**
|
|
216
235
|
* Programming language for syntax highlighting
|
|
236
|
+
* @attribute
|
|
217
237
|
*/
|
|
218
238
|
));
|
|
219
239
|
/**
|
|
@@ -221,13 +241,26 @@ let CodeEditor = (() => {
|
|
|
221
241
|
*/
|
|
222
242
|
get darkTheme() { return this.#darkTheme_accessor_storage; }
|
|
223
243
|
set darkTheme(value) { this.#darkTheme_accessor_storage = value; }
|
|
224
|
-
#language_accessor_storage = (__runInitializers(this, _darkTheme_extraInitializers), __runInitializers(this, _language_initializers, 'javascript'
|
|
244
|
+
#language_accessor_storage = (__runInitializers(this, _darkTheme_extraInitializers), __runInitializers(this, _language_initializers, 'javascript'
|
|
245
|
+
/**
|
|
246
|
+
* Whether to show documentation links/buttons in function tooltips and autocomplete
|
|
247
|
+
* @attribute show-documentation
|
|
248
|
+
*/
|
|
249
|
+
));
|
|
225
250
|
/**
|
|
226
251
|
* Programming language for syntax highlighting
|
|
252
|
+
* @attribute
|
|
227
253
|
*/
|
|
228
254
|
get language() { return this.#language_accessor_storage; }
|
|
229
255
|
set language(value) { this.#language_accessor_storage = value; }
|
|
230
|
-
#
|
|
256
|
+
#showDocumentation_accessor_storage = (__runInitializers(this, _language_extraInitializers), __runInitializers(this, _showDocumentation_initializers, false));
|
|
257
|
+
/**
|
|
258
|
+
* Whether to show documentation links/buttons in function tooltips and autocomplete
|
|
259
|
+
* @attribute show-documentation
|
|
260
|
+
*/
|
|
261
|
+
get showDocumentation() { return this.#showDocumentation_accessor_storage; }
|
|
262
|
+
set showDocumentation(value) { this.#showDocumentation_accessor_storage = value; }
|
|
263
|
+
#editorContainer_accessor_storage = (__runInitializers(this, _showDocumentation_extraInitializers), __runInitializers(this, _editorContainer_initializers, void 0));
|
|
231
264
|
get editorContainer() { return this.#editorContainer_accessor_storage; }
|
|
232
265
|
set editorContainer(value) { this.#editorContainer_accessor_storage = value; }
|
|
233
266
|
#hasContent_accessor_storage = (__runInitializers(this, _editorContainer_extraInitializers), __runInitializers(this, _hasContent_initializers, false));
|
|
@@ -307,6 +340,10 @@ let CodeEditor = (() => {
|
|
|
307
340
|
if (update.focusChanged) {
|
|
308
341
|
this.handleFocusChange(update.view.hasFocus);
|
|
309
342
|
}
|
|
343
|
+
else if (update.view.hasFocus !== this.isEditorFocus) {
|
|
344
|
+
// If focus state changed without focusChanged event, update manually
|
|
345
|
+
this.handleFocusChange(update.view.hasFocus);
|
|
346
|
+
}
|
|
310
347
|
}),
|
|
311
348
|
this.createPlaceholderPlugin(),
|
|
312
349
|
hoverTooltip(this.createHoverTooltipSource),
|
|
@@ -505,6 +542,23 @@ let CodeEditor = (() => {
|
|
|
505
542
|
returnsContainer.appendChild(returnsDesc);
|
|
506
543
|
container.appendChild(returnsContainer);
|
|
507
544
|
}
|
|
545
|
+
// Add documentation button if showDocumentation is enabled
|
|
546
|
+
if (this.showDocumentation) {
|
|
547
|
+
const docContainer = document.createElement('div');
|
|
548
|
+
docContainer.className = 'documentation';
|
|
549
|
+
const docButton = document.createElement('ui-button');
|
|
550
|
+
docButton.type = 'button';
|
|
551
|
+
docButton.className = 'documentation-button';
|
|
552
|
+
docButton.textContent = 'Show documentation';
|
|
553
|
+
docButton.setAttribute('aria-label', `Show documentation for ${fn.name} function`);
|
|
554
|
+
docButton.addEventListener('click', (event) => {
|
|
555
|
+
event.preventDefault();
|
|
556
|
+
event.stopPropagation();
|
|
557
|
+
this.dispatchFunctionDocumentation(fn);
|
|
558
|
+
});
|
|
559
|
+
docContainer.appendChild(docButton);
|
|
560
|
+
container.appendChild(docContainer);
|
|
561
|
+
}
|
|
508
562
|
return container;
|
|
509
563
|
}
|
|
510
564
|
/**
|
|
@@ -582,6 +636,16 @@ let CodeEditor = (() => {
|
|
|
582
636
|
});
|
|
583
637
|
this.dispatchEvent(event);
|
|
584
638
|
}
|
|
639
|
+
/**
|
|
640
|
+
* Dispatch function documentation event
|
|
641
|
+
*/
|
|
642
|
+
dispatchFunctionDocumentation(functionSchema) {
|
|
643
|
+
const event = new CustomEvent('function-documentation', {
|
|
644
|
+
detail: { functionSchema },
|
|
645
|
+
bubbles: true,
|
|
646
|
+
});
|
|
647
|
+
this.dispatchEvent(event);
|
|
648
|
+
}
|
|
585
649
|
/**
|
|
586
650
|
* Focus the editor
|
|
587
651
|
*/
|
|
@@ -638,6 +702,7 @@ let CodeEditor = (() => {
|
|
|
638
702
|
*
|
|
639
703
|
* @fires function-insert - When a function is inserted
|
|
640
704
|
* @fires suggestion-insert - When a suggestion is inserted
|
|
705
|
+
* @fires function-documentation - When documentation is requested for a function
|
|
641
706
|
* @fires input - When the editor content changes
|
|
642
707
|
* @fires change - When the editor loses focus and content has changed
|
|
643
708
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeEditor.js","sourceRoot":"","sources":["../../../../../src/elements/code-editor/internals/CodeEditor.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAkC,OAAO,EAAE,MAAM,KAAK,CAAA;AAC/E,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,WAAW,EAAE,WAAW,EAAa,MAAM,mBAAmB,CAAA;AACvE,OAAO,EACL,cAAc,GAKf,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AACxD,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAA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lit/decorators.js'\nimport { classMap } from 'lit/directives/class-map.js'\nimport { linter } from '@codemirror/lint'\nimport { Compartment, EditorState, Extension } from '@codemirror/state'\nimport {\n autocompletion,\n CompletionContext,\n type CompletionResult,\n type CompletionSource,\n type Completion,\n} from '@codemirror/autocomplete'\nimport { javascript } from '@codemirror/lang-javascript'\nimport { syntaxHighlighting, defaultHighlightStyle } from '@codemirror/language'\nimport { oneDark } from '@codemirror/theme-one-dark'\nimport { keymap } from '@codemirror/view'\nimport { defaultKeymap } from '@codemirror/commands'\nimport {\n EditorView,\n Decoration,\n DecorationSet,\n ViewPlugin,\n ViewUpdate,\n hoverTooltip,\n type Tooltip,\n} from '@codemirror/view'\nimport type { FunctionSchema } from '@pawel-up/jexl/schemas/types.js'\nimport { getTypeStringFromSchema } from '@pawel-up/jexl/schemas/utils.js'\nimport { functionLinter } from './Linter.js'\nimport type { FunctionInsertEvent, Suggestion, SuggestionInsertEvent } from './types.js'\nimport { SuggestionMatchDecorator } from './SuggestionMatchDecorator.js'\n\n/**\n * A CodeMirror 6 based editor component that supports function autocomplete and suggestion placeholders.\n *\n * Features:\n * - Dynamic function schema loading\n * - Autocomplete for functions and suggestions\n * - Suggestion placeholders with double curly braces ({{suggestion}})\n * - Keyboard navigation\n * - Accessibility support\n *\n * @fires function-insert - When a function is inserted\n * @fires suggestion-insert - When a suggestion is inserted\n * @fires input - When the editor content changes\n * @fires change - When the editor loses focus and content has changed\n */\nexport default class CodeEditor extends LitElement {\n /**\n * Shadow root configuration for the component.\n * Uses 'open' mode for accessibility and delegates focus to enable proper focus management.\n */\n static override shadowRootOptions: ShadowRootInit = {\n mode: 'open',\n delegatesFocus: true,\n }\n\n /**\n * The label text displayed as placeholder/floating label\n */\n @property({ type: String })\n accessor label = ''\n\n /**\n * Supporting text displayed below the editor\n */\n @property({ type: String, attribute: 'supporting-text' })\n accessor supportingText = ''\n\n /**\n * Whether the component is disabled\n */\n @property({ type: Boolean, reflect: true })\n accessor disabled = false\n\n /**\n * Whether the component is in an invalid state\n */\n @property({ type: Boolean, reflect: true })\n accessor invalid = false\n\n /**\n * The name attribute for form integration\n */\n @property({ type: String })\n accessor name = ''\n\n /**\n * Whether the input is required\n */\n @property({ type: Boolean })\n accessor required = false\n\n /**\n * Placeholder text shown when editor is empty\n */\n @property({ type: String })\n accessor placeholder = ''\n\n /**\n * This property is used internally to set value without triggering updates.\n */\n #value = ''\n\n /**\n * The editor content value\n */\n get value(): string {\n return this.#value\n }\n\n @property({ type: String })\n set value(newValue: string) {\n const oldValue = this.#value\n if (newValue !== oldValue) {\n this.#value = newValue\n this._previousValue = newValue\n this.requestUpdate('value', oldValue)\n }\n }\n\n /**\n * Available function schemas for autocomplete\n */\n @property({ type: Array, attribute: false })\n accessor functionSchemas: FunctionSchema[] = []\n\n /**\n * Available suggestions for autocomplete\n */\n @property({ type: Array, attribute: false })\n accessor suggestions: Suggestion[] = []\n\n /**\n * Whether to use dark theme\n */\n @property({ type: Boolean, attribute: 'dark-theme' })\n accessor darkTheme = false\n\n /**\n * Programming language for syntax highlighting\n */\n @property({ type: String })\n accessor language = 'javascript'\n\n @query('.editor-container')\n private accessor editorContainer!: HTMLDivElement\n\n @state()\n private accessor hasContent = false\n\n @state()\n private accessor isEditorFocus = false\n\n private editorView?: EditorView\n /**\n * A control value to track previous value of the editor.\n * This is used to detect when change event should be dispatched.\n */\n private _previousValue = ''\n /**\n * Matcher for suggestion placeholders in the editor.\n */\n placeholderMatcher?: SuggestionMatchDecorator\n\n /**\n * Get all suggestions (placeholders) currently in the editor\n */\n get activeSuggestions(): Suggestion[] {\n const suggestions: Suggestion[] = []\n const placeholderPattern = /\\{\\{([^}]+)\\}\\}/g\n let match: RegExpExecArray | null\n while ((match = placeholderPattern.exec(this.value)) !== null) {\n const placeholderText = match[1]\n // Find suggestion by id\n const suggestion = this.suggestions.find((s) => s.id === placeholderText)\n if (suggestion) {\n suggestions.push(suggestion)\n }\n }\n return suggestions\n }\n\n private readonlyState = new Compartment()\n\n override disconnectedCallback(): void {\n super.disconnectedCallback()\n this.editorView?.destroy()\n }\n\n override firstUpdated(): void {\n this.initializeCodeMirror()\n this.updateEditorContent()\n }\n\n override willUpdate(changedProperties: PropertyValues): void {\n super.willUpdate(changedProperties)\n\n if (changedProperties.has('suggestions')) {\n if (this.placeholderMatcher) {\n this.placeholderMatcher.suggestions = this.suggestions || []\n }\n }\n\n if (changedProperties.has('value') && this.editorView) {\n this.updateEditorContent()\n }\n\n if (changedProperties.has('disabled')) {\n this.editorView?.dispatch({\n effects: this.readonlyState.reconfigure(EditorState.readOnly.of(this.disabled)),\n })\n }\n }\n\n /**\n * Initialize CodeMirror editor with extensions\n */\n private initializeCodeMirror(): void {\n const extensions: Extension[] = [\n keymap.of(defaultKeymap),\n syntaxHighlighting(defaultHighlightStyle),\n autocompletion({\n override: [this.createCompletionSource()],\n activateOnTyping: true,\n maxRenderedOptions: 10,\n }),\n EditorView.updateListener.of((update: ViewUpdate) => {\n if (update.docChanged) {\n this.handleEditorChange()\n }\n if (update.focusChanged) {\n this.handleFocusChange(update.view.hasFocus)\n }\n }),\n this.createPlaceholderPlugin(),\n hoverTooltip(this.createHoverTooltipSource),\n linter((view) => functionLinter(view, this.functionSchemas, (e) => this.dispatchEvent(e))),\n this.readonlyState.of(EditorState.readOnly.of(this.disabled)),\n ]\n\n // Add language support\n if (this.language === 'javascript') {\n extensions.push(javascript())\n }\n\n // Add theme\n if (this.darkTheme) {\n extensions.push(oneDark)\n }\n\n // Add placeholder\n if (this.placeholder) {\n extensions.push(\n EditorView.contentAttributes.of({\n 'aria-placeholder': this.placeholder,\n })\n )\n }\n\n const state = EditorState.create({\n doc: this.value,\n extensions,\n })\n\n this.editorView = new EditorView({\n state,\n parent: this.editorContainer,\n })\n }\n\n /**\n * Creates the ViewPlugin for rendering suggestion placeholders.\n * This is created as a method to get access to the component's `suggestions`.\n */\n private createPlaceholderPlugin(): Extension {\n const placeholderMatcher = new SuggestionMatchDecorator(/\\{\\{([^}]+)\\}\\}/g, this.suggestions)\n this.placeholderMatcher = placeholderMatcher\n // This class needs to be defined here to have access to the `placeholderMatcher`\n class AtomicDecorationRange {\n placeholders: DecorationSet\n constructor(view: EditorView) {\n this.placeholders = placeholderMatcher.createDeco(view)\n }\n update(update: ViewUpdate) {\n this.placeholders = placeholderMatcher.updateDeco(update, this.placeholders)\n }\n }\n\n return ViewPlugin.fromClass(AtomicDecorationRange, {\n decorations: (instance) => instance.placeholders,\n provide: (plugin) => EditorView.atomicRanges.of((view) => view.plugin(plugin)?.placeholders || Decoration.none),\n })\n }\n\n /**\n * Create completion source for functions and suggestions\n */\n private createCompletionSource(): CompletionSource {\n return (context: CompletionContext): CompletionResult | null => {\n const { pos } = context\n const line = context.state.doc.lineAt(pos)\n const textBefore = line.text.slice(0, pos - line.from)\n\n // Check if we're typing a function name\n const functionMatch = textBefore.match(/(\\w+)$/)\n if (functionMatch) {\n const prefix = functionMatch[1]\n const functions = this.functionSchemas\n .filter((fn) => fn.name.toLowerCase().startsWith(prefix.toLowerCase()))\n .map((fn) => this.createFunctionCompletion(fn))\n\n if (functions.length > 0) {\n return {\n from: pos - prefix.length,\n options: functions,\n }\n }\n }\n\n // Check if we're typing a suggestion trigger (e.g., {{)\n const suggestionMatch = textBefore.match(/\\{\\{([^}]*)$/)\n if (suggestionMatch) {\n const prefix = suggestionMatch[1]\n const suggestions = this.suggestions\n .filter((suggestion) => suggestion.label.toLowerCase().startsWith(prefix.toLowerCase()))\n .map((suggestion) => this.createSuggestionCompletion(suggestion))\n\n if (suggestions.length > 0) {\n return {\n from: pos - prefix.length,\n options: suggestions,\n }\n }\n }\n\n return null\n }\n }\n\n private createFunctionCompletion(schema: FunctionSchema): Completion {\n const result: Completion = {\n label: schema.name,\n detail: schema.description || '',\n type: 'function',\n info: () => this.createFunctionInfoElement(schema),\n apply: (view: EditorView, completion: unknown, from: number, to: number) => {\n const functionCall = this.formatFunctionCall(schema)\n view.dispatch({\n changes: { from, to, insert: functionCall },\n selection: { anchor: from + functionCall.length },\n })\n this.dispatchFunctionInsert(schema, from)\n },\n }\n\n return result\n }\n\n private createSuggestionCompletion(suggestion: Suggestion): Completion {\n const result: Completion = {\n label: suggestion.label,\n detail: suggestion.description || '',\n info: suggestion.suffix || '',\n type: 'variable',\n apply: (view: EditorView, completion: unknown, from: number, to: number) => {\n const placeholderText = `{{${suggestion.id}}}`\n view.dispatch({\n changes: { from: from - 2, to, insert: placeholderText }, // -2 to include the {{\n selection: { anchor: from - 2 + placeholderText.length },\n })\n this.dispatchSuggestionInsert(suggestion, from - 2)\n },\n }\n\n return result\n }\n\n /**\n * Creates the source for the hover tooltips.\n * This is an arrow function to automatically bind `this`.\n */\n private createHoverTooltipSource = (view: EditorView, pos: number): Tooltip | null => {\n const word = view.state.wordAt(pos)\n if (!word) {\n return null\n }\n\n const functionName = view.state.doc.sliceString(word.from, word.to)\n const fnSchema = this.functionSchemas.find((schema) => schema.name === functionName)\n\n if (!fnSchema) {\n return null\n }\n\n return {\n pos: word.from,\n end: word.to,\n above: true,\n create: () => ({ dom: this.createFunctionInfoElement(fnSchema) }),\n }\n }\n\n /**\n * Creates a styled HTML element to display function documentation.\n * This is used for both hover tooltips and autocomplete info panels.\n */\n private createFunctionInfoElement(fn: FunctionSchema): HTMLElement {\n const container = document.createElement('div')\n container.className = 'function-info' // for styling\n\n if (fn.description) {\n const description = document.createElement('p')\n description.className = 'description'\n description.textContent = fn.description\n container.appendChild(description)\n }\n\n if (fn.parameters && fn.parameters.length > 0) {\n const paramsContainer = document.createElement('div')\n paramsContainer.className = 'parameters'\n\n const paramsHeader = document.createElement('h4')\n paramsHeader.textContent = 'Parameters'\n paramsContainer.appendChild(paramsHeader)\n\n const paramsList = document.createElement('ul')\n fn.parameters.forEach((param) => {\n const listItem = document.createElement('li')\n\n const name = document.createElement('span')\n name.className = 'param-name'\n name.textContent = param.name\n\n const type = document.createElement('span')\n type.className = 'param-type'\n type.textContent = `: ${getTypeStringFromSchema(param.schema)}`\n\n listItem.appendChild(name)\n listItem.appendChild(type)\n\n if (param.schema.description) {\n const paramDesc = document.createElement('p')\n paramDesc.className = 'param-description'\n paramDesc.textContent = param.schema.description\n listItem.appendChild(paramDesc)\n }\n paramsList.appendChild(listItem)\n })\n paramsContainer.appendChild(paramsList)\n container.appendChild(paramsContainer)\n }\n\n if (fn.returns) {\n const returnsContainer = document.createElement('div')\n returnsContainer.className = 'returns'\n\n const returnsHeader = document.createElement('h4')\n returnsHeader.textContent = 'Returns'\n returnsContainer.appendChild(returnsHeader)\n\n const returnsDesc = document.createElement('p')\n const returnType = getTypeStringFromSchema(fn.returns)\n returnsDesc.textContent = fn.returns.description ? `${returnType}: ${fn.returns.description}` : returnType\n returnsContainer.appendChild(returnsDesc)\n container.appendChild(returnsContainer)\n }\n\n return container\n }\n\n /**\n * Format function call with parameters\n */\n private formatFunctionCall(fn: FunctionSchema): string {\n if (!fn.parameters || fn.parameters.length === 0) {\n return `${fn.name}()`\n }\n\n const params = fn.parameters\n .map((param) => {\n if (param.required) {\n return param.name\n }\n return `${param.name}?`\n })\n .join(', ')\n\n return `${fn.name}(${params})`\n }\n\n /**\n * Update editor content when value changes\n */\n private updateEditorContent(): void {\n if (!this.editorView) return\n\n const currentValue = this.editorView.state.doc.toString()\n if (currentValue !== this.value) {\n this.editorView.dispatch({\n changes: {\n from: 0,\n to: this.editorView.state.doc.length,\n insert: this.value,\n },\n })\n }\n }\n\n /**\n * Handle editor content change\n */\n private handleEditorChange(): void {\n if (!this.editorView) return\n\n const newValue = this.editorView.state.doc.toString()\n this.#value = newValue\n this.hasContent = newValue.length > 0\n\n this.dispatchEvent(new Event('input', { bubbles: true }))\n }\n\n /**\n * Handle focus change\n */\n private handleFocusChange(hasFocus: boolean): void {\n this.isEditorFocus = hasFocus\n\n if (!hasFocus && this.#value !== this._previousValue) {\n this._previousValue = this.#value\n this.dispatchEvent(new Event('change'))\n }\n }\n\n /**\n * Dispatch function insert event\n */\n private dispatchFunctionInsert(functionSchema: FunctionSchema, position: number): void {\n const event = new CustomEvent<FunctionInsertEvent>('function-insert', {\n detail: { functionSchema, position },\n bubbles: true,\n })\n this.dispatchEvent(event)\n }\n\n /**\n * Dispatch suggestion insert event\n */\n private dispatchSuggestionInsert(suggestion: Suggestion, position: number): void {\n const event = new CustomEvent<SuggestionInsertEvent>('suggestion-insert', {\n detail: { suggestion, position },\n bubbles: true,\n })\n this.dispatchEvent(event)\n }\n\n /**\n * Focus the editor\n */\n override focus(): void {\n this.editorView?.focus()\n }\n\n /**\n * Get the editor's current selection\n */\n getSelection(): { from: number; to: number } | null {\n if (!this.editorView) return null\n const { from, to } = this.editorView.state.selection.main\n return { from, to }\n }\n\n /**\n * Insert text at the current cursor position\n */\n insertText(text: string): void {\n if (!this.editorView) return\n\n const { from, to } = this.editorView.state.selection.main\n this.editorView.dispatch({\n changes: { from, to, insert: text },\n selection: { anchor: from + text.length },\n })\n }\n\n override render(): TemplateResult {\n const hasLabel = !!this.label\n const hasSupportingText = !!this.supportingText\n\n return html`\n <div class=\"surface ${classMap({ 'has-focus': this.isEditorFocus, 'invalid': this.invalid })}\">\n <div class=\"content\">\n ${hasLabel ? html`<div class=\"label\">${this.label}</div>` : nothing}\n\n <div class=\"editor-container\" part=\"editor\"></div>\n </div>\n\n ${hasSupportingText ? html`<div class=\"supporting-text\">${this.supportingText}</div>` : nothing}\n </div>\n `\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"CodeEditor.js","sourceRoot":"","sources":["../../../../../src/elements/code-editor/internals/CodeEditor.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAkC,OAAO,EAAE,MAAM,KAAK,CAAA;AAC/E,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,WAAW,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OAAO,IAAI,CAAA;4BACa,QAAQ,CAAC,EAAE,WAAW,EAAE,IAAI,CAAC,aAAa,EAAE,SAAS,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC;;YAEtF,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAA,sBAAsB,IAAI,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO;;;;;UAKnE,iBAAiB,CAAC,CAAC,CAAC,IAAI,CAAA,gCAAgC,IAAI,CAAC,cAAc,QAAQ,CAAC,CAAC,CAAC,OAAO;;KAElG,CAAA;QACH,CAAC;;;AA3mBH;;;;;;;;;;;;;;;GAeG;AACH","sourcesContent":["import { html, LitElement, PropertyValues, TemplateResult, nothing } from 'lit'\nimport { property, query, state } from 'lit/decorators.js'\nimport { classMap } from 'lit/directives/class-map.js'\nimport { linter } from '@codemirror/lint'\nimport { Compartment, EditorState, Extension } from '@codemirror/state'\nimport {\n autocompletion,\n CompletionContext,\n type CompletionResult,\n type CompletionSource,\n type Completion,\n} from '@codemirror/autocomplete'\nimport { javascript } from '@codemirror/lang-javascript'\nimport { syntaxHighlighting, defaultHighlightStyle } from '@codemirror/language'\nimport { oneDark } from '@codemirror/theme-one-dark'\nimport { keymap } from '@codemirror/view'\nimport { defaultKeymap } from '@codemirror/commands'\nimport {\n EditorView,\n Decoration,\n DecorationSet,\n ViewPlugin,\n ViewUpdate,\n hoverTooltip,\n type Tooltip,\n} from '@codemirror/view'\nimport type { FunctionSchema } from '@pawel-up/jexl/schemas/types.js'\nimport { getTypeStringFromSchema } from '@pawel-up/jexl/schemas/utils.js'\nimport { functionLinter } from './Linter.js'\nimport type { FunctionInsertEvent, Suggestion, SuggestionInsertEvent, FunctionDocumentationEvent } from './types.js'\nimport { SuggestionMatchDecorator } from './SuggestionMatchDecorator.js'\n\nimport '../../../md/button/ui-button.js'\n\n/**\n * A CodeMirror 6 based editor component that supports function autocomplete and suggestion placeholders.\n *\n * Features:\n * - Dynamic function schema loading\n * - Autocomplete for functions and suggestions\n * - Suggestion placeholders with double curly braces ({{suggestion}})\n * - Keyboard navigation\n * - Accessibility support\n *\n * @fires function-insert - When a function is inserted\n * @fires suggestion-insert - When a suggestion is inserted\n * @fires function-documentation - When documentation is requested for a function\n * @fires input - When the editor content changes\n * @fires change - When the editor loses focus and content has changed\n */\nexport default class CodeEditor extends LitElement {\n /**\n * Shadow root configuration for the component.\n * Uses 'open' mode for accessibility and delegates focus to enable proper focus management.\n */\n static override shadowRootOptions: ShadowRootInit = {\n mode: 'open',\n delegatesFocus: true,\n }\n\n /**\n * The label text displayed as placeholder/floating label\n * @attribute\n */\n @property({ type: String })\n accessor label = ''\n\n /**\n * Supporting text displayed below the editor\n * @attribute\n */\n @property({ type: String, attribute: 'supporting-text' })\n accessor supportingText = ''\n\n /**\n * Whether the component is disabled\n * @attribute\n */\n @property({ type: Boolean, reflect: true })\n accessor disabled = false\n\n /**\n * Whether the component is in an invalid state\n * @attribute\n */\n @property({ type: Boolean, reflect: true })\n accessor invalid = false\n\n /**\n * The name attribute for form integration\n * @attribute\n */\n @property({ type: String })\n accessor name = ''\n\n /**\n * Whether the input is required\n * @attribute\n */\n @property({ type: Boolean })\n accessor required = false\n\n /**\n * Placeholder text shown when editor is empty\n * @attribute\n */\n @property({ type: String })\n accessor placeholder = ''\n\n /**\n * This property is used internally to set value without triggering updates.\n */\n #value = ''\n\n /**\n * The editor content value\n */\n get value(): string {\n return this.#value\n }\n\n @property({ type: String })\n set value(newValue: string) {\n const oldValue = this.#value\n if (newValue !== oldValue) {\n this.#value = newValue\n this._previousValue = newValue\n this.requestUpdate('value', oldValue)\n }\n }\n\n /**\n * Available function schemas for autocomplete\n */\n @property({ type: Array, attribute: false })\n accessor functionSchemas: FunctionSchema[] = []\n\n /**\n * Available suggestions for autocomplete\n */\n @property({ type: Array, attribute: false })\n accessor suggestions: Suggestion[] = []\n\n /**\n * Whether to use dark theme\n */\n @property({ type: Boolean, attribute: 'dark-theme' })\n accessor darkTheme = false\n\n /**\n * Programming language for syntax highlighting\n * @attribute\n */\n @property({ type: String })\n accessor language = 'javascript'\n\n /**\n * Whether to show documentation links/buttons in function tooltips and autocomplete\n * @attribute show-documentation\n */\n @property({ type: Boolean, attribute: 'show-documentation' })\n accessor showDocumentation = false\n\n @query('.editor-container')\n private accessor editorContainer!: HTMLDivElement\n\n @state()\n private accessor hasContent = false\n\n @state()\n private accessor isEditorFocus = false\n\n private editorView?: EditorView\n /**\n * A control value to track previous value of the editor.\n * This is used to detect when change event should be dispatched.\n */\n private _previousValue = ''\n /**\n * Matcher for suggestion placeholders in the editor.\n */\n placeholderMatcher?: SuggestionMatchDecorator\n\n /**\n * Get all suggestions (placeholders) currently in the editor\n */\n get activeSuggestions(): Suggestion[] {\n const suggestions: Suggestion[] = []\n const placeholderPattern = /\\{\\{([^}]+)\\}\\}/g\n let match: RegExpExecArray | null\n while ((match = placeholderPattern.exec(this.value)) !== null) {\n const placeholderText = match[1]\n // Find suggestion by id\n const suggestion = this.suggestions.find((s) => s.id === placeholderText)\n if (suggestion) {\n suggestions.push(suggestion)\n }\n }\n return suggestions\n }\n\n private readonlyState = new Compartment()\n\n override disconnectedCallback(): void {\n super.disconnectedCallback()\n this.editorView?.destroy()\n }\n\n override firstUpdated(): void {\n this.initializeCodeMirror()\n this.updateEditorContent()\n }\n\n override willUpdate(changedProperties: PropertyValues): void {\n super.willUpdate(changedProperties)\n\n if (changedProperties.has('suggestions')) {\n if (this.placeholderMatcher) {\n this.placeholderMatcher.suggestions = this.suggestions || []\n }\n }\n\n if (changedProperties.has('value') && this.editorView) {\n this.updateEditorContent()\n }\n\n if (changedProperties.has('disabled')) {\n this.editorView?.dispatch({\n effects: this.readonlyState.reconfigure(EditorState.readOnly.of(this.disabled)),\n })\n }\n }\n\n /**\n * Initialize CodeMirror editor with extensions\n */\n private initializeCodeMirror(): void {\n const extensions: Extension[] = [\n keymap.of(defaultKeymap),\n syntaxHighlighting(defaultHighlightStyle),\n autocompletion({\n override: [this.createCompletionSource()],\n activateOnTyping: true,\n maxRenderedOptions: 10,\n }),\n EditorView.updateListener.of((update: ViewUpdate) => {\n if (update.docChanged) {\n this.handleEditorChange()\n }\n if (update.focusChanged) {\n this.handleFocusChange(update.view.hasFocus)\n } else if (update.view.hasFocus !== this.isEditorFocus) {\n // If focus state changed without focusChanged event, update manually\n this.handleFocusChange(update.view.hasFocus)\n }\n }),\n this.createPlaceholderPlugin(),\n hoverTooltip(this.createHoverTooltipSource),\n linter((view) => functionLinter(view, this.functionSchemas, (e) => this.dispatchEvent(e))),\n this.readonlyState.of(EditorState.readOnly.of(this.disabled)),\n ]\n\n // Add language support\n if (this.language === 'javascript') {\n extensions.push(javascript())\n }\n\n // Add theme\n if (this.darkTheme) {\n extensions.push(oneDark)\n }\n\n // Add placeholder\n if (this.placeholder) {\n extensions.push(\n EditorView.contentAttributes.of({\n 'aria-placeholder': this.placeholder,\n })\n )\n }\n\n const state = EditorState.create({\n doc: this.value,\n extensions,\n })\n\n this.editorView = new EditorView({\n state,\n parent: this.editorContainer,\n })\n }\n\n /**\n * Creates the ViewPlugin for rendering suggestion placeholders.\n * This is created as a method to get access to the component's `suggestions`.\n */\n private createPlaceholderPlugin(): Extension {\n const placeholderMatcher = new SuggestionMatchDecorator(/\\{\\{([^}]+)\\}\\}/g, this.suggestions)\n this.placeholderMatcher = placeholderMatcher\n // This class needs to be defined here to have access to the `placeholderMatcher`\n class AtomicDecorationRange {\n placeholders: DecorationSet\n constructor(view: EditorView) {\n this.placeholders = placeholderMatcher.createDeco(view)\n }\n update(update: ViewUpdate) {\n this.placeholders = placeholderMatcher.updateDeco(update, this.placeholders)\n }\n }\n\n return ViewPlugin.fromClass(AtomicDecorationRange, {\n decorations: (instance) => instance.placeholders,\n provide: (plugin) => EditorView.atomicRanges.of((view) => view.plugin(plugin)?.placeholders || Decoration.none),\n })\n }\n\n /**\n * Create completion source for functions and suggestions\n */\n private createCompletionSource(): CompletionSource {\n return (context: CompletionContext): CompletionResult | null => {\n const { pos } = context\n const line = context.state.doc.lineAt(pos)\n const textBefore = line.text.slice(0, pos - line.from)\n\n // Check if we're typing a function name\n const functionMatch = textBefore.match(/(\\w+)$/)\n if (functionMatch) {\n const prefix = functionMatch[1]\n const functions = this.functionSchemas\n .filter((fn) => fn.name.toLowerCase().startsWith(prefix.toLowerCase()))\n .map((fn) => this.createFunctionCompletion(fn))\n\n if (functions.length > 0) {\n return {\n from: pos - prefix.length,\n options: functions,\n }\n }\n }\n\n // Check if we're typing a suggestion trigger (e.g., {{)\n const suggestionMatch = textBefore.match(/\\{\\{([^}]*)$/)\n if (suggestionMatch) {\n const prefix = suggestionMatch[1]\n const suggestions = this.suggestions\n .filter((suggestion) => suggestion.label.toLowerCase().startsWith(prefix.toLowerCase()))\n .map((suggestion) => this.createSuggestionCompletion(suggestion))\n\n if (suggestions.length > 0) {\n return {\n from: pos - prefix.length,\n options: suggestions,\n }\n }\n }\n\n return null\n }\n }\n\n private createFunctionCompletion(schema: FunctionSchema): Completion {\n const result: Completion = {\n label: schema.name,\n detail: schema.description || '',\n type: 'function',\n info: () => this.createFunctionInfoElement(schema),\n apply: (view: EditorView, completion: unknown, from: number, to: number) => {\n const functionCall = this.formatFunctionCall(schema)\n view.dispatch({\n changes: { from, to, insert: functionCall },\n selection: { anchor: from + functionCall.length },\n })\n this.dispatchFunctionInsert(schema, from)\n },\n }\n\n return result\n }\n\n private createSuggestionCompletion(suggestion: Suggestion): Completion {\n const result: Completion = {\n label: suggestion.label,\n detail: suggestion.description || '',\n info: suggestion.suffix || '',\n type: 'variable',\n apply: (view: EditorView, completion: unknown, from: number, to: number) => {\n const placeholderText = `{{${suggestion.id}}}`\n view.dispatch({\n changes: { from: from - 2, to, insert: placeholderText }, // -2 to include the {{\n selection: { anchor: from - 2 + placeholderText.length },\n })\n this.dispatchSuggestionInsert(suggestion, from - 2)\n },\n }\n\n return result\n }\n\n /**\n * Creates the source for the hover tooltips.\n * This is an arrow function to automatically bind `this`.\n */\n private createHoverTooltipSource = (view: EditorView, pos: number): Tooltip | null => {\n const word = view.state.wordAt(pos)\n if (!word) {\n return null\n }\n\n const functionName = view.state.doc.sliceString(word.from, word.to)\n const fnSchema = this.functionSchemas.find((schema) => schema.name === functionName)\n\n if (!fnSchema) {\n return null\n }\n\n return {\n pos: word.from,\n end: word.to,\n above: true,\n create: () => ({ dom: this.createFunctionInfoElement(fnSchema) }),\n }\n }\n\n /**\n * Creates a styled HTML element to display function documentation.\n * This is used for both hover tooltips and autocomplete info panels.\n */\n protected createFunctionInfoElement(fn: FunctionSchema): HTMLElement {\n const container = document.createElement('div')\n container.className = 'function-info' // for styling\n\n if (fn.description) {\n const description = document.createElement('p')\n description.className = 'description'\n description.textContent = fn.description\n container.appendChild(description)\n }\n\n if (fn.parameters && fn.parameters.length > 0) {\n const paramsContainer = document.createElement('div')\n paramsContainer.className = 'parameters'\n\n const paramsHeader = document.createElement('h4')\n paramsHeader.textContent = 'Parameters'\n paramsContainer.appendChild(paramsHeader)\n\n const paramsList = document.createElement('ul')\n fn.parameters.forEach((param) => {\n const listItem = document.createElement('li')\n\n const name = document.createElement('span')\n name.className = 'param-name'\n name.textContent = param.name\n\n const type = document.createElement('span')\n type.className = 'param-type'\n type.textContent = `: ${getTypeStringFromSchema(param.schema)}`\n\n listItem.appendChild(name)\n listItem.appendChild(type)\n\n if (param.schema.description) {\n const paramDesc = document.createElement('p')\n paramDesc.className = 'param-description'\n paramDesc.textContent = param.schema.description\n listItem.appendChild(paramDesc)\n }\n paramsList.appendChild(listItem)\n })\n paramsContainer.appendChild(paramsList)\n container.appendChild(paramsContainer)\n }\n\n if (fn.returns) {\n const returnsContainer = document.createElement('div')\n returnsContainer.className = 'returns'\n\n const returnsHeader = document.createElement('h4')\n returnsHeader.textContent = 'Returns'\n returnsContainer.appendChild(returnsHeader)\n\n const returnsDesc = document.createElement('p')\n const returnType = getTypeStringFromSchema(fn.returns)\n returnsDesc.textContent = fn.returns.description ? `${returnType}: ${fn.returns.description}` : returnType\n returnsContainer.appendChild(returnsDesc)\n container.appendChild(returnsContainer)\n }\n\n // Add documentation button if showDocumentation is enabled\n if (this.showDocumentation) {\n const docContainer = document.createElement('div')\n docContainer.className = 'documentation'\n\n const docButton = document.createElement('ui-button')\n docButton.type = 'button'\n docButton.className = 'documentation-button'\n docButton.textContent = 'Show documentation'\n docButton.setAttribute('aria-label', `Show documentation for ${fn.name} function`)\n\n docButton.addEventListener('click', (event) => {\n event.preventDefault()\n event.stopPropagation()\n this.dispatchFunctionDocumentation(fn)\n })\n\n docContainer.appendChild(docButton)\n container.appendChild(docContainer)\n }\n\n return container\n }\n\n /**\n * Format function call with parameters\n */\n private formatFunctionCall(fn: FunctionSchema): string {\n if (!fn.parameters || fn.parameters.length === 0) {\n return `${fn.name}()`\n }\n\n const params = fn.parameters\n .map((param) => {\n if (param.required) {\n return param.name\n }\n return `${param.name}?`\n })\n .join(', ')\n\n return `${fn.name}(${params})`\n }\n\n /**\n * Update editor content when value changes\n */\n private updateEditorContent(): void {\n if (!this.editorView) return\n\n const currentValue = this.editorView.state.doc.toString()\n if (currentValue !== this.value) {\n this.editorView.dispatch({\n changes: {\n from: 0,\n to: this.editorView.state.doc.length,\n insert: this.value,\n },\n })\n }\n }\n\n /**\n * Handle editor content change\n */\n private handleEditorChange(): void {\n if (!this.editorView) return\n\n const newValue = this.editorView.state.doc.toString()\n this.#value = newValue\n this.hasContent = newValue.length > 0\n\n this.dispatchEvent(new Event('input', { bubbles: true }))\n }\n\n /**\n * Handle focus change\n */\n private handleFocusChange(hasFocus: boolean): void {\n this.isEditorFocus = hasFocus\n\n if (!hasFocus && this.#value !== this._previousValue) {\n this._previousValue = this.#value\n this.dispatchEvent(new Event('change'))\n }\n }\n\n /**\n * Dispatch function insert event\n */\n private dispatchFunctionInsert(functionSchema: FunctionSchema, position: number): void {\n const event = new CustomEvent<FunctionInsertEvent>('function-insert', {\n detail: { functionSchema, position },\n bubbles: true,\n })\n this.dispatchEvent(event)\n }\n\n /**\n * Dispatch suggestion insert event\n */\n private dispatchSuggestionInsert(suggestion: Suggestion, position: number): void {\n const event = new CustomEvent<SuggestionInsertEvent>('suggestion-insert', {\n detail: { suggestion, position },\n bubbles: true,\n })\n this.dispatchEvent(event)\n }\n\n /**\n * Dispatch function documentation event\n */\n private dispatchFunctionDocumentation(functionSchema: FunctionSchema): void {\n const event = new CustomEvent<FunctionDocumentationEvent>('function-documentation', {\n detail: { functionSchema },\n bubbles: true,\n })\n this.dispatchEvent(event)\n }\n\n /**\n * Focus the editor\n */\n override focus(): void {\n this.editorView?.focus()\n }\n\n /**\n * Get the editor's current selection\n */\n getSelection(): { from: number; to: number } | null {\n if (!this.editorView) return null\n const { from, to } = this.editorView.state.selection.main\n return { from, to }\n }\n\n /**\n * Insert text at the current cursor position\n */\n insertText(text: string): void {\n if (!this.editorView) return\n\n const { from, to } = this.editorView.state.selection.main\n this.editorView.dispatch({\n changes: { from, to, insert: text },\n selection: { anchor: from + text.length },\n })\n }\n\n override render(): TemplateResult {\n const hasLabel = !!this.label\n const hasSupportingText = !!this.supportingText\n\n return html`\n <div class=\"surface ${classMap({ 'has-focus': this.isEditorFocus, 'invalid': this.invalid })}\">\n <div class=\"content\">\n ${hasLabel ? html`<div class=\"label\">${this.label}</div>` : nothing}\n\n <div class=\"editor-container\" part=\"editor\"></div>\n </div>\n\n ${hasSupportingText ? html`<div class=\"supporting-text\">${this.supportingText}</div>` : nothing}\n </div>\n `\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeEditor.styles.d.ts","sourceRoot":"","sources":["../../../../../src/elements/code-editor/internals/CodeEditor.styles.ts"],"names":[],"mappings":";AAEA,
|
|
1
|
+
{"version":3,"file":"CodeEditor.styles.d.ts","sourceRoot":"","sources":["../../../../../src/elements/code-editor/internals/CodeEditor.styles.ts"],"names":[],"mappings":";AAEA,wBAoNC"}
|
|
@@ -116,8 +116,8 @@ export default css `
|
|
|
116
116
|
border: none;
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
.cm-focused .cm-
|
|
120
|
-
|
|
119
|
+
.cm-focused .cm-content[contenteditable='true'] {
|
|
120
|
+
caret-color: var(--md-sys-color-primary);
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
::selection {
|
|
@@ -185,6 +185,12 @@ export default css `
|
|
|
185
185
|
.param-description {
|
|
186
186
|
color: var(--md-sys-color-on-surface-variant);
|
|
187
187
|
}
|
|
188
|
+
|
|
189
|
+
.documentation {
|
|
190
|
+
margin-top: 8px;
|
|
191
|
+
padding-top: 8px;
|
|
192
|
+
border-top: 1px solid var(--md-sys-color-outline-variant);
|
|
193
|
+
}
|
|
188
194
|
}
|
|
189
195
|
|
|
190
196
|
/* Responsive */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeEditor.styles.js","sourceRoot":"","sources":["../../../../../src/elements/code-editor/internals/CodeEditor.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAEzB,eAAe,GAAG,CAAA
|
|
1
|
+
{"version":3,"file":"CodeEditor.styles.js","sourceRoot":"","sources":["../../../../../src/elements/code-editor/internals/CodeEditor.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAEzB,eAAe,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoNjB,CAAA","sourcesContent":["import { css } from 'lit'\n\nexport default css`\n :host {\n display: flex;\n flex-direction: column;\n outline: none;\n min-width: 200px;\n background-color: transparent;\n color: var(--md-sys-color-on-surface);\n\n font-family: var(--md-sys-typescale-body-large-font);\n font-size: var(--md-sys-typescale-body-large-size);\n letter-spacing: var(--md-sys-typescale-body-large-tracking);\n line-height: var(--md-sys-typescale-body-large-height);\n }\n\n .surface {\n display: flex;\n flex-direction: column;\n }\n\n .content {\n display: flex;\n flex-direction: column;\n flex: 1;\n }\n\n .label {\n font-family: var(--md-sys-typescale-label-medium-font);\n font-weight: var(--md-sys-typescale-label-medium-weight);\n font-size: var(--md-sys-typescale-label-medium-size);\n letter-spacing: var(--md-sys-typescale-label-medium-tracking);\n line-height: var(--md-sys-typescale-label-medium-height);\n color: var(--md-sys-color-on-surface-variant);\n\n padding: 8px 16px 4px 16px;\n margin: 0;\n }\n\n .has-focus .label {\n color: var(--md-sys-color-primary);\n }\n\n .editor-container {\n position: relative;\n flex: 1;\n\n border-radius: var(--md-sys-shape-corner-extra-small);\n border: 1px solid var(--md-sys-color-outline);\n outline: 0px solid var(--md-sys-color-primary);\n outline-offset: -1px;\n transition:\n border-color 150ms cubic-bezier(0.4, 0, 0.2, 1),\n outline-width 150ms cubic-bezier(0.4, 0, 0.2, 1),\n outline-offset 150ms cubic-bezier(0.4, 0, 0.2, 1);\n }\n\n .editor-container:focus-within {\n border-color: var(--md-sys-color-primary);\n outline-width: 2px;\n outline-offset: -2px;\n }\n\n .supporting-text {\n margin-top: 4px;\n padding: 0 16px;\n color: var(--md-sys-color-on-surface-variant);\n font-family: var(--md-sys-typescale-body-small-font);\n font-weight: var(--md-sys-typescale-body-small-weight);\n font-size: var(--md-sys-typescale-body-small-size);\n letter-spacing: var(--md-sys-typescale-body-small-tracking);\n line-height: var(--md-sys-typescale-body-small-height);\n }\n\n :host([disabled]) {\n pointer-events: none;\n }\n\n :host([disabled]) .editor-container {\n border-color: var(--md-sys-color-on-surface);\n }\n\n :host([disabled]) .label,\n :host([disabled]) .editor-container {\n color: var(--md-sys-color-on-surface);\n opacity: 0.38;\n }\n\n :host([invalid]) .label,\n :host([invalid]) .supporting-text {\n color: var(--md-sys-color-error);\n }\n\n :host([invalid]) .editor-container {\n border-color: var(--md-sys-color-error);\n outline-color: var(--md-sys-color-error);\n }\n\n .mention-chip {\n display: inline-flex;\n align-items: center;\n margin: 0 2px;\n vertical-align: baseline;\n user-select: none;\n }\n\n .mention-chip ui-chip {\n margin: 0;\n font-size: inherit;\n line-height: inherit;\n }\n\n .cm-gutters {\n background: var(--md-sys-color-surface-variant);\n color: var(--md-sys-color-on-surface-variant);\n border: none;\n }\n\n .cm-focused .cm-content[contenteditable='true'] {\n caret-color: var(--md-sys-color-primary);\n }\n\n ::selection {\n background: var(--md-sys-color-surface-variant);\n }\n\n .ͼ1.cm-focused {\n outline: none;\n }\n\n .cm-tooltip-hover {\n box-shadow: var(--md-sys-elevation-3);\n }\n\n .editor-container .cm-editor .cm-tooltip,\n .cm-tooltip-lint,\n .function-info {\n background-color: var(--md-sys-color-surface-container-highest);\n color: var(--md-sys-color-on-surface);\n }\n\n .function-info {\n padding: 8px;\n\n font-family: var(--md-sys-typescale-body-medium-font);\n font-weight: var(--md-sys-typescale-body-medium-weight);\n font-size: var(--md-sys-typescale-body-medium-size);\n letter-spacing: var(--md-sys-typescale-body-medium-tracking);\n line-height: var(--md-sys-typescale-body-medium-height);\n\n h4 {\n margin: 4px 0;\n font-family: var(--md-sys-typescale-title-medium-font);\n font-weight: var(--md-sys-typescale-title-medium-weight);\n font-size: var(--md-sys-typescale-title-medium-size);\n letter-spacing: var(--md-sys-typescale-title-medium-tracking);\n line-height: var(--md-sys-typescale-title-medium-height);\n }\n\n p {\n margin: 0;\n }\n\n .description {\n font-family: var(--md-sys-typescale-body-large-font);\n font-weight: var(--md-sys-typescale-body-large-weight);\n font-size: var(--md-sys-typescale-body-large-size);\n letter-spacing: var(--md-sys-typescale-body-large-tracking);\n line-height: var(--md-sys-typescale-body-large-height);\n }\n\n ul {\n margin: 0;\n }\n\n .param-name,\n .param-type {\n font-family: var(--md-sys-typescale-label-large-font);\n font-weight: var(--md-sys-typescale-label-large-weight);\n font-size: var(--md-sys-typescale-label-large-size);\n letter-spacing: var(--md-sys-typescale-label-large-tracking);\n line-height: var(--md-sys-typescale-label-large-height);\n }\n\n .param-description {\n color: var(--md-sys-color-on-surface-variant);\n }\n\n .documentation {\n margin-top: 8px;\n padding-top: 8px;\n border-top: 1px solid var(--md-sys-color-outline-variant);\n }\n }\n\n /* Responsive */\n @media (max-width: 600px) {\n :host {\n min-width: 0;\n }\n\n .label {\n padding: 6px 6px 3px 6px;\n }\n\n .editor-container {\n padding: 6px;\n }\n\n .supporting-text {\n padding: 3px 6px 6px 6px;\n }\n }\n`\n"]}
|
|
@@ -23,4 +23,8 @@ export interface SuggestionInsertEvent {
|
|
|
23
23
|
/** The position where the suggestion was inserted */
|
|
24
24
|
position: number;
|
|
25
25
|
}
|
|
26
|
+
export interface FunctionDocumentationEvent {
|
|
27
|
+
/** The function schema for which documentation is requested */
|
|
28
|
+
functionSchema: FunctionSchema;
|
|
29
|
+
}
|
|
26
30
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/elements/code-editor/internals/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAA;AAErE,MAAM,WAAW,UAAU;IACzB,2CAA2C;IAC3C,EAAE,EAAE,MAAM,CAAA;IACV,2BAA2B;IAC3B,KAAK,EAAE,MAAM,CAAA;IACb,kCAAkC;IAClC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,yCAAyC;IACzC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,qDAAqD;IACrD,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC/B;AAED,MAAM,WAAW,mBAAmB;IAClC,mCAAmC;IACnC,cAAc,EAAE,cAAc,CAAA;IAC9B,mDAAmD;IACnD,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,qBAAqB;IACpC,8BAA8B;IAC9B,UAAU,EAAE,UAAU,CAAA;IACtB,qDAAqD;IACrD,QAAQ,EAAE,MAAM,CAAA;CACjB"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/elements/code-editor/internals/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAA;AAErE,MAAM,WAAW,UAAU;IACzB,2CAA2C;IAC3C,EAAE,EAAE,MAAM,CAAA;IACV,2BAA2B;IAC3B,KAAK,EAAE,MAAM,CAAA;IACb,kCAAkC;IAClC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,yCAAyC;IACzC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,qDAAqD;IACrD,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC/B;AAED,MAAM,WAAW,mBAAmB;IAClC,mCAAmC;IACnC,cAAc,EAAE,cAAc,CAAA;IAC9B,mDAAmD;IACnD,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,qBAAqB;IACpC,8BAA8B;IAC9B,UAAU,EAAE,UAAU,CAAA;IACtB,qDAAqD;IACrD,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,0BAA0B;IACzC,+DAA+D;IAC/D,cAAc,EAAE,cAAc,CAAA;CAC/B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/elements/code-editor/internals/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { FunctionSchema } from '@pawel-up/jexl/schemas/types.js'\n\nexport interface Suggestion {\n /** Unique identifier for the suggestion */\n id: string\n /** Main label displayed */\n label: string\n /** Supporting description text */\n description?: string\n /** Suffix text (e.g., type, category) */\n suffix?: string\n /** Additional data associated with the suggestion */\n data?: Record<string, unknown>\n}\n\nexport interface FunctionInsertEvent {\n /** The inserted function schema */\n functionSchema: FunctionSchema\n /** The position where the function was inserted */\n position: number\n}\n\nexport interface SuggestionInsertEvent {\n /** The inserted suggestion */\n suggestion: Suggestion\n /** The position where the suggestion was inserted */\n position: number\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/elements/code-editor/internals/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { FunctionSchema } from '@pawel-up/jexl/schemas/types.js'\n\nexport interface Suggestion {\n /** Unique identifier for the suggestion */\n id: string\n /** Main label displayed */\n label: string\n /** Supporting description text */\n description?: string\n /** Suffix text (e.g., type, category) */\n suffix?: string\n /** Additional data associated with the suggestion */\n data?: Record<string, unknown>\n}\n\nexport interface FunctionInsertEvent {\n /** The inserted function schema */\n functionSchema: FunctionSchema\n /** The position where the function was inserted */\n position: number\n}\n\nexport interface SuggestionInsertEvent {\n /** The inserted suggestion */\n suggestion: Suggestion\n /** The position where the suggestion was inserted */\n position: number\n}\n\nexport interface FunctionDocumentationEvent {\n /** The function schema for which documentation is requested */\n functionSchema: FunctionSchema\n}\n"]}
|