@api-client/ui 0.5.19 → 0.5.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/src/elements/code-editor/internals/CodeEditor.d.ts +4 -8
- package/build/src/elements/code-editor/internals/CodeEditor.d.ts.map +1 -1
- package/build/src/elements/code-editor/internals/CodeEditor.js +13 -33
- package/build/src/elements/code-editor/internals/CodeEditor.js.map +1 -1
- package/build/src/md/dialog/internals/Dialog.d.ts +13 -35
- package/build/src/md/dialog/internals/Dialog.d.ts.map +1 -1
- package/build/src/md/dialog/internals/Dialog.js +32 -146
- package/build/src/md/dialog/internals/Dialog.js.map +1 -1
- package/demo/elements/code-editor/CodeEditorDemo.ts +7 -21
- package/package.json +1 -2
- package/src/elements/code-editor/README.md +9 -6
- package/src/elements/code-editor/internals/CodeEditor.ts +9 -21
- package/src/md/dialog/internals/Dialog.ts +20 -120
- package/test/elements/code-editor/code-editor.accessibility.test.ts +2 -29
- package/test/elements/code-editor/code-editor.test.ts +10 -13
- package/build/src/events/SyntheticSubmitEvent.d.ts +0 -9
- package/build/src/events/SyntheticSubmitEvent.d.ts.map +0 -1
- package/build/src/events/SyntheticSubmitEvent.js +0 -22
- package/build/src/events/SyntheticSubmitEvent.js.map +0 -1
- package/src/events/SyntheticSubmitEvent.ts +0 -27
|
@@ -13,9 +13,9 @@ import '../../../md/button/ui-button.js';
|
|
|
13
13
|
* - Keyboard navigation
|
|
14
14
|
* - Accessibility support
|
|
15
15
|
*
|
|
16
|
-
* @fires
|
|
17
|
-
* @fires
|
|
18
|
-
* @fires
|
|
16
|
+
* @fires functioninsert - When a function is inserted
|
|
17
|
+
* @fires suggestioninsert - When a suggestion is inserted
|
|
18
|
+
* @fires docsrequest - When documentation is requested for a function
|
|
19
19
|
* @fires input - When the editor content changes
|
|
20
20
|
* @fires change - When the editor loses focus and content has changed
|
|
21
21
|
*/
|
|
@@ -74,10 +74,6 @@ export default class CodeEditor extends LitElement {
|
|
|
74
74
|
* Available suggestions for autocomplete
|
|
75
75
|
*/
|
|
76
76
|
accessor suggestions: Suggestion[];
|
|
77
|
-
/**
|
|
78
|
-
* Whether to use dark theme
|
|
79
|
-
*/
|
|
80
|
-
accessor darkTheme: boolean;
|
|
81
77
|
/**
|
|
82
78
|
* Programming language for syntax highlighting
|
|
83
79
|
* @attribute
|
|
@@ -85,7 +81,7 @@ export default class CodeEditor extends LitElement {
|
|
|
85
81
|
accessor language: string;
|
|
86
82
|
/**
|
|
87
83
|
* Whether to show documentation links/buttons in function tooltips and autocomplete
|
|
88
|
-
* @attribute
|
|
84
|
+
* @attribute
|
|
89
85
|
*/
|
|
90
86
|
accessor showDocumentation: boolean;
|
|
91
87
|
private accessor editorContainer;
|
|
@@ -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;
|
|
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;AAyB/E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAA;AAGrE,OAAO,KAAK,EAAuB,UAAU,EAAqD,MAAM,YAAY,CAAA;AACpH,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAA;AAExE,OAAO,iCAAiC,CAAA;AAExC;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,UAAU;;IAChD;;;OAGG;IACH,OAAgB,iBAAiB,EAAE,cAAc,CAGhD;IAED;;;OAGG;IAEH,QAAQ,CAAC,KAAK,SAAK;IAEnB;;;OAGG;IAEH,QA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mBlC;;;OAGG;IACH,OAAO,CAAC,wBAAwB,CAmB/B;IAED;;;OAGG;IACH,SAAS,CAAC,yBAAyB,CAAC,EAAE,EAAE,cAAc,GAAG,WAAW;IAqFpE;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAiB1B;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAe3B;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAU1B;;OAEG;IACH,OAAO,CAAC,iBAAiB;IASzB;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAQ9B;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAQhC;;OAEG;IACH,OAAO,CAAC,6BAA6B;IAQrC;;OAEG;IACM,KAAK,IAAI,IAAI;IAItB;;OAEG;IACH,YAAY,IAAI;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IAMnD;;OAEG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAUrB,MAAM,IAAI,cAAc;CAgBlC"}
|
|
@@ -7,7 +7,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';
|
|
10
|
-
import { oneDark } from '@codemirror/theme-one-dark';
|
|
11
10
|
import { keymap } from '@codemirror/view';
|
|
12
11
|
import { defaultKeymap } from '@codemirror/commands';
|
|
13
12
|
import { EditorView, Decoration, ViewPlugin, hoverTooltip, } from '@codemirror/view';
|
|
@@ -46,9 +45,6 @@ let CodeEditor = (() => {
|
|
|
46
45
|
let _suggestions_decorators;
|
|
47
46
|
let _suggestions_initializers = [];
|
|
48
47
|
let _suggestions_extraInitializers = [];
|
|
49
|
-
let _darkTheme_decorators;
|
|
50
|
-
let _darkTheme_initializers = [];
|
|
51
|
-
let _darkTheme_extraInitializers = [];
|
|
52
48
|
let _language_decorators;
|
|
53
49
|
let _language_initializers = [];
|
|
54
50
|
let _language_extraInitializers = [];
|
|
@@ -68,7 +64,7 @@ let CodeEditor = (() => {
|
|
|
68
64
|
static {
|
|
69
65
|
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
70
66
|
_label_decorators = [property({ type: String })];
|
|
71
|
-
_supportingText_decorators = [property({ type: String
|
|
67
|
+
_supportingText_decorators = [property({ type: String })];
|
|
72
68
|
_disabled_decorators = [property({ type: Boolean, reflect: true })];
|
|
73
69
|
_invalid_decorators = [property({ type: Boolean, reflect: true })];
|
|
74
70
|
_name_decorators = [property({ type: String })];
|
|
@@ -77,9 +73,8 @@ let CodeEditor = (() => {
|
|
|
77
73
|
_set_value_decorators = [property({ type: String })];
|
|
78
74
|
_functionSchemas_decorators = [property({ type: Array, attribute: false })];
|
|
79
75
|
_suggestions_decorators = [property({ type: Array, attribute: false })];
|
|
80
|
-
_darkTheme_decorators = [property({ type: Boolean, attribute: 'dark-theme' })];
|
|
81
76
|
_language_decorators = [property({ type: String })];
|
|
82
|
-
_showDocumentation_decorators = [property({ type: Boolean
|
|
77
|
+
_showDocumentation_decorators = [property({ type: Boolean })];
|
|
83
78
|
_editorContainer_decorators = [query('.editor-container')];
|
|
84
79
|
_hasContent_decorators = [state()];
|
|
85
80
|
_isEditorFocus_decorators = [state()];
|
|
@@ -93,7 +88,6 @@ let CodeEditor = (() => {
|
|
|
93
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);
|
|
94
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);
|
|
95
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);
|
|
96
|
-
__esDecorate(this, null, _darkTheme_decorators, { kind: "accessor", name: "darkTheme", static: false, private: false, access: { has: obj => "darkTheme" in obj, get: obj => obj.darkTheme, set: (obj, value) => { obj.darkTheme = value; } }, metadata: _metadata }, _darkTheme_initializers, _darkTheme_extraInitializers);
|
|
97
91
|
__esDecorate(this, null, _language_decorators, { kind: "accessor", name: "language", static: false, private: false, access: { has: obj => "language" in obj, get: obj => obj.language, set: (obj, value) => { obj.language = value; } }, metadata: _metadata }, _language_initializers, _language_extraInitializers);
|
|
98
92
|
__esDecorate(this, null, _showDocumentation_decorators, { kind: "accessor", name: "showDocumentation", static: false, private: false, access: { has: obj => "showDocumentation" in obj, get: obj => obj.showDocumentation, set: (obj, value) => { obj.showDocumentation = value; } }, metadata: _metadata }, _showDocumentation_initializers, _showDocumentation_extraInitializers);
|
|
99
93
|
__esDecorate(this, null, _editorContainer_decorators, { kind: "accessor", name: "editorContainer", static: false, private: false, access: { has: obj => "editorContainer" in obj, get: obj => obj.editorContainer, set: (obj, value) => { obj.editorContainer = value; } }, metadata: _metadata }, _editorContainer_initializers, _editorContainer_extraInitializers);
|
|
@@ -222,7 +216,8 @@ let CodeEditor = (() => {
|
|
|
222
216
|
set functionSchemas(value) { this.#functionSchemas_accessor_storage = value; }
|
|
223
217
|
#suggestions_accessor_storage = (__runInitializers(this, _functionSchemas_extraInitializers), __runInitializers(this, _suggestions_initializers, []
|
|
224
218
|
/**
|
|
225
|
-
*
|
|
219
|
+
* Programming language for syntax highlighting
|
|
220
|
+
* @attribute
|
|
226
221
|
*/
|
|
227
222
|
));
|
|
228
223
|
/**
|
|
@@ -230,21 +225,10 @@ let CodeEditor = (() => {
|
|
|
230
225
|
*/
|
|
231
226
|
get suggestions() { return this.#suggestions_accessor_storage; }
|
|
232
227
|
set suggestions(value) { this.#suggestions_accessor_storage = value; }
|
|
233
|
-
#
|
|
234
|
-
/**
|
|
235
|
-
* Programming language for syntax highlighting
|
|
236
|
-
* @attribute
|
|
237
|
-
*/
|
|
238
|
-
));
|
|
239
|
-
/**
|
|
240
|
-
* Whether to use dark theme
|
|
241
|
-
*/
|
|
242
|
-
get darkTheme() { return this.#darkTheme_accessor_storage; }
|
|
243
|
-
set darkTheme(value) { this.#darkTheme_accessor_storage = value; }
|
|
244
|
-
#language_accessor_storage = (__runInitializers(this, _darkTheme_extraInitializers), __runInitializers(this, _language_initializers, 'javascript'
|
|
228
|
+
#language_accessor_storage = (__runInitializers(this, _suggestions_extraInitializers), __runInitializers(this, _language_initializers, 'javascript'
|
|
245
229
|
/**
|
|
246
230
|
* Whether to show documentation links/buttons in function tooltips and autocomplete
|
|
247
|
-
* @attribute
|
|
231
|
+
* @attribute
|
|
248
232
|
*/
|
|
249
233
|
));
|
|
250
234
|
/**
|
|
@@ -256,7 +240,7 @@ let CodeEditor = (() => {
|
|
|
256
240
|
#showDocumentation_accessor_storage = (__runInitializers(this, _language_extraInitializers), __runInitializers(this, _showDocumentation_initializers, false));
|
|
257
241
|
/**
|
|
258
242
|
* Whether to show documentation links/buttons in function tooltips and autocomplete
|
|
259
|
-
* @attribute
|
|
243
|
+
* @attribute
|
|
260
244
|
*/
|
|
261
245
|
get showDocumentation() { return this.#showDocumentation_accessor_storage; }
|
|
262
246
|
set showDocumentation(value) { this.#showDocumentation_accessor_storage = value; }
|
|
@@ -354,10 +338,6 @@ let CodeEditor = (() => {
|
|
|
354
338
|
if (this.language === 'javascript') {
|
|
355
339
|
extensions.push(javascript());
|
|
356
340
|
}
|
|
357
|
-
// Add theme
|
|
358
|
-
if (this.darkTheme) {
|
|
359
|
-
extensions.push(oneDark);
|
|
360
|
-
}
|
|
361
341
|
// Add placeholder
|
|
362
342
|
if (this.placeholder) {
|
|
363
343
|
extensions.push(EditorView.contentAttributes.of({
|
|
@@ -620,7 +600,7 @@ let CodeEditor = (() => {
|
|
|
620
600
|
* Dispatch function insert event
|
|
621
601
|
*/
|
|
622
602
|
dispatchFunctionInsert(functionSchema, position) {
|
|
623
|
-
const event = new CustomEvent('
|
|
603
|
+
const event = new CustomEvent('functioninsert', {
|
|
624
604
|
detail: { functionSchema, position },
|
|
625
605
|
bubbles: true,
|
|
626
606
|
});
|
|
@@ -630,7 +610,7 @@ let CodeEditor = (() => {
|
|
|
630
610
|
* Dispatch suggestion insert event
|
|
631
611
|
*/
|
|
632
612
|
dispatchSuggestionInsert(suggestion, position) {
|
|
633
|
-
const event = new CustomEvent('
|
|
613
|
+
const event = new CustomEvent('suggestioninsert', {
|
|
634
614
|
detail: { suggestion, position },
|
|
635
615
|
bubbles: true,
|
|
636
616
|
});
|
|
@@ -640,7 +620,7 @@ let CodeEditor = (() => {
|
|
|
640
620
|
* Dispatch function documentation event
|
|
641
621
|
*/
|
|
642
622
|
dispatchFunctionDocumentation(functionSchema) {
|
|
643
|
-
const event = new CustomEvent('
|
|
623
|
+
const event = new CustomEvent('docsrequest', {
|
|
644
624
|
detail: { functionSchema },
|
|
645
625
|
bubbles: true,
|
|
646
626
|
});
|
|
@@ -700,9 +680,9 @@ let CodeEditor = (() => {
|
|
|
700
680
|
* - Keyboard navigation
|
|
701
681
|
* - Accessibility support
|
|
702
682
|
*
|
|
703
|
-
* @fires
|
|
704
|
-
* @fires
|
|
705
|
-
* @fires
|
|
683
|
+
* @fires functioninsert - When a function is inserted
|
|
684
|
+
* @fires suggestioninsert - When a suggestion is inserted
|
|
685
|
+
* @fires docsrequest - When documentation is requested for a function
|
|
706
686
|
* @fires input - When the editor content changes
|
|
707
687
|
* @fires change - When the editor loses focus and content has changed
|
|
708
688
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeEditor.js","sourceRoot":"","sources":["../../../../../src/elements/code-editor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EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;gBACnC,SAAS,EAAE,EAAE,MAAM,EAAE,IAAI,GAAG,IAAI,CAAC,MAAM,EAAE;aAC1C,CAAC,CAAA;QACJ,CAAC;QAEQ,MAAM;YACb,MAAM,QAAQ,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAA;YAC7B,MAAM,iBAAiB,GAAG,CAAC,CAAC,IAAI,CAAC,cAAc,CAAA;YAE/C,OAAO,IAAI,CAAA;4BACa,QAAQ,CAAC,EAAE,WAAW,EAAE,IAAI,CAAC,aAAa,EAAE,SAAS,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC;;YAEtF,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAA,sBAAsB,IAAI,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO;;;;;UAKnE,iBAAiB,CAAC,CAAC,CAAC,IAAI,CAAA,gCAAgC,IAAI,CAAC,cAAc,QAAQ,CAAC,CAAC,CAAC,OAAO;;KAElG,CAAA;QACH,CAAC;;;AA3mBH;;;;;;;;;;;;;;;GAeG;AACH","sourcesContent":["import { html, LitElement, PropertyValues, TemplateResult, nothing } from 'lit'\nimport { property, query, state } from 'lit/decorators.js'\nimport { classMap } from 'lit/directives/class-map.js'\nimport { linter } from '@codemirror/lint'\nimport { Compartment, EditorState, Extension } from '@codemirror/state'\nimport {\n autocompletion,\n CompletionContext,\n type CompletionResult,\n type CompletionSource,\n type Completion,\n} from '@codemirror/autocomplete'\nimport { javascript } from '@codemirror/lang-javascript'\nimport { syntaxHighlighting, defaultHighlightStyle } from '@codemirror/language'\nimport { oneDark } from '@codemirror/theme-one-dark'\nimport { keymap } from '@codemirror/view'\nimport { defaultKeymap } from '@codemirror/commands'\nimport {\n EditorView,\n Decoration,\n DecorationSet,\n ViewPlugin,\n ViewUpdate,\n hoverTooltip,\n type Tooltip,\n} from '@codemirror/view'\nimport type { FunctionSchema } from '@pawel-up/jexl/schemas/types.js'\nimport { getTypeStringFromSchema } from '@pawel-up/jexl/schemas/utils.js'\nimport { functionLinter } from './Linter.js'\nimport type { FunctionInsertEvent, Suggestion, SuggestionInsertEvent, FunctionDocumentationEvent } from './types.js'\nimport { SuggestionMatchDecorator } from './SuggestionMatchDecorator.js'\n\nimport '../../../md/button/ui-button.js'\n\n/**\n * A CodeMirror 6 based editor component that supports function autocomplete and suggestion placeholders.\n *\n * Features:\n * - Dynamic function schema loading\n * - Autocomplete for functions and suggestions\n * - Suggestion placeholders with double curly braces ({{suggestion}})\n * - Keyboard navigation\n * - Accessibility support\n *\n * @fires function-insert - When a function is inserted\n * @fires suggestion-insert - When a suggestion is inserted\n * @fires function-documentation - When documentation is requested for a function\n * @fires input - When the editor content changes\n * @fires change - When the editor loses focus and content has changed\n */\nexport default class CodeEditor extends LitElement {\n /**\n * Shadow root configuration for the component.\n * Uses 'open' mode for accessibility and delegates focus to enable proper focus management.\n */\n static override shadowRootOptions: ShadowRootInit = {\n mode: 'open',\n delegatesFocus: true,\n }\n\n /**\n * The label text displayed as placeholder/floating label\n * @attribute\n */\n @property({ type: String })\n accessor label = ''\n\n /**\n * Supporting text displayed below the editor\n * @attribute\n */\n @property({ type: String, attribute: 'supporting-text' })\n accessor supportingText = ''\n\n /**\n * Whether the component is disabled\n * @attribute\n */\n @property({ type: Boolean, reflect: true })\n accessor disabled = false\n\n /**\n * Whether the component is in an invalid state\n * @attribute\n */\n @property({ type: Boolean, reflect: true })\n accessor invalid = false\n\n /**\n * The name attribute for form integration\n * @attribute\n */\n @property({ type: String })\n accessor name = ''\n\n /**\n * Whether the input is required\n * @attribute\n */\n @property({ type: Boolean })\n accessor required = false\n\n /**\n * Placeholder text shown when editor is empty\n * @attribute\n */\n @property({ type: String })\n accessor placeholder = ''\n\n /**\n * This property is used internally to set value without triggering updates.\n */\n #value = ''\n\n /**\n * The editor content value\n */\n get value(): string {\n return this.#value\n }\n\n @property({ type: String })\n set value(newValue: string) {\n const oldValue = this.#value\n if (newValue !== oldValue) {\n this.#value = newValue\n this._previousValue = newValue\n this.requestUpdate('value', oldValue)\n }\n }\n\n /**\n * Available function schemas for autocomplete\n */\n @property({ type: Array, attribute: false })\n accessor functionSchemas: FunctionSchema[] = []\n\n /**\n * Available suggestions for autocomplete\n */\n @property({ type: Array, attribute: false })\n accessor suggestions: Suggestion[] = []\n\n /**\n * Whether to use dark theme\n */\n @property({ type: Boolean, attribute: 'dark-theme' })\n accessor darkTheme = false\n\n /**\n * Programming language for syntax highlighting\n * @attribute\n */\n @property({ type: String })\n accessor language = 'javascript'\n\n /**\n * Whether to show documentation links/buttons in function tooltips and autocomplete\n * @attribute show-documentation\n */\n @property({ type: Boolean, attribute: 'show-documentation' })\n accessor showDocumentation = false\n\n @query('.editor-container')\n private accessor editorContainer!: HTMLDivElement\n\n @state()\n private accessor hasContent = false\n\n @state()\n private accessor isEditorFocus = false\n\n private editorView?: EditorView\n /**\n * A control value to track previous value of the editor.\n * This is used to detect when change event should be dispatched.\n */\n private _previousValue = ''\n /**\n * Matcher for suggestion placeholders in the editor.\n */\n placeholderMatcher?: SuggestionMatchDecorator\n\n /**\n * Get all suggestions (placeholders) currently in the editor\n */\n get activeSuggestions(): Suggestion[] {\n const suggestions: Suggestion[] = []\n const placeholderPattern = /\\{\\{([^}]+)\\}\\}/g\n let match: RegExpExecArray | null\n while ((match = placeholderPattern.exec(this.value)) !== null) {\n const placeholderText = match[1]\n // Find suggestion by id\n const suggestion = this.suggestions.find((s) => s.id === placeholderText)\n if (suggestion) {\n suggestions.push(suggestion)\n }\n }\n return suggestions\n }\n\n private readonlyState = new Compartment()\n\n override disconnectedCallback(): void {\n super.disconnectedCallback()\n this.editorView?.destroy()\n }\n\n override firstUpdated(): void {\n this.initializeCodeMirror()\n this.updateEditorContent()\n }\n\n override willUpdate(changedProperties: PropertyValues): void {\n super.willUpdate(changedProperties)\n\n if (changedProperties.has('suggestions')) {\n if (this.placeholderMatcher) {\n this.placeholderMatcher.suggestions = this.suggestions || []\n }\n }\n\n if (changedProperties.has('value') && this.editorView) {\n this.updateEditorContent()\n }\n\n if (changedProperties.has('disabled')) {\n this.editorView?.dispatch({\n effects: this.readonlyState.reconfigure(EditorState.readOnly.of(this.disabled)),\n })\n }\n }\n\n /**\n * Initialize CodeMirror editor with extensions\n */\n private initializeCodeMirror(): void {\n const extensions: Extension[] = [\n keymap.of(defaultKeymap),\n syntaxHighlighting(defaultHighlightStyle),\n autocompletion({\n override: [this.createCompletionSource()],\n activateOnTyping: true,\n maxRenderedOptions: 10,\n }),\n EditorView.updateListener.of((update: ViewUpdate) => {\n if (update.docChanged) {\n this.handleEditorChange()\n }\n if (update.focusChanged) {\n this.handleFocusChange(update.view.hasFocus)\n } else if (update.view.hasFocus !== this.isEditorFocus) {\n // If focus state changed without focusChanged event, update manually\n this.handleFocusChange(update.view.hasFocus)\n }\n }),\n this.createPlaceholderPlugin(),\n hoverTooltip(this.createHoverTooltipSource),\n linter((view) => functionLinter(view, this.functionSchemas, (e) => this.dispatchEvent(e))),\n this.readonlyState.of(EditorState.readOnly.of(this.disabled)),\n ]\n\n // Add language support\n if (this.language === 'javascript') {\n extensions.push(javascript())\n }\n\n // Add theme\n if (this.darkTheme) {\n extensions.push(oneDark)\n }\n\n // Add placeholder\n if (this.placeholder) {\n extensions.push(\n EditorView.contentAttributes.of({\n 'aria-placeholder': this.placeholder,\n })\n )\n }\n\n const state = EditorState.create({\n doc: this.value,\n extensions,\n })\n\n this.editorView = new EditorView({\n state,\n parent: this.editorContainer,\n })\n }\n\n /**\n * Creates the ViewPlugin for rendering suggestion placeholders.\n * This is created as a method to get access to the component's `suggestions`.\n */\n private createPlaceholderPlugin(): Extension {\n const placeholderMatcher = new SuggestionMatchDecorator(/\\{\\{([^}]+)\\}\\}/g, this.suggestions)\n this.placeholderMatcher = placeholderMatcher\n // This class needs to be defined here to have access to the `placeholderMatcher`\n class AtomicDecorationRange {\n placeholders: DecorationSet\n constructor(view: EditorView) {\n this.placeholders = placeholderMatcher.createDeco(view)\n }\n update(update: ViewUpdate) {\n this.placeholders = placeholderMatcher.updateDeco(update, this.placeholders)\n }\n }\n\n return ViewPlugin.fromClass(AtomicDecorationRange, {\n decorations: (instance) => instance.placeholders,\n provide: (plugin) => EditorView.atomicRanges.of((view) => view.plugin(plugin)?.placeholders || Decoration.none),\n })\n }\n\n /**\n * Create completion source for functions and suggestions\n */\n private createCompletionSource(): CompletionSource {\n return (context: CompletionContext): CompletionResult | null => {\n const { pos } = context\n const line = context.state.doc.lineAt(pos)\n const textBefore = line.text.slice(0, pos - line.from)\n\n // Check if we're typing a function name\n const functionMatch = textBefore.match(/(\\w+)$/)\n if (functionMatch) {\n const prefix = functionMatch[1]\n const functions = this.functionSchemas\n .filter((fn) => fn.name.toLowerCase().startsWith(prefix.toLowerCase()))\n .map((fn) => this.createFunctionCompletion(fn))\n\n if (functions.length > 0) {\n return {\n from: pos - prefix.length,\n options: functions,\n }\n }\n }\n\n // Check if we're typing a suggestion trigger (e.g., {{)\n const suggestionMatch = textBefore.match(/\\{\\{([^}]*)$/)\n if (suggestionMatch) {\n const prefix = suggestionMatch[1]\n const suggestions = this.suggestions\n .filter((suggestion) => suggestion.label.toLowerCase().startsWith(prefix.toLowerCase()))\n .map((suggestion) => this.createSuggestionCompletion(suggestion))\n\n if (suggestions.length > 0) {\n return {\n from: pos - prefix.length,\n options: suggestions,\n }\n }\n }\n\n return null\n }\n }\n\n private createFunctionCompletion(schema: FunctionSchema): Completion {\n const result: Completion = {\n label: schema.name,\n detail: schema.description || '',\n type: 'function',\n info: () => this.createFunctionInfoElement(schema),\n apply: (view: EditorView, completion: unknown, from: number, to: number) => {\n const functionCall = this.formatFunctionCall(schema)\n view.dispatch({\n changes: { from, to, insert: functionCall },\n selection: { anchor: from + functionCall.length },\n })\n this.dispatchFunctionInsert(schema, from)\n },\n }\n\n return result\n }\n\n private createSuggestionCompletion(suggestion: Suggestion): Completion {\n const result: Completion = {\n label: suggestion.label,\n detail: suggestion.description || '',\n info: suggestion.suffix || '',\n type: 'variable',\n apply: (view: EditorView, completion: unknown, from: number, to: number) => {\n const placeholderText = `{{${suggestion.id}}}`\n view.dispatch({\n changes: { from: from - 2, to, insert: placeholderText }, // -2 to include the {{\n selection: { anchor: from - 2 + placeholderText.length },\n })\n this.dispatchSuggestionInsert(suggestion, from - 2)\n },\n }\n\n return result\n }\n\n /**\n * Creates the source for the hover tooltips.\n * This is an arrow function to automatically bind `this`.\n */\n private createHoverTooltipSource = (view: EditorView, pos: number): Tooltip | null => {\n const word = view.state.wordAt(pos)\n if (!word) {\n return null\n }\n\n const functionName = view.state.doc.sliceString(word.from, word.to)\n const fnSchema = this.functionSchemas.find((schema) => schema.name === functionName)\n\n if (!fnSchema) {\n return null\n }\n\n return {\n pos: word.from,\n end: word.to,\n above: true,\n create: () => ({ dom: this.createFunctionInfoElement(fnSchema) }),\n }\n }\n\n /**\n * Creates a styled HTML element to display function documentation.\n * This is used for both hover tooltips and autocomplete info panels.\n */\n protected createFunctionInfoElement(fn: FunctionSchema): HTMLElement {\n const container = document.createElement('div')\n container.className = 'function-info' // for styling\n\n if (fn.description) {\n const description = document.createElement('p')\n description.className = 'description'\n description.textContent = fn.description\n container.appendChild(description)\n }\n\n if (fn.parameters && fn.parameters.length > 0) {\n const paramsContainer = document.createElement('div')\n paramsContainer.className = 'parameters'\n\n const paramsHeader = document.createElement('h4')\n paramsHeader.textContent = 'Parameters'\n paramsContainer.appendChild(paramsHeader)\n\n const paramsList = document.createElement('ul')\n fn.parameters.forEach((param) => {\n const listItem = document.createElement('li')\n\n const name = document.createElement('span')\n name.className = 'param-name'\n name.textContent = param.name\n\n const type = document.createElement('span')\n type.className = 'param-type'\n type.textContent = `: ${getTypeStringFromSchema(param.schema)}`\n\n listItem.appendChild(name)\n listItem.appendChild(type)\n\n if (param.schema.description) {\n const paramDesc = document.createElement('p')\n paramDesc.className = 'param-description'\n paramDesc.textContent = param.schema.description\n listItem.appendChild(paramDesc)\n }\n paramsList.appendChild(listItem)\n })\n paramsContainer.appendChild(paramsList)\n container.appendChild(paramsContainer)\n }\n\n if (fn.returns) {\n const returnsContainer = document.createElement('div')\n returnsContainer.className = 'returns'\n\n const returnsHeader = document.createElement('h4')\n returnsHeader.textContent = 'Returns'\n returnsContainer.appendChild(returnsHeader)\n\n const returnsDesc = document.createElement('p')\n const returnType = getTypeStringFromSchema(fn.returns)\n returnsDesc.textContent = fn.returns.description ? `${returnType}: ${fn.returns.description}` : returnType\n returnsContainer.appendChild(returnsDesc)\n container.appendChild(returnsContainer)\n }\n\n // Add documentation button if showDocumentation is enabled\n if (this.showDocumentation) {\n const docContainer = document.createElement('div')\n docContainer.className = 'documentation'\n\n const docButton = document.createElement('ui-button')\n docButton.type = 'button'\n docButton.className = 'documentation-button'\n docButton.textContent = 'Show documentation'\n docButton.setAttribute('aria-label', `Show documentation for ${fn.name} function`)\n\n docButton.addEventListener('click', (event) => {\n event.preventDefault()\n event.stopPropagation()\n this.dispatchFunctionDocumentation(fn)\n })\n\n docContainer.appendChild(docButton)\n container.appendChild(docContainer)\n }\n\n return container\n }\n\n /**\n * Format function call with parameters\n */\n private formatFunctionCall(fn: FunctionSchema): string {\n if (!fn.parameters || fn.parameters.length === 0) {\n return `${fn.name}()`\n }\n\n const params = fn.parameters\n .map((param) => {\n if (param.required) {\n return param.name\n }\n return `${param.name}?`\n })\n .join(', ')\n\n return `${fn.name}(${params})`\n }\n\n /**\n * Update editor content when value changes\n */\n private updateEditorContent(): void {\n if (!this.editorView) return\n\n const currentValue = this.editorView.state.doc.toString()\n if (currentValue !== this.value) {\n this.editorView.dispatch({\n changes: {\n from: 0,\n to: this.editorView.state.doc.length,\n insert: this.value,\n },\n })\n }\n }\n\n /**\n * Handle editor content change\n */\n private handleEditorChange(): void {\n if (!this.editorView) return\n\n const newValue = this.editorView.state.doc.toString()\n this.#value = newValue\n this.hasContent = newValue.length > 0\n\n this.dispatchEvent(new Event('input', { bubbles: true }))\n }\n\n /**\n * Handle focus change\n */\n private handleFocusChange(hasFocus: boolean): void {\n this.isEditorFocus = hasFocus\n\n if (!hasFocus && this.#value !== this._previousValue) {\n this._previousValue = this.#value\n this.dispatchEvent(new Event('change'))\n }\n }\n\n /**\n * Dispatch function insert event\n */\n private dispatchFunctionInsert(functionSchema: FunctionSchema, position: number): void {\n const event = new CustomEvent<FunctionInsertEvent>('function-insert', {\n detail: { functionSchema, position },\n bubbles: true,\n })\n this.dispatchEvent(event)\n }\n\n /**\n * Dispatch suggestion insert event\n */\n private dispatchSuggestionInsert(suggestion: Suggestion, position: number): void {\n const event = new CustomEvent<SuggestionInsertEvent>('suggestion-insert', {\n detail: { suggestion, position },\n bubbles: true,\n })\n this.dispatchEvent(event)\n }\n\n /**\n * Dispatch function documentation event\n */\n private dispatchFunctionDocumentation(functionSchema: FunctionSchema): void {\n const event = new CustomEvent<FunctionDocumentationEvent>('function-documentation', {\n detail: { functionSchema },\n bubbles: true,\n })\n this.dispatchEvent(event)\n }\n\n /**\n * Focus the editor\n */\n override focus(): void {\n this.editorView?.focus()\n }\n\n /**\n * Get the editor's current selection\n */\n getSelection(): { from: number; to: number } | null {\n if (!this.editorView) return null\n const { from, to } = this.editorView.state.selection.main\n return { from, to }\n }\n\n /**\n * Insert text at the current cursor position\n */\n insertText(text: string): void {\n if (!this.editorView) return\n\n const { from, to } = this.editorView.state.selection.main\n this.editorView.dispatch({\n changes: { from, to, insert: text },\n selection: { anchor: from + text.length },\n })\n }\n\n override render(): TemplateResult {\n const hasLabel = !!this.label\n const hasSupportingText = !!this.supportingText\n\n return html`\n <div class=\"surface ${classMap({ 'has-focus': this.isEditorFocus, 'invalid': this.invalid })}\">\n <div class=\"content\">\n ${hasLabel ? html`<div class=\"label\">${this.label}</div>` : nothing}\n\n <div class=\"editor-container\" part=\"editor\"></div>\n </div>\n\n ${hasSupportingText ? html`<div class=\"supporting-text\">${this.supportingText}</div>` : nothing}\n </div>\n `\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"CodeEditor.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AC;;YAEtF,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAA,sBAAsB,IAAI,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO;;;;;UAKnE,iBAAiB,CAAC,CAAC,CAAC,IAAI,CAAA,gCAAgC,IAAI,CAAC,cAAc,QAAQ,CAAC,CAAC,CAAC,OAAO;;KAElG,CAAA;QACH,CAAC;;;AAhmBH;;;;;;;;;;;;;;;GAeG;AACH","sourcesContent":["import { html, LitElement, PropertyValues, TemplateResult, nothing } from 'lit'\nimport { property, query, state } from 'lit/decorators.js'\nimport { classMap } from 'lit/directives/class-map.js'\nimport { linter } from '@codemirror/lint'\nimport { Compartment, EditorState, Extension } from '@codemirror/state'\nimport {\n autocompletion,\n CompletionContext,\n type CompletionResult,\n type CompletionSource,\n type Completion,\n} from '@codemirror/autocomplete'\nimport { javascript } from '@codemirror/lang-javascript'\nimport { syntaxHighlighting, defaultHighlightStyle } from '@codemirror/language'\nimport { keymap } from '@codemirror/view'\nimport { defaultKeymap } from '@codemirror/commands'\nimport {\n EditorView,\n Decoration,\n DecorationSet,\n ViewPlugin,\n ViewUpdate,\n hoverTooltip,\n type Tooltip,\n} from '@codemirror/view'\nimport type { FunctionSchema } from '@pawel-up/jexl/schemas/types.js'\nimport { getTypeStringFromSchema } from '@pawel-up/jexl/schemas/utils.js'\nimport { functionLinter } from './Linter.js'\nimport type { FunctionInsertEvent, Suggestion, SuggestionInsertEvent, FunctionDocumentationEvent } from './types.js'\nimport { SuggestionMatchDecorator } from './SuggestionMatchDecorator.js'\n\nimport '../../../md/button/ui-button.js'\n\n/**\n * A CodeMirror 6 based editor component that supports function autocomplete and suggestion placeholders.\n *\n * Features:\n * - Dynamic function schema loading\n * - Autocomplete for functions and suggestions\n * - Suggestion placeholders with double curly braces ({{suggestion}})\n * - Keyboard navigation\n * - Accessibility support\n *\n * @fires functioninsert - When a function is inserted\n * @fires suggestioninsert - When a suggestion is inserted\n * @fires docsrequest - When documentation is requested for a function\n * @fires input - When the editor content changes\n * @fires change - When the editor loses focus and content has changed\n */\nexport default class CodeEditor extends LitElement {\n /**\n * Shadow root configuration for the component.\n * Uses 'open' mode for accessibility and delegates focus to enable proper focus management.\n */\n static override shadowRootOptions: ShadowRootInit = {\n mode: 'open',\n delegatesFocus: true,\n }\n\n /**\n * The label text displayed as placeholder/floating label\n * @attribute\n */\n @property({ type: String })\n accessor label = ''\n\n /**\n * Supporting text displayed below the editor\n * @attribute\n */\n @property({ type: String })\n accessor supportingText = ''\n\n /**\n * Whether the component is disabled\n * @attribute\n */\n @property({ type: Boolean, reflect: true })\n accessor disabled = false\n\n /**\n * Whether the component is in an invalid state\n * @attribute\n */\n @property({ type: Boolean, reflect: true })\n accessor invalid = false\n\n /**\n * The name attribute for form integration\n * @attribute\n */\n @property({ type: String })\n accessor name = ''\n\n /**\n * Whether the input is required\n * @attribute\n */\n @property({ type: Boolean })\n accessor required = false\n\n /**\n * Placeholder text shown when editor is empty\n * @attribute\n */\n @property({ type: String })\n accessor placeholder = ''\n\n /**\n * This property is used internally to set value without triggering updates.\n */\n #value = ''\n\n /**\n * The editor content value\n */\n get value(): string {\n return this.#value\n }\n\n @property({ type: String })\n set value(newValue: string) {\n const oldValue = this.#value\n if (newValue !== oldValue) {\n this.#value = newValue\n this._previousValue = newValue\n this.requestUpdate('value', oldValue)\n }\n }\n\n /**\n * Available function schemas for autocomplete\n */\n @property({ type: Array, attribute: false })\n accessor functionSchemas: FunctionSchema[] = []\n\n /**\n * Available suggestions for autocomplete\n */\n @property({ type: Array, attribute: false })\n accessor suggestions: Suggestion[] = []\n\n /**\n * Programming language for syntax highlighting\n * @attribute\n */\n @property({ type: String })\n accessor language = 'javascript'\n\n /**\n * Whether to show documentation links/buttons in function tooltips and autocomplete\n * @attribute\n */\n @property({ type: Boolean })\n accessor showDocumentation = false\n\n @query('.editor-container')\n private accessor editorContainer!: HTMLDivElement\n\n @state()\n private accessor hasContent = false\n\n @state()\n private accessor isEditorFocus = false\n\n private editorView?: EditorView\n /**\n * A control value to track previous value of the editor.\n * This is used to detect when change event should be dispatched.\n */\n private _previousValue = ''\n /**\n * Matcher for suggestion placeholders in the editor.\n */\n placeholderMatcher?: SuggestionMatchDecorator\n\n /**\n * Get all suggestions (placeholders) currently in the editor\n */\n get activeSuggestions(): Suggestion[] {\n const suggestions: Suggestion[] = []\n const placeholderPattern = /\\{\\{([^}]+)\\}\\}/g\n let match: RegExpExecArray | null\n while ((match = placeholderPattern.exec(this.value)) !== null) {\n const placeholderText = match[1]\n // Find suggestion by id\n const suggestion = this.suggestions.find((s) => s.id === placeholderText)\n if (suggestion) {\n suggestions.push(suggestion)\n }\n }\n return suggestions\n }\n\n private readonlyState = new Compartment()\n\n override disconnectedCallback(): void {\n super.disconnectedCallback()\n this.editorView?.destroy()\n }\n\n override firstUpdated(): void {\n this.initializeCodeMirror()\n this.updateEditorContent()\n }\n\n override willUpdate(changedProperties: PropertyValues): void {\n super.willUpdate(changedProperties)\n\n if (changedProperties.has('suggestions')) {\n if (this.placeholderMatcher) {\n this.placeholderMatcher.suggestions = this.suggestions || []\n }\n }\n\n if (changedProperties.has('value') && this.editorView) {\n this.updateEditorContent()\n }\n\n if (changedProperties.has('disabled')) {\n this.editorView?.dispatch({\n effects: this.readonlyState.reconfigure(EditorState.readOnly.of(this.disabled)),\n })\n }\n }\n\n /**\n * Initialize CodeMirror editor with extensions\n */\n private initializeCodeMirror(): void {\n const extensions: Extension[] = [\n keymap.of(defaultKeymap),\n syntaxHighlighting(defaultHighlightStyle),\n autocompletion({\n override: [this.createCompletionSource()],\n activateOnTyping: true,\n maxRenderedOptions: 10,\n }),\n EditorView.updateListener.of((update: ViewUpdate) => {\n if (update.docChanged) {\n this.handleEditorChange()\n }\n if (update.focusChanged) {\n this.handleFocusChange(update.view.hasFocus)\n } else if (update.view.hasFocus !== this.isEditorFocus) {\n // If focus state changed without focusChanged event, update manually\n this.handleFocusChange(update.view.hasFocus)\n }\n }),\n this.createPlaceholderPlugin(),\n hoverTooltip(this.createHoverTooltipSource),\n linter((view) => functionLinter(view, this.functionSchemas, (e) => this.dispatchEvent(e))),\n this.readonlyState.of(EditorState.readOnly.of(this.disabled)),\n ]\n\n // Add language support\n if (this.language === 'javascript') {\n extensions.push(javascript())\n }\n\n // Add placeholder\n if (this.placeholder) {\n extensions.push(\n EditorView.contentAttributes.of({\n 'aria-placeholder': this.placeholder,\n })\n )\n }\n\n const state = EditorState.create({\n doc: this.value,\n extensions,\n })\n\n this.editorView = new EditorView({\n state,\n parent: this.editorContainer,\n })\n }\n\n /**\n * Creates the ViewPlugin for rendering suggestion placeholders.\n * This is created as a method to get access to the component's `suggestions`.\n */\n private createPlaceholderPlugin(): Extension {\n const placeholderMatcher = new SuggestionMatchDecorator(/\\{\\{([^}]+)\\}\\}/g, this.suggestions)\n this.placeholderMatcher = placeholderMatcher\n // This class needs to be defined here to have access to the `placeholderMatcher`\n class AtomicDecorationRange {\n placeholders: DecorationSet\n constructor(view: EditorView) {\n this.placeholders = placeholderMatcher.createDeco(view)\n }\n update(update: ViewUpdate) {\n this.placeholders = placeholderMatcher.updateDeco(update, this.placeholders)\n }\n }\n\n return ViewPlugin.fromClass(AtomicDecorationRange, {\n decorations: (instance) => instance.placeholders,\n provide: (plugin) => EditorView.atomicRanges.of((view) => view.plugin(plugin)?.placeholders || Decoration.none),\n })\n }\n\n /**\n * Create completion source for functions and suggestions\n */\n private createCompletionSource(): CompletionSource {\n return (context: CompletionContext): CompletionResult | null => {\n const { pos } = context\n const line = context.state.doc.lineAt(pos)\n const textBefore = line.text.slice(0, pos - line.from)\n\n // Check if we're typing a function name\n const functionMatch = textBefore.match(/(\\w+)$/)\n if (functionMatch) {\n const prefix = functionMatch[1]\n const functions = this.functionSchemas\n .filter((fn) => fn.name.toLowerCase().startsWith(prefix.toLowerCase()))\n .map((fn) => this.createFunctionCompletion(fn))\n\n if (functions.length > 0) {\n return {\n from: pos - prefix.length,\n options: functions,\n }\n }\n }\n\n // Check if we're typing a suggestion trigger (e.g., {{)\n const suggestionMatch = textBefore.match(/\\{\\{([^}]*)$/)\n if (suggestionMatch) {\n const prefix = suggestionMatch[1]\n const suggestions = this.suggestions\n .filter((suggestion) => suggestion.label.toLowerCase().startsWith(prefix.toLowerCase()))\n .map((suggestion) => this.createSuggestionCompletion(suggestion))\n\n if (suggestions.length > 0) {\n return {\n from: pos - prefix.length,\n options: suggestions,\n }\n }\n }\n\n return null\n }\n }\n\n private createFunctionCompletion(schema: FunctionSchema): Completion {\n const result: Completion = {\n label: schema.name,\n detail: schema.description || '',\n type: 'function',\n info: () => this.createFunctionInfoElement(schema),\n apply: (view: EditorView, completion: unknown, from: number, to: number) => {\n const functionCall = this.formatFunctionCall(schema)\n view.dispatch({\n changes: { from, to, insert: functionCall },\n selection: { anchor: from + functionCall.length },\n })\n this.dispatchFunctionInsert(schema, from)\n },\n }\n\n return result\n }\n\n private createSuggestionCompletion(suggestion: Suggestion): Completion {\n const result: Completion = {\n label: suggestion.label,\n detail: suggestion.description || '',\n info: suggestion.suffix || '',\n type: 'variable',\n apply: (view: EditorView, completion: unknown, from: number, to: number) => {\n const placeholderText = `{{${suggestion.id}}}`\n view.dispatch({\n changes: { from: from - 2, to, insert: placeholderText }, // -2 to include the {{\n selection: { anchor: from - 2 + placeholderText.length },\n })\n this.dispatchSuggestionInsert(suggestion, from - 2)\n },\n }\n\n return result\n }\n\n /**\n * Creates the source for the hover tooltips.\n * This is an arrow function to automatically bind `this`.\n */\n private createHoverTooltipSource = (view: EditorView, pos: number): Tooltip | null => {\n const word = view.state.wordAt(pos)\n if (!word) {\n return null\n }\n\n const functionName = view.state.doc.sliceString(word.from, word.to)\n const fnSchema = this.functionSchemas.find((schema) => schema.name === functionName)\n\n if (!fnSchema) {\n return null\n }\n\n return {\n pos: word.from,\n end: word.to,\n above: true,\n create: () => ({ dom: this.createFunctionInfoElement(fnSchema) }),\n }\n }\n\n /**\n * Creates a styled HTML element to display function documentation.\n * This is used for both hover tooltips and autocomplete info panels.\n */\n protected createFunctionInfoElement(fn: FunctionSchema): HTMLElement {\n const container = document.createElement('div')\n container.className = 'function-info' // for styling\n\n if (fn.description) {\n const description = document.createElement('p')\n description.className = 'description'\n description.textContent = fn.description\n container.appendChild(description)\n }\n\n if (fn.parameters && fn.parameters.length > 0) {\n const paramsContainer = document.createElement('div')\n paramsContainer.className = 'parameters'\n\n const paramsHeader = document.createElement('h4')\n paramsHeader.textContent = 'Parameters'\n paramsContainer.appendChild(paramsHeader)\n\n const paramsList = document.createElement('ul')\n fn.parameters.forEach((param) => {\n const listItem = document.createElement('li')\n\n const name = document.createElement('span')\n name.className = 'param-name'\n name.textContent = param.name\n\n const type = document.createElement('span')\n type.className = 'param-type'\n type.textContent = `: ${getTypeStringFromSchema(param.schema)}`\n\n listItem.appendChild(name)\n listItem.appendChild(type)\n\n if (param.schema.description) {\n const paramDesc = document.createElement('p')\n paramDesc.className = 'param-description'\n paramDesc.textContent = param.schema.description\n listItem.appendChild(paramDesc)\n }\n paramsList.appendChild(listItem)\n })\n paramsContainer.appendChild(paramsList)\n container.appendChild(paramsContainer)\n }\n\n if (fn.returns) {\n const returnsContainer = document.createElement('div')\n returnsContainer.className = 'returns'\n\n const returnsHeader = document.createElement('h4')\n returnsHeader.textContent = 'Returns'\n returnsContainer.appendChild(returnsHeader)\n\n const returnsDesc = document.createElement('p')\n const returnType = getTypeStringFromSchema(fn.returns)\n returnsDesc.textContent = fn.returns.description ? `${returnType}: ${fn.returns.description}` : returnType\n returnsContainer.appendChild(returnsDesc)\n container.appendChild(returnsContainer)\n }\n\n // Add documentation button if showDocumentation is enabled\n if (this.showDocumentation) {\n const docContainer = document.createElement('div')\n docContainer.className = 'documentation'\n\n const docButton = document.createElement('ui-button')\n docButton.type = 'button'\n docButton.className = 'documentation-button'\n docButton.textContent = 'Show documentation'\n docButton.setAttribute('aria-label', `Show documentation for ${fn.name} function`)\n\n docButton.addEventListener('click', (event) => {\n event.preventDefault()\n event.stopPropagation()\n this.dispatchFunctionDocumentation(fn)\n })\n\n docContainer.appendChild(docButton)\n container.appendChild(docContainer)\n }\n\n return container\n }\n\n /**\n * Format function call with parameters\n */\n private formatFunctionCall(fn: FunctionSchema): string {\n if (!fn.parameters || fn.parameters.length === 0) {\n return `${fn.name}()`\n }\n\n const params = fn.parameters\n .map((param) => {\n if (param.required) {\n return param.name\n }\n return `${param.name}?`\n })\n .join(', ')\n\n return `${fn.name}(${params})`\n }\n\n /**\n * Update editor content when value changes\n */\n private updateEditorContent(): void {\n if (!this.editorView) return\n\n const currentValue = this.editorView.state.doc.toString()\n if (currentValue !== this.value) {\n this.editorView.dispatch({\n changes: {\n from: 0,\n to: this.editorView.state.doc.length,\n insert: this.value,\n },\n })\n }\n }\n\n /**\n * Handle editor content change\n */\n private handleEditorChange(): void {\n if (!this.editorView) return\n\n const newValue = this.editorView.state.doc.toString()\n this.#value = newValue\n this.hasContent = newValue.length > 0\n\n this.dispatchEvent(new Event('input', { bubbles: true }))\n }\n\n /**\n * Handle focus change\n */\n private handleFocusChange(hasFocus: boolean): void {\n this.isEditorFocus = hasFocus\n\n if (!hasFocus && this.#value !== this._previousValue) {\n this._previousValue = this.#value\n this.dispatchEvent(new Event('change'))\n }\n }\n\n /**\n * Dispatch function insert event\n */\n private dispatchFunctionInsert(functionSchema: FunctionSchema, position: number): void {\n const event = new CustomEvent<FunctionInsertEvent>('functioninsert', {\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>('suggestioninsert', {\n detail: { suggestion, position },\n bubbles: true,\n })\n this.dispatchEvent(event)\n }\n\n /**\n * Dispatch function documentation event\n */\n private dispatchFunctionDocumentation(functionSchema: FunctionSchema): void {\n const event = new CustomEvent<FunctionDocumentationEvent>('docsrequest', {\n detail: { functionSchema },\n bubbles: true,\n })\n this.dispatchEvent(event)\n }\n\n /**\n * Focus the editor\n */\n override focus(): void {\n this.editorView?.focus()\n }\n\n /**\n * Get the editor's current selection\n */\n getSelection(): { from: number; to: number } | null {\n if (!this.editorView) return null\n const { from, to } = this.editorView.state.selection.main\n return { from, to }\n }\n\n /**\n * Insert text at the current cursor position\n */\n insertText(text: string): void {\n if (!this.editorView) return\n\n const { from, to } = this.editorView.state.selection.main\n this.editorView.dispatch({\n changes: { from, to, insert: text },\n selection: { anchor: from + text.length },\n })\n }\n\n override render(): TemplateResult {\n const hasLabel = !!this.label\n const hasSupportingText = !!this.supportingText\n\n return html`\n <div class=\"surface ${classMap({ 'has-focus': this.isEditorFocus, 'invalid': this.invalid })}\">\n <div class=\"content\">\n ${hasLabel ? html`<div class=\"label\">${this.label}</div>` : nothing}\n\n <div class=\"editor-container\" part=\"editor\"></div>\n </div>\n\n ${hasSupportingText ? html`<div class=\"supporting-text\">${this.supportingText}</div>` : nothing}\n </div>\n `\n }\n}\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type PropertyValues, type TemplateResult } from 'lit';
|
|
2
2
|
import { UiElement } from '../../UiElement.js';
|
|
3
3
|
import type { TypedEvents } from '../../../core/types.js';
|
|
4
|
+
import type { ButtonType } from '../../button/internals/button.js';
|
|
4
5
|
import '../../button/ui-button.js';
|
|
5
6
|
export interface UiDialogClosingReason {
|
|
6
7
|
/**
|
|
@@ -31,8 +32,8 @@ export type RenderFunction = () => TemplateResult;
|
|
|
31
32
|
* closing reason detail.
|
|
32
33
|
*
|
|
33
34
|
* ```javascript
|
|
34
|
-
* <ui-button color="text" value="dismiss">Cancel</ui-button>
|
|
35
|
-
* <ui-button color="text" value="confirm">Take action</ui-button>
|
|
35
|
+
* <ui-button slot="button" color="text" value="dismiss">Cancel</ui-button>
|
|
36
|
+
* <ui-button slot="button" color="text" value="confirm">Take action</ui-button>
|
|
36
37
|
* ```
|
|
37
38
|
*
|
|
38
39
|
* ```javascript
|
|
@@ -109,25 +110,6 @@ export default class UiDialog extends UiElement implements TypedEvents<DialogEve
|
|
|
109
110
|
* @attribute
|
|
110
111
|
*/
|
|
111
112
|
accessor destructive: boolean;
|
|
112
|
-
/**
|
|
113
|
-
* Part of the imperative access to the element.
|
|
114
|
-
* When set, it wraps the content in a `<form>` element.
|
|
115
|
-
* When this is enabled the following will happen:
|
|
116
|
-
* - The `confirm` button will get `type="submit"`
|
|
117
|
-
* - The form `method` attribute is set to `dialog`
|
|
118
|
-
* - The form `id` attribute is set to a random string. You can get it from the `formId` getter.
|
|
119
|
-
* - The dialog will dispatch the same `submit` event as the form.
|
|
120
|
-
* - When the `submit` event dispatched by the dialog gets cancelled, then:
|
|
121
|
-
* - The original submit event also gets cancelled.
|
|
122
|
-
* - The default confirm action is not invoked
|
|
123
|
-
* - The dialog stays opened
|
|
124
|
-
* - When the submit event is not cancelled, then:
|
|
125
|
-
* - The default confirm action is invoked.
|
|
126
|
-
* - The dialog is closed.
|
|
127
|
-
*
|
|
128
|
-
* @deprecated Wrap the content in a `<form>` element instead.
|
|
129
|
-
*/
|
|
130
|
-
accessor useForm: boolean | undefined;
|
|
131
113
|
/**
|
|
132
114
|
* Only when `confirmLabel` is set.
|
|
133
115
|
* Defines the value associated with the button's name when it's submitted with the form data.
|
|
@@ -135,6 +117,14 @@ export default class UiDialog extends UiElement implements TypedEvents<DialogEve
|
|
|
135
117
|
* @attribute
|
|
136
118
|
*/
|
|
137
119
|
accessor confirmValue: string | undefined;
|
|
120
|
+
/**
|
|
121
|
+
* The type of the confirm button.
|
|
122
|
+
* This is used to set the button's `type` attribute.
|
|
123
|
+
* If not set, the default is `button`.
|
|
124
|
+
* If set to `submit`, the dialog will trigger the form submission on the parent form.
|
|
125
|
+
* @attribute
|
|
126
|
+
*/
|
|
127
|
+
accessor confirmType: ButtonType | undefined;
|
|
138
128
|
/**
|
|
139
129
|
* When the dialog is wrapped in a form, set this to `true` to close the dialog
|
|
140
130
|
* when the form is submitted.
|
|
@@ -142,6 +132,7 @@ export default class UiDialog extends UiElement implements TypedEvents<DialogEve
|
|
|
142
132
|
* Note that the dialog doesn't perform any validation of the form. It only closes
|
|
143
133
|
* when the form is submitted, regardless of the application logic. The `submit` event
|
|
144
134
|
* is dispatched by the dialog when the form is valid.
|
|
135
|
+
* @attribute
|
|
145
136
|
*/
|
|
146
137
|
accessor submitClose: boolean | undefined;
|
|
147
138
|
/**
|
|
@@ -159,22 +150,9 @@ export default class UiDialog extends UiElement implements TypedEvents<DialogEve
|
|
|
159
150
|
* This is passed to the close event.
|
|
160
151
|
*/
|
|
161
152
|
dialogValue?: unknown;
|
|
162
|
-
/**
|
|
163
|
-
* @deprecated Use `useForm` instead.
|
|
164
|
-
*/
|
|
165
|
-
get formId(): string | undefined;
|
|
166
153
|
constructor();
|
|
167
|
-
/**
|
|
168
|
-
* Allows to inject a template into the internals of the element.
|
|
169
|
-
* This is helpful when working with imperative dialogs.
|
|
170
|
-
* @param content The content to inject into the body.
|
|
171
|
-
* @deprecated This will be removed in the future. To use forms, wrap the content in a `<form>` element.
|
|
172
|
-
*/
|
|
173
|
-
inject(content?: TemplateResult | RenderFunction, styles?: CSSResultOrNative[]): void;
|
|
174
154
|
connectedCallback(): void;
|
|
175
155
|
disconnectedCallback(): void;
|
|
176
|
-
protected firstUpdated(): void;
|
|
177
|
-
willUpdate(cp: PropertyValues<this>): void;
|
|
178
156
|
protected handleFormSubmit(): void;
|
|
179
157
|
handleClick(e: MouseEvent): void;
|
|
180
158
|
handleKeyDown(e: KeyboardEvent): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../../../../src/md/dialog/internals/Dialog.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../../../../src/md/dialog/internals/Dialog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,KAAK,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