@api-client/ui 0.5.13 → 0.5.15

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 (28) hide show
  1. package/build/src/elements/code-editor/code-editor.d.ts +2 -1
  2. package/build/src/elements/code-editor/code-editor.d.ts.map +1 -1
  3. package/build/src/elements/code-editor/code-editor.js.map +1 -1
  4. package/build/src/elements/code-editor/internals/CodeEditor.d.ts +10 -6
  5. package/build/src/elements/code-editor/internals/CodeEditor.d.ts.map +1 -1
  6. package/build/src/elements/code-editor/internals/CodeEditor.js +44 -44
  7. package/build/src/elements/code-editor/internals/CodeEditor.js.map +1 -1
  8. package/build/src/elements/code-editor/internals/CodeEditor.styles.d.ts.map +1 -1
  9. package/build/src/elements/code-editor/internals/CodeEditor.styles.js +55 -0
  10. package/build/src/elements/code-editor/internals/CodeEditor.styles.js.map +1 -1
  11. package/build/src/elements/code-editor/internals/Linter.d.ts +1 -1
  12. package/build/src/elements/code-editor/internals/Linter.d.ts.map +1 -1
  13. package/build/src/elements/code-editor/internals/Linter.js +3 -2
  14. package/build/src/elements/code-editor/internals/Linter.js.map +1 -1
  15. package/build/src/elements/code-editor/internals/types.d.ts +1 -26
  16. package/build/src/elements/code-editor/internals/types.d.ts.map +1 -1
  17. package/build/src/elements/code-editor/internals/types.js.map +1 -1
  18. package/build/src/index.d.ts +1 -1
  19. package/build/src/index.d.ts.map +1 -1
  20. package/build/src/index.js.map +1 -1
  21. package/demo/elements/code-editor/CodeEditorDemo.ts +24 -19
  22. package/package.json +2 -1
  23. package/src/elements/code-editor/code-editor.ts +2 -7
  24. package/src/elements/code-editor/internals/CodeEditor.styles.ts +55 -0
  25. package/src/elements/code-editor/internals/CodeEditor.ts +42 -31
  26. package/src/elements/code-editor/internals/Linter.ts +4 -3
  27. package/src/elements/code-editor/internals/types.ts +1 -27
  28. package/src/index.ts +1 -7
@@ -9,5 +9,6 @@ declare global {
9
9
  }
10
10
  }
11
11
  export default CodeEditorElement;
12
- export type { FunctionSchema, FunctionParameter, Suggestion, FunctionInsertEvent, SuggestionInsertEvent, } from './internals/types.js';
12
+ export type { Suggestion, FunctionInsertEvent, SuggestionInsertEvent } from './internals/types.js';
13
+ export type { FunctionSchema, FunctionParameter } from '@pawel-up/jexl/schemas/types.js';
13
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,EACV,cAAc,EACd,iBAAiB,EACjB,UAAU,EACV,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,sBAAsB,CAAA"}
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,EAAE,UAAU,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAA;AAClG,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 {\n FunctionSchema,\n FunctionParameter,\n Suggestion,\n FunctionInsertEvent,\n SuggestionInsertEvent,\n} from './internals/types.js'\n"]}
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 { Suggestion, FunctionInsertEvent, SuggestionInsertEvent } from './internals/types.js'\nexport type { FunctionSchema, FunctionParameter } from '@pawel-up/jexl/schemas/types.js'\n"]}
@@ -1,5 +1,6 @@
1
1
  import { LitElement, PropertyValues, TemplateResult } from 'lit';
2
- import type { FunctionSchema, Suggestion } from './types.js';
2
+ import type { FunctionSchema } from '@pawel-up/jexl/schemas/types.js';
3
+ import type { Suggestion } from './types.js';
3
4
  import { SuggestionMatchDecorator } from './SuggestionMatchDecorator.js';
4
5
  /**
5
6
  * A CodeMirror 6 based editor component that supports function autocomplete and suggestion placeholders.
@@ -17,6 +18,7 @@ import { SuggestionMatchDecorator } from './SuggestionMatchDecorator.js';
17
18
  * @fires change - When the editor loses focus and content has changed
18
19
  */
19
20
  export default class CodeEditor extends LitElement {
21
+ #private;
20
22
  /**
21
23
  * Shadow root configuration for the component.
22
24
  * Uses 'open' mode for accessibility and delegates focus to enable proper focus management.
@@ -53,7 +55,8 @@ export default class CodeEditor extends LitElement {
53
55
  /**
54
56
  * The editor content value
55
57
  */
56
- accessor value: string;
58
+ get value(): string;
59
+ set value(newValue: string);
57
60
  /**
58
61
  * Available function schemas for autocomplete
59
62
  */
@@ -74,6 +77,10 @@ export default class CodeEditor extends LitElement {
74
77
  private accessor hasContent;
75
78
  private accessor isEditorFocus;
76
79
  private editorView?;
80
+ /**
81
+ * A control value to track previous value of the editor.
82
+ * This is used to detect when change event should be dispatched.
83
+ */
77
84
  private _previousValue;
78
85
  /**
79
86
  * Matcher for suggestion placeholders in the editor.
@@ -83,6 +90,7 @@ export default class CodeEditor extends LitElement {
83
90
  * Get all suggestions (placeholders) currently in the editor
84
91
  */
85
92
  get activeSuggestions(): Suggestion[];
93
+ private readonlyState;
86
94
  disconnectedCallback(): void;
87
95
  firstUpdated(): void;
88
96
  willUpdate(changedProperties: PropertyValues): void;
@@ -119,10 +127,6 @@ export default class CodeEditor extends LitElement {
119
127
  * Update editor content when value changes
120
128
  */
121
129
  private updateEditorContent;
122
- /**
123
- * Update editor state (e.g., disabled state)
124
- */
125
- private updateEditorState;
126
130
  /**
127
131
  * Handle editor content change
128
132
  */
@@ -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;AA2B/E,OAAO,KAAK,EAAuB,cAAc,EAAE,UAAU,EAAyB,MAAM,YAAY,CAAA;AACxG,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAA;AAExE;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,UAAU;IAChD;;;OAGG;IACH,OAAgB,iBAAiB,EAAE,cAAc,CAGhD;IAED;;OAEG;IAEH,QAAQ,CAAC,KAAK,SAAK;IAEnB;;OAEG;IAEH,QAAQ,CAAC,cAAc,SAAK;IAE5B;;OAEG;IAEH,QAAQ,CAAC,QAAQ,UAAQ;IAEzB;;OAEG;IAEH,QAAQ,CAAC,OAAO,UAAQ;IAExB;;OAEG;IAEH,QAAQ,CAAC,IAAI,SAAK;IAElB;;OAEG;IAEH,QAAQ,CAAC,QAAQ,UAAQ;IAEzB;;OAEG;IAEH,QAAQ,CAAC,WAAW,SAAK;IAEzB;;OAEG;IAEH,QAAQ,CAAC,KAAK,SAAK;IAEnB;;OAEG;IAEH,QAAQ,CAAC,eAAe,EAAE,c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IAAI,cAAc;CAgBlC"}
@@ -3,7 +3,7 @@ import { html, LitElement, nothing } from 'lit';
3
3
  import { property, query, state } from 'lit/decorators.js';
4
4
  import { classMap } from 'lit/directives/class-map.js';
5
5
  import { linter } from '@codemirror/lint';
6
- import { EditorState } from '@codemirror/state';
6
+ import { Compartment, EditorState } from '@codemirror/state';
7
7
  import { autocompletion, } from '@codemirror/autocomplete';
8
8
  import { javascript } from '@codemirror/lang-javascript';
9
9
  import { syntaxHighlighting, defaultHighlightStyle } from '@codemirror/language';
@@ -11,10 +11,12 @@ import { oneDark } from '@codemirror/theme-one-dark';
11
11
  import { keymap } from '@codemirror/view';
12
12
  import { defaultKeymap } from '@codemirror/commands';
13
13
  import { EditorView, Decoration, ViewPlugin, hoverTooltip, } from '@codemirror/view';
14
+ import { getTypeStringFromSchema } from '@pawel-up/jexl/schemas/utils.js';
14
15
  import { functionLinter } from './Linter.js';
15
16
  import { SuggestionMatchDecorator } from './SuggestionMatchDecorator.js';
16
17
  let CodeEditor = (() => {
17
18
  let _classSuper = LitElement;
19
+ let _instanceExtraInitializers = [];
18
20
  let _label_decorators;
19
21
  let _label_initializers = [];
20
22
  let _label_extraInitializers = [];
@@ -36,9 +38,7 @@ let CodeEditor = (() => {
36
38
  let _placeholder_decorators;
37
39
  let _placeholder_initializers = [];
38
40
  let _placeholder_extraInitializers = [];
39
- let _value_decorators;
40
- let _value_initializers = [];
41
- let _value_extraInitializers = [];
41
+ let _set_value_decorators;
42
42
  let _functionSchemas_decorators;
43
43
  let _functionSchemas_initializers = [];
44
44
  let _functionSchemas_extraInitializers = [];
@@ -70,7 +70,7 @@ let CodeEditor = (() => {
70
70
  _name_decorators = [property({ type: String })];
71
71
  _required_decorators = [property({ type: Boolean })];
72
72
  _placeholder_decorators = [property({ type: String })];
73
- _value_decorators = [property({ type: String })];
73
+ _set_value_decorators = [property({ type: String })];
74
74
  _functionSchemas_decorators = [property({ type: Array, attribute: false })];
75
75
  _suggestions_decorators = [property({ type: Array, attribute: false })];
76
76
  _darkTheme_decorators = [property({ type: Boolean, attribute: 'dark-theme' })];
@@ -85,7 +85,7 @@ let CodeEditor = (() => {
85
85
  __esDecorate(this, null, _name_decorators, { kind: "accessor", name: "name", static: false, private: false, access: { has: obj => "name" in obj, get: obj => obj.name, set: (obj, value) => { obj.name = value; } }, metadata: _metadata }, _name_initializers, _name_extraInitializers);
86
86
  __esDecorate(this, null, _required_decorators, { kind: "accessor", name: "required", static: false, private: false, access: { has: obj => "required" in obj, get: obj => obj.required, set: (obj, value) => { obj.required = value; } }, metadata: _metadata }, _required_initializers, _required_extraInitializers);
87
87
  __esDecorate(this, null, _placeholder_decorators, { kind: "accessor", name: "placeholder", static: false, private: false, access: { has: obj => "placeholder" in obj, get: obj => obj.placeholder, set: (obj, value) => { obj.placeholder = value; } }, metadata: _metadata }, _placeholder_initializers, _placeholder_extraInitializers);
88
- __esDecorate(this, null, _value_decorators, { kind: "accessor", name: "value", static: false, private: false, access: { has: obj => "value" in obj, get: obj => obj.value, set: (obj, value) => { obj.value = value; } }, metadata: _metadata }, _value_initializers, _value_extraInitializers);
88
+ __esDecorate(this, null, _set_value_decorators, { kind: "setter", name: "value", static: false, private: false, access: { has: obj => "value" in obj, set: (obj, value) => { obj.value = value; } }, metadata: _metadata }, null, _instanceExtraInitializers);
89
89
  __esDecorate(this, null, _functionSchemas_decorators, { kind: "accessor", name: "functionSchemas", static: false, private: false, access: { has: obj => "functionSchemas" in obj, get: obj => obj.functionSchemas, set: (obj, value) => { obj.functionSchemas = value; } }, metadata: _metadata }, _functionSchemas_initializers, _functionSchemas_extraInitializers);
90
90
  __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
91
  __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);
@@ -103,11 +103,11 @@ let CodeEditor = (() => {
103
103
  mode: 'open',
104
104
  delegatesFocus: true,
105
105
  };
106
- #label_accessor_storage = __runInitializers(this, _label_initializers, ''
106
+ #label_accessor_storage = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _label_initializers, ''
107
107
  /**
108
108
  * Supporting text displayed below the editor
109
109
  */
110
- );
110
+ ));
111
111
  /**
112
112
  * The label text displayed as placeholder/floating label
113
113
  */
@@ -165,7 +165,7 @@ let CodeEditor = (() => {
165
165
  set required(value) { this.#required_accessor_storage = value; }
166
166
  #placeholder_accessor_storage = (__runInitializers(this, _required_extraInitializers), __runInitializers(this, _placeholder_initializers, ''
167
167
  /**
168
- * The editor content value
168
+ * This property is used internally to set value without triggering updates.
169
169
  */
170
170
  ));
171
171
  /**
@@ -173,21 +173,29 @@ let CodeEditor = (() => {
173
173
  */
174
174
  get placeholder() { return this.#placeholder_accessor_storage; }
175
175
  set placeholder(value) { this.#placeholder_accessor_storage = value; }
176
- #value_accessor_storage = (__runInitializers(this, _placeholder_extraInitializers), __runInitializers(this, _value_initializers, ''
177
176
  /**
178
- * Available function schemas for autocomplete
177
+ * This property is used internally to set value without triggering updates.
179
178
  */
180
- ));
179
+ #value = (__runInitializers(this, _placeholder_extraInitializers), '');
181
180
  /**
182
181
  * The editor content value
183
182
  */
184
- get value() { return this.#value_accessor_storage; }
185
- set value(value) { this.#value_accessor_storage = value; }
186
- #functionSchemas_accessor_storage = (__runInitializers(this, _value_extraInitializers), __runInitializers(this, _functionSchemas_initializers, []
183
+ get value() {
184
+ return this.#value;
185
+ }
186
+ set value(newValue) {
187
+ const oldValue = this.#value;
188
+ if (newValue !== oldValue) {
189
+ this.#value = newValue;
190
+ this._previousValue = newValue;
191
+ this.requestUpdate('value', oldValue);
192
+ }
193
+ }
194
+ #functionSchemas_accessor_storage = __runInitializers(this, _functionSchemas_initializers, []
187
195
  /**
188
196
  * Available suggestions for autocomplete
189
197
  */
190
- ));
198
+ );
191
199
  /**
192
200
  * Available function schemas for autocomplete
193
201
  */
@@ -229,6 +237,10 @@ let CodeEditor = (() => {
229
237
  get isEditorFocus() { return this.#isEditorFocus_accessor_storage; }
230
238
  set isEditorFocus(value) { this.#isEditorFocus_accessor_storage = value; }
231
239
  editorView = __runInitializers(this, _isEditorFocus_extraInitializers);
240
+ /**
241
+ * A control value to track previous value of the editor.
242
+ * This is used to detect when change event should be dispatched.
243
+ */
232
244
  _previousValue = '';
233
245
  /**
234
246
  * Matcher for suggestion placeholders in the editor.
@@ -251,6 +263,7 @@ let CodeEditor = (() => {
251
263
  }
252
264
  return suggestions;
253
265
  }
266
+ readonlyState = new Compartment();
254
267
  disconnectedCallback() {
255
268
  super.disconnectedCallback();
256
269
  this.editorView?.destroy();
@@ -270,7 +283,9 @@ let CodeEditor = (() => {
270
283
  this.updateEditorContent();
271
284
  }
272
285
  if (changedProperties.has('disabled')) {
273
- this.updateEditorState();
286
+ this.editorView?.dispatch({
287
+ effects: this.readonlyState.reconfigure(EditorState.readOnly.of(this.disabled)),
288
+ });
274
289
  }
275
290
  }
276
291
  /**
@@ -296,6 +311,7 @@ let CodeEditor = (() => {
296
311
  this.createPlaceholderPlugin(),
297
312
  hoverTooltip(this.createHoverTooltipSource),
298
313
  linter((view) => functionLinter(view, this.functionSchemas, (e) => this.dispatchEvent(e))),
314
+ this.readonlyState.of(EditorState.readOnly.of(this.disabled)),
299
315
  ];
300
316
  // Add language support
301
317
  if (this.language === 'javascript') {
@@ -461,13 +477,13 @@ let CodeEditor = (() => {
461
477
  name.textContent = param.name;
462
478
  const type = document.createElement('span');
463
479
  type.className = 'param-type';
464
- type.textContent = `: ${param.type}`;
480
+ type.textContent = `: ${getTypeStringFromSchema(param.schema)}`;
465
481
  listItem.appendChild(name);
466
482
  listItem.appendChild(type);
467
- if (param.description) {
483
+ if (param.schema.description) {
468
484
  const paramDesc = document.createElement('p');
469
485
  paramDesc.className = 'param-description';
470
- paramDesc.textContent = param.description;
486
+ paramDesc.textContent = param.schema.description;
471
487
  listItem.appendChild(paramDesc);
472
488
  }
473
489
  paramsList.appendChild(listItem);
@@ -482,7 +498,8 @@ let CodeEditor = (() => {
482
498
  returnsHeader.textContent = 'Returns';
483
499
  returnsContainer.appendChild(returnsHeader);
484
500
  const returnsDesc = document.createElement('p');
485
- returnsDesc.textContent = fn.returns;
501
+ const returnType = getTypeStringFromSchema(fn.returns);
502
+ returnsDesc.textContent = fn.returns.description ? `${returnType}: ${fn.returns.description}` : returnType;
486
503
  returnsContainer.appendChild(returnsDesc);
487
504
  container.appendChild(returnsContainer);
488
505
  }
@@ -522,21 +539,6 @@ let CodeEditor = (() => {
522
539
  });
523
540
  }
524
541
  }
525
- /**
526
- * Update editor state (e.g., disabled state)
527
- */
528
- updateEditorState() {
529
- if (!this.editorView)
530
- return;
531
- // For now, we'll handle disabled state differently
532
- // CodeMirror 6 doesn't use reconfigure for editable
533
- if (this.disabled) {
534
- this.editorView.contentDOM.setAttribute('contenteditable', 'false');
535
- }
536
- else {
537
- this.editorView.contentDOM.setAttribute('contenteditable', 'true');
538
- }
539
- }
540
542
  /**
541
543
  * Handle editor content change
542
544
  */
@@ -544,20 +546,18 @@ let CodeEditor = (() => {
544
546
  if (!this.editorView)
545
547
  return;
546
548
  const newValue = this.editorView.state.doc.toString();
547
- if (newValue !== this._previousValue) {
548
- this._previousValue = newValue;
549
- this.value = newValue;
550
- this.hasContent = newValue.length > 0;
551
- this.dispatchEvent(new Event('input', { bubbles: true }));
552
- }
549
+ this.#value = newValue;
550
+ this.hasContent = newValue.length > 0;
551
+ this.dispatchEvent(new Event('input', { bubbles: true }));
553
552
  }
554
553
  /**
555
554
  * Handle focus change
556
555
  */
557
556
  handleFocusChange(hasFocus) {
558
557
  this.isEditorFocus = hasFocus;
559
- if (!hasFocus && this.value !== this._previousValue) {
560
- this.dispatchEvent(new Event('change', { bubbles: true }));
558
+ if (!hasFocus && this.#value !== this._previousValue) {
559
+ this._previousValue = this.#value;
560
+ this.dispatchEvent(new Event('change'));
561
561
  }
562
562
  }
563
563
  /**
@@ -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,EAAa,MAAM,mBAAmB,CAAA;AAC1D,OAAO,EACL,cAAc,GAKf,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AACxD,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAA;AAChF,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,EACL,UAAU,EACV,UAAU,EAEV,UAAU,EAEV,YAAY,GAEb,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAE5C,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAA;;sBAiBhC,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAA7B,UAAW,SAAQ,WAAU;;;iCAa/C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0CAM1B,QAAQ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C,CAAC,OAAO;;;;;UAKnE,iBAAiB,CAAC,CAAC,CAAC,IAAI,CAAA,gCAAgC,IAAI,CAAC,cAAc,QAAQ,CAAC,CAAC,CAAC,OAAO;;KAElG,CAAA;QACH,CAAC;;;AA7iBH;;;;;;;;;;;;;;GAcG;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 { 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 { functionLinter } from './Linter.js'\nimport type { FunctionInsertEvent, FunctionSchema, 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 * The editor content value\n */\n @property({ type: String })\n accessor value = ''\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 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 = /\\{\\{(\\w+)\\}\\}/g\n let match: RegExpExecArray | null\n while ((match = placeholderPattern.exec(this.value)) !== null) {\n const placeholderText = match[1]\n // Find suggestion by label\n const suggestion = this.suggestions.find((s) => s.label.toLowerCase() === placeholderText.toLowerCase())\n if (suggestion) {\n suggestions.push(suggestion)\n }\n }\n return suggestions\n }\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.updateEditorState()\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 ]\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(/\\{\\{(\\w+)\\}\\}/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(/\\{\\{(\\w*)$/)\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 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 apply: (view: EditorView, completion: unknown, from: number, to: number) => {\n const placeholderText = `{{${suggestion.label}}}`\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 = `: ${param.type}`\n\n listItem.appendChild(name)\n listItem.appendChild(type)\n\n if (param.description) {\n const paramDesc = document.createElement('p')\n paramDesc.className = 'param-description'\n paramDesc.textContent = param.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 returnsDesc.textContent = fn.returns\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 * Update editor state (e.g., disabled state)\n */\n private updateEditorState(): void {\n if (!this.editorView) return\n\n // For now, we'll handle disabled state differently\n // CodeMirror 6 doesn't use reconfigure for editable\n if (this.disabled) {\n this.editorView.contentDOM.setAttribute('contenteditable', 'false')\n } else {\n this.editorView.contentDOM.setAttribute('contenteditable', 'true')\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 if (newValue !== this._previousValue) {\n this._previousValue = newValue\n this.value = newValue\n this.hasContent = newValue.length > 0\n\n this.dispatchEvent(new Event('input', { bubbles: true }))\n }\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.dispatchEvent(new Event('change', { bubbles: true }))\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,EAAE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AAC,cAAc,QAAQ,CAAC,CAAC,CAAC,OAAO;;KAElG,CAAA;QACH,CAAC;;;AAtjBH;;;;;;;;;;;;;;GAcG;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 } 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 = /\\{\\{(\\w+)\\}\\}/g\n let match: RegExpExecArray | null\n while ((match = placeholderPattern.exec(this.value)) !== null) {\n const placeholderText = match[1]\n // Find suggestion by label\n const suggestion = this.suggestions.find((s) => s.label.toLowerCase() === placeholderText.toLowerCase())\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(/\\{\\{(\\w+)\\}\\}/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(/\\{\\{(\\w*)$/)\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 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 apply: (view: EditorView, completion: unknown, from: number, to: number) => {\n const placeholderText = `{{${suggestion.label}}}`\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 +1 @@
1
- {"version":3,"file":"CodeEditor.styles.d.ts","sourceRoot":"","sources":["../../../../../src/elements/code-editor/internals/CodeEditor.styles.ts"],"names":[],"mappings":";AAEA,wBAuJC"}
1
+ {"version":3,"file":"CodeEditor.styles.d.ts","sourceRoot":"","sources":["../../../../../src/elements/code-editor/internals/CodeEditor.styles.ts"],"names":[],"mappings":";AAEA,wBA8MC"}
@@ -128,8 +128,63 @@ export default css `
128
128
  outline: none;
129
129
  }
130
130
 
131
+ .cm-tooltip-hover {
132
+ box-shadow: var(--md-sys-elevation-3);
133
+ }
134
+
135
+ .editor-container .cm-editor .cm-tooltip,
136
+ .cm-tooltip-lint,
137
+ .function-info {
138
+ background-color: var(--md-sys-color-surface-container-highest);
139
+ color: var(--md-sys-color-on-surface);
140
+ }
141
+
131
142
  .function-info {
132
143
  padding: 8px;
144
+
145
+ font-family: var(--md-sys-typescale-body-medium-font);
146
+ font-weight: var(--md-sys-typescale-body-medium-weight);
147
+ font-size: var(--md-sys-typescale-body-medium-size);
148
+ letter-spacing: var(--md-sys-typescale-body-medium-tracking);
149
+ line-height: var(--md-sys-typescale-body-medium-height);
150
+
151
+ h4 {
152
+ margin: 4px 0;
153
+ font-family: var(--md-sys-typescale-title-medium-font);
154
+ font-weight: var(--md-sys-typescale-title-medium-weight);
155
+ font-size: var(--md-sys-typescale-title-medium-size);
156
+ letter-spacing: var(--md-sys-typescale-title-medium-tracking);
157
+ line-height: var(--md-sys-typescale-title-medium-height);
158
+ }
159
+
160
+ p {
161
+ margin: 0;
162
+ }
163
+
164
+ .description {
165
+ font-family: var(--md-sys-typescale-body-large-font);
166
+ font-weight: var(--md-sys-typescale-body-large-weight);
167
+ font-size: var(--md-sys-typescale-body-large-size);
168
+ letter-spacing: var(--md-sys-typescale-body-large-tracking);
169
+ line-height: var(--md-sys-typescale-body-large-height);
170
+ }
171
+
172
+ ul {
173
+ margin: 0;
174
+ }
175
+
176
+ .param-name,
177
+ .param-type {
178
+ font-family: var(--md-sys-typescale-label-large-font);
179
+ font-weight: var(--md-sys-typescale-label-large-weight);
180
+ font-size: var(--md-sys-typescale-label-large-size);
181
+ letter-spacing: var(--md-sys-typescale-label-large-tracking);
182
+ line-height: var(--md-sys-typescale-label-large-height);
183
+ }
184
+
185
+ .param-description {
186
+ color: var(--md-sys-color-on-surface-variant);
187
+ }
133
188
  }
134
189
 
135
190
  /* 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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuJjB,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-cursor {\n border-left-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 .function-info {\n padding: 8px;\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"]}
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8MjB,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-cursor {\n border-left-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\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"]}
@@ -1,5 +1,5 @@
1
1
  import type { Diagnostic } from '@codemirror/lint';
2
2
  import type { EditorView } from '@codemirror/view';
3
- import type { FunctionSchema } from './types.js';
3
+ import type { FunctionSchema } from '@pawel-up/jexl/schemas/types.js';
4
4
  export declare function functionLinter(view: EditorView, functionSchemas: readonly FunctionSchema[], dispatchEvent: (e: CustomEvent) => void): readonly Diagnostic[];
5
5
  //# sourceMappingURL=Linter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Linter.d.ts","sourceRoot":"","sources":["../../../../../src/elements/code-editor/internals/Linter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAEhD,wBAAgB,cAAc,CAC5B,IAAI,EAAE,UAAU,EAChB,eAAe,EAAE,SAAS,cAAc,EAAE,EAC1C,aAAa,EAAE,CAAC,CAAC,EAAE,WAAW,KAAK,IAAI,GACtC,SAAS,UAAU,EAAE,CA4EvB"}
1
+ {"version":3,"file":"Linter.d.ts","sourceRoot":"","sources":["../../../../../src/elements/code-editor/internals/Linter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAA;AAErE,wBAAgB,cAAc,CAC5B,IAAI,EAAE,UAAU,EAChB,eAAe,EAAE,SAAS,cAAc,EAAE,EAC1C,aAAa,EAAE,CAAC,CAAC,EAAE,WAAW,KAAK,IAAI,GACtC,SAAS,UAAU,EAAE,CA6EvB"}
@@ -52,13 +52,14 @@ export function functionLinter(view, functionSchemas, dispatchEvent) {
52
52
  });
53
53
  }
54
54
  // Check if too many parameters
55
- if (fn.parameters && args.length > fn.parameters.length) {
55
+ const hasVariadicParam = fn.parameters.length > 0 && !!fn.parameters[fn.parameters.length - 1].variadic;
56
+ if (!hasVariadicParam && args.length > fn.parameters.length) {
56
57
  const functionEndPos = startPos + functionCallMatch[0].length;
57
58
  diagnostics.push({
58
59
  from: startPos,
59
60
  to: functionEndPos,
60
61
  severity: 'warning',
61
- message: `Function "${functionName}" expects at most ${fn.parameters.length} parameters but got ${args.length}`,
62
+ message: `Function "${functionName}" expects at most ${fn.parameters.length} parameters, but got ${args.length}.`,
62
63
  });
63
64
  }
64
65
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Linter.js","sourceRoot":"","sources":["../../../../../src/elements/code-editor/internals/Linter.ts"],"names":[],"mappings":"AAIA,MA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CAAC;gBAED,+BAA+B;gBAC/B,IAAI,EAAE,CAAC,UAAU,IAAI,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;oBACxD,MAAM,cAAc,GAAG,QAAQ,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAC,MAAM,CAAA;oBAC7D,WAAW,CAAC,IAAI,CAAC;wBACf,IAAI,EAAE,QAAQ;wBACd,EAAE,EAAE,cAAc;wBAClB,QAAQ,EAAE,SAAS;wBACnB,OAAO,EAAE,aAAa,YAAY,qBAAqB,EAAE,CAAC,UAAU,CAAC,MAAM,uBAAuB,IAAI,CAAC,MAAM,EAAE;qBAChH,CAAC,CAAA;gBACJ,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,WAAW,CAAA;AACpB,CAAC","sourcesContent":["import type { Diagnostic } from '@codemirror/lint'\nimport type { EditorView } from '@codemirror/view'\nimport type { FunctionSchema } from './types.js'\n\nexport function functionLinter(\n view: EditorView,\n functionSchemas: readonly FunctionSchema[],\n dispatchEvent: (e: CustomEvent) => void\n): readonly Diagnostic[] {\n const diagnostics: Diagnostic[] = []\n const doc = view.state.doc\n const text = doc.toString()\n\n const functions = functionSchemas\n if (!functions || functions.length === 0) {\n return diagnostics\n }\n\n // Regular expression to match function calls like functionName(args)\n const functionCallRegex = /(\\w+)\\s*\\(/g\n let match: RegExpExecArray | null\n\n while ((match = functionCallRegex.exec(text)) !== null) {\n const functionName = match[1]\n const startPos = match.index\n const endPos = startPos + functionName.length\n\n // Check if this function exists in our schemas\n const fn = functions.find((schema) => schema.name === functionName)\n\n if (!fn) {\n diagnostics.push({\n from: startPos,\n to: endPos,\n severity: 'error',\n message: `Unknown function \"${functionName}\". Make sure you have the correct syntax for the function call.`,\n actions: [\n {\n name: 'View available functions',\n apply: () => {\n dispatchEvent(\n new CustomEvent('show-available-functions', {\n detail: { availableFunctions: [...functions] },\n bubbles: true,\n })\n )\n },\n },\n ],\n })\n } else {\n // Extract the function call content to validate parameters\n const functionCallMatch = text.substring(startPos).match(/(\\w+)\\s*\\(([^)]*)\\)/)\n if (functionCallMatch && fn.parameters && fn.parameters.length > 0) {\n const argsString = functionCallMatch[2].trim()\n const args = argsString ? argsString.split(',').map((arg) => arg.trim()) : []\n\n // Check required parameters\n const requiredParams = fn.parameters.filter((p) => p.required)\n if (args.length < requiredParams.length) {\n const functionEndPos = startPos + functionCallMatch[0].length\n diagnostics.push({\n from: startPos,\n to: functionEndPos,\n severity: 'error',\n message: `Function \"${functionName}\" requires ${requiredParams.length} parameters but got ${args.length}. Required: ${requiredParams.map((p) => p.name).join(', ')}`,\n })\n }\n\n // Check if too many parameters\n if (fn.parameters && args.length > fn.parameters.length) {\n const functionEndPos = startPos + functionCallMatch[0].length\n diagnostics.push({\n from: startPos,\n to: functionEndPos,\n severity: 'warning',\n message: `Function \"${functionName}\" expects at most ${fn.parameters.length} parameters but got ${args.length}`,\n })\n }\n }\n }\n }\n\n return diagnostics\n}\n"]}
1
+ {"version":3,"file":"Linter.js","sourceRoot":"","sources":["../../../../../src/elements/code-editor/internals/Linter.ts"],"names":[],"mappings":"AAIA,MAAM,UAAU,cAAc,CAC5B,IAAgB,EAChB,eAA0C,EAC1C,aAAuC;IAEvC,MAAM,WAAW,GAAiB,EAAE,CAAA;IACpC,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAA;IAC1B,MAAM,IAAI,GAAG,GAAG,CAAC,QAAQ,EAAE,CAAA;IAE3B,MAAM,SAAS,GAAG,eAAe,CAAA;IACjC,IAAI,CAAC,SAAS,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzC,OAAO,WAAW,CAAA;IACpB,CAAC;IAED,qEAAqE;IACrE,MAAM,iBAAiB,GAAG,aAAa,CAAA;IACvC,IAAI,KAA6B,CAAA;IAEjC,OAAO,CAAC,KAAK,GAAG,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,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,aAAa,YAAY,qBAAqB,EAAE,CAAC,UAAU,CAAC,MAAM,wBAAwB,IAAI,CAAC,MAAM,GAAG;qBAClH,CAAC,CAAA;gBACJ,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,WAAW,CAAA;AACpB,CAAC","sourcesContent":["import type { Diagnostic } from '@codemirror/lint'\nimport type { EditorView } from '@codemirror/view'\nimport type { FunctionSchema } from '@pawel-up/jexl/schemas/types.js'\n\nexport function functionLinter(\n view: EditorView,\n functionSchemas: readonly FunctionSchema[],\n dispatchEvent: (e: CustomEvent) => void\n): readonly Diagnostic[] {\n const diagnostics: Diagnostic[] = []\n const doc = view.state.doc\n const text = doc.toString()\n\n const functions = functionSchemas\n if (!functions || functions.length === 0) {\n return diagnostics\n }\n\n // Regular expression to match function calls like functionName(args)\n const functionCallRegex = /(\\w+)\\s*\\(/g\n let match: RegExpExecArray | null\n\n while ((match = functionCallRegex.exec(text)) !== null) {\n const functionName = match[1]\n const startPos = match.index\n const endPos = startPos + functionName.length\n\n // Check if this function exists in our schemas\n const fn = functions.find((schema) => schema.name === functionName)\n\n if (!fn) {\n diagnostics.push({\n from: startPos,\n to: endPos,\n severity: 'error',\n message: `Unknown function \"${functionName}\". Make sure you have the correct syntax for the function call.`,\n actions: [\n {\n name: 'View available functions',\n apply: () => {\n dispatchEvent(\n new CustomEvent('show-available-functions', {\n detail: { availableFunctions: [...functions] },\n bubbles: true,\n })\n )\n },\n },\n ],\n })\n } else {\n // Extract the function call content to validate parameters\n const functionCallMatch = text.substring(startPos).match(/(\\w+)\\s*\\(([^)]*)\\)/)\n if (functionCallMatch && fn.parameters && fn.parameters.length > 0) {\n const argsString = functionCallMatch[2].trim()\n const args = argsString ? argsString.split(',').map((arg) => arg.trim()) : []\n\n // Check required parameters\n const requiredParams = fn.parameters.filter((p) => p.required)\n if (args.length < requiredParams.length) {\n const functionEndPos = startPos + functionCallMatch[0].length\n diagnostics.push({\n from: startPos,\n to: functionEndPos,\n severity: 'error',\n message: `Function \"${functionName}\" requires ${requiredParams.length} parameters but got ${args.length}. Required: ${requiredParams.map((p) => p.name).join(', ')}`,\n })\n }\n\n // Check if too many parameters\n const hasVariadicParam = fn.parameters.length > 0 && !!fn.parameters[fn.parameters.length - 1].variadic\n if (!hasVariadicParam && args.length > fn.parameters.length) {\n const functionEndPos = startPos + functionCallMatch[0].length\n diagnostics.push({\n from: startPos,\n to: functionEndPos,\n severity: 'warning',\n message: `Function \"${functionName}\" expects at most ${fn.parameters.length} parameters, but got ${args.length}.`,\n })\n }\n }\n }\n }\n\n return diagnostics\n}\n"]}
@@ -1,29 +1,4 @@
1
- export interface FunctionSchema {
2
- /** Unique identifier for the function */
3
- id: string;
4
- /** Function name */
5
- name: string;
6
- /** Function description */
7
- description?: string;
8
- /** Function parameters */
9
- parameters?: FunctionParameter[];
10
- /** Return type description */
11
- returns?: string;
12
- /** Additional metadata */
13
- metadata?: Record<string, unknown>;
14
- }
15
- export interface FunctionParameter {
16
- /** Parameter name */
17
- name: string;
18
- /** Parameter type */
19
- type: string;
20
- /** Parameter description */
21
- description?: string;
22
- /** Whether parameter is required */
23
- required?: boolean;
24
- /** Default value */
25
- defaultValue?: unknown;
26
- }
1
+ import type { FunctionSchema } from '@pawel-up/jexl/schemas/types.js';
27
2
  export interface Suggestion {
28
3
  /** Unique identifier for the suggestion */
29
4
  id: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/elements/code-editor/internals/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,yCAAyC;IACzC,EAAE,EAAE,MAAM,CAAA;IACV,oBAAoB;IACpB,IAAI,EAAE,MAAM,CAAA;IACZ,2BAA2B;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,0BAA0B;IAC1B,UAAU,CAAC,EAAE,iBAAiB,EAAE,CAAA;IAChC,8BAA8B;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,0BAA0B;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACnC;AAED,MAAM,WAAW,iBAAiB;IAChC,qBAAqB;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,qBAAqB;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,4BAA4B;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,oCAAoC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,oBAAoB;IACpB,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB;AAED,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"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/elements/code-editor/internals/types.ts"],"names":[],"mappings":"","sourcesContent":["export interface FunctionSchema {\n /** Unique identifier for the function */\n id: string\n /** Function name */\n name: string\n /** Function description */\n description?: string\n /** Function parameters */\n parameters?: FunctionParameter[]\n /** Return type description */\n returns?: string\n /** Additional metadata */\n metadata?: Record<string, unknown>\n}\n\nexport interface FunctionParameter {\n /** Parameter name */\n name: string\n /** Parameter type */\n type: string\n /** Parameter description */\n description?: string\n /** Whether parameter is required */\n required?: boolean\n /** Default value */\n defaultValue?: unknown\n}\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"]}
@@ -2,7 +2,7 @@ export { default as MarkedHighlightElement } from './elements/highlight/MarkedHi
2
2
  export { default as PrismHighlightElement } from './elements/highlight/PrismHighlight.js';
3
3
  export { default as HarViewerElement } from './elements/har/HarViewer.js';
4
4
  export { default as CodeEditorElement } from './elements/code-editor/code-editor.js';
5
- export type { FunctionSchema, FunctionParameter, Suggestion, FunctionInsertEvent, SuggestionInsertEvent, } from './elements/code-editor/code-editor.js';
5
+ export type { Suggestion, FunctionInsertEvent, SuggestionInsertEvent } from './elements/code-editor/code-editor.js';
6
6
  export { default as Menu } from './md/menu/internal/Menu.js';
7
7
  export { default as MenuItem } from './md/menu/internal/MenuItem.js';
8
8
  export { default as SubMenu } from './md/menu/internal/SubMenu.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,yCAAyC,CAAA;AAC3F,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,wCAAwC,CAAA;AACzF,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAGzE,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AACpF,YAAY,EACV,cAAc,EACd,iBAAiB,EACjB,UAAU,EACV,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,uCAAuC,CAAA;AAG9C,OAAO,EAAE,OAAO,IAAI,I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E7C,WAAW;AAEX,cAAc,0CAA0C,CAAA;AACxD,cAAc,6BAA6B,CAAA;AAC3C,cAAc,qCAAqC,CAAA;AAEnD,SAAS;AAET,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAQnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAA;AAEjE,SAAS;AACT,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAA;AAExC,OAAO;AAEP,OAAO,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAA;AAC3E,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,sCAAsC,CAAA;AAC7E,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,wCAAwC,CAAA;AAClF,OAAO,KAAK,eAAe,MAAM,yCAAyC,CAAA;AAC1E,OAAO,KAAK,UAAU,MAAM,wBAAwB,CAAA;AAEpD,SAAS;AACT,OAAO,KAAK,YAAY,MAAM,oBAAoB,CAAA;AAClD,OAAO,KAAK,WAAW,MAAM,mBAAmB,CAAA;AAEhD,SAAS;AACT,cAAc,wBAAwB,CAAA;AAEtC,QAAQ;AACR,OAAO,KAAK,UAAU,MAAM,uBAAuB,CAAA","sourcesContent":["// Elements\n\nexport { default as MarkedHighlightElement } from './elements/highlight/MarkedHighlight.js'\nexport { default as PrismHighlightElement } from './elements/highlight/PrismHighlight.js'\nexport { default as HarViewerElement } from './elements/har/HarViewer.js'\n\n// Code Editor\nexport { default as CodeEditorElement } from './elements/code-editor/code-editor.js'\nexport type {\n FunctionSchema,\n FunctionParameter,\n Suggestion,\n FunctionInsertEvent,\n SuggestionInsertEvent,\n} from './elements/code-editor/code-editor.js'\n\n// Menu Components\nexport { default as Menu } from './md/menu/internal/Menu.js'\nexport { default as MenuItem } from './md/menu/internal/MenuItem.js'\nexport { default as SubMenu } from './md/menu/internal/SubMenu.js'\n\n// Date Picker Components\nexport {\n UiDatePickerCalendar,\n UiDatePickerInput,\n UiDatePickerModal,\n UiDatePickerModalInput,\n} from './md/date-picker/index.js'\nexport type {\n DateRange,\n CalendarDay,\n CalendarMonth,\n DateSelectEvent,\n DateRangeSelectEvent,\n ModalDatePickerChangeEvent,\n ModalInputDatePickerChangeEvent,\n} from './md/date-picker/index.js'\n\n// Demo\nexport { DemoPage } from './demo/DemoPage.js'\n\n// Bindings\n\nexport * from './bindings/base/ConfigurationBindings.js'\nexport * from './bindings/base/IoThread.js'\nexport * from './bindings/base/PlatformBindings.js'\n\n// Events\n\nexport { Events } from './events/Events.js'\nexport { EventTypes } from './events/EventTypes.js'\nexport type {\n INavDetail,\n INavRunHttpProjectDetail,\n INavRunSchemaDesignerDetail,\n INavRunHttpClient,\n NavRunDetail,\n} from './events/NavigationEvents.js'\nexport { AppNavigationEvent } from './events/NavigationEvents.js'\n\n// Router\nexport * as Router from './lib/route.js'\n\n// libs\n\nexport { PrismHighlighter } from './elements/highlight/PrismHighlighter.js'\nexport { default as PrismStyles } from './elements/highlight/Prism.styles.js'\nexport { default as MarkdownStyles } from './elements/highlight/MarkdownStyles.js'\nexport * as PrismAutoDetect from './elements/highlight/PrismAutoDetect.js'\nexport * as RouteMixin from './mixins/RouteMixin.js'\n\n// Monaco\nexport * as MonacoLoader from './monaco/loader.js'\nexport * as MonacoTheme from './monaco/theme.js'\n\n// Config\nexport * from './lib/config/Config.js'\n\n// Other\nexport * as Decorators from './decorators/index.js'\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,WAAW;AAEX,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,yCAAyC,CAAA;AAC3F,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,wCAAwC,CAAA;AACzF,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAEzE,cAAc;AACd,OAAO,EAAE,OAAO,IAAI,iBA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default as MarkedHighlightElement } from './elements/highlight/MarkedHighlight.js'\nexport { default as PrismHighlightElement } from './elements/highlight/PrismHighlight.js'\nexport { default as HarViewerElement } from './elements/har/HarViewer.js'\n\n// Code Editor\nexport { default as CodeEditorElement } from './elements/code-editor/code-editor.js'\nexport type { Suggestion, FunctionInsertEvent, SuggestionInsertEvent } from './elements/code-editor/code-editor.js'\n\n// Menu Components\nexport { default as Menu } from './md/menu/internal/Menu.js'\nexport { default as MenuItem } from './md/menu/internal/MenuItem.js'\nexport { default as SubMenu } from './md/menu/internal/SubMenu.js'\n\n// Date Picker Components\nexport {\n UiDatePickerCalendar,\n UiDatePickerInput,\n UiDatePickerModal,\n UiDatePickerModalInput,\n} from './md/date-picker/index.js'\nexport type {\n DateRange,\n CalendarDay,\n CalendarMonth,\n DateSelectEvent,\n DateRangeSelectEvent,\n ModalDatePickerChangeEvent,\n ModalInputDatePickerChangeEvent,\n} from './md/date-picker/index.js'\n\n// Demo\nexport { DemoPage } from './demo/DemoPage.js'\n\n// Bindings\n\nexport * from './bindings/base/ConfigurationBindings.js'\nexport * from './bindings/base/IoThread.js'\nexport * from './bindings/base/PlatformBindings.js'\n\n// Events\n\nexport { Events } from './events/Events.js'\nexport { EventTypes } from './events/EventTypes.js'\nexport type {\n INavDetail,\n INavRunHttpProjectDetail,\n INavRunSchemaDesignerDetail,\n INavRunHttpClient,\n NavRunDetail,\n} from './events/NavigationEvents.js'\nexport { AppNavigationEvent } from './events/NavigationEvents.js'\n\n// Router\nexport * as Router from './lib/route.js'\n\n// libs\n\nexport { PrismHighlighter } from './elements/highlight/PrismHighlighter.js'\nexport { default as PrismStyles } from './elements/highlight/Prism.styles.js'\nexport { default as MarkdownStyles } from './elements/highlight/MarkdownStyles.js'\nexport * as PrismAutoDetect from './elements/highlight/PrismAutoDetect.js'\nexport * as RouteMixin from './mixins/RouteMixin.js'\n\n// Monaco\nexport * as MonacoLoader from './monaco/loader.js'\nexport * as MonacoTheme from './monaco/theme.js'\n\n// Config\nexport * from './lib/config/Config.js'\n\n// Other\nexport * as Decorators from './decorators/index.js'\n"]}
@@ -1,8 +1,8 @@
1
1
  import { html } from 'lit'
2
+ import type { FunctionSchema } from '@pawel-up/jexl/schemas/types.js'
2
3
  import reactive from '../../../src/decorators/reactive.js'
3
4
  import { DemoPage } from '../../../src/demo/DemoPage.js'
4
5
  import type {
5
- FunctionSchema,
6
6
  Suggestion,
7
7
  FunctionInsertEvent,
8
8
  SuggestionInsertEvent,
@@ -29,64 +29,61 @@ class CodeEditorDemo extends DemoPage {
29
29
 
30
30
  private functionSchemas: FunctionSchema[] = [
31
31
  {
32
- id: 'getData',
33
32
  name: 'getData',
34
33
  description: 'Fetches data from the server',
35
34
  parameters: [
36
35
  {
37
36
  name: 'url',
38
- type: 'string',
39
- description: 'The URL to fetch data from',
37
+ schema: { type: 'string', description: 'The URL to fetch data from' },
40
38
  required: true,
41
39
  },
42
40
  {
43
41
  name: 'options',
44
- type: 'RequestInit',
45
- description: 'Fetch options',
42
+ schema: { type: 'object', description: 'Fetch options' },
46
43
  required: false,
47
44
  },
48
45
  ],
49
- returns: 'Promise<Response>',
46
+ returns: {
47
+ type: 'object',
48
+ description: 'The fetched data as an object',
49
+ },
50
+ category: 'network',
50
51
  },
51
52
  {
52
- id: 'processData',
53
53
  name: 'processData',
54
54
  description: 'Processes raw data into a usable format',
55
55
  parameters: [
56
56
  {
57
57
  name: 'data',
58
- type: 'any',
59
- description: 'Raw data to process',
58
+ schema: { description: 'Raw data to process' },
60
59
  required: true,
61
60
  },
62
61
  {
63
62
  name: 'transformer',
64
- type: 'Function',
65
- description: 'Optional transformer function',
63
+ schema: { description: 'Optional transformer function' },
66
64
  required: false,
67
65
  },
68
66
  ],
69
- returns: 'any',
67
+ returns: {},
68
+ category: 'data',
70
69
  },
71
70
  {
72
- id: 'validateInput',
71
+ category: 'validation',
73
72
  name: 'validateInput',
74
73
  description: 'Validates user input against a schema',
75
74
  parameters: [
76
75
  {
77
76
  name: 'input',
78
- type: 'object',
79
- description: 'The input to validate',
77
+ schema: { type: 'object', description: 'The input to validate' },
80
78
  required: true,
81
79
  },
82
80
  {
83
81
  name: 'schema',
84
- type: 'Schema',
85
- description: 'Validation schema',
82
+ schema: { type: 'object', description: 'Validation schema' },
86
83
  required: true,
87
84
  },
88
85
  ],
89
- returns: 'ValidationResult',
86
+ returns: { type: 'object', description: 'Validation result' },
90
87
  },
91
88
  ]
92
89
 
@@ -127,6 +124,13 @@ class CodeEditorDemo extends DemoPage {
127
124
  private handleInput(event: Event): void {
128
125
  const target = event.target as HTMLElement & { value: string }
129
126
  this.editorValue = target.value
127
+ console.log('Editor input:', new Error().stack)
128
+ }
129
+
130
+ private handleChange(event: Event): void {
131
+ const target = event.target as HTMLElement & { value: string }
132
+ this.output = `Editor content changed: ${target.value}`
133
+ console.log('Editor change:', target.value)
130
134
  }
131
135
 
132
136
  contentTemplate() {
@@ -146,6 +150,7 @@ class CodeEditorDemo extends DemoPage {
146
150
  @function-insert=${this.handleFunctionInsert}
147
151
  @suggestion-insert=${this.handleSuggestionInsert}
148
152
  @input=${this.handleInput}
153
+ @change=${this.handleChange}
149
154
  ></code-editor>
150
155
 
151
156
  ${this.output ? html`<p><strong>Output:</strong> ${this.output}</p>` : ''}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@api-client/ui",
3
- "version": "0.5.13",
3
+ "version": "0.5.15",
4
4
  "description": "Internal UI component library for the API Client ecosystem.",
5
5
  "license": "UNLICENSED",
6
6
  "main": "build/src/index.js",
@@ -190,6 +190,7 @@
190
190
  "@codemirror/view": "^6.38.0",
191
191
  "@github/relative-time-element": "^4.4.6",
192
192
  "@material/web": "^2.3.0",
193
+ "@pawel-up/jexl": "^4.3.0",
193
194
  "@types/har-format": "^1.2.8",
194
195
  "dompurify": "^3.2.5",
195
196
  "idb-keyval": "^6.1.0",
@@ -15,10 +15,5 @@ declare global {
15
15
  }
16
16
 
17
17
  export default CodeEditorElement
18
- export type {
19
- FunctionSchema,
20
- FunctionParameter,
21
- Suggestion,
22
- FunctionInsertEvent,
23
- SuggestionInsertEvent,
24
- } from './internals/types.js'
18
+ export type { Suggestion, FunctionInsertEvent, SuggestionInsertEvent } from './internals/types.js'
19
+ export type { FunctionSchema, FunctionParameter } from '@pawel-up/jexl/schemas/types.js'
@@ -129,8 +129,63 @@ export default css`
129
129
  outline: none;
130
130
  }
131
131
 
132
+ .cm-tooltip-hover {
133
+ box-shadow: var(--md-sys-elevation-3);
134
+ }
135
+
136
+ .editor-container .cm-editor .cm-tooltip,
137
+ .cm-tooltip-lint,
138
+ .function-info {
139
+ background-color: var(--md-sys-color-surface-container-highest);
140
+ color: var(--md-sys-color-on-surface);
141
+ }
142
+
132
143
  .function-info {
133
144
  padding: 8px;
145
+
146
+ font-family: var(--md-sys-typescale-body-medium-font);
147
+ font-weight: var(--md-sys-typescale-body-medium-weight);
148
+ font-size: var(--md-sys-typescale-body-medium-size);
149
+ letter-spacing: var(--md-sys-typescale-body-medium-tracking);
150
+ line-height: var(--md-sys-typescale-body-medium-height);
151
+
152
+ h4 {
153
+ margin: 4px 0;
154
+ font-family: var(--md-sys-typescale-title-medium-font);
155
+ font-weight: var(--md-sys-typescale-title-medium-weight);
156
+ font-size: var(--md-sys-typescale-title-medium-size);
157
+ letter-spacing: var(--md-sys-typescale-title-medium-tracking);
158
+ line-height: var(--md-sys-typescale-title-medium-height);
159
+ }
160
+
161
+ p {
162
+ margin: 0;
163
+ }
164
+
165
+ .description {
166
+ font-family: var(--md-sys-typescale-body-large-font);
167
+ font-weight: var(--md-sys-typescale-body-large-weight);
168
+ font-size: var(--md-sys-typescale-body-large-size);
169
+ letter-spacing: var(--md-sys-typescale-body-large-tracking);
170
+ line-height: var(--md-sys-typescale-body-large-height);
171
+ }
172
+
173
+ ul {
174
+ margin: 0;
175
+ }
176
+
177
+ .param-name,
178
+ .param-type {
179
+ font-family: var(--md-sys-typescale-label-large-font);
180
+ font-weight: var(--md-sys-typescale-label-large-weight);
181
+ font-size: var(--md-sys-typescale-label-large-size);
182
+ letter-spacing: var(--md-sys-typescale-label-large-tracking);
183
+ line-height: var(--md-sys-typescale-label-large-height);
184
+ }
185
+
186
+ .param-description {
187
+ color: var(--md-sys-color-on-surface-variant);
188
+ }
134
189
  }
135
190
 
136
191
  /* Responsive */
@@ -2,7 +2,7 @@ import { html, LitElement, PropertyValues, TemplateResult, nothing } from 'lit'
2
2
  import { property, query, state } from 'lit/decorators.js'
3
3
  import { classMap } from 'lit/directives/class-map.js'
4
4
  import { linter } from '@codemirror/lint'
5
- import { EditorState, Extension } from '@codemirror/state'
5
+ import { Compartment, EditorState, Extension } from '@codemirror/state'
6
6
  import {
7
7
  autocompletion,
8
8
  CompletionContext,
@@ -24,8 +24,10 @@ import {
24
24
  hoverTooltip,
25
25
  type Tooltip,
26
26
  } from '@codemirror/view'
27
+ import type { FunctionSchema } from '@pawel-up/jexl/schemas/types.js'
28
+ import { getTypeStringFromSchema } from '@pawel-up/jexl/schemas/utils.js'
27
29
  import { functionLinter } from './Linter.js'
28
- import type { FunctionInsertEvent, FunctionSchema, Suggestion, SuggestionInsertEvent } from './types.js'
30
+ import type { FunctionInsertEvent, Suggestion, SuggestionInsertEvent } from './types.js'
29
31
  import { SuggestionMatchDecorator } from './SuggestionMatchDecorator.js'
30
32
 
31
33
  /**
@@ -95,11 +97,27 @@ export default class CodeEditor extends LitElement {
95
97
  @property({ type: String })
96
98
  accessor placeholder = ''
97
99
 
100
+ /**
101
+ * This property is used internally to set value without triggering updates.
102
+ */
103
+ #value = ''
104
+
98
105
  /**
99
106
  * The editor content value
100
107
  */
108
+ get value(): string {
109
+ return this.#value
110
+ }
111
+
101
112
  @property({ type: String })
102
- accessor value = ''
113
+ set value(newValue: string) {
114
+ const oldValue = this.#value
115
+ if (newValue !== oldValue) {
116
+ this.#value = newValue
117
+ this._previousValue = newValue
118
+ this.requestUpdate('value', oldValue)
119
+ }
120
+ }
103
121
 
104
122
  /**
105
123
  * Available function schemas for autocomplete
@@ -135,6 +153,10 @@ export default class CodeEditor extends LitElement {
135
153
  private accessor isEditorFocus = false
136
154
 
137
155
  private editorView?: EditorView
156
+ /**
157
+ * A control value to track previous value of the editor.
158
+ * This is used to detect when change event should be dispatched.
159
+ */
138
160
  private _previousValue = ''
139
161
  /**
140
162
  * Matcher for suggestion placeholders in the editor.
@@ -159,6 +181,8 @@ export default class CodeEditor extends LitElement {
159
181
  return suggestions
160
182
  }
161
183
 
184
+ private readonlyState = new Compartment()
185
+
162
186
  override disconnectedCallback(): void {
163
187
  super.disconnectedCallback()
164
188
  this.editorView?.destroy()
@@ -183,7 +207,9 @@ export default class CodeEditor extends LitElement {
183
207
  }
184
208
 
185
209
  if (changedProperties.has('disabled')) {
186
- this.updateEditorState()
210
+ this.editorView?.dispatch({
211
+ effects: this.readonlyState.reconfigure(EditorState.readOnly.of(this.disabled)),
212
+ })
187
213
  }
188
214
  }
189
215
 
@@ -210,6 +236,7 @@ export default class CodeEditor extends LitElement {
210
236
  this.createPlaceholderPlugin(),
211
237
  hoverTooltip(this.createHoverTooltipSource),
212
238
  linter((view) => functionLinter(view, this.functionSchemas, (e) => this.dispatchEvent(e))),
239
+ this.readonlyState.of(EditorState.readOnly.of(this.disabled)),
213
240
  ]
214
241
 
215
242
  // Add language support
@@ -405,15 +432,15 @@ export default class CodeEditor extends LitElement {
405
432
 
406
433
  const type = document.createElement('span')
407
434
  type.className = 'param-type'
408
- type.textContent = `: ${param.type}`
435
+ type.textContent = `: ${getTypeStringFromSchema(param.schema)}`
409
436
 
410
437
  listItem.appendChild(name)
411
438
  listItem.appendChild(type)
412
439
 
413
- if (param.description) {
440
+ if (param.schema.description) {
414
441
  const paramDesc = document.createElement('p')
415
442
  paramDesc.className = 'param-description'
416
- paramDesc.textContent = param.description
443
+ paramDesc.textContent = param.schema.description
417
444
  listItem.appendChild(paramDesc)
418
445
  }
419
446
  paramsList.appendChild(listItem)
@@ -431,7 +458,8 @@ export default class CodeEditor extends LitElement {
431
458
  returnsContainer.appendChild(returnsHeader)
432
459
 
433
460
  const returnsDesc = document.createElement('p')
434
- returnsDesc.textContent = fn.returns
461
+ const returnType = getTypeStringFromSchema(fn.returns)
462
+ returnsDesc.textContent = fn.returns.description ? `${returnType}: ${fn.returns.description}` : returnType
435
463
  returnsContainer.appendChild(returnsDesc)
436
464
  container.appendChild(returnsContainer)
437
465
  }
@@ -477,21 +505,6 @@ export default class CodeEditor extends LitElement {
477
505
  }
478
506
  }
479
507
 
480
- /**
481
- * Update editor state (e.g., disabled state)
482
- */
483
- private updateEditorState(): void {
484
- if (!this.editorView) return
485
-
486
- // For now, we'll handle disabled state differently
487
- // CodeMirror 6 doesn't use reconfigure for editable
488
- if (this.disabled) {
489
- this.editorView.contentDOM.setAttribute('contenteditable', 'false')
490
- } else {
491
- this.editorView.contentDOM.setAttribute('contenteditable', 'true')
492
- }
493
- }
494
-
495
508
  /**
496
509
  * Handle editor content change
497
510
  */
@@ -499,13 +512,10 @@ export default class CodeEditor extends LitElement {
499
512
  if (!this.editorView) return
500
513
 
501
514
  const newValue = this.editorView.state.doc.toString()
502
- if (newValue !== this._previousValue) {
503
- this._previousValue = newValue
504
- this.value = newValue
505
- this.hasContent = newValue.length > 0
515
+ this.#value = newValue
516
+ this.hasContent = newValue.length > 0
506
517
 
507
- this.dispatchEvent(new Event('input', { bubbles: true }))
508
- }
518
+ this.dispatchEvent(new Event('input', { bubbles: true }))
509
519
  }
510
520
 
511
521
  /**
@@ -514,8 +524,9 @@ export default class CodeEditor extends LitElement {
514
524
  private handleFocusChange(hasFocus: boolean): void {
515
525
  this.isEditorFocus = hasFocus
516
526
 
517
- if (!hasFocus && this.value !== this._previousValue) {
518
- this.dispatchEvent(new Event('change', { bubbles: true }))
527
+ if (!hasFocus && this.#value !== this._previousValue) {
528
+ this._previousValue = this.#value
529
+ this.dispatchEvent(new Event('change'))
519
530
  }
520
531
  }
521
532
 
@@ -1,6 +1,6 @@
1
1
  import type { Diagnostic } from '@codemirror/lint'
2
2
  import type { EditorView } from '@codemirror/view'
3
- import type { FunctionSchema } from './types.js'
3
+ import type { FunctionSchema } from '@pawel-up/jexl/schemas/types.js'
4
4
 
5
5
  export function functionLinter(
6
6
  view: EditorView,
@@ -68,13 +68,14 @@ export function functionLinter(
68
68
  }
69
69
 
70
70
  // Check if too many parameters
71
- if (fn.parameters && args.length > fn.parameters.length) {
71
+ const hasVariadicParam = fn.parameters.length > 0 && !!fn.parameters[fn.parameters.length - 1].variadic
72
+ if (!hasVariadicParam && args.length > fn.parameters.length) {
72
73
  const functionEndPos = startPos + functionCallMatch[0].length
73
74
  diagnostics.push({
74
75
  from: startPos,
75
76
  to: functionEndPos,
76
77
  severity: 'warning',
77
- message: `Function "${functionName}" expects at most ${fn.parameters.length} parameters but got ${args.length}`,
78
+ message: `Function "${functionName}" expects at most ${fn.parameters.length} parameters, but got ${args.length}.`,
78
79
  })
79
80
  }
80
81
  }
@@ -1,30 +1,4 @@
1
- export interface FunctionSchema {
2
- /** Unique identifier for the function */
3
- id: string
4
- /** Function name */
5
- name: string
6
- /** Function description */
7
- description?: string
8
- /** Function parameters */
9
- parameters?: FunctionParameter[]
10
- /** Return type description */
11
- returns?: string
12
- /** Additional metadata */
13
- metadata?: Record<string, unknown>
14
- }
15
-
16
- export interface FunctionParameter {
17
- /** Parameter name */
18
- name: string
19
- /** Parameter type */
20
- type: string
21
- /** Parameter description */
22
- description?: string
23
- /** Whether parameter is required */
24
- required?: boolean
25
- /** Default value */
26
- defaultValue?: unknown
27
- }
1
+ import type { FunctionSchema } from '@pawel-up/jexl/schemas/types.js'
28
2
 
29
3
  export interface Suggestion {
30
4
  /** Unique identifier for the suggestion */
package/src/index.ts CHANGED
@@ -6,13 +6,7 @@ export { default as HarViewerElement } from './elements/har/HarViewer.js'
6
6
 
7
7
  // Code Editor
8
8
  export { default as CodeEditorElement } from './elements/code-editor/code-editor.js'
9
- export type {
10
- FunctionSchema,
11
- FunctionParameter,
12
- Suggestion,
13
- FunctionInsertEvent,
14
- SuggestionInsertEvent,
15
- } from './elements/code-editor/code-editor.js'
9
+ export type { Suggestion, FunctionInsertEvent, SuggestionInsertEvent } from './elements/code-editor/code-editor.js'
16
10
 
17
11
  // Menu Components
18
12
  export { default as Menu } from './md/menu/internal/Menu.js'