@luzmo/analytics-components-kit 1.0.1-alpha.140 → 1.0.1-alpha.142

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 (52) hide show
  1. package/README.md +17 -5
  2. package/angular/components/ai-interaction-textarea.component.ts +2 -0
  3. package/angular/components/grid.component.ts +2 -2
  4. package/angular/esm/components/ai-interaction-textarea.component.d.ts +2 -1
  5. package/angular/esm/components/ai-interaction-textarea.component.js +7 -2
  6. package/angular/esm/components/grid.component.d.ts +2 -2
  7. package/angular/esm/types/ai-chat.types.d.ts +1 -0
  8. package/angular/types/ai-chat.types.ts +1 -0
  9. package/components/ai-chat/ai-chat.d.ts +21 -1
  10. package/components/ai-chat/index.cjs +1 -1
  11. package/components/ai-chat/index.d.ts +1 -0
  12. package/components/ai-chat/index.js +3 -3
  13. package/components/ai-chat/request-contract.d.ts +38 -0
  14. package/components/{ai-chat-Dg2dvhDq.js → ai-chat-DlUYd_Cf.js} +211 -151
  15. package/components/ai-chat-rok8ar11.cjs +62 -0
  16. package/components/ai-interaction-textarea/ai-interaction-textarea.d.ts +6 -0
  17. package/components/ai-interaction-textarea/index.cjs +1 -1
  18. package/components/ai-interaction-textarea/index.js +1 -1
  19. package/components/{ai-interaction-textarea-DDVKMfTQ.cjs → ai-interaction-textarea-BGnQbDpJ.cjs} +2 -2
  20. package/components/{ai-interaction-textarea-ZDQPVgXC.js → ai-interaction-textarea-EdWcPK0w.js} +6 -3
  21. package/components/grid/grid.d.ts +4 -9
  22. package/components/grid/helpers/grid-effects.d.ts +1 -0
  23. package/components/grid/helpers/grid-events.d.ts +50 -0
  24. package/components/grid/helpers/grid-interactions.d.ts +91 -0
  25. package/components/grid/helpers/grid-item-management.d.ts +45 -0
  26. package/components/grid/helpers/grid-item-popover.d.ts +15 -0
  27. package/components/grid/helpers/grid-items.d.ts +9 -0
  28. package/components/grid/helpers/grid-keyboard-updates.d.ts +18 -0
  29. package/components/grid/helpers/grid-keydown-event.d.ts +18 -0
  30. package/components/grid/helpers/grid-popover-cleanup.d.ts +4 -0
  31. package/components/grid/helpers/grid-rendering.d.ts +63 -0
  32. package/components/grid/helpers/grid-stack-lifecycle.d.ts +26 -0
  33. package/components/grid/helpers/grid-theme.d.ts +16 -0
  34. package/components/grid/helpers/grid-update-cycle.d.ts +24 -0
  35. package/components/grid/index.cjs +1 -1
  36. package/components/grid/index.js +1 -1
  37. package/components/grid-BNbbl-9p.cjs +316 -0
  38. package/components/{grid-BW6LPvCu.js → grid-Ca-fxUK1.js} +2341 -1965
  39. package/components/index.cjs +1 -1
  40. package/components/index.js +5 -5
  41. package/components/item-data-picker-panel/index.cjs +1 -1
  42. package/components/item-data-picker-panel/index.js +1 -1
  43. package/components/slot-contents-picker/index.cjs +1 -1
  44. package/components/slot-contents-picker/index.js +1 -1
  45. package/components/slot-contents-picker/slot-contents-picker.d.ts +4 -2
  46. package/components/{slot-contents-picker-HRJuZQq5.cjs → slot-contents-picker-BO5lSTDz.cjs} +4 -4
  47. package/components/{slot-contents-picker-CgACNIVS.js → slot-contents-picker-Bw_G1BwZ.js} +112 -92
  48. package/custom-elements.json +1558 -17
  49. package/package.json +2 -2
  50. package/types/ai-chat.types.d.ts +1 -0
  51. package/components/ai-chat-CbqvVZDp.cjs +0 -60
  52. package/components/grid-xtLaTdhb.cjs +0 -316
package/README.md CHANGED
@@ -63,11 +63,12 @@ npm install @luzmo/analytics-components-kit
63
63
 
64
64
  ### Panel Components (Recommended)
65
65
 
66
- | Component | Import | Description |
67
- | --------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------------- |
68
- | Draggable Data Fields Panel | `@luzmo/analytics-components-kit/draggable-data-fields-panel` | Panel displaying draggable data fields from datasets |
69
- | Item Data Drop Panel | `@luzmo/analytics-components-kit/item-data-drop-panel` | Drop panel for chart slot configuration |
70
- | Item Data Picker Panel | `@luzmo/analytics-components-kit/item-data-picker-panel` | Dropdown-based panel for chart slot configuration (mobile-friendly) |
66
+ | Component | Import | Description |
67
+ | --------------------------- | ------------------------------------------------------------- | --------------------------------------------------------------------- |
68
+ | Draggable Data Fields Panel | `@luzmo/analytics-components-kit/draggable-data-fields-panel` | Panel displaying draggable data fields from datasets |
69
+ | Item Data Drop Panel | `@luzmo/analytics-components-kit/item-data-drop-panel` | Drop panel for chart slot configuration |
70
+ | Item Data Picker Panel | `@luzmo/analytics-components-kit/item-data-picker-panel` | Dropdown-based panel for chart slot configuration (mobile-friendly) |
71
+ | AI Chat | `@luzmo/analytics-components-kit/ai-chat` | AI chart prompting UI with internal or external request orchestration |
71
72
 
72
73
  > **Note**: Use `Draggable Data Fields Panel` together with `Item Data Drop Panel` for a complete drag & drop experience. Use `Item Data Picker Panel` as a mobile-friendly alternative; swap between them with media queries.
73
74
  >
@@ -151,6 +152,17 @@ import type {
151
152
  import type { SlotConfig } from '@luzmo/dashboard-contents-types';
152
153
  ```
153
154
 
155
+ Import AI chat types from the ai-chat component:
156
+
157
+ ```typescript
158
+ import type {
159
+ AiMessageRequestBody,
160
+ LuzmoPromptSubmittedEventDetail,
161
+ BuildAiMessageRequestOptions
162
+ } from '@luzmo/analytics-components-kit/ai-chat';
163
+ import { buildAiMessageRequest } from '@luzmo/analytics-components-kit/ai-chat';
164
+ ```
165
+
154
166
  Runtime values are exported from the main package (or via `@luzmo/analytics-components-kit/utils`):
155
167
 
156
168
  ```typescript
@@ -18,6 +18,7 @@ import type { Dataset } from '../types';
18
18
  [attr.hide-dataset-button]="hideDatasetButton"
19
19
  [attr.is-generating]="isGenerating"
20
20
  [attr.value]="value"
21
+ [attr.retain-on-submit]="retainOnSubmit"
21
22
  (prompt-submitted)="promptSubmitted.emit($event)">
22
23
  <ng-content></ng-content>
23
24
  </luzmo-ai-interaction-textarea>`
@@ -35,5 +36,6 @@ export class AiInteractionTextareaComponent {
35
36
  @Input() hideDatasetButton?: boolean;
36
37
  @Input() isGenerating?: boolean;
37
38
  @Input() value?: string;
39
+ @Input() retainOnSubmit?: boolean;
38
40
  @Output() promptSubmitted = new EventEmitter<CustomEvent>();
39
41
  }
@@ -1,5 +1,5 @@
1
1
  import { Component, Input, Output, EventEmitter, ChangeDetectionStrategy } from '@angular/core';
2
- import type { Placement, InputActionGroup, GridItemData, GridItemRenderer } from '../types';
2
+ import type { Placement, InputActionGroup, ThemeConfig, GridItemData, GridItemRenderer } from '../types';
3
3
 
4
4
  @Component({
5
5
  selector: 'luzmo-grid',
@@ -40,7 +40,7 @@ export class GridComponent {
40
40
  @Input() viewMode?: boolean;
41
41
  @Input() placementItemActionsMenu?: Placement;
42
42
  @Input() defaultItemActionsMenu?: InputActionGroup[];
43
- @Input() theme?: any;
43
+ @Input() theme?: ThemeConfig;
44
44
  @Input() items?: GridItemData[];
45
45
  @Input() renderers?: Record<string, GridItemRenderer>;
46
46
  @Output() luzmoGridItemAction = new EventEmitter<CustomEvent>();
@@ -14,7 +14,8 @@ export declare class AiInteractionTextareaComponent {
14
14
  hideDatasetButton?: boolean;
15
15
  isGenerating?: boolean;
16
16
  value?: string;
17
+ retainOnSubmit?: boolean;
17
18
  promptSubmitted: EventEmitter<CustomEvent<any>>;
18
19
  static ɵfac: i0.ɵɵFactoryDeclaration<AiInteractionTextareaComponent, never>;
19
- static ɵcmp: i0.ɵɵComponentDeclaration<AiInteractionTextareaComponent, "luzmo-ai-interaction-textarea", never, { "placeholder": { "alias": "placeholder"; "required": false; }; "selectedDatasets": { "alias": "selectedDatasets"; "required": false; }; "authKey": { "alias": "authKey"; "required": false; }; "authToken": { "alias": "authToken"; "required": false; }; "apiUrl": { "alias": "apiUrl"; "required": false; }; "appServer": { "alias": "appServer"; "required": false; }; "flagOpendata": { "alias": "flagOpendata"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "singleLine": { "alias": "singleLine"; "required": false; }; "hideDatasetButton": { "alias": "hideDatasetButton"; "required": false; }; "isGenerating": { "alias": "isGenerating"; "required": false; }; "value": { "alias": "value"; "required": false; }; }, { "promptSubmitted": "promptSubmitted"; }, never, ["*"], true, never>;
20
+ static ɵcmp: i0.ɵɵComponentDeclaration<AiInteractionTextareaComponent, "luzmo-ai-interaction-textarea", never, { "placeholder": { "alias": "placeholder"; "required": false; }; "selectedDatasets": { "alias": "selectedDatasets"; "required": false; }; "authKey": { "alias": "authKey"; "required": false; }; "authToken": { "alias": "authToken"; "required": false; }; "apiUrl": { "alias": "apiUrl"; "required": false; }; "appServer": { "alias": "appServer"; "required": false; }; "flagOpendata": { "alias": "flagOpendata"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "singleLine": { "alias": "singleLine"; "required": false; }; "hideDatasetButton": { "alias": "hideDatasetButton"; "required": false; }; "isGenerating": { "alias": "isGenerating"; "required": false; }; "value": { "alias": "value"; "required": false; }; "retainOnSubmit": { "alias": "retainOnSubmit"; "required": false; }; }, { "promptSubmitted": "promptSubmitted"; }, never, ["*"], true, never>;
20
21
  }
@@ -13,9 +13,10 @@ export class AiInteractionTextareaComponent {
13
13
  hideDatasetButton;
14
14
  isGenerating;
15
15
  value;
16
+ retainOnSubmit;
16
17
  promptSubmitted = new EventEmitter();
17
18
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.3", ngImport: i0, type: AiInteractionTextareaComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
18
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.2.3", type: AiInteractionTextareaComponent, isStandalone: true, selector: "luzmo-ai-interaction-textarea", inputs: { placeholder: "placeholder", selectedDatasets: "selectedDatasets", authKey: "authKey", authToken: "authToken", apiUrl: "apiUrl", appServer: "appServer", flagOpendata: "flagOpendata", disabled: "disabled", singleLine: "singleLine", hideDatasetButton: "hideDatasetButton", isGenerating: "isGenerating", value: "value" }, outputs: { promptSubmitted: "promptSubmitted" }, ngImport: i0, template: `<luzmo-ai-interaction-textarea
19
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.2.3", type: AiInteractionTextareaComponent, isStandalone: true, selector: "luzmo-ai-interaction-textarea", inputs: { placeholder: "placeholder", selectedDatasets: "selectedDatasets", authKey: "authKey", authToken: "authToken", apiUrl: "apiUrl", appServer: "appServer", flagOpendata: "flagOpendata", disabled: "disabled", singleLine: "singleLine", hideDatasetButton: "hideDatasetButton", isGenerating: "isGenerating", value: "value", retainOnSubmit: "retainOnSubmit" }, outputs: { promptSubmitted: "promptSubmitted" }, ngImport: i0, template: `<luzmo-ai-interaction-textarea
19
20
  [attr.placeholder]="placeholder"
20
21
  [attr.selectedDatasets]="selectedDatasets"
21
22
  [attr.auth-key]="authKey"
@@ -28,9 +29,10 @@ export class AiInteractionTextareaComponent {
28
29
  [attr.hide-dataset-button]="hideDatasetButton"
29
30
  [attr.is-generating]="isGenerating"
30
31
  [attr.value]="value"
32
+ [attr.retain-on-submit]="retainOnSubmit"
31
33
  (prompt-submitted)="promptSubmitted.emit($event)">
32
34
  <ng-content></ng-content>
33
- </luzmo-ai-interaction-textarea>`, isInline: true, dependencies: [{ kind: "component", type: AiInteractionTextareaComponent, selector: "luzmo-ai-interaction-textarea", inputs: ["placeholder", "selectedDatasets", "authKey", "authToken", "apiUrl", "appServer", "flagOpendata", "disabled", "singleLine", "hideDatasetButton", "isGenerating", "value"], outputs: ["promptSubmitted"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
35
+ </luzmo-ai-interaction-textarea>`, isInline: true, dependencies: [{ kind: "component", type: AiInteractionTextareaComponent, selector: "luzmo-ai-interaction-textarea", inputs: ["placeholder", "selectedDatasets", "authKey", "authToken", "apiUrl", "appServer", "flagOpendata", "disabled", "singleLine", "hideDatasetButton", "isGenerating", "value", "retainOnSubmit"], outputs: ["promptSubmitted"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
34
36
  }
35
37
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.3", ngImport: i0, type: AiInteractionTextareaComponent, decorators: [{
36
38
  type: Component,
@@ -51,6 +53,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.3", ngImpor
51
53
  [attr.hide-dataset-button]="hideDatasetButton"
52
54
  [attr.is-generating]="isGenerating"
53
55
  [attr.value]="value"
56
+ [attr.retain-on-submit]="retainOnSubmit"
54
57
  (prompt-submitted)="promptSubmitted.emit($event)">
55
58
  <ng-content></ng-content>
56
59
  </luzmo-ai-interaction-textarea>`
@@ -79,6 +82,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.3", ngImpor
79
82
  type: Input
80
83
  }], value: [{
81
84
  type: Input
85
+ }], retainOnSubmit: [{
86
+ type: Input
82
87
  }], promptSubmitted: [{
83
88
  type: Output
84
89
  }] } });
@@ -1,5 +1,5 @@
1
1
  import { EventEmitter } from '@angular/core';
2
- import type { Placement, InputActionGroup, GridItemData, GridItemRenderer } from '../types';
2
+ import type { Placement, InputActionGroup, ThemeConfig, GridItemData, GridItemRenderer } from '../types';
3
3
  import * as i0 from "@angular/core";
4
4
  export declare class GridComponent {
5
5
  appServer?: string;
@@ -14,7 +14,7 @@ export declare class GridComponent {
14
14
  viewMode?: boolean;
15
15
  placementItemActionsMenu?: Placement;
16
16
  defaultItemActionsMenu?: InputActionGroup[];
17
- theme?: any;
17
+ theme?: ThemeConfig;
18
18
  items?: GridItemData[];
19
19
  renderers?: Record<string, GridItemRenderer>;
20
20
  luzmoGridItemAction: EventEmitter<CustomEvent<any>>;
@@ -40,4 +40,5 @@ export interface AISampleChart {
40
40
  feedback: unknown;
41
41
  conversationId?: string;
42
42
  message?: string;
43
+ clarificationQuestion?: string;
43
44
  }
@@ -40,4 +40,5 @@ export interface AISampleChart {
40
40
  feedback: unknown;
41
41
  conversationId?: string;
42
42
  message?: string;
43
+ clarificationQuestion?: string;
43
44
  }
@@ -7,6 +7,7 @@ import '../ai-interaction-textarea';
7
7
  * @name luzmo-ai-chat
8
8
  * @summary A complete AI chat interface combining messages display and input
9
9
  * @fires luzmo-message-sent - Fired when a user sends a message
10
+ * @fires luzmo-prompt-submitted - Fired when request-mode is set to external so the host can execute the API request lifecycle.
10
11
  * @fires luzmo-response-received - Fired when an AI text response is received. For chart responses, this event is only fired if the response includes a `message` field. For error responses, this event is always fired with the error explanation.
11
12
  * @fires luzmo-chart-generated - Fired when the AI generates a chart (includes generatedChart in response)
12
13
  */
@@ -64,6 +65,16 @@ export declare class LuzmoAiChat extends LuzmoElement {
64
65
  * @default 'performance'
65
66
  */
66
67
  modelPreference: 'performance' | 'quality';
68
+ /**
69
+ * Controls if API calls are handled internally or by the host application.
70
+ * @default 'internal'
71
+ */
72
+ requestMode: 'internal' | 'external';
73
+ /**
74
+ * Used only in external request mode to reflect request lifecycle in the UI.
75
+ * @default false
76
+ */
77
+ isGenerating: boolean;
67
78
  /**
68
79
  * Conversation ID
69
80
  * @default null
@@ -74,9 +85,15 @@ export declare class LuzmoAiChat extends LuzmoElement {
74
85
  * @default null
75
86
  */
76
87
  chart: LuzmoChart | null;
77
- private _isGenerating;
88
+ /**
89
+ * API version
90
+ * @default '0.1.0'
91
+ */
92
+ apiVersion: string;
93
+ private _isGeneratingInternal;
78
94
  private _textareaValue;
79
95
  private _generateMessageId;
96
+ private _buildRequestBody;
80
97
  private _sendMessage;
81
98
  private _addUserMessage;
82
99
  private _prepareForAIResponse;
@@ -85,6 +102,9 @@ export declare class LuzmoAiChat extends LuzmoElement {
85
102
  private _processAIResponse;
86
103
  private _handleAPIError;
87
104
  private _finalizeAIResponse;
105
+ private _handleDatasetSelected;
106
+ private _handleDatasetRemoved;
107
+ private _emitDatasetsChanged;
88
108
  private _handlePromptSubmitted;
89
109
  private _scrollToBottom;
90
110
  /**
@@ -17,4 +17,4 @@
17
17
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
18
18
  * SOFTWARE.
19
19
  * */
20
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../base-C_azywlB.cjs`),require(`../focus-visible-3ACCHno4.cjs`),require(`../set-locale-CKjJZRH6.cjs`),require(`../localized-mixin-DTvVLuXW.cjs`);const e=require(`../ai-chat-CbqvVZDp.cjs`);require(`../dataset-icon-BbNgugDA.cjs`),require(`../data-broker-BUIUM5hr.cjs`),require(`../dataset-selector-list-BdeJlo0u.cjs`),require(`../dataset-selector-row-CAlRVIk_.cjs`),require(`../ai-interaction-textarea-DDVKMfTQ.cjs`),exports.LuzmoAiChat=e.t;
20
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../base-C_azywlB.cjs`),require(`../focus-visible-3ACCHno4.cjs`),require(`../set-locale-CKjJZRH6.cjs`),require(`../localized-mixin-DTvVLuXW.cjs`);const e=require(`../ai-chat-rok8ar11.cjs`);require(`../dataset-icon-BbNgugDA.cjs`),require(`../data-broker-BUIUM5hr.cjs`),require(`../dataset-selector-list-BdeJlo0u.cjs`),require(`../dataset-selector-row-CAlRVIk_.cjs`),require(`../ai-interaction-textarea-BGnQbDpJ.cjs`),exports.LuzmoAiChat=e.t,exports.buildAiMessageRequest=e.n;
@@ -5,3 +5,4 @@ declare global {
5
5
  }
6
6
  }
7
7
  export { LuzmoAiChat } from './ai-chat';
8
+ export * from './request-contract';
@@ -27,10 +27,10 @@ import "../base-rg2x95aL.js";
27
27
  import "../focus-visible-D1pJhWEh.js";
28
28
  import "../set-locale-Uv6F4uSq.js";
29
29
  import "../localized-mixin-cLT0UbaF.js";
30
- import { t as LuzmoAiChat } from "../ai-chat-Dg2dvhDq.js";
30
+ import { n as buildAiMessageRequest, t as LuzmoAiChat } from "../ai-chat-DlUYd_Cf.js";
31
31
  import "../dataset-icon-x6Q8nhYc.js";
32
32
  import "../data-broker-cLR-t5LM.js";
33
33
  import "../dataset-selector-list-DO_ExOrO.js";
34
34
  import "../dataset-selector-row-VsvdrVDf.js";
35
- import "../ai-interaction-textarea-ZDQPVgXC.js";
36
- export { LuzmoAiChat };
35
+ import "../ai-interaction-textarea-EdWcPK0w.js";
36
+ export { LuzmoAiChat, buildAiMessageRequest };
@@ -0,0 +1,38 @@
1
+ import type { Dataset, LuzmoChart } from '../../types';
2
+ export interface AiMessageRequestBody {
3
+ key: string;
4
+ token: string;
5
+ action: 'create';
6
+ version: string;
7
+ properties: {
8
+ content: {
9
+ role: 'user';
10
+ content: string;
11
+ };
12
+ conversation_id?: string;
13
+ };
14
+ options: {
15
+ available_datasets: string[];
16
+ dataset_id?: string;
17
+ chart?: Record<string, unknown>;
18
+ model_preference: 'performance' | 'quality';
19
+ };
20
+ }
21
+ export interface BuildAiMessageRequestOptions {
22
+ prompt: string;
23
+ datasetIds: string[];
24
+ authKey: string;
25
+ authToken: string;
26
+ conversationId: string | null;
27
+ chart: LuzmoChart | null;
28
+ modelPreference: 'performance' | 'quality';
29
+ apiVersion?: string;
30
+ }
31
+ export interface LuzmoPromptSubmittedEventDetail {
32
+ prompt: string;
33
+ selectedDatasets: Dataset[];
34
+ datasetIds: string[];
35
+ request: AiMessageRequestBody;
36
+ url: string;
37
+ }
38
+ export declare function buildAiMessageRequest(options: BuildAiMessageRequestOptions): AiMessageRequestBody;