@api-client/ui 0.5.11 → 0.5.13

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 (49) hide show
  1. package/build/src/elements/code-editor/code-editor.d.ts +13 -0
  2. package/build/src/elements/code-editor/code-editor.d.ts.map +1 -0
  3. package/build/src/elements/code-editor/code-editor.js +28 -0
  4. package/build/src/elements/code-editor/code-editor.js.map +1 -0
  5. package/build/src/elements/code-editor/internals/CodeEditor.d.ts +159 -0
  6. package/build/src/elements/code-editor/internals/CodeEditor.d.ts.map +1 -0
  7. package/build/src/elements/code-editor/internals/CodeEditor.js +643 -0
  8. package/build/src/elements/code-editor/internals/CodeEditor.js.map +1 -0
  9. package/build/src/elements/code-editor/internals/CodeEditor.styles.d.ts +3 -0
  10. package/build/src/elements/code-editor/internals/CodeEditor.styles.d.ts.map +1 -0
  11. package/build/src/elements/code-editor/internals/CodeEditor.styles.js +154 -0
  12. package/build/src/elements/code-editor/internals/CodeEditor.styles.js.map +1 -0
  13. package/build/src/elements/code-editor/internals/Linter.d.ts +5 -0
  14. package/build/src/elements/code-editor/internals/Linter.d.ts.map +1 -0
  15. package/build/src/elements/code-editor/internals/Linter.js +69 -0
  16. package/build/src/elements/code-editor/internals/Linter.js.map +1 -0
  17. package/build/src/elements/code-editor/internals/PlaceholderWidget.d.ts +20 -0
  18. package/build/src/elements/code-editor/internals/PlaceholderWidget.d.ts.map +1 -0
  19. package/build/src/elements/code-editor/internals/PlaceholderWidget.js +46 -0
  20. package/build/src/elements/code-editor/internals/PlaceholderWidget.js.map +1 -0
  21. package/build/src/elements/code-editor/internals/SuggestionMatchDecorator.d.ts +17 -0
  22. package/build/src/elements/code-editor/internals/SuggestionMatchDecorator.d.ts.map +1 -0
  23. package/build/src/elements/code-editor/internals/SuggestionMatchDecorator.js +31 -0
  24. package/build/src/elements/code-editor/internals/SuggestionMatchDecorator.js.map +1 -0
  25. package/build/src/elements/code-editor/internals/types.d.ts +51 -0
  26. package/build/src/elements/code-editor/internals/types.d.ts.map +1 -0
  27. package/build/src/elements/code-editor/internals/types.js +2 -0
  28. package/build/src/elements/code-editor/internals/types.js.map +1 -0
  29. package/build/src/index.d.ts +2 -0
  30. package/build/src/index.d.ts.map +1 -1
  31. package/build/src/index.js +2 -0
  32. package/build/src/index.js.map +1 -1
  33. package/build/src/md/chip/internals/Chip.styles.d.ts.map +1 -1
  34. package/build/src/md/chip/internals/Chip.styles.js +1 -0
  35. package/build/src/md/chip/internals/Chip.styles.js.map +1 -1
  36. package/demo/elements/code-editor/CodeEditorDemo.ts +212 -0
  37. package/demo/elements/code-editor/index.html +19 -0
  38. package/demo/elements/index.html +3 -0
  39. package/package.json +10 -2
  40. package/src/elements/code-editor/README.md +204 -0
  41. package/src/elements/code-editor/code-editor.ts +24 -0
  42. package/src/elements/code-editor/internals/CodeEditor.styles.ts +154 -0
  43. package/src/elements/code-editor/internals/CodeEditor.ts +589 -0
  44. package/src/elements/code-editor/internals/Linter.ts +85 -0
  45. package/src/elements/code-editor/internals/PlaceholderWidget.ts +50 -0
  46. package/src/elements/code-editor/internals/SuggestionMatchDecorator.ts +36 -0
  47. package/src/elements/code-editor/internals/types.ts +54 -0
  48. package/src/index.ts +10 -0
  49. package/src/md/chip/internals/Chip.styles.ts +1 -0
@@ -0,0 +1,13 @@
1
+ import type { CSSResultOrNative } from 'lit';
2
+ import Element from './internals/CodeEditor.js';
3
+ export declare class CodeEditorElement extends Element {
4
+ static styles: CSSResultOrNative[];
5
+ }
6
+ declare global {
7
+ interface HTMLElementTagNameMap {
8
+ 'code-editor': CodeEditorElement;
9
+ }
10
+ }
11
+ export default CodeEditorElement;
12
+ export type { FunctionSchema, FunctionParameter, Suggestion, FunctionInsertEvent, SuggestionInsertEvent, } from './internals/types.js';
13
+ //# sourceMappingURL=code-editor.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,28 @@
1
+ import { __esDecorate, __runInitializers } from "tslib";
2
+ import { customElement } from 'lit/decorators.js';
3
+ import Element from './internals/CodeEditor.js';
4
+ import styles from './internals/CodeEditor.styles.js';
5
+ let CodeEditorElement = (() => {
6
+ let _classDecorators = [customElement('code-editor')];
7
+ let _classDescriptor;
8
+ let _classExtraInitializers = [];
9
+ let _classThis;
10
+ let _classSuper = Element;
11
+ var CodeEditorElement = class extends _classSuper {
12
+ static { _classThis = this; }
13
+ static {
14
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
15
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
16
+ CodeEditorElement = _classThis = _classDescriptor.value;
17
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
18
+ }
19
+ static styles = [styles];
20
+ static {
21
+ __runInitializers(_classThis, _classExtraInitializers);
22
+ }
23
+ };
24
+ return CodeEditorElement = _classThis;
25
+ })();
26
+ export { CodeEditorElement };
27
+ export default CodeEditorElement;
28
+ //# sourceMappingURL=code-editor.js.map
@@ -0,0 +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"]}
@@ -0,0 +1,159 @@
1
+ import { LitElement, PropertyValues, TemplateResult } from 'lit';
2
+ import type { FunctionSchema, Suggestion } from './types.js';
3
+ import { SuggestionMatchDecorator } from './SuggestionMatchDecorator.js';
4
+ /**
5
+ * A CodeMirror 6 based editor component that supports function autocomplete and suggestion placeholders.
6
+ *
7
+ * Features:
8
+ * - Dynamic function schema loading
9
+ * - Autocomplete for functions and suggestions
10
+ * - Suggestion placeholders with double curly braces ({{suggestion}})
11
+ * - Keyboard navigation
12
+ * - Accessibility support
13
+ *
14
+ * @fires function-insert - When a function is inserted
15
+ * @fires suggestion-insert - When a suggestion is inserted
16
+ * @fires input - When the editor content changes
17
+ * @fires change - When the editor loses focus and content has changed
18
+ */
19
+ export default class CodeEditor extends LitElement {
20
+ /**
21
+ * Shadow root configuration for the component.
22
+ * Uses 'open' mode for accessibility and delegates focus to enable proper focus management.
23
+ */
24
+ static shadowRootOptions: ShadowRootInit;
25
+ /**
26
+ * The label text displayed as placeholder/floating label
27
+ */
28
+ accessor label: string;
29
+ /**
30
+ * Supporting text displayed below the editor
31
+ */
32
+ accessor supportingText: string;
33
+ /**
34
+ * Whether the component is disabled
35
+ */
36
+ accessor disabled: boolean;
37
+ /**
38
+ * Whether the component is in an invalid state
39
+ */
40
+ accessor invalid: boolean;
41
+ /**
42
+ * The name attribute for form integration
43
+ */
44
+ accessor name: string;
45
+ /**
46
+ * Whether the input is required
47
+ */
48
+ accessor required: boolean;
49
+ /**
50
+ * Placeholder text shown when editor is empty
51
+ */
52
+ accessor placeholder: string;
53
+ /**
54
+ * The editor content value
55
+ */
56
+ accessor value: string;
57
+ /**
58
+ * Available function schemas for autocomplete
59
+ */
60
+ accessor functionSchemas: FunctionSchema[];
61
+ /**
62
+ * Available suggestions for autocomplete
63
+ */
64
+ accessor suggestions: Suggestion[];
65
+ /**
66
+ * Whether to use dark theme
67
+ */
68
+ accessor darkTheme: boolean;
69
+ /**
70
+ * Programming language for syntax highlighting
71
+ */
72
+ accessor language: string;
73
+ private accessor editorContainer;
74
+ private accessor hasContent;
75
+ private accessor isEditorFocus;
76
+ private editorView?;
77
+ private _previousValue;
78
+ /**
79
+ * Matcher for suggestion placeholders in the editor.
80
+ */
81
+ placeholderMatcher?: SuggestionMatchDecorator;
82
+ /**
83
+ * Get all suggestions (placeholders) currently in the editor
84
+ */
85
+ get activeSuggestions(): Suggestion[];
86
+ disconnectedCallback(): void;
87
+ firstUpdated(): void;
88
+ willUpdate(changedProperties: PropertyValues): void;
89
+ /**
90
+ * Initialize CodeMirror editor with extensions
91
+ */
92
+ private initializeCodeMirror;
93
+ /**
94
+ * Creates the ViewPlugin for rendering suggestion placeholders.
95
+ * This is created as a method to get access to the component's `suggestions`.
96
+ */
97
+ private createPlaceholderPlugin;
98
+ /**
99
+ * Create completion source for functions and suggestions
100
+ */
101
+ private createCompletionSource;
102
+ private createFunctionCompletion;
103
+ private createSuggestionCompletion;
104
+ /**
105
+ * Creates the source for the hover tooltips.
106
+ * This is an arrow function to automatically bind `this`.
107
+ */
108
+ private createHoverTooltipSource;
109
+ /**
110
+ * Creates a styled HTML element to display function documentation.
111
+ * This is used for both hover tooltips and autocomplete info panels.
112
+ */
113
+ private createFunctionInfoElement;
114
+ /**
115
+ * Format function call with parameters
116
+ */
117
+ private formatFunctionCall;
118
+ /**
119
+ * Update editor content when value changes
120
+ */
121
+ private updateEditorContent;
122
+ /**
123
+ * Update editor state (e.g., disabled state)
124
+ */
125
+ private updateEditorState;
126
+ /**
127
+ * Handle editor content change
128
+ */
129
+ private handleEditorChange;
130
+ /**
131
+ * Handle focus change
132
+ */
133
+ private handleFocusChange;
134
+ /**
135
+ * Dispatch function insert event
136
+ */
137
+ private dispatchFunctionInsert;
138
+ /**
139
+ * Dispatch suggestion insert event
140
+ */
141
+ private dispatchSuggestionInsert;
142
+ /**
143
+ * Focus the editor
144
+ */
145
+ focus(): void;
146
+ /**
147
+ * Get the editor's current selection
148
+ */
149
+ getSelection(): {
150
+ from: number;
151
+ to: number;
152
+ } | null;
153
+ /**
154
+ * Insert text at the current cursor position
155
+ */
156
+ insertText(text: string): void;
157
+ render(): TemplateResult;
158
+ }
159
+ //# sourceMappingURL=CodeEditor.d.ts.map
@@ -0,0 +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,C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