@inkindcards/semantic-layer 2.2.6 → 2.4.0
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/dist/components.cjs +1060 -162
- package/dist/components.cjs.map +1 -1
- package/dist/components.d.cts +61 -5
- package/dist/components.d.ts +61 -5
- package/dist/components.js +1056 -163
- package/dist/components.js.map +1 -1
- package/package.json +1 -1
package/dist/components.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { S as SemanticField, d as FieldType, Q as QueryResult } from './types-c5qj4BKB.cjs';
|
|
2
|
+
import { S as SemanticField, d as FieldType, Q as QueryResult, T as TimeGrain } from './types-c5qj4BKB.cjs';
|
|
3
3
|
import React__default from 'react';
|
|
4
4
|
|
|
5
5
|
interface MetricPickerProps {
|
|
@@ -73,7 +73,7 @@ interface DataInspectorProps {
|
|
|
73
73
|
}
|
|
74
74
|
/**
|
|
75
75
|
* Dev-mode overlay that wraps your app in an InspectableRegistry and provides
|
|
76
|
-
* a floating toggle +
|
|
76
|
+
* a floating toggle + unified modal for data migration and report building.
|
|
77
77
|
* Renders the registry context so <Inspectable> children can register.
|
|
78
78
|
*/
|
|
79
79
|
declare function DataInspector({ children }: DataInspectorProps): react_jsx_runtime.JSX.Element;
|
|
@@ -84,20 +84,76 @@ interface FieldMatch {
|
|
|
84
84
|
suggestedField: SemanticField | null;
|
|
85
85
|
confidence: MatchConfidence;
|
|
86
86
|
}
|
|
87
|
+
interface ChartAnalysis {
|
|
88
|
+
dimensionColumns: string[];
|
|
89
|
+
metricColumns: string[];
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Best-effort match of a single column name against the catalog.
|
|
93
|
+
*/
|
|
94
|
+
declare function matchField(column: string, catalog: SemanticField[]): {
|
|
95
|
+
field: SemanticField | null;
|
|
96
|
+
confidence: MatchConfidence;
|
|
97
|
+
};
|
|
87
98
|
/**
|
|
88
99
|
* Match an array of column names against the semantic layer field catalog.
|
|
89
100
|
* Uses three layers: exact name match, normalized match, then display name match.
|
|
90
101
|
*/
|
|
91
102
|
declare function matchFields(columns: string[], catalog: SemanticField[]): FieldMatch[];
|
|
103
|
+
/**
|
|
104
|
+
* Analyze chart data to classify columns as dimensions (string/date values)
|
|
105
|
+
* or metrics (numeric values). Used by the inspector modal to build the
|
|
106
|
+
* query builder UI instead of a flat column-to-field mapping.
|
|
107
|
+
*/
|
|
108
|
+
declare function analyzeChartData(columns: string[], sampleValues: Record<string, unknown>[]): ChartAnalysis;
|
|
92
109
|
|
|
93
110
|
interface FieldMapping {
|
|
94
111
|
column: string;
|
|
95
112
|
field: SemanticField | null;
|
|
96
113
|
}
|
|
114
|
+
interface DimensionMapping {
|
|
115
|
+
column: string;
|
|
116
|
+
field: SemanticField;
|
|
117
|
+
}
|
|
118
|
+
interface MigrationConfig {
|
|
119
|
+
componentLabel: string;
|
|
120
|
+
dimensions: DimensionMapping[];
|
|
121
|
+
metrics: SemanticField[];
|
|
122
|
+
grain: TimeGrain | null;
|
|
123
|
+
originalMetricColumns: string[];
|
|
124
|
+
}
|
|
97
125
|
/**
|
|
98
126
|
* Generate a ready-to-paste Lovable prompt that tells the AI how to migrate
|
|
99
|
-
* a component from
|
|
127
|
+
* a component from hardcoded data to a useSemanticQuery() call.
|
|
128
|
+
*
|
|
129
|
+
* Understands the distinction between dimensions (groupBy) and metrics (values),
|
|
130
|
+
* and produces correct query config with data reshaping instructions.
|
|
100
131
|
*/
|
|
101
|
-
declare function generateMigrationPrompt(
|
|
132
|
+
declare function generateMigrationPrompt(config: MigrationConfig): string;
|
|
133
|
+
|
|
134
|
+
type WidgetType = "line" | "bar" | "area" | "pie" | "table" | "kpi";
|
|
135
|
+
type DashboardLayout = "single" | "two-column" | "dashboard";
|
|
136
|
+
interface WidgetConfig {
|
|
137
|
+
id: string;
|
|
138
|
+
title: string;
|
|
139
|
+
type: WidgetType;
|
|
140
|
+
metrics: SemanticField[];
|
|
141
|
+
groupBy: SemanticField[];
|
|
142
|
+
grain: TimeGrain | null;
|
|
143
|
+
comparisonMetric?: SemanticField;
|
|
144
|
+
}
|
|
145
|
+
interface SharedFilter {
|
|
146
|
+
dimension: SemanticField;
|
|
147
|
+
label: string;
|
|
148
|
+
}
|
|
149
|
+
interface ReportConfig {
|
|
150
|
+
dashboardTitle: string;
|
|
151
|
+
layout: DashboardLayout;
|
|
152
|
+
widgets: WidgetConfig[];
|
|
153
|
+
sharedFilters: SharedFilter[];
|
|
154
|
+
}
|
|
155
|
+
declare function generateReportPrompt(config: ReportConfig): string;
|
|
156
|
+
declare function canOpenInLovable(prompt: string): boolean;
|
|
157
|
+
declare function openInLovable(prompt: string): void;
|
|
102
158
|
|
|
103
|
-
export { AdminDashboard, type AdminDashboardProps, DataCatalog, type DataCatalogProps, DataInspector, type DataInspectorProps, type FieldMapping, type FieldMatch, Inspectable, type InspectableProps, type MatchConfidence, MetricPicker, type MetricPickerProps, ResultsTable, type ResultsTableProps, generateMigrationPrompt, matchFields };
|
|
159
|
+
export { AdminDashboard, type AdminDashboardProps, type ChartAnalysis, type DashboardLayout, DataCatalog, type DataCatalogProps, DataInspector, type DataInspectorProps, type DimensionMapping, type FieldMapping, type FieldMatch, Inspectable, type InspectableProps, type MatchConfidence, MetricPicker, type MetricPickerProps, type MigrationConfig, type ReportConfig, ResultsTable, type ResultsTableProps, type SharedFilter, type WidgetConfig, type WidgetType, analyzeChartData, canOpenInLovable, generateMigrationPrompt, generateReportPrompt, matchField, matchFields, openInLovable };
|
package/dist/components.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { S as SemanticField, d as FieldType, Q as QueryResult } from './types-c5qj4BKB.js';
|
|
2
|
+
import { S as SemanticField, d as FieldType, Q as QueryResult, T as TimeGrain } from './types-c5qj4BKB.js';
|
|
3
3
|
import React__default from 'react';
|
|
4
4
|
|
|
5
5
|
interface MetricPickerProps {
|
|
@@ -73,7 +73,7 @@ interface DataInspectorProps {
|
|
|
73
73
|
}
|
|
74
74
|
/**
|
|
75
75
|
* Dev-mode overlay that wraps your app in an InspectableRegistry and provides
|
|
76
|
-
* a floating toggle +
|
|
76
|
+
* a floating toggle + unified modal for data migration and report building.
|
|
77
77
|
* Renders the registry context so <Inspectable> children can register.
|
|
78
78
|
*/
|
|
79
79
|
declare function DataInspector({ children }: DataInspectorProps): react_jsx_runtime.JSX.Element;
|
|
@@ -84,20 +84,76 @@ interface FieldMatch {
|
|
|
84
84
|
suggestedField: SemanticField | null;
|
|
85
85
|
confidence: MatchConfidence;
|
|
86
86
|
}
|
|
87
|
+
interface ChartAnalysis {
|
|
88
|
+
dimensionColumns: string[];
|
|
89
|
+
metricColumns: string[];
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Best-effort match of a single column name against the catalog.
|
|
93
|
+
*/
|
|
94
|
+
declare function matchField(column: string, catalog: SemanticField[]): {
|
|
95
|
+
field: SemanticField | null;
|
|
96
|
+
confidence: MatchConfidence;
|
|
97
|
+
};
|
|
87
98
|
/**
|
|
88
99
|
* Match an array of column names against the semantic layer field catalog.
|
|
89
100
|
* Uses three layers: exact name match, normalized match, then display name match.
|
|
90
101
|
*/
|
|
91
102
|
declare function matchFields(columns: string[], catalog: SemanticField[]): FieldMatch[];
|
|
103
|
+
/**
|
|
104
|
+
* Analyze chart data to classify columns as dimensions (string/date values)
|
|
105
|
+
* or metrics (numeric values). Used by the inspector modal to build the
|
|
106
|
+
* query builder UI instead of a flat column-to-field mapping.
|
|
107
|
+
*/
|
|
108
|
+
declare function analyzeChartData(columns: string[], sampleValues: Record<string, unknown>[]): ChartAnalysis;
|
|
92
109
|
|
|
93
110
|
interface FieldMapping {
|
|
94
111
|
column: string;
|
|
95
112
|
field: SemanticField | null;
|
|
96
113
|
}
|
|
114
|
+
interface DimensionMapping {
|
|
115
|
+
column: string;
|
|
116
|
+
field: SemanticField;
|
|
117
|
+
}
|
|
118
|
+
interface MigrationConfig {
|
|
119
|
+
componentLabel: string;
|
|
120
|
+
dimensions: DimensionMapping[];
|
|
121
|
+
metrics: SemanticField[];
|
|
122
|
+
grain: TimeGrain | null;
|
|
123
|
+
originalMetricColumns: string[];
|
|
124
|
+
}
|
|
97
125
|
/**
|
|
98
126
|
* Generate a ready-to-paste Lovable prompt that tells the AI how to migrate
|
|
99
|
-
* a component from
|
|
127
|
+
* a component from hardcoded data to a useSemanticQuery() call.
|
|
128
|
+
*
|
|
129
|
+
* Understands the distinction between dimensions (groupBy) and metrics (values),
|
|
130
|
+
* and produces correct query config with data reshaping instructions.
|
|
100
131
|
*/
|
|
101
|
-
declare function generateMigrationPrompt(
|
|
132
|
+
declare function generateMigrationPrompt(config: MigrationConfig): string;
|
|
133
|
+
|
|
134
|
+
type WidgetType = "line" | "bar" | "area" | "pie" | "table" | "kpi";
|
|
135
|
+
type DashboardLayout = "single" | "two-column" | "dashboard";
|
|
136
|
+
interface WidgetConfig {
|
|
137
|
+
id: string;
|
|
138
|
+
title: string;
|
|
139
|
+
type: WidgetType;
|
|
140
|
+
metrics: SemanticField[];
|
|
141
|
+
groupBy: SemanticField[];
|
|
142
|
+
grain: TimeGrain | null;
|
|
143
|
+
comparisonMetric?: SemanticField;
|
|
144
|
+
}
|
|
145
|
+
interface SharedFilter {
|
|
146
|
+
dimension: SemanticField;
|
|
147
|
+
label: string;
|
|
148
|
+
}
|
|
149
|
+
interface ReportConfig {
|
|
150
|
+
dashboardTitle: string;
|
|
151
|
+
layout: DashboardLayout;
|
|
152
|
+
widgets: WidgetConfig[];
|
|
153
|
+
sharedFilters: SharedFilter[];
|
|
154
|
+
}
|
|
155
|
+
declare function generateReportPrompt(config: ReportConfig): string;
|
|
156
|
+
declare function canOpenInLovable(prompt: string): boolean;
|
|
157
|
+
declare function openInLovable(prompt: string): void;
|
|
102
158
|
|
|
103
|
-
export { AdminDashboard, type AdminDashboardProps, DataCatalog, type DataCatalogProps, DataInspector, type DataInspectorProps, type FieldMapping, type FieldMatch, Inspectable, type InspectableProps, type MatchConfidence, MetricPicker, type MetricPickerProps, ResultsTable, type ResultsTableProps, generateMigrationPrompt, matchFields };
|
|
159
|
+
export { AdminDashboard, type AdminDashboardProps, type ChartAnalysis, type DashboardLayout, DataCatalog, type DataCatalogProps, DataInspector, type DataInspectorProps, type DimensionMapping, type FieldMapping, type FieldMatch, Inspectable, type InspectableProps, type MatchConfidence, MetricPicker, type MetricPickerProps, type MigrationConfig, type ReportConfig, ResultsTable, type ResultsTableProps, type SharedFilter, type WidgetConfig, type WidgetType, analyzeChartData, canOpenInLovable, generateMigrationPrompt, generateReportPrompt, matchField, matchFields, openInLovable };
|