@sqlrooms/kepler 0.29.0-rc.7 → 0.29.0-rc.8
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/LICENSE.md +2 -1
- package/README.md +121 -4
- package/dist/KeplerSlice.d.ts +55 -2
- package/dist/KeplerSlice.d.ts.map +1 -1
- package/dist/KeplerSlice.js +92 -15
- package/dist/KeplerSlice.js.map +1 -1
- package/dist/components/CustomFilterManager.d.ts.map +1 -1
- package/dist/components/CustomFilterManager.js +16 -4
- package/dist/components/CustomFilterManager.js.map +1 -1
- package/dist/components/CustomLayerManager.d.ts.map +1 -1
- package/dist/components/CustomLayerManager.js +23 -110
- package/dist/components/CustomLayerManager.js.map +1 -1
- package/dist/components/CustomMapLegendPanel.d.ts +1 -1
- package/dist/components/CustomMapLegendPanel.d.ts.map +1 -1
- package/dist/components/CustomMapLegendPanel.js +14 -6
- package/dist/components/CustomMapLegendPanel.js.map +1 -1
- package/dist/components/CustomSourceDataSelector.d.ts +18 -0
- package/dist/components/CustomSourceDataSelector.d.ts.map +1 -0
- package/dist/components/CustomSourceDataSelector.js +130 -0
- package/dist/components/CustomSourceDataSelector.js.map +1 -0
- package/dist/components/KeplerInjector.d.ts.map +1 -1
- package/dist/components/KeplerInjector.js +3 -1
- package/dist/components/KeplerInjector.js.map +1 -1
- package/dist/components/KeplerMapContainer.d.ts.map +1 -1
- package/dist/components/KeplerMapContainer.js +9 -2
- package/dist/components/KeplerMapContainer.js.map +1 -1
- package/dist/components/KeplerProvider.d.ts.map +1 -1
- package/dist/components/KeplerProvider.js +3 -1
- package/dist/components/KeplerProvider.js.map +1 -1
- package/dist/components/KeplerTableSourceSelector.d.ts +20 -0
- package/dist/components/KeplerTableSourceSelector.d.ts.map +1 -0
- package/dist/components/KeplerTableSourceSelector.js +21 -0
- package/dist/components/KeplerTableSourceSelector.js.map +1 -0
- package/dist/index.d.ts +6 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/keplerTableSelection.d.ts +142 -0
- package/dist/keplerTableSelection.d.ts.map +1 -0
- package/dist/keplerTableSelection.js +231 -0
- package/dist/keplerTableSelection.js.map +1 -0
- package/dist/styles/theme.d.ts +12 -0
- package/dist/styles/theme.d.ts.map +1 -1
- package/dist/styles/theme.js +12 -0
- package/dist/styles/theme.js.map +1 -1
- package/package.json +13 -7
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
const UNLOADED_TABLE_COLOR = [143, 149, 161];
|
|
2
|
+
function resolveDefaultDbSchema(options = {}) {
|
|
3
|
+
if (typeof options.defaultDbSchema === 'function') {
|
|
4
|
+
return options.defaultDbSchema();
|
|
5
|
+
}
|
|
6
|
+
if (options.defaultDbSchema) {
|
|
7
|
+
return options.defaultDbSchema;
|
|
8
|
+
}
|
|
9
|
+
return undefined;
|
|
10
|
+
}
|
|
11
|
+
function tableMatchesDbSchema(table, reference) {
|
|
12
|
+
if (!reference) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
if (!reference.database || !reference.schema) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
return (table.table.database === reference.database &&
|
|
19
|
+
table.table.schema === reference.schema);
|
|
20
|
+
}
|
|
21
|
+
function getKeplerTableKey(table) {
|
|
22
|
+
if (!table) {
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
return [
|
|
26
|
+
table.table.database ?? '',
|
|
27
|
+
table.table.schema ?? '',
|
|
28
|
+
table.table.table,
|
|
29
|
+
].join('.');
|
|
30
|
+
}
|
|
31
|
+
function getKeplerDatasetLabel(datasetId, dataset, table, tableSelection) {
|
|
32
|
+
if (table) {
|
|
33
|
+
return getKeplerTableLabel(table, tableSelection);
|
|
34
|
+
}
|
|
35
|
+
if (dataset?.label) {
|
|
36
|
+
return dataset.label;
|
|
37
|
+
}
|
|
38
|
+
return datasetId;
|
|
39
|
+
}
|
|
40
|
+
function getKeplerDatasetColor(dataset) {
|
|
41
|
+
return dataset?.color ?? UNLOADED_TABLE_COLOR;
|
|
42
|
+
}
|
|
43
|
+
function findMatchingKeplerTableForDatasetId(tables, datasetId, options = {}) {
|
|
44
|
+
if (options.findTableForDatasetId) {
|
|
45
|
+
return options.findTableForDatasetId(tables, datasetId);
|
|
46
|
+
}
|
|
47
|
+
const defaultDbSchema = resolveDefaultDbSchema(options);
|
|
48
|
+
for (const table of tables) {
|
|
49
|
+
if (table.table.toString() === datasetId) {
|
|
50
|
+
return table;
|
|
51
|
+
}
|
|
52
|
+
if (tableMatchesDbSchema(table, defaultDbSchema) &&
|
|
53
|
+
table.table.table === datasetId) {
|
|
54
|
+
return table;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Return whether a DuckDB table should be exposed as a Kepler layer source.
|
|
61
|
+
*
|
|
62
|
+
* This is the shared gate used by Add Layer table options and by host UIs that
|
|
63
|
+
* offer their own "add table to map" actions.
|
|
64
|
+
*/
|
|
65
|
+
export function shouldIncludeKeplerTable(table, options = {}) {
|
|
66
|
+
if (!options.includeTable) {
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
return options.includeTable(table);
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Choose the dataset id that should be written into new Kepler layer config.
|
|
73
|
+
*
|
|
74
|
+
* By default, tables in `defaultDbSchema` use bare ids (`places`) and all
|
|
75
|
+
* other tables use qualified SQL references. Hosts can override this with
|
|
76
|
+
* `getDatasetIdForTable`.
|
|
77
|
+
*/
|
|
78
|
+
export function getKeplerDatasetIdForTable(table, options = {}) {
|
|
79
|
+
if (options.getDatasetIdForTable) {
|
|
80
|
+
return options.getDatasetIdForTable(table);
|
|
81
|
+
}
|
|
82
|
+
const defaultDbSchema = resolveDefaultDbSchema(options);
|
|
83
|
+
if (tableMatchesDbSchema(table, defaultDbSchema)) {
|
|
84
|
+
return table.table.table;
|
|
85
|
+
}
|
|
86
|
+
return table.table.toString();
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Build a human-facing table label from raw catalog parts.
|
|
90
|
+
*
|
|
91
|
+
* Labels omit `defaultDbSchema` and do not include SQL identifier quotes.
|
|
92
|
+
* They are display-only; option values still carry the stable dataset id.
|
|
93
|
+
*/
|
|
94
|
+
export function getKeplerTableLabel(table, options = {}) {
|
|
95
|
+
if (options.getTableLabel) {
|
|
96
|
+
return options.getTableLabel(table);
|
|
97
|
+
}
|
|
98
|
+
const defaultDbSchema = resolveDefaultDbSchema(options);
|
|
99
|
+
const labelParts = [];
|
|
100
|
+
if (!defaultDbSchema && table.table.database) {
|
|
101
|
+
labelParts.push(table.table.database);
|
|
102
|
+
}
|
|
103
|
+
if (defaultDbSchema &&
|
|
104
|
+
table.table.database &&
|
|
105
|
+
table.table.database !== defaultDbSchema.database) {
|
|
106
|
+
labelParts.push(table.table.database);
|
|
107
|
+
}
|
|
108
|
+
if (!defaultDbSchema && table.table.schema) {
|
|
109
|
+
labelParts.push(table.table.schema);
|
|
110
|
+
}
|
|
111
|
+
if (defaultDbSchema &&
|
|
112
|
+
table.table.schema &&
|
|
113
|
+
table.table.schema !== defaultDbSchema.schema) {
|
|
114
|
+
labelParts.push(table.table.schema);
|
|
115
|
+
}
|
|
116
|
+
labelParts.push(table.table.table);
|
|
117
|
+
return labelParts.join('.');
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Resolve a saved Kepler dataset id back to the DuckDB table it should load.
|
|
121
|
+
*
|
|
122
|
+
* The default resolver accepts qualified table references and bare ids inside
|
|
123
|
+
* `defaultDbSchema`. Tables rejected by `includeTable` are ignored.
|
|
124
|
+
*/
|
|
125
|
+
export function findKeplerTableForDatasetId(tables, datasetId, options = {}) {
|
|
126
|
+
const table = findMatchingKeplerTableForDatasetId(tables, datasetId, options);
|
|
127
|
+
if (!table) {
|
|
128
|
+
return undefined;
|
|
129
|
+
}
|
|
130
|
+
if (!shouldIncludeKeplerTable(table, options)) {
|
|
131
|
+
return undefined;
|
|
132
|
+
}
|
|
133
|
+
return table;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Build source picker options from loaded Kepler datasets plus unloaded DuckDB
|
|
137
|
+
* tables that are allowed by the table-selection policy.
|
|
138
|
+
*
|
|
139
|
+
* Loaded Kepler datasets keep their existing dataset ids so selecting them does
|
|
140
|
+
* not duplicate data. Unloaded tables use `getKeplerDatasetIdForTable`.
|
|
141
|
+
*/
|
|
142
|
+
export function buildKeplerTableSourceOptions({ dbTables, datasets = {}, includeUnloadedTables = true, loadedDatasetIds, tableSelection = {}, }) {
|
|
143
|
+
const optionsByValue = new Map();
|
|
144
|
+
const loadedTableKeys = new Set();
|
|
145
|
+
const loadedIds = loadedDatasetIds ?? Object.keys(datasets);
|
|
146
|
+
for (const datasetId of loadedIds) {
|
|
147
|
+
const table = findMatchingKeplerTableForDatasetId(dbTables, datasetId, tableSelection);
|
|
148
|
+
const tableKey = getKeplerTableKey(table);
|
|
149
|
+
if (tableKey) {
|
|
150
|
+
loadedTableKeys.add(tableKey);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
for (const [datasetId, dataset] of Object.entries(datasets)) {
|
|
154
|
+
const table = findMatchingKeplerTableForDatasetId(dbTables, datasetId, tableSelection);
|
|
155
|
+
if (table && !shouldIncludeKeplerTable(table, tableSelection)) {
|
|
156
|
+
continue;
|
|
157
|
+
}
|
|
158
|
+
const label = getKeplerDatasetLabel(datasetId, dataset, table, tableSelection);
|
|
159
|
+
optionsByValue.set(datasetId, {
|
|
160
|
+
value: datasetId,
|
|
161
|
+
label,
|
|
162
|
+
color: getKeplerDatasetColor(dataset),
|
|
163
|
+
isLoaded: true,
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
if (includeUnloadedTables) {
|
|
167
|
+
for (const table of dbTables) {
|
|
168
|
+
if (!shouldIncludeKeplerTable(table, tableSelection)) {
|
|
169
|
+
continue;
|
|
170
|
+
}
|
|
171
|
+
const tableKey = getKeplerTableKey(table);
|
|
172
|
+
if (tableKey && loadedTableKeys.has(tableKey)) {
|
|
173
|
+
continue;
|
|
174
|
+
}
|
|
175
|
+
const value = getKeplerDatasetIdForTable(table, tableSelection);
|
|
176
|
+
if (optionsByValue.has(value)) {
|
|
177
|
+
continue;
|
|
178
|
+
}
|
|
179
|
+
optionsByValue.set(value, {
|
|
180
|
+
value,
|
|
181
|
+
label: getKeplerTableLabel(table, tableSelection),
|
|
182
|
+
color: UNLOADED_TABLE_COLOR,
|
|
183
|
+
isLoaded: false,
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
return Array.from(optionsByValue.values()).sort((left, right) => left.label.localeCompare(right.label) ||
|
|
188
|
+
left.value.localeCompare(right.value));
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Build Add Layer dropdown options from DuckDB tables plus datasets that are
|
|
192
|
+
* already loaded into Kepler.
|
|
193
|
+
*
|
|
194
|
+
* `includeTable` controls which DuckDB tables are exposed. Already-loaded
|
|
195
|
+
* dataset ids are included unless they resolve to an excluded table or duplicate
|
|
196
|
+
* an exposed table option.
|
|
197
|
+
*/
|
|
198
|
+
export function buildKeplerTableLayerOptions(dbTables, keplerDatasetIds, options = {}) {
|
|
199
|
+
const optionsByValue = new Map();
|
|
200
|
+
for (const table of dbTables) {
|
|
201
|
+
if (!shouldIncludeKeplerTable(table, options)) {
|
|
202
|
+
continue;
|
|
203
|
+
}
|
|
204
|
+
const value = getKeplerDatasetIdForTable(table, options);
|
|
205
|
+
const label = getKeplerTableLabel(table, options);
|
|
206
|
+
optionsByValue.set(value, label);
|
|
207
|
+
}
|
|
208
|
+
for (const id of keplerDatasetIds) {
|
|
209
|
+
const table = findMatchingKeplerTableForDatasetId(dbTables, id, options);
|
|
210
|
+
if (table) {
|
|
211
|
+
if (!shouldIncludeKeplerTable(table, options)) {
|
|
212
|
+
continue;
|
|
213
|
+
}
|
|
214
|
+
const value = getKeplerDatasetIdForTable(table, options);
|
|
215
|
+
// Avoid showing both a table option and an already-loaded dataset alias
|
|
216
|
+
// for the same DuckDB table.
|
|
217
|
+
if (optionsByValue.has(value)) {
|
|
218
|
+
continue;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
if (!optionsByValue.has(id)) {
|
|
222
|
+
optionsByValue.set(id, id);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
return Array.from(optionsByValue, ([value, label]) => ({
|
|
226
|
+
label,
|
|
227
|
+
value,
|
|
228
|
+
})).sort((left, right) => left.label.localeCompare(right.label) ||
|
|
229
|
+
left.value.localeCompare(right.value));
|
|
230
|
+
}
|
|
231
|
+
//# sourceMappingURL=keplerTableSelection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keplerTableSelection.js","sourceRoot":"","sources":["../src/keplerTableSelection.ts"],"names":[],"mappings":"AAGA,MAAM,oBAAoB,GAAa,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AA8GvD,SAAS,sBAAsB,CAC7B,UAAuC,EAAE;IAEzC,IAAI,OAAO,OAAO,CAAC,eAAe,KAAK,UAAU,EAAE,CAAC;QAClD,OAAO,OAAO,CAAC,eAAe,EAAE,CAAC;IACnC,CAAC;IAED,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC;QAC5B,OAAO,OAAO,CAAC,eAAe,CAAC;IACjC,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,oBAAoB,CAC3B,KAAgB,EAChB,SAA8C;IAE9C,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,CAAC,SAAS,CAAC,QAAQ,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC;QAC7C,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,CACL,KAAK,CAAC,KAAK,CAAC,QAAQ,KAAK,S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CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACnC,CAAC;IAED,KAAK,MAAM,EAAE,IAAI,gBAAgB,EAAE,CAAC;QAClC,MAAM,KAAK,GAAG,mCAAmC,CAAC,QAAQ,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;QACzE,IAAI,KAAK,EAAE,CAAC;YACV,IAAI,CAAC,wBAAwB,CAAC,KAAK,EAAE,OAAO,CAAC,EAAE,CAAC;gBAC9C,SAAS;YACX,CAAC;YAED,MAAM,KAAK,GAAG,0BAA0B,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;YACzD,wEAAwE;YACxE,6BAA6B;YAC7B,IAAI,cAAc,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC9B,SAAS;YACX,CAAC;QACH,CAAC;QAED,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC;YAC5B,cAAc,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;QAC7B,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC;QACrD,KAAK;QACL,KAAK;KACN,CAAC,CAAC,CAAC,IAAI,CACN,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CACd,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,KAAK,CAAC;QACrC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,KAAK,CAAC,CACxC,CAAC;AACJ,CAAC","sourcesContent":["import type {DataTable} from '@sqlrooms/duckdb-core';\nimport type {RGBColor} from '@kepler.gl/types';\n\nconst UNLOADED_TABLE_COLOR: RGBColor = [143, 149, 161];\n\n/**\n * A database/schema pair that can be referred to by bare table name in Kepler\n * dataset ids.\n */\nexport type KeplerDbSchemaReference = {\n database?: string;\n schema?: string;\n};\n\n/**\n * One selectable entry in Kepler's Add Layer table-source dropdown.\n */\nexport type KeplerTableLayerOption = {\n label: string;\n value: string;\n};\n\n/**\n * Minimal loaded Kepler dataset shape needed to build table source options.\n */\nexport type KeplerSourceDataset = {\n id: string;\n label?: string;\n color?: RGBColor;\n};\n\n/**\n * One option in a Kepler table source picker.\n */\nexport type KeplerTableSourceOption = {\n value: string;\n label: string;\n color: RGBColor;\n isLoaded: boolean;\n};\n\n/**\n * Inputs for building source picker options from loaded Kepler datasets plus\n * the DuckDB table catalog.\n */\nexport type BuildKeplerTableSourceOptionsParams = {\n dbTables: DataTable[];\n datasets?: Record<string, KeplerSourceDataset | undefined>;\n /**\n * Set false when the picker should only show datasets already loaded into\n * Kepler, such as filter data-source selectors.\n */\n includeUnloadedTables?: boolean;\n loadedDatasetIds?: string[];\n tableSelection?: KeplerTableSelectionOptions;\n};\n\n/**\n * Policy hooks for deciding which DuckDB tables are exposed to Kepler and how\n * they are represented in saved Kepler layer config.\n */\nexport type KeplerTableSelectionOptions = {\n /**\n * Return false to hide a DuckDB table from the Add Layer menu and to skip\n * loading matching saved dataset ids during sync.\n *\n * Defaults to including every visible DuckDB table.\n */\n includeTable?: (table: DataTable) => boolean;\n\n /**\n * Database/schema whose tables may use bare dataset ids, such as `places`.\n *\n * Tables outside this database/schema use qualified SQL table references for their\n * dataset ids. The Kepler slice defaults this to its current DuckDB\n * database/schema; host apps can supply their own stable resolver when their\n * persistence model needs a different comparison point.\n */\n defaultDbSchema?:\n | KeplerDbSchemaReference\n | (() => KeplerDbSchemaReference | undefined);\n\n /**\n * Override how new Kepler dataset ids are generated for DuckDB tables.\n *\n * Use this only when the default bare-or-qualified policy does not match the\n * host app's persistence model.\n */\n getDatasetIdForTable?: (table: DataTable) => string;\n\n /**\n * Override the display label shown for a DuckDB table in Kepler's Add Layer\n * table-source dropdown.\n *\n * This only changes presentation; dataset ids still come from\n * `getDatasetIdForTable` or the default bare-or-qualified policy.\n */\n getTableLabel?: (table: DataTable) => string;\n\n /**\n * Override how saved Kepler dataset ids are resolved back to DuckDB tables.\n *\n * The default resolver matches qualified table references first, then bare ids\n * within `defaultDbSchema`. Return the matching table independent of\n * `includeTable`; the shared helpers apply `includeTable` after matching so\n * excluded tables are handled consistently.\n */\n findTableForDatasetId?: (\n tables: DataTable[],\n datasetId: string,\n ) => DataTable | undefined;\n};\n\nfunction resolveDefaultDbSchema(\n options: KeplerTableSelectionOptions = {},\n): KeplerDbSchemaReference | undefined {\n if (typeof options.defaultDbSchema === 'function') {\n return options.defaultDbSchema();\n }\n\n if (options.defaultDbSchema) {\n return options.defaultDbSchema;\n }\n\n return undefined;\n}\n\nfunction tableMatchesDbSchema(\n table: DataTable,\n reference: KeplerDbSchemaReference | undefined,\n): boolean {\n if (!reference) {\n return false;\n }\n\n if (!reference.database || !reference.schema) {\n return false;\n }\n\n return (\n table.table.database === reference.database &&\n table.table.schema === reference.schema\n );\n}\n\nfunction getKeplerTableKey(table: DataTable | undefined): string | undefined {\n if (!table) {\n return undefined;\n }\n\n return [\n table.table.database ?? '',\n table.table.schema ?? '',\n table.table.table,\n ].join('.');\n}\n\nfunction getKeplerDatasetLabel(\n datasetId: string,\n dataset: KeplerSourceDataset | undefined,\n table: DataTable | undefined,\n tableSelection: KeplerTableSelectionOptions,\n): string {\n if (table) {\n return getKeplerTableLabel(table, tableSelection);\n }\n\n if (dataset?.label) {\n return dataset.label;\n }\n\n return datasetId;\n}\n\nfunction getKeplerDatasetColor(\n dataset: KeplerSourceDataset | undefined,\n): RGBColor {\n return dataset?.color ?? UNLOADED_TABLE_COLOR;\n}\n\nfunction findMatchingKeplerTableForDatasetId(\n tables: DataTable[],\n datasetId: string,\n options: KeplerTableSelectionOptions = {},\n): DataTable | undefined {\n if (options.findTableForDatasetId) {\n return options.findTableForDatasetId(tables, datasetId);\n }\n\n const defaultDbSchema = resolveDefaultDbSchema(options);\n for (const table of tables) {\n if (table.table.toString() === datasetId) {\n return table;\n }\n\n if (\n tableMatchesDbSchema(table, defaultDbSchema) &&\n table.table.table === datasetId\n ) {\n return table;\n }\n }\n return undefined;\n}\n\n/**\n * Return whether a DuckDB table should be exposed as a Kepler layer source.\n *\n * This is the shared gate used by Add Layer table options and by host UIs that\n * offer their own \"add table to map\" actions.\n */\nexport function shouldIncludeKeplerTable(\n table: DataTable,\n options: KeplerTableSelectionOptions = {},\n): boolean {\n if (!options.includeTable) {\n return true;\n }\n\n return options.includeTable(table);\n}\n\n/**\n * Choose the dataset id that should be written into new Kepler layer config.\n *\n * By default, tables in `defaultDbSchema` use bare ids (`places`) and all\n * other tables use qualified SQL references. Hosts can override this with\n * `getDatasetIdForTable`.\n */\nexport function getKeplerDatasetIdForTable(\n table: DataTable,\n options: KeplerTableSelectionOptions = {},\n): string {\n if (options.getDatasetIdForTable) {\n return options.getDatasetIdForTable(table);\n }\n\n const defaultDbSchema = resolveDefaultDbSchema(options);\n if (tableMatchesDbSchema(table, defaultDbSchema)) {\n return table.table.table;\n }\n\n return table.table.toString();\n}\n\n/**\n * Build a human-facing table label from raw catalog parts.\n *\n * Labels omit `defaultDbSchema` and do not include SQL identifier quotes.\n * They are display-only; option values still carry the stable dataset id.\n */\nexport function getKeplerTableLabel(\n table: DataTable,\n options: KeplerTableSelectionOptions = {},\n): string {\n if (options.getTableLabel) {\n return options.getTableLabel(table);\n }\n\n const defaultDbSchema = resolveDefaultDbSchema(options);\n const labelParts: string[] = [];\n\n if (!defaultDbSchema && table.table.database) {\n labelParts.push(table.table.database);\n }\n\n if (\n defaultDbSchema &&\n table.table.database &&\n table.table.database !== defaultDbSchema.database\n ) {\n labelParts.push(table.table.database);\n }\n\n if (!defaultDbSchema && table.table.schema) {\n labelParts.push(table.table.schema);\n }\n\n if (\n defaultDbSchema &&\n table.table.schema &&\n table.table.schema !== defaultDbSchema.schema\n ) {\n labelParts.push(table.table.schema);\n }\n\n labelParts.push(table.table.table);\n return labelParts.join('.');\n}\n\n/**\n * Resolve a saved Kepler dataset id back to the DuckDB table it should load.\n *\n * The default resolver accepts qualified table references and bare ids inside\n * `defaultDbSchema`. Tables rejected by `includeTable` are ignored.\n */\nexport function findKeplerTableForDatasetId(\n tables: DataTable[],\n datasetId: string,\n options: KeplerTableSelectionOptions = {},\n): DataTable | undefined {\n const table = findMatchingKeplerTableForDatasetId(tables, datasetId, options);\n if (!table) {\n return undefined;\n }\n\n if (!shouldIncludeKeplerTable(table, options)) {\n return undefined;\n }\n\n return table;\n}\n\n/**\n * Build source picker options from loaded Kepler datasets plus unloaded DuckDB\n * tables that are allowed by the table-selection policy.\n *\n * Loaded Kepler datasets keep their existing dataset ids so selecting them does\n * not duplicate data. Unloaded tables use `getKeplerDatasetIdForTable`.\n */\nexport function buildKeplerTableSourceOptions({\n dbTables,\n datasets = {},\n includeUnloadedTables = true,\n loadedDatasetIds,\n tableSelection = {},\n}: BuildKeplerTableSourceOptionsParams): KeplerTableSourceOption[] {\n const optionsByValue = new Map<string, KeplerTableSourceOption>();\n const loadedTableKeys = new Set<string>();\n const loadedIds = loadedDatasetIds ?? Object.keys(datasets);\n\n for (const datasetId of loadedIds) {\n const table = findMatchingKeplerTableForDatasetId(\n dbTables,\n datasetId,\n tableSelection,\n );\n const tableKey = getKeplerTableKey(table);\n if (tableKey) {\n loadedTableKeys.add(tableKey);\n }\n }\n\n for (const [datasetId, dataset] of Object.entries(datasets)) {\n const table = findMatchingKeplerTableForDatasetId(\n dbTables,\n datasetId,\n tableSelection,\n );\n if (table && !shouldIncludeKeplerTable(table, tableSelection)) {\n continue;\n }\n\n const label = getKeplerDatasetLabel(\n datasetId,\n dataset,\n table,\n tableSelection,\n );\n\n optionsByValue.set(datasetId, {\n value: datasetId,\n label,\n color: getKeplerDatasetColor(dataset),\n isLoaded: true,\n });\n }\n\n if (includeUnloadedTables) {\n for (const table of dbTables) {\n if (!shouldIncludeKeplerTable(table, tableSelection)) {\n continue;\n }\n\n const tableKey = getKeplerTableKey(table);\n if (tableKey && loadedTableKeys.has(tableKey)) {\n continue;\n }\n\n const value = getKeplerDatasetIdForTable(table, tableSelection);\n if (optionsByValue.has(value)) {\n continue;\n }\n\n optionsByValue.set(value, {\n value,\n label: getKeplerTableLabel(table, tableSelection),\n color: UNLOADED_TABLE_COLOR,\n isLoaded: false,\n });\n }\n }\n\n return Array.from(optionsByValue.values()).sort(\n (left, right) =>\n left.label.localeCompare(right.label) ||\n left.value.localeCompare(right.value),\n );\n}\n\n/**\n * Build Add Layer dropdown options from DuckDB tables plus datasets that are\n * already loaded into Kepler.\n *\n * `includeTable` controls which DuckDB tables are exposed. Already-loaded\n * dataset ids are included unless they resolve to an excluded table or duplicate\n * an exposed table option.\n */\nexport function buildKeplerTableLayerOptions(\n dbTables: DataTable[],\n keplerDatasetIds: string[],\n options: KeplerTableSelectionOptions = {},\n): KeplerTableLayerOption[] {\n const optionsByValue = new Map<string, string>();\n\n for (const table of dbTables) {\n if (!shouldIncludeKeplerTable(table, options)) {\n continue;\n }\n\n const value = getKeplerDatasetIdForTable(table, options);\n const label = getKeplerTableLabel(table, options);\n\n optionsByValue.set(value, label);\n }\n\n for (const id of keplerDatasetIds) {\n const table = findMatchingKeplerTableForDatasetId(dbTables, id, options);\n if (table) {\n if (!shouldIncludeKeplerTable(table, options)) {\n continue;\n }\n\n const value = getKeplerDatasetIdForTable(table, options);\n // Avoid showing both a table option and an already-loaded dataset alias\n // for the same DuckDB table.\n if (optionsByValue.has(value)) {\n continue;\n }\n }\n\n if (!optionsByValue.has(id)) {\n optionsByValue.set(id, id);\n }\n }\n\n return Array.from(optionsByValue, ([value, label]) => ({\n label,\n value,\n })).sort(\n (left, right) =>\n left.label.localeCompare(right.label) ||\n left.value.localeCompare(right.value),\n );\n}\n"]}
|
package/dist/styles/theme.d.ts
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
import { theme } from '@kepler.gl/styles';
|
|
1
2
|
import { DefaultTheme } from 'styled-components';
|
|
2
3
|
export declare const darkTheme: DefaultTheme;
|
|
4
|
+
export type KeplerThemeOverrides = Partial<typeof theme> & Partial<DefaultTheme>;
|
|
5
|
+
/**
|
|
6
|
+
* Create a custom Kepler theme by merging overrides into the base dark theme.
|
|
7
|
+
* Use this to set modal z-indices, colors, or other theme values from the app level.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* const myTheme = createKeplerTheme({ modalOverLayZ: 49 });
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export declare function createKeplerTheme(overrides?: KeplerThemeOverrides): DefaultTheme;
|
|
3
15
|
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/styles/theme.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/styles/theme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAC,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAC,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAK/C,eAAO,MAAM,SAAS,EAAE,YAiFvB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,OAAO,CAAC,OAAO,KAAK,CAAC,GACtD,OAAO,CAAC,YAAY,CAAC,CAAC;AAExB;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAC/B,SAAS,CAAC,EAAE,oBAAoB,GAC/B,YAAY,CAEd"}
|
package/dist/styles/theme.js
CHANGED
|
@@ -75,4 +75,16 @@ export const darkTheme = {
|
|
|
75
75
|
bottomWidgetPaddingLeft: 0,
|
|
76
76
|
panelHeaderBorderRadius: '4px',
|
|
77
77
|
};
|
|
78
|
+
/**
|
|
79
|
+
* Create a custom Kepler theme by merging overrides into the base dark theme.
|
|
80
|
+
* Use this to set modal z-indices, colors, or other theme values from the app level.
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* ```ts
|
|
84
|
+
* const myTheme = createKeplerTheme({ modalOverLayZ: 49 });
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
export function createKeplerTheme(overrides) {
|
|
88
|
+
return { ...darkTheme, ...overrides };
|
|
89
|
+
}
|
|
78
90
|
//# sourceMappingURL=theme.js.map
|
package/dist/styles/theme.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.js","sourceRoot":"","sources":["../../src/styles/theme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAC,MAAM,mBAAmB,CAAC;AAGxC,2FAA2F;AAC3F,sEAAsE;AAEtE,MAAM,CAAC,MAAM,SAAS,GAAiB;IACrC,GAAG,KAAK;IACR,WAAW,EAAE,wBAAwB;IACrC,eAAe,EAAE,wBAAwB;IACzC,SAAS,EAAE,wBAAwB;IACnC,cAAc,EAAE,wBAAwB;IACxC,WAAW,EAAE,wBAAwB;IACrC,WAAW,EAAE,qBAAqB;IAClC,YAAY,EAAE,8BAA8B;IAC5C,UAAU,EAAE,8BAA8B;IAC1C,eAAe,EAAE,gCAAgC;IACjD,gBAAgB,EAAE,oCAAoC;IACtD,sBAAsB,EAAE,wBAAwB;IAChD,uBAAuB,EAAE,gCAAgC;IACzD,6BAA6B,EAAE,mBAAmB;IAElD,QAAQ,EAAE,mBAAmB;IAC7B,UAAU,EAAE,wBAAwB;IACpC,qBAAqB,EAAE,8BAA8B;IACrD,WAAW,EAAE,wBAAwB;IACrC,sBAAsB,EAAE,8BAA8B;IACtD,wBAAwB,EAAE,8BAA8B;IACxD,aAAa,EAAE,yBAAyB;IACxC,cAAc,EAAE,yBAAyB;IACzC,qBAAqB,EAAE,yBAAyB;IAChD,sBAAsB,EAAE,yBAAyB;IAEjD,oBAAoB,EAAE,mBAAmB;IACzC,cAAc,EAAE,mBAAmB;IACnC,kBAAkB,EAAE,wBAAwB;IAC5C,YAAY,EAAE,oCAAoC;IAClD,uBAAuB,EAAE,mBAAmB;IAC5C,qBAAqB,EAAE,oCAAoC;IAE3D,mBAAmB,EAAE,wBAAwB;IAC7C,iBAAiB,EAAE,mBAAmB;IACtC,sBAAsB,EAAE,yBAAyB;IACjD,uBAAuB,EAAE,yBAAyB;IAClD,+BAA+B,EAAE,yBAAyB;IAC1D,yBAAyB,EAAE,mBAAmB;IAE9C,oBAAoB,EAAE,mBAAmB;IACzC,eAAe,EAAE,8BAA8B;IAC/C,qBAAqB,EAAE,wBAAwB;IAC/C,oBAAoB,EAAE,wBAAwB;IAC9C,oBAAoB,EAAE,wBAAwB;IAE9C,SAAS;IACT,aAAa,EAAE,qBAAqB;IACpC,kBAAkB,EAAE,2BAA2B;IAC/C,gBAAgB,EAAE,2BAA2B;IAC7C,eAAe,EAAE,gCAAgC;IACjD,kBAAkB,EAAE,gCAAgC;IACpD,yBAAyB,EAAE,UAAU;IACrC,iBAAiB,EAAE,KAAK;IACxB,SAAS,EAAE,qBAAqB;IAChC,cAAc,EAAE,2BAA2B;IAC3C,YAAY,EAAE,2BAA2B;IACzC,cAAc,EAAE,gCAAgC;IAChD,mBAAmB,EAAE,oBAAoB;IACzC,mBAAmB,EAAE,wBAAwB;IAC7C,gBAAgB,EAAE,wBAAwB;IAE1C,WAAW;IACX,eAAe,EAAE,gCAAgC;IACjD,mBAAmB,EAAE,oBAAoB;IACzC,uBAAuB,EAAE,oBAAoB;IAC7C,WAAW,EAAE,oCAAoC;IACjD,qBAAqB,EAAE,oCAAoC;IAC3D,SAAS;IACT,YAAY,EAAE,uBAAuB;IAErC,QAAQ;IACR,oBAAoB,EAAE,qBAAqB;IAE3C,OAAO;IACP,sBAAsB,EAAE,CAAC;IACzB,wBAAwB,EAAE,CAAC;IAC3B,yBAAyB,EAAE,CAAC;IAC5B,uBAAuB,EAAE,CAAC;IAC1B,uBAAuB,EAAE,KAAK;CAC/B,CAAC","sourcesContent":["import {theme} from '@kepler.gl/styles';\nimport {DefaultTheme} from 'styled-components';\n\n// SQL Room dark theme exported from sqlRoom preset, maybe there is a better way to do this\n// but this is the only way I could find to make it work with tailwind\n\nexport const darkTheme: DefaultTheme = {\n ...theme,\n sidePanelBg: 'hsl(var(--background))',\n bottomWidgetBgd: 'hsl(var(--background))',\n textColor: 'hsl(var(--foreground))',\n titleTextColor: 'hsl(var(--foreground))',\n textColorHl: 'hsl(var(--foreground))',\n activeColor: 'hsl(var(--primary))',\n subtextColor: 'hsl(var(--muted-foreground))',\n labelColor: 'hsl(var(--muted-foreground))',\n panelBackground: 'hsl(var(--primary-foreground))',\n panelBorderColor: 'hsl(var(--muted-foreground) / 0.2)',\n panelContentBackground: 'hsl(var(--background))',\n mapPanelBackgroundColor: 'hsl(var(--primary-foreground))',\n mapPanelHeaderBackgroundColor: 'hsl(var(--muted))',\n\n inputBgd: 'hsl(var(--input))',\n inputColor: 'hsl(var(--foreground))',\n inputPlaceholderColor: 'hsl(var(--muted-foreground))',\n selectColor: 'hsl(var(--foreground))',\n selectColorPlaceHolder: 'hsl(var(--muted-foreground))',\n selectColorPlaceHolderLT: 'hsl(var(--muted-foreground))',\n inputBgdHover: 'hsl(var(--input) / 0.8)',\n inputBgdActive: 'hsl(var(--input) / 0.8)',\n inputBorderHoverColor: 'hsl(var(--input) / 0.8)',\n inputBorderActiveColor: 'hsl(var(--input) / 0.8)',\n\n switchTrackBgdActive: 'hsl(var(--input))',\n switchTrackBgd: 'hsl(var(--input))',\n switchBtnBgdActive: 'hsl(var(--foreground))',\n switchBtnBgd: 'hsl(var(--muted-foreground) / 0.2)',\n secondarySwitchTrackBgd: 'hsl(var(--input))',\n secondarySwitchBtnBgd: 'hsl(var(--muted-foreground) / 0.2)',\n\n secondaryInputColor: 'hsl(var(--foreground))',\n secondaryInputBgd: 'hsl(var(--input))',\n secondaryInputBgdHover: 'hsl(var(--input) / 0.8)',\n secondaryInputBgdActive: 'hsl(var(--input) / 0.8)',\n secondaryInputBorderActiveColor: 'hsl(var(--input) / 0.8)',\n secondaryInputBorderColor: 'hsl(var(--input))',\n\n panelBackgroundHover: 'hsl(var(--muted))',\n panelHeaderIcon: 'hsl(var(--muted-foreground))',\n panelHeaderIconActive: 'hsl(var(--foreground))',\n panelHeaderIconHover: 'hsl(var(--foreground))',\n toolbarItemIconHover: 'hsl(var(--foreground))',\n\n // button\n primaryBtnBgd: 'hsl(var(--primary))',\n primaryBtnBgdHover: 'hsl(var(--primary) / 0.8)',\n primaryBtnRadius: 'calc(var(--radius) - 2px)',\n primaryBtnColor: 'hsl(var(--primary-foreground))',\n primaryBtnActColor: 'hsl(var(--primary-foreground))',\n primaryBtnFontSizeDefault: '0.875rem',\n floatingBtnRadius: '4px',\n ctaBtnBgd: 'hsl(var(--primary))',\n ctaBtnBgdHover: 'hsl(var(--primary) / 0.8)',\n ctaBtnActBgd: 'hsl(var(--primary) / 0.8)',\n floatingBtnBgd: 'hsl(var(--primary-foreground))',\n floatingBtnBgdHover: 'hsl(var(--accent))',\n floatingBtnActColor: 'hsl(var(--foreground))',\n floatingBtnColor: 'hsl(var(--foreground))',\n\n // dropdown\n dropdownListBgd: 'hsl(var(--primary-foreground))',\n toolbarItemBgdHover: 'hsl(var(--accent))',\n dropdownListHighlightBg: 'hsl(var(--accent))',\n chickletBgd: 'hsl(var(--muted-foreground) / 0.4)',\n dropdownListBorderTop: 'hsl(var(--muted-foreground) / 0.2)',\n // slider\n sliderBarBgd: 'hsl(var(--secondary))',\n\n // chart\n histogramFillInRange: 'hsl(var(--chart-1))',\n\n // size\n bottomWidgetPaddingTop: 0,\n bottomWidgetPaddingRight: 0,\n bottomWidgetPaddingBottom: 0,\n bottomWidgetPaddingLeft: 0,\n panelHeaderBorderRadius: '4px',\n};\n"]}
|
|
1
|
+
{"version":3,"file":"theme.js","sourceRoot":"","sources":["../../src/styles/theme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAC,MAAM,mBAAmB,CAAC;AAGxC,2FAA2F;AAC3F,sEAAsE;AAEtE,MAAM,CAAC,MAAM,SAAS,GAAiB;IACrC,GAAG,KAAK;IACR,WAAW,EAAE,wBAAwB;IACrC,eAAe,EAAE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,gCAAgC;IACpD,yBAAyB,EAAE,UAAU;IACrC,iBAAiB,EAAE,KAAK;IACxB,SAAS,EAAE,qBAAqB;IAChC,cAAc,EAAE,2BAA2B;IAC3C,YAAY,EAAE,2BAA2B;IACzC,cAAc,EAAE,gCAAgC;IAChD,mBAAmB,EAAE,oBAAoB;IACzC,mBAAmB,EAAE,wBAAwB;IAC7C,gBAAgB,EAAE,wBAAwB;IAE1C,WAAW;IACX,eAAe,EAAE,gCAAgC;IACjD,mBAAmB,EAAE,oBAAoB;IACzC,uBAAuB,EAAE,oBAAoB;IAC7C,WAAW,EAAE,oCAAoC;IACjD,qBAAqB,EAAE,oCAAoC;IAC3D,SAAS;IACT,YAAY,EAAE,uBAAuB;IAErC,QAAQ;IACR,oBAAoB,EAAE,qBAAqB;IAE3C,OAAO;IACP,sBAAsB,EAAE,CAAC;IACzB,wBAAwB,EAAE,CAAC;IAC3B,yBAAyB,EAAE,CAAC;IAC5B,uBAAuB,EAAE,CAAC;IAC1B,uBAAuB,EAAE,KAAK;CAC/B,CAAC;AAKF;;;;;;;;GAQG;AACH,MAAM,UAAU,iBAAiB,CAC/B,SAAgC;IAEhC,OAAO,EAAC,GAAG,SAAS,EAAE,GAAG,SAAS,EAAC,CAAC;AACtC,CAAC","sourcesContent":["import {theme} from '@kepler.gl/styles';\nimport {DefaultTheme} from 'styled-components';\n\n// SQL Room dark theme exported from sqlRoom preset, maybe there is a better way to do this\n// but this is the only way I could find to make it work with tailwind\n\nexport const darkTheme: DefaultTheme = {\n ...theme,\n sidePanelBg: 'hsl(var(--background))',\n bottomWidgetBgd: 'hsl(var(--background))',\n textColor: 'hsl(var(--foreground))',\n titleTextColor: 'hsl(var(--foreground))',\n textColorHl: 'hsl(var(--foreground))',\n activeColor: 'hsl(var(--primary))',\n subtextColor: 'hsl(var(--muted-foreground))',\n labelColor: 'hsl(var(--muted-foreground))',\n panelBackground: 'hsl(var(--primary-foreground))',\n panelBorderColor: 'hsl(var(--muted-foreground) / 0.2)',\n panelContentBackground: 'hsl(var(--background))',\n mapPanelBackgroundColor: 'hsl(var(--primary-foreground))',\n mapPanelHeaderBackgroundColor: 'hsl(var(--muted))',\n\n inputBgd: 'hsl(var(--input))',\n inputColor: 'hsl(var(--foreground))',\n inputPlaceholderColor: 'hsl(var(--muted-foreground))',\n selectColor: 'hsl(var(--foreground))',\n selectColorPlaceHolder: 'hsl(var(--muted-foreground))',\n selectColorPlaceHolderLT: 'hsl(var(--muted-foreground))',\n inputBgdHover: 'hsl(var(--input) / 0.8)',\n inputBgdActive: 'hsl(var(--input) / 0.8)',\n inputBorderHoverColor: 'hsl(var(--input) / 0.8)',\n inputBorderActiveColor: 'hsl(var(--input) / 0.8)',\n\n switchTrackBgdActive: 'hsl(var(--input))',\n switchTrackBgd: 'hsl(var(--input))',\n switchBtnBgdActive: 'hsl(var(--foreground))',\n switchBtnBgd: 'hsl(var(--muted-foreground) / 0.2)',\n secondarySwitchTrackBgd: 'hsl(var(--input))',\n secondarySwitchBtnBgd: 'hsl(var(--muted-foreground) / 0.2)',\n\n secondaryInputColor: 'hsl(var(--foreground))',\n secondaryInputBgd: 'hsl(var(--input))',\n secondaryInputBgdHover: 'hsl(var(--input) / 0.8)',\n secondaryInputBgdActive: 'hsl(var(--input) / 0.8)',\n secondaryInputBorderActiveColor: 'hsl(var(--input) / 0.8)',\n secondaryInputBorderColor: 'hsl(var(--input))',\n\n panelBackgroundHover: 'hsl(var(--muted))',\n panelHeaderIcon: 'hsl(var(--muted-foreground))',\n panelHeaderIconActive: 'hsl(var(--foreground))',\n panelHeaderIconHover: 'hsl(var(--foreground))',\n toolbarItemIconHover: 'hsl(var(--foreground))',\n\n // button\n primaryBtnBgd: 'hsl(var(--primary))',\n primaryBtnBgdHover: 'hsl(var(--primary) / 0.8)',\n primaryBtnRadius: 'calc(var(--radius) - 2px)',\n primaryBtnColor: 'hsl(var(--primary-foreground))',\n primaryBtnActColor: 'hsl(var(--primary-foreground))',\n primaryBtnFontSizeDefault: '0.875rem',\n floatingBtnRadius: '4px',\n ctaBtnBgd: 'hsl(var(--primary))',\n ctaBtnBgdHover: 'hsl(var(--primary) / 0.8)',\n ctaBtnActBgd: 'hsl(var(--primary) / 0.8)',\n floatingBtnBgd: 'hsl(var(--primary-foreground))',\n floatingBtnBgdHover: 'hsl(var(--accent))',\n floatingBtnActColor: 'hsl(var(--foreground))',\n floatingBtnColor: 'hsl(var(--foreground))',\n\n // dropdown\n dropdownListBgd: 'hsl(var(--primary-foreground))',\n toolbarItemBgdHover: 'hsl(var(--accent))',\n dropdownListHighlightBg: 'hsl(var(--accent))',\n chickletBgd: 'hsl(var(--muted-foreground) / 0.4)',\n dropdownListBorderTop: 'hsl(var(--muted-foreground) / 0.2)',\n // slider\n sliderBarBgd: 'hsl(var(--secondary))',\n\n // chart\n histogramFillInRange: 'hsl(var(--chart-1))',\n\n // size\n bottomWidgetPaddingTop: 0,\n bottomWidgetPaddingRight: 0,\n bottomWidgetPaddingBottom: 0,\n bottomWidgetPaddingLeft: 0,\n panelHeaderBorderRadius: '4px',\n};\n\nexport type KeplerThemeOverrides = Partial<typeof theme> &\n Partial<DefaultTheme>;\n\n/**\n * Create a custom Kepler theme by merging overrides into the base dark theme.\n * Use this to set modal z-indices, colors, or other theme values from the app level.\n *\n * @example\n * ```ts\n * const myTheme = createKeplerTheme({ modalOverLayZ: 49 });\n * ```\n */\nexport function createKeplerTheme(\n overrides?: KeplerThemeOverrides,\n): DefaultTheme {\n return {...darkTheme, ...overrides};\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sqlrooms/kepler",
|
|
3
|
-
"version": "0.29.0-rc.
|
|
3
|
+
"version": "0.29.0-rc.8",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/sqlrooms/sqlrooms.git"
|
|
@@ -19,6 +19,8 @@
|
|
|
19
19
|
"build": "tsc",
|
|
20
20
|
"dev": "tsc -w",
|
|
21
21
|
"lint": "eslint .",
|
|
22
|
+
"test": "jest",
|
|
23
|
+
"test:watch": "jest --watch",
|
|
22
24
|
"typedoc": "typedoc"
|
|
23
25
|
},
|
|
24
26
|
"dependencies": {
|
|
@@ -37,10 +39,11 @@
|
|
|
37
39
|
"@kepler.gl/types": "3.3.0-alpha.0",
|
|
38
40
|
"@kepler.gl/utils": "3.3.0-alpha.0",
|
|
39
41
|
"@paralleldrive/cuid2": "^3.0.0",
|
|
40
|
-
"@sqlrooms/
|
|
41
|
-
"@sqlrooms/
|
|
42
|
-
"@sqlrooms/
|
|
43
|
-
"@sqlrooms/
|
|
42
|
+
"@sqlrooms/duckdb-core": "0.29.0-rc.8",
|
|
43
|
+
"@sqlrooms/kepler-config": "0.29.0-rc.8",
|
|
44
|
+
"@sqlrooms/room-shell": "0.29.0-rc.8",
|
|
45
|
+
"@sqlrooms/s3-browser": "0.29.0-rc.8",
|
|
46
|
+
"@sqlrooms/ui": "0.29.0-rc.8",
|
|
44
47
|
"apache-arrow": "17.0.0",
|
|
45
48
|
"immer": "^11.0.1",
|
|
46
49
|
"lucide-react": "^0.556.0",
|
|
@@ -52,7 +55,10 @@
|
|
|
52
55
|
"styled-components": "6.1.8"
|
|
53
56
|
},
|
|
54
57
|
"devDependencies": {
|
|
55
|
-
"@types/
|
|
58
|
+
"@types/jest": "^30.0.0",
|
|
59
|
+
"@types/redux-logger": "^3.0.13",
|
|
60
|
+
"jest": "^30.1.3",
|
|
61
|
+
"ts-jest": "^29.4.4"
|
|
56
62
|
},
|
|
57
63
|
"peerDependencies": {
|
|
58
64
|
"react": ">=18",
|
|
@@ -61,5 +67,5 @@
|
|
|
61
67
|
"publishConfig": {
|
|
62
68
|
"access": "public"
|
|
63
69
|
},
|
|
64
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "dcb1a51631c5fa87b49d3e78ae6c0023eccd4189"
|
|
65
71
|
}
|