@akohn/dashql-react 0.0.0-stage → 0.0.20-dev.661.gda3ac9a7e
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 +373 -0
- package/NOTICE +66 -0
- package/README.md +46 -2
- package/dist/_virtual/_vite/preload-helper.js +100 -0
- package/dist/brand/brand.d.ts +13 -0
- package/dist/brand/brand.js +14 -0
- package/dist/brand/landing_backdrop.d.ts +56 -0
- package/dist/brand/landing_backdrop.js +1019 -0
- package/dist/brand/wobble_morph.d.ts +54 -0
- package/dist/brand/wobble_morph.js +439 -0
- package/dist/components/action_list.d.ts +31 -0
- package/dist/components/action_list.js +63 -0
- package/dist/components/action_list.module.js +11 -0
- package/dist/components/anchored_overlay.d.ts +28 -0
- package/dist/components/anchored_overlay.js +93 -0
- package/dist/components/button.d.ts +42 -0
- package/dist/components/button.js +97 -0
- package/dist/components/button.module.js +20 -0
- package/dist/components/button_group.d.ts +7 -0
- package/dist/components/button_group.js +18 -0
- package/dist/components/button_group.module.js +3 -0
- package/dist/components/card_placeholder.d.ts +9 -0
- package/dist/components/card_placeholder.js +39 -0
- package/dist/components/card_placeholder.module.js +6 -0
- package/dist/components/clipboard.d.ts +19 -0
- package/dist/components/clipboard.js +54 -0
- package/dist/components/data_table/computation_tables.d.ts +12 -0
- package/dist/components/data_table/computation_tables.js +42 -0
- package/dist/components/data_table/data_table.d.ts +38 -0
- package/dist/components/data_table/data_table.js +378 -0
- package/dist/components/data_table/data_table.module.js +41 -0
- package/dist/components/data_table/data_table_cell.d.ts +7 -0
- package/dist/components/data_table/data_table_cell.js +9 -0
- package/dist/components/data_table/data_table_cell_data.d.ts +21 -0
- package/dist/components/data_table/data_table_cell_data.js +99 -0
- package/dist/components/data_table/data_table_cell_header_name.d.ts +17 -0
- package/dist/components/data_table/data_table_cell_header_name.js +73 -0
- package/dist/components/data_table/data_table_cell_header_plots.d.ts +31 -0
- package/dist/components/data_table/data_table_cell_header_plots.js +122 -0
- package/dist/components/data_table/data_table_colors.d.ts +19 -0
- package/dist/components/data_table/data_table_colors.js +27 -0
- package/dist/components/data_table/data_table_column_resize.d.ts +21 -0
- package/dist/components/data_table/data_table_column_resize.js +121 -0
- package/dist/components/data_table/data_table_focus.d.ts +15 -0
- package/dist/components/data_table/data_table_focus.js +53 -0
- package/dist/components/data_table/data_table_layout.d.ts +18 -0
- package/dist/components/data_table/data_table_layout.js +103 -0
- package/dist/components/data_table/data_table_ordering.d.ts +9 -0
- package/dist/components/data_table/data_table_ordering.js +39 -0
- package/dist/components/data_table/data_table_portals.d.ts +9 -0
- package/dist/components/data_table/data_table_portals.js +29 -0
- package/dist/components/data_table/data_table_sticky_views.d.ts +34 -0
- package/dist/components/data_table/data_table_sticky_views.js +161 -0
- package/dist/components/data_table/data_table_window.d.ts +18 -0
- package/dist/components/data_table/data_table_window.js +118 -0
- package/dist/components/data_table/format_peek.d.ts +2 -0
- package/dist/components/data_table/format_peek.js +17 -0
- package/dist/components/data_table/histogram_bars.d.ts +36 -0
- package/dist/components/data_table/histogram_bars.js +100 -0
- package/dist/components/data_table/histogram_brush.d.ts +23 -0
- package/dist/components/data_table/histogram_brush.js +107 -0
- package/dist/components/data_table/histogram_cell.d.ts +19 -0
- package/dist/components/data_table/histogram_cell.js +325 -0
- package/dist/components/data_table/histogram_cell.module.js +9 -0
- package/dist/components/data_table/histogram_label.d.ts +1 -0
- package/dist/components/data_table/histogram_label.js +7 -0
- package/dist/components/data_table/memo_props.d.ts +1 -0
- package/dist/components/data_table/memo_props.js +17 -0
- package/dist/components/data_table/mostfrequent_cell.d.ts +17 -0
- package/dist/components/data_table/mostfrequent_cell.js +316 -0
- package/dist/components/data_table/mostfrequent_cell.module.js +10 -0
- package/dist/components/data_table/use_cross_filters.d.ts +14 -0
- package/dist/components/data_table/use_cross_filters.js +47 -0
- package/dist/components/deferred.d.ts +11 -0
- package/dist/components/deferred.js +41 -0
- package/dist/components/deferred.module.js +5 -0
- package/dist/components/error_boundary.d.ts +18 -0
- package/dist/components/error_boundary.js +15 -0
- package/dist/components/graph.module.js +15 -0
- package/dist/components/graph_port.d.ts +10 -0
- package/dist/components/graph_port.js +34 -0
- package/dist/components/inspector_overlay.d.ts +32 -0
- package/dist/components/inspector_overlay.js +72 -0
- package/dist/components/inspector_overlay.module.js +18 -0
- package/dist/components/json/json_arrow_symbol.d.ts +4 -0
- package/dist/components/json/json_arrow_symbol.js +25 -0
- package/dist/components/json/json_copy_button.d.ts +11 -0
- package/dist/components/json/json_copy_button.js +61 -0
- package/dist/components/json/json_ellipsis_symbol.d.ts +7 -0
- package/dist/components/json/json_ellipsis_symbol.js +11 -0
- package/dist/components/json/json_item_count.d.ts +5 -0
- package/dist/components/json/json_item_count.js +12 -0
- package/dist/components/json/json_key_name.d.ts +6 -0
- package/dist/components/json/json_key_name.js +40 -0
- package/dist/components/json/json_key_values.d.ts +12 -0
- package/dist/components/json/json_key_values.js +99 -0
- package/dist/components/json/json_literal.d.ts +8 -0
- package/dist/components/json/json_literal.js +140 -0
- package/dist/components/json/json_nested_close.d.ts +11 -0
- package/dist/components/json/json_nested_close.js +31 -0
- package/dist/components/json/json_nested_open.d.ts +18 -0
- package/dist/components/json/json_nested_open.js +150 -0
- package/dist/components/json/json_nested_state.d.ts +14 -0
- package/dist/components/json/json_nested_state.js +28 -0
- package/dist/components/json/json_tool_state.d.ts +18 -0
- package/dist/components/json/json_tool_state.js +46 -0
- package/dist/components/json/json_value.d.ts +10 -0
- package/dist/components/json/json_value.js +46 -0
- package/dist/components/json/json_view.d.ts +14 -0
- package/dist/components/json/json_view.js +37 -0
- package/dist/components/json/json_view.module.js +41 -0
- package/dist/components/json/json_view_state.d.ts +14 -0
- package/dist/components/json/json_view_state.js +32 -0
- package/dist/components/json/unique_key.d.ts +1 -0
- package/dist/components/json/unique_key.js +8 -0
- package/dist/components/keyvalue_list.d.ts +25 -0
- package/dist/components/keyvalue_list.js +106 -0
- package/dist/components/keyvalue_list.module.js +15 -0
- package/dist/components/name_input.d.ts +11 -0
- package/dist/components/name_input.js +51 -0
- package/dist/components/overlay.d.ts +53 -0
- package/dist/components/overlay.js +183 -0
- package/dist/components/overlay.module.js +32 -0
- package/dist/components/panel_resize_handle.d.ts +12 -0
- package/dist/components/panel_resize_handle.js +39 -0
- package/dist/components/portal.d.ts +8 -0
- package/dist/components/portal.js +53 -0
- package/dist/components/progress_bar.d.ts +7 -0
- package/dist/components/progress_bar.js +21 -0
- package/dist/components/progress_bar.module.js +3 -0
- package/dist/components/query_history_viewer.d.ts +33 -0
- package/dist/components/query_history_viewer.js +268 -0
- package/dist/components/query_history_viewer.module.js +7 -0
- package/dist/components/query_profile/engine_profile_view.d.ts +19 -0
- package/dist/components/query_profile/engine_profile_view.js +94 -0
- package/dist/components/query_profile/numeric_limits.d.ts +1 -0
- package/dist/components/query_profile/numeric_limits.js +2 -0
- package/dist/components/query_profile/profile_execution_controller.d.ts +14 -0
- package/dist/components/query_profile/profile_execution_controller.js +56 -0
- package/dist/components/query_profile/profile_fit.d.ts +24 -0
- package/dist/components/query_profile/profile_fit.js +22 -0
- package/dist/components/query_profile/profile_navigation.d.ts +3 -0
- package/dist/components/query_profile/profile_navigation.js +34 -0
- package/dist/components/query_profile/profile_scene.d.ts +64 -0
- package/dist/components/query_profile/profile_scene.js +422 -0
- package/dist/components/query_profile/query_profile_view.d.ts +44 -0
- package/dist/components/query_profile/query_profile_view.js +961 -0
- package/dist/components/query_profile/query_profile_view.module.js +23 -0
- package/dist/components/query_progress/query_profile_overlay.d.ts +7 -0
- package/dist/components/query_progress/query_profile_overlay.js +67 -0
- package/dist/components/query_progress/query_profile_overlay.module.js +6 -0
- package/dist/components/query_progress/query_progress_panel.d.ts +14 -0
- package/dist/components/query_progress/query_progress_panel.js +255 -0
- package/dist/components/query_progress/query_progress_panel.module.js +10 -0
- package/dist/components/query_result/cell_detail_overlay.d.ts +34 -0
- package/dist/components/query_result/cell_detail_overlay.js +277 -0
- package/dist/components/query_result/cell_detail_overlay.module.js +21 -0
- package/dist/components/query_result/query_result_action_menu.d.ts +12 -0
- package/dist/components/query_result/query_result_action_menu.js +62 -0
- package/dist/components/query_result/query_result_action_menu.module.js +2 -0
- package/dist/components/query_result/query_result_details.d.ts +17 -0
- package/dist/components/query_result/query_result_details.js +46 -0
- package/dist/components/query_result/query_result_details.module.js +5 -0
- package/dist/components/query_result/query_result_download_button.d.ts +8 -0
- package/dist/components/query_result/query_result_download_button.js +38 -0
- package/dist/components/query_result/query_result_header.d.ts +21 -0
- package/dist/components/query_result/query_result_header.js +71 -0
- package/dist/components/query_result/query_result_header.module.js +3 -0
- package/dist/components/query_result/query_result_search_controls.d.ts +12 -0
- package/dist/components/query_result/query_result_search_controls.js +141 -0
- package/dist/components/query_result/query_result_search_controls.module.js +7 -0
- package/dist/components/query_result/query_result_toolbar.d.ts +21 -0
- package/dist/components/query_result/query_result_toolbar.js +74 -0
- package/dist/components/query_result/result_table_overlay.d.ts +9 -0
- package/dist/components/query_result/result_table_overlay.js +73 -0
- package/dist/components/query_result/result_table_overlay.module.js +6 -0
- package/dist/components/query_result/use_query_result_search.d.ts +8 -0
- package/dist/components/query_result/use_query_result_search.js +28 -0
- package/dist/components/segmented_control.d.ts +58 -0
- package/dist/components/segmented_control.js +116 -0
- package/dist/components/segmented_control.module.js +17 -0
- package/dist/components/separator.d.ts +21 -0
- package/dist/components/separator.js +79 -0
- package/dist/components/separator.module.js +7 -0
- package/dist/components/size_observer.d.ts +7 -0
- package/dist/components/size_observer.js +57 -0
- package/dist/components/skeleton.d.ts +2 -0
- package/dist/components/skeleton.js +14 -0
- package/dist/components/skeleton.module.js +2 -0
- package/dist/components/spinners.d.ts +8 -0
- package/dist/components/spinners.js +33 -0
- package/dist/components/spinners.module.js +8 -0
- package/dist/components/status_indicator.d.ts +36 -0
- package/dist/components/status_indicator.js +182 -0
- package/dist/components/status_indicator.module.js +3 -0
- package/dist/components/symbol_icon.d.ts +65 -0
- package/dist/components/symbol_icon.js +213 -0
- package/dist/components/tab_header.d.ts +11 -0
- package/dist/components/tab_header.js +55 -0
- package/dist/components/tab_header.module.js +7 -0
- package/dist/components/tag.d.ts +10 -0
- package/dist/components/tag.js +17 -0
- package/dist/components/tag.module.js +4 -0
- package/dist/components/text_field.d.ts +44 -0
- package/dist/components/text_field.js +159 -0
- package/dist/components/text_field.module.js +15 -0
- package/dist/components/text_input.d.ts +25 -0
- package/dist/components/text_input.js +90 -0
- package/dist/components/text_input.module.js +13 -0
- package/dist/components/text_input_action.d.ts +19 -0
- package/dist/components/text_input_action.js +33 -0
- package/dist/components/text_input_action.module.js +2 -0
- package/dist/components/toggle_switch.d.ts +7 -0
- package/dist/components/toggle_switch.js +22 -0
- package/dist/components/toggle_switch.module.js +6 -0
- package/dist/components/tooltip.d.ts +22 -0
- package/dist/components/tooltip.js +139 -0
- package/dist/components/tooltip.module.js +2 -0
- package/dist/components/tree_entry.d.ts +17 -0
- package/dist/components/tree_entry.js +48 -0
- package/dist/components/tree_entry.module.js +9 -0
- package/dist/components/value_list.d.ts +17 -0
- package/dist/components/value_list.js +70 -0
- package/dist/components/value_list.module.js +8 -0
- package/dist/components/vegalite_chart.d.ts +18 -0
- package/dist/components/vegalite_chart.js +151 -0
- package/dist/components/vegalite_chart.module.js +3 -0
- package/dist/components/vegalite_view.d.ts +27 -0
- package/dist/components/vegalite_view.js +248 -0
- package/dist/components/vegalite_view.module.js +5 -0
- package/dist/components/vertical_scroll_shadows.d.ts +14 -0
- package/dist/components/vertical_scroll_shadows.js +55 -0
- package/dist/components/vertical_scroll_shadows.module.js +5 -0
- package/dist/components/vertical_split.d.ts +15 -0
- package/dist/components/vertical_split.js +112 -0
- package/dist/components/vertical_split.module.js +5 -0
- package/dist/components/vertical_tabs.d.ts +36 -0
- package/dist/components/vertical_tabs.js +169 -0
- package/dist/components/vertical_tabs.module.js +23 -0
- package/dist/components/visualization/capped_rows.d.ts +9 -0
- package/dist/components/visualization/capped_rows.js +23 -0
- package/dist/components/visualization/capped_rows.module.js +3 -0
- package/dist/components/visualization/chart_download_button.d.ts +12 -0
- package/dist/components/visualization/chart_download_button.js +41 -0
- package/dist/components/visualization/kpi_view.d.ts +10 -0
- package/dist/components/visualization/kpi_view.js +215 -0
- package/dist/components/visualization/kpi_view.module.js +17 -0
- package/dist/components/visualization/markdown_view.d.ts +17 -0
- package/dist/components/visualization/markdown_view.js +154 -0
- package/dist/components/visualization/markdown_view.module.js +4 -0
- package/dist/components/visualization/result_rows.d.ts +17 -0
- package/dist/components/visualization/result_rows.js +82 -0
- package/dist/components/visualization/vegalite_preview.d.ts +8 -0
- package/dist/components/visualization/vegalite_preview.js +17 -0
- package/dist/components/visualization/vegalite_preview.module.js +2 -0
- package/dist/components/visualization/visualization_dispatch.d.ts +14 -0
- package/dist/components/visualization/visualization_dispatch.js +41 -0
- package/dist/components/visualization/visualization_panel.d.ts +10 -0
- package/dist/components/visualization/visualization_panel.js +37 -0
- package/dist/components/visualization/visualization_panel.module.js +3 -0
- package/dist/dom/anchored_position.d.ts +42 -0
- package/dist/dom/anchored_position.js +255 -0
- package/dist/dom/app_host.d.ts +6 -0
- package/dist/dom/app_host.js +13 -0
- package/dist/dom/calm_frames.d.ts +24 -0
- package/dist/dom/calm_frames.js +96 -0
- package/dist/dom/classnames.d.ts +8 -0
- package/dist/dom/classnames.js +20 -0
- package/dist/dom/download_file.d.ts +1 -0
- package/dist/dom/download_file.js +12 -0
- package/dist/dom/focus.d.ts +29 -0
- package/dist/dom/focus.js +84 -0
- package/dist/dom/graph_edges.d.ts +53 -0
- package/dist/dom/graph_edges.js +450 -0
- package/dist/dom/key_events.d.ts +9 -0
- package/dist/dom/key_events.js +33 -0
- package/dist/dom/media_query.d.ts +2 -0
- package/dist/dom/media_query.js +15 -0
- package/dist/dom/outside_click.d.ts +8 -0
- package/dist/dom/outside_click.js +32 -0
- package/dist/dom/rerender_ref.d.ts +2 -0
- package/dist/dom/rerender_ref.js +11 -0
- package/dist/dom/row_context_menu.d.ts +7 -0
- package/dist/dom/row_context_menu.js +32 -0
- package/dist/dom/scrollbar.d.ts +3 -0
- package/dist/dom/scrollbar.js +23 -0
- package/dist/format/format.d.ts +11 -0
- package/dist/format/format.js +72 -0
- package/dist/format/query_progress_format.d.ts +17 -0
- package/dist/format/query_progress_format.js +69 -0
- package/dist/format/time_format.d.ts +5 -0
- package/dist/format/time_format.js +45 -0
- package/dist/hooks.d.ts +71 -0
- package/dist/hooks.js +302 -0
- package/dist/host.d.ts +10 -0
- package/dist/host.js +12 -0
- package/dist/logger.d.ts +4 -0
- package/dist/logger.js +6 -0
- package/dist/models/computation_model.d.ts +14 -0
- package/dist/models/computation_model.js +27 -0
- package/dist/models/query_model.d.ts +12 -0
- package/dist/models/query_model.js +27 -0
- package/dist/models/script_model.d.ts +17 -0
- package/dist/models/script_model.js +69 -0
- package/dist/style.css +4226 -0
- package/dist/svg_symbols.d.ts +2 -0
- package/dist/svg_symbols.js +2 -0
- package/dist/symbols.svg +1197 -0
- package/dist/theme/color_scheme.d.ts +4 -0
- package/dist/theme/color_scheme.js +28 -0
- package/dist/theme/xcode_palette.d.ts +22 -0
- package/dist/theme/xcode_palette.js +4 -0
- package/dist/theme/xcode_palettes.js +41 -0
- package/dist/utils/plan_engine.d.ts +2 -0
- package/dist/utils/plan_engine.js +13 -0
- package/dist/vegalite/vegalite_check.d.ts +1 -0
- package/dist/vegalite/vegalite_check.js +7 -0
- package/dist/vegalite/vegalite_crossfilter.d.ts +54 -0
- package/dist/vegalite/vegalite_crossfilter.js +187 -0
- package/dist/vegalite/vegalite_image.d.ts +16 -0
- package/dist/vegalite/vegalite_image.js +28 -0
- package/dist/vegalite/vegalite_loader.d.ts +7 -0
- package/dist/vegalite/vegalite_loader.js +15 -0
- package/dist/vegalite/vegalite_rows.d.ts +3 -0
- package/dist/vegalite/vegalite_rows.js +17 -0
- package/dist/vegalite/vegalite_theme.d.ts +11 -0
- package/dist/vegalite/vegalite_theme.js +125 -0
- package/fonts/InstrumentSans-Bold.ttf +0 -0
- package/fonts/InstrumentSans-Medium.ttf +0 -0
- package/fonts/InstrumentSans-OFL.txt +93 -0
- package/fonts/InstrumentSans-Regular.ttf +0 -0
- package/fonts/InstrumentSans-SemiBold.ttf +0 -0
- package/fonts/JetBrainsMono-Bold.ttf +0 -0
- package/fonts/JetBrainsMono-Medium.ttf +0 -0
- package/fonts/JetBrainsMono-OFL.txt +93 -0
- package/fonts/JetBrainsMono-Regular.ttf +0 -0
- package/fonts/JetBrainsMono-SemiBold.ttf +0 -0
- package/fonts/fonts.css +61 -0
- package/package.json +43 -4
- package/styles/colors.css +110 -0
- package/styles/flavors/dbcom.css +48 -0
- package/styles/tokens.css +192 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
var DARK_QUERY = "(prefers-color-scheme: dark)";
|
|
3
|
+
var currentSetting = null;
|
|
4
|
+
var listeners = /* @__PURE__ */ new Set();
|
|
5
|
+
function applyColorSchemeToDocument(setting, doc = document) {
|
|
6
|
+
if (setting == null) delete doc.documentElement.dataset.colorScheme;
|
|
7
|
+
else doc.documentElement.dataset.colorScheme = setting;
|
|
8
|
+
if (setting !== currentSetting) {
|
|
9
|
+
currentSetting = setting;
|
|
10
|
+
for (const listener of listeners) listener();
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
function subscribe(listener) {
|
|
14
|
+
listeners.add(listener);
|
|
15
|
+
const media = globalThis.matchMedia?.(DARK_QUERY);
|
|
16
|
+
media?.addEventListener("change", listener);
|
|
17
|
+
return () => {
|
|
18
|
+
listeners.delete(listener);
|
|
19
|
+
media?.removeEventListener("change", listener);
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
function resolveColorScheme() {
|
|
23
|
+
return currentSetting ?? (globalThis.matchMedia?.(DARK_QUERY).matches ? "dark" : "light");
|
|
24
|
+
}
|
|
25
|
+
function useColorScheme() {
|
|
26
|
+
return React.useSyncExternalStore(subscribe, resolveColorScheme, () => "light");
|
|
27
|
+
}
|
|
28
|
+
export { applyColorSchemeToDocument, resolveColorScheme, useColorScheme };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface XcodePalette {
|
|
2
|
+
background: string;
|
|
3
|
+
foreground: string;
|
|
4
|
+
caret?: string;
|
|
5
|
+
selection: string;
|
|
6
|
+
selectionMatch: string;
|
|
7
|
+
gutterBackground?: string;
|
|
8
|
+
gutterForeground?: string;
|
|
9
|
+
lineHighlight: string;
|
|
10
|
+
comment: string;
|
|
11
|
+
keyword: string;
|
|
12
|
+
typeOperator?: string;
|
|
13
|
+
typeName: string;
|
|
14
|
+
propertyName: string;
|
|
15
|
+
string: string;
|
|
16
|
+
name: string;
|
|
17
|
+
variableName: string;
|
|
18
|
+
variableDefinition: string;
|
|
19
|
+
link: string;
|
|
20
|
+
}
|
|
21
|
+
export declare const xcodeLightPalette: XcodePalette;
|
|
22
|
+
export declare const xcodeDarkPalette: XcodePalette;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
var light = {
|
|
2
|
+
"background": "#fff",
|
|
3
|
+
"foreground": "#3D3D3D",
|
|
4
|
+
"selection": "#BBDFFF",
|
|
5
|
+
"selectionMatch": "#BBDFFF",
|
|
6
|
+
"gutterBackground": "#fff",
|
|
7
|
+
"gutterForeground": "#AFAFAF",
|
|
8
|
+
"lineHighlight": "#d5e6ff69",
|
|
9
|
+
"comment": "#707F8D",
|
|
10
|
+
"keyword": "#aa0d91",
|
|
11
|
+
"typeOperator": "#aa0d91",
|
|
12
|
+
"typeName": "#522BB2",
|
|
13
|
+
"propertyName": "#032f62",
|
|
14
|
+
"string": "#D23423",
|
|
15
|
+
"name": "#032f62",
|
|
16
|
+
"variableName": "#23575C",
|
|
17
|
+
"variableDefinition": "#327A9E",
|
|
18
|
+
"link": "#0e0eff"
|
|
19
|
+
};
|
|
20
|
+
var dark = {
|
|
21
|
+
"background": "#292A30",
|
|
22
|
+
"foreground": "#CECFD0",
|
|
23
|
+
"caret": "#fff",
|
|
24
|
+
"selection": "#727377",
|
|
25
|
+
"selectionMatch": "#727377",
|
|
26
|
+
"lineHighlight": "#ffffff0f",
|
|
27
|
+
"comment": "#7F8C98",
|
|
28
|
+
"keyword": "#FF7AB2",
|
|
29
|
+
"typeName": "#DABAFF",
|
|
30
|
+
"propertyName": "#6BAA9F",
|
|
31
|
+
"string": "#FF8170",
|
|
32
|
+
"name": "#6BAA9F",
|
|
33
|
+
"variableName": "#ACF2E4",
|
|
34
|
+
"variableDefinition": "#6BDFFF",
|
|
35
|
+
"link": "#FF8170"
|
|
36
|
+
};
|
|
37
|
+
var xcode_palettes_default = {
|
|
38
|
+
light,
|
|
39
|
+
dark
|
|
40
|
+
};
|
|
41
|
+
export { dark, xcode_palettes_default as default, light };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as dashql from "@akohn/dashql";
|
|
2
|
+
var PEEK_WINDOW = 4096;
|
|
3
|
+
var TRINO_PLAN_RE = /^\{\s*"\d+"\s*:\s*\{\s*"id"\s*:/;
|
|
4
|
+
var HYPER_OPERATOR_KEY = "\"operator\"";
|
|
5
|
+
function detectPlanEngine(text) {
|
|
6
|
+
if (text == null) return null;
|
|
7
|
+
const head = text.slice(0, PEEK_WINDOW).trimStart();
|
|
8
|
+
if (!head.startsWith("{") || !text.slice(-4096).trimEnd().endsWith("}")) return null;
|
|
9
|
+
if (TRINO_PLAN_RE.test(head)) return dashql.buffers.profile.ProfileEngine.TRINO;
|
|
10
|
+
if (head.includes(HYPER_OPERATOR_KEY)) return dashql.buffers.profile.ProfileEngine.HYPER;
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
export { detectPlanEngine };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function checkVegaLiteSpec(spec: Record<string, unknown>): Promise<string[]>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { loadVega } from "./vegalite_loader.js";
|
|
2
|
+
import { compileProblems } from "@akohn/dashql/platform/workbook/chart_config";
|
|
3
|
+
async function checkVegaLiteSpec(spec) {
|
|
4
|
+
const { vegaLite } = await loadVega();
|
|
5
|
+
return compileProblems(vegaLite.compile, spec);
|
|
6
|
+
}
|
|
7
|
+
export { checkVegaLiteSpec };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import * as arrow from 'apache-arrow';
|
|
2
|
+
import type { Spec as VegaSpec } from 'vega';
|
|
3
|
+
import type { TopLevelSpec } from 'vega-lite';
|
|
4
|
+
export declare const MASK_ROW_ID_FIELD = "__dashql_row_id";
|
|
5
|
+
export interface VegaLiteCrossFilterBinding {
|
|
6
|
+
spec: TopLevelSpec;
|
|
7
|
+
sourceDatasetName: string;
|
|
8
|
+
maskDatasetName: string | null;
|
|
9
|
+
maskActiveSignalName: string | null;
|
|
10
|
+
maskSelectedFieldName: string | null;
|
|
11
|
+
}
|
|
12
|
+
export interface VegaCrossFilterView {
|
|
13
|
+
data(name: string, values: object[]): VegaCrossFilterView;
|
|
14
|
+
signal(name: string, value: unknown): VegaCrossFilterView;
|
|
15
|
+
scale(name: string): {
|
|
16
|
+
domain(): unknown[];
|
|
17
|
+
};
|
|
18
|
+
resize(): VegaCrossFilterView;
|
|
19
|
+
runAsync(): Promise<unknown>;
|
|
20
|
+
}
|
|
21
|
+
export interface VegaStableScaleDomain {
|
|
22
|
+
scaleName: string;
|
|
23
|
+
signalName: string;
|
|
24
|
+
}
|
|
25
|
+
export interface VegaStableScaleBinding {
|
|
26
|
+
spec: VegaSpec;
|
|
27
|
+
domains: VegaStableScaleDomain[];
|
|
28
|
+
}
|
|
29
|
+
export interface VegaCrossFilterMask {
|
|
30
|
+
active: boolean;
|
|
31
|
+
rows: VegaCrossFilterRow[];
|
|
32
|
+
}
|
|
33
|
+
export interface VegaCrossFilterRow {
|
|
34
|
+
[MASK_ROW_ID_FIELD]: number;
|
|
35
|
+
[key: string]: number | boolean;
|
|
36
|
+
}
|
|
37
|
+
export declare function injectVegaStableScaleDomains(spec: VegaSpec): VegaStableScaleBinding;
|
|
38
|
+
export declare function injectVegaLiteCrossFilter(spec: TopLevelSpec, rowNumberFieldName: string | null, sourceFieldNames?: Iterable<string>): VegaLiteCrossFilterBinding;
|
|
39
|
+
export declare function filterTableToVegaCrossFilterRows(table: arrow.Table, selectedFieldName: string): VegaCrossFilterRow[];
|
|
40
|
+
export declare class VegaCrossFilterUpdater {
|
|
41
|
+
private view;
|
|
42
|
+
private sourceRows;
|
|
43
|
+
private readonly sourceDatasetName;
|
|
44
|
+
private readonly maskDatasetName;
|
|
45
|
+
private readonly maskActiveSignalName;
|
|
46
|
+
private readonly stableScaleDomains;
|
|
47
|
+
private pending;
|
|
48
|
+
private running;
|
|
49
|
+
private readonly onError;
|
|
50
|
+
constructor(view: VegaCrossFilterView, sourceDatasetName: string, sourceRows: object[], maskDatasetName: string | null, maskActiveSignalName: string | null, onError?: (error: unknown) => void, stableScaleDomains?: readonly VegaStableScaleDomain[]);
|
|
51
|
+
update(mask: VegaCrossFilterMask): void;
|
|
52
|
+
dispose(): void;
|
|
53
|
+
private flush;
|
|
54
|
+
}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
var SOURCE_DATASET_BASE = "__dashql_source";
|
|
2
|
+
var MASK_DATASET_BASE = "__dashql_crossfilter_ids";
|
|
3
|
+
var MASK_ACTIVE_BASE = "__dashql_crossfilter_active";
|
|
4
|
+
var MASK_SELECTED_FIELD_BASE = "__dashql_crossfilter_selected";
|
|
5
|
+
var STABLE_DOMAIN_SIGNAL_BASE = "__dashql_stable_domain";
|
|
6
|
+
var MASK_ROW_ID_FIELD = "__dashql_row_id";
|
|
7
|
+
function allocateName(base, usedNames) {
|
|
8
|
+
let name = base;
|
|
9
|
+
let suffix = 2;
|
|
10
|
+
while (usedNames.has(name)) name = `${base}_${suffix++}`;
|
|
11
|
+
usedNames.add(name);
|
|
12
|
+
return name;
|
|
13
|
+
}
|
|
14
|
+
function collectRuntimeNames(value, names) {
|
|
15
|
+
if (Array.isArray(value)) {
|
|
16
|
+
for (const entry of value) collectRuntimeNames(entry, names);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
if (value == null || typeof value !== "object") return;
|
|
20
|
+
const object = value;
|
|
21
|
+
if (typeof object.name === "string") names.add(object.name);
|
|
22
|
+
for (const entry of Object.values(object)) collectRuntimeNames(entry, names);
|
|
23
|
+
}
|
|
24
|
+
function hasDataReference(value) {
|
|
25
|
+
if (Array.isArray(value)) return value.some(hasDataReference);
|
|
26
|
+
if (value == null || typeof value !== "object") return false;
|
|
27
|
+
const object = value;
|
|
28
|
+
if (typeof object.data === "string") return true;
|
|
29
|
+
return Object.values(object).some(hasDataReference);
|
|
30
|
+
}
|
|
31
|
+
function injectVegaStableScaleDomains(spec) {
|
|
32
|
+
const input = spec;
|
|
33
|
+
const usedNames = /* @__PURE__ */ new Set();
|
|
34
|
+
collectRuntimeNames(input, usedNames);
|
|
35
|
+
const domains = [];
|
|
36
|
+
const signals = [...input.signals ?? []];
|
|
37
|
+
const scales = (input.scales ?? []).map((scale) => {
|
|
38
|
+
const scaleName = scale.name;
|
|
39
|
+
if (typeof scaleName !== "string" || scale.domainRaw != null || !hasDataReference(scale.domain)) return scale;
|
|
40
|
+
const signalName = allocateName(STABLE_DOMAIN_SIGNAL_BASE, usedNames);
|
|
41
|
+
domains.push({
|
|
42
|
+
scaleName,
|
|
43
|
+
signalName
|
|
44
|
+
});
|
|
45
|
+
signals.push({
|
|
46
|
+
name: signalName,
|
|
47
|
+
value: null
|
|
48
|
+
});
|
|
49
|
+
return {
|
|
50
|
+
...scale,
|
|
51
|
+
domainRaw: { signal: signalName }
|
|
52
|
+
};
|
|
53
|
+
});
|
|
54
|
+
if (domains.length === 0) return {
|
|
55
|
+
spec,
|
|
56
|
+
domains
|
|
57
|
+
};
|
|
58
|
+
return {
|
|
59
|
+
spec: {
|
|
60
|
+
...input,
|
|
61
|
+
scales,
|
|
62
|
+
signals
|
|
63
|
+
},
|
|
64
|
+
domains
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
function injectVegaLiteCrossFilter(spec, rowNumberFieldName, sourceFieldNames = []) {
|
|
68
|
+
const input = spec;
|
|
69
|
+
const usedNames = new Set(Object.keys(input.datasets ?? {}));
|
|
70
|
+
collectRuntimeNames(input, usedNames);
|
|
71
|
+
for (const fieldName of sourceFieldNames) usedNames.add(fieldName);
|
|
72
|
+
for (const param of input.params ?? []) if (param.name != null) usedNames.add(param.name);
|
|
73
|
+
const sourceDatasetName = allocateName(SOURCE_DATASET_BASE, usedNames);
|
|
74
|
+
const maskDatasetName = rowNumberFieldName != null ? allocateName(MASK_DATASET_BASE, usedNames) : null;
|
|
75
|
+
const maskActiveSignalName = rowNumberFieldName != null ? allocateName(MASK_ACTIVE_BASE, usedNames) : null;
|
|
76
|
+
const maskSelectedFieldName = rowNumberFieldName != null ? allocateName(MASK_SELECTED_FIELD_BASE, usedNames) : null;
|
|
77
|
+
const datasets = { ...input.datasets ?? {} };
|
|
78
|
+
const params = [...input.params ?? []];
|
|
79
|
+
const transforms = [...input.transform ?? []];
|
|
80
|
+
if (rowNumberFieldName != null && maskDatasetName != null && maskActiveSignalName != null && maskSelectedFieldName != null) {
|
|
81
|
+
datasets[maskDatasetName] = [];
|
|
82
|
+
params.push({
|
|
83
|
+
name: maskActiveSignalName,
|
|
84
|
+
value: false
|
|
85
|
+
});
|
|
86
|
+
transforms.unshift({
|
|
87
|
+
lookup: rowNumberFieldName,
|
|
88
|
+
from: {
|
|
89
|
+
data: { name: maskDatasetName },
|
|
90
|
+
key: MASK_ROW_ID_FIELD,
|
|
91
|
+
fields: [maskSelectedFieldName]
|
|
92
|
+
},
|
|
93
|
+
as: [maskSelectedFieldName],
|
|
94
|
+
default: false
|
|
95
|
+
}, { filter: `!${maskActiveSignalName} || datum[${JSON.stringify(maskSelectedFieldName)}] === true` });
|
|
96
|
+
}
|
|
97
|
+
return {
|
|
98
|
+
spec: {
|
|
99
|
+
...input,
|
|
100
|
+
data: { name: sourceDatasetName },
|
|
101
|
+
datasets,
|
|
102
|
+
params,
|
|
103
|
+
transform: transforms
|
|
104
|
+
},
|
|
105
|
+
sourceDatasetName,
|
|
106
|
+
maskDatasetName,
|
|
107
|
+
maskActiveSignalName,
|
|
108
|
+
maskSelectedFieldName
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
function filterTableToVegaCrossFilterRows(table, selectedFieldName) {
|
|
112
|
+
if (table.numCols !== 1) return [];
|
|
113
|
+
const column = table.getChildAt(0);
|
|
114
|
+
if (column == null) return [];
|
|
115
|
+
const rows = [];
|
|
116
|
+
for (let i = 0; i < column.length; ++i) {
|
|
117
|
+
const value = column.get(i);
|
|
118
|
+
if (value == null) continue;
|
|
119
|
+
rows.push({
|
|
120
|
+
[MASK_ROW_ID_FIELD]: Number(value),
|
|
121
|
+
[selectedFieldName]: true
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
return rows;
|
|
125
|
+
}
|
|
126
|
+
var VegaCrossFilterUpdater = class {
|
|
127
|
+
view;
|
|
128
|
+
sourceRows;
|
|
129
|
+
sourceDatasetName;
|
|
130
|
+
maskDatasetName;
|
|
131
|
+
maskActiveSignalName;
|
|
132
|
+
stableScaleDomains;
|
|
133
|
+
pending = null;
|
|
134
|
+
running = false;
|
|
135
|
+
onError;
|
|
136
|
+
constructor(view, sourceDatasetName, sourceRows, maskDatasetName, maskActiveSignalName, onError = () => {}, stableScaleDomains = []) {
|
|
137
|
+
this.view = view;
|
|
138
|
+
this.sourceDatasetName = sourceDatasetName;
|
|
139
|
+
this.sourceRows = sourceRows;
|
|
140
|
+
this.maskDatasetName = maskDatasetName;
|
|
141
|
+
this.maskActiveSignalName = maskActiveSignalName;
|
|
142
|
+
this.onError = onError;
|
|
143
|
+
this.stableScaleDomains = stableScaleDomains;
|
|
144
|
+
}
|
|
145
|
+
update(mask) {
|
|
146
|
+
if (this.view == null) return;
|
|
147
|
+
this.pending = mask;
|
|
148
|
+
if (!this.running) this.flush();
|
|
149
|
+
}
|
|
150
|
+
dispose() {
|
|
151
|
+
this.view = null;
|
|
152
|
+
this.sourceRows = null;
|
|
153
|
+
this.pending = null;
|
|
154
|
+
}
|
|
155
|
+
async flush() {
|
|
156
|
+
this.running = true;
|
|
157
|
+
try {
|
|
158
|
+
while (this.view != null && this.pending != null) {
|
|
159
|
+
const view = this.view;
|
|
160
|
+
let unmaskedRun = false;
|
|
161
|
+
if (this.sourceRows != null) {
|
|
162
|
+
view.data(this.sourceDatasetName, this.sourceRows);
|
|
163
|
+
this.sourceRows = null;
|
|
164
|
+
if (this.stableScaleDomains.length > 0) {
|
|
165
|
+
if (this.maskDatasetName != null && this.maskActiveSignalName != null) view.data(this.maskDatasetName, []).signal(this.maskActiveSignalName, false);
|
|
166
|
+
await view.resize().runAsync();
|
|
167
|
+
if (this.view !== view) continue;
|
|
168
|
+
for (const domain of this.stableScaleDomains) view.signal(domain.signalName, [...view.scale(domain.scaleName).domain()]);
|
|
169
|
+
unmaskedRun = true;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
const mask = this.pending;
|
|
173
|
+
if (mask == null) continue;
|
|
174
|
+
this.pending = null;
|
|
175
|
+
if (unmaskedRun && !mask.active && mask.rows.length === 0) continue;
|
|
176
|
+
if (this.maskDatasetName != null && this.maskActiveSignalName != null) view.data(this.maskDatasetName, mask.rows).signal(this.maskActiveSignalName, mask.active);
|
|
177
|
+
await view.resize().runAsync();
|
|
178
|
+
}
|
|
179
|
+
} catch (error) {
|
|
180
|
+
this.onError(error);
|
|
181
|
+
} finally {
|
|
182
|
+
this.running = false;
|
|
183
|
+
if (this.view != null && this.pending != null) this.flush();
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
export { MASK_ROW_ID_FIELD, VegaCrossFilterUpdater, filterTableToVegaCrossFilterRows, injectVegaLiteCrossFilter, injectVegaStableScaleDomains };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { TopLevelSpec } from 'vega-lite';
|
|
2
|
+
import { CHART_IMAGE_HEIGHT, CHART_IMAGE_SCALE, CHART_IMAGE_WIDTH } from '@akohn/dashql/platform/workbook/chart_config';
|
|
3
|
+
import { type VegaModules } from './vegalite_loader.js';
|
|
4
|
+
export { CHART_IMAGE_HEIGHT, CHART_IMAGE_SCALE, CHART_IMAGE_WIDTH };
|
|
5
|
+
export interface ChartImageOptions {
|
|
6
|
+
width?: number;
|
|
7
|
+
height?: number;
|
|
8
|
+
scale?: number;
|
|
9
|
+
loader?: () => Promise<VegaModules>;
|
|
10
|
+
}
|
|
11
|
+
export interface ChartImage {
|
|
12
|
+
png: Uint8Array;
|
|
13
|
+
width: number;
|
|
14
|
+
height: number;
|
|
15
|
+
}
|
|
16
|
+
export declare function renderVegaLitePng(spec: TopLevelSpec, rows: readonly object[], options?: ChartImageOptions): Promise<ChartImage>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { loadVega } from "./vegalite_loader.js";
|
|
2
|
+
import { createVegaLiteConfig, resolveChartColors } from "./vegalite_theme.js";
|
|
3
|
+
import { CHART_IMAGE_HEIGHT, CHART_IMAGE_SCALE, CHART_IMAGE_WIDTH, chartImageConfig, chartImageSpec } from "@akohn/dashql/platform/workbook/chart_config";
|
|
4
|
+
var VEGA_LOG_LEVEL_ERROR = 1;
|
|
5
|
+
async function renderVegaLitePng(spec, rows, options = {}) {
|
|
6
|
+
const { vega, vegaLite, expressionInterpreter } = await (options.loader ?? loadVega)();
|
|
7
|
+
const sizedSpec = chartImageSpec(spec, rows, options.width ?? CHART_IMAGE_WIDTH, options.height ?? CHART_IMAGE_HEIGHT);
|
|
8
|
+
const compiled = vegaLite.compile(sizedSpec, { config: chartImageConfig(createVegaLiteConfig(resolveChartColors("light"))) }).spec;
|
|
9
|
+
const view = new vega.View(vega.parse(compiled, void 0, { ast: true }), {
|
|
10
|
+
renderer: "none",
|
|
11
|
+
expr: expressionInterpreter,
|
|
12
|
+
logLevel: VEGA_LOG_LEVEL_ERROR
|
|
13
|
+
});
|
|
14
|
+
try {
|
|
15
|
+
await view.runAsync();
|
|
16
|
+
const canvas = await view.toCanvas(options.scale ?? CHART_IMAGE_SCALE);
|
|
17
|
+
const blob = await new Promise((resolve) => canvas.toBlob(resolve, "image/png"));
|
|
18
|
+
if (blob == null) throw new Error("The chart cannot be encoded as PNG");
|
|
19
|
+
return {
|
|
20
|
+
png: new Uint8Array(await blob.arrayBuffer()),
|
|
21
|
+
width: canvas.width,
|
|
22
|
+
height: canvas.height
|
|
23
|
+
};
|
|
24
|
+
} finally {
|
|
25
|
+
view.finalize();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export { CHART_IMAGE_HEIGHT, CHART_IMAGE_SCALE, CHART_IMAGE_WIDTH, renderVegaLitePng };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface VegaModules {
|
|
2
|
+
embed: typeof import('vega-embed').default;
|
|
3
|
+
vega: typeof import('vega-embed').vega;
|
|
4
|
+
vegaLite: typeof import('vega-embed').vegaLite;
|
|
5
|
+
expressionInterpreter: typeof import('vega-interpreter').expressionInterpreter;
|
|
6
|
+
}
|
|
7
|
+
export declare function loadVega(): Promise<VegaModules>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { __vitePreload } from "../_virtual/_vite/preload-helper.js";
|
|
2
|
+
var loading = null;
|
|
3
|
+
function loadVega() {
|
|
4
|
+
loading ??= Promise.all([__vitePreload(() => import("vega-embed"), []), __vitePreload(() => import("vega-interpreter"), [])]).then(([embed, interpreter]) => ({
|
|
5
|
+
embed: embed.default,
|
|
6
|
+
vega: embed.vega,
|
|
7
|
+
vegaLite: embed.vegaLite,
|
|
8
|
+
expressionInterpreter: interpreter.expressionInterpreter
|
|
9
|
+
})).catch((error) => {
|
|
10
|
+
loading = null;
|
|
11
|
+
throw error;
|
|
12
|
+
});
|
|
13
|
+
return loading;
|
|
14
|
+
}
|
|
15
|
+
export { loadVega };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var CHART_ROWS = 1e4;
|
|
2
|
+
function arrowRowToObject(row, fields) {
|
|
3
|
+
const obj = {};
|
|
4
|
+
for (const field of fields) {
|
|
5
|
+
const value = row[field.name];
|
|
6
|
+
if (typeof value === "bigint") obj[field.name] = Number(value);
|
|
7
|
+
else if (value instanceof Date) obj[field.name] = value.toISOString();
|
|
8
|
+
else obj[field.name] = value;
|
|
9
|
+
}
|
|
10
|
+
return obj;
|
|
11
|
+
}
|
|
12
|
+
function arrowTableToRows(table) {
|
|
13
|
+
const rows = [];
|
|
14
|
+
for (const row of table) rows.push(arrowRowToObject(row, table.schema.fields));
|
|
15
|
+
return rows;
|
|
16
|
+
}
|
|
17
|
+
export { CHART_ROWS, arrowTableToRows };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Config } from 'vega-lite';
|
|
2
|
+
import type { EmbedOptions } from 'vega-embed';
|
|
3
|
+
import { type ChartColors } from '@akohn/dashql/platform/workbook/chart_config';
|
|
4
|
+
import type { ColorScheme } from '../theme/color_scheme.js';
|
|
5
|
+
export type { ChartColors };
|
|
6
|
+
export declare const CATEGORICAL_COLOR_TOKENS: readonly ["--chart_color_1", "--chart_color_2", "--chart_color_3", "--chart_color_4", "--chart_color_5", "--chart_color_6", "--chart_color_7", "--chart_color_8"];
|
|
7
|
+
export declare function resolveChartColors(scheme?: ColorScheme): ChartColors;
|
|
8
|
+
export declare function createVegaLiteConfig(colors: ChartColors): Config;
|
|
9
|
+
export declare function createVegaLitePreviewConfig(colors: ChartColors): Config;
|
|
10
|
+
export declare const VEGA_TOOLTIP_THEME = "dashql";
|
|
11
|
+
export declare function createEmbedOptions(colors: ChartColors, expressionInterpreter: EmbedOptions['expr']): EmbedOptions;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/* empty css */
|
|
2
|
+
import { CHART_FALLBACK_FONT, LIGHT_CHART_COLORS, createChartConfig } from "@akohn/dashql/platform/workbook/chart_config";
|
|
3
|
+
var CATEGORICAL_COLOR_TOKENS = [
|
|
4
|
+
"--chart_color_1",
|
|
5
|
+
"--chart_color_2",
|
|
6
|
+
"--chart_color_3",
|
|
7
|
+
"--chart_color_4",
|
|
8
|
+
"--chart_color_5",
|
|
9
|
+
"--chart_color_6",
|
|
10
|
+
"--chart_color_7",
|
|
11
|
+
"--chart_color_8"
|
|
12
|
+
];
|
|
13
|
+
var TOKEN_FALLBACKS = {
|
|
14
|
+
...Object.fromEntries(CATEGORICAL_COLOR_TOKENS.map((token, i) => [token, LIGHT_CHART_COLORS.categorical[i]])),
|
|
15
|
+
"--color_danger_fg": LIGHT_CHART_COLORS.critical,
|
|
16
|
+
"--color_border_muted": LIGHT_CHART_COLORS.grid,
|
|
17
|
+
"--color_neutral_fg": LIGHT_CHART_COLORS.label,
|
|
18
|
+
"--color_fg_muted": LIGHT_CHART_COLORS.title,
|
|
19
|
+
"--color_fg": LIGHT_CHART_COLORS.text,
|
|
20
|
+
"--color_bg_card": LIGHT_CHART_COLORS.surface
|
|
21
|
+
};
|
|
22
|
+
function resolveColorTokens(tokens, scheme) {
|
|
23
|
+
const resolved = /* @__PURE__ */ new Map();
|
|
24
|
+
const rootStyle = getComputedStyle(document.documentElement);
|
|
25
|
+
const probe = document.createElement("span");
|
|
26
|
+
probe.style.display = "none";
|
|
27
|
+
if (scheme !== void 0) probe.style.colorScheme = scheme;
|
|
28
|
+
document.body.appendChild(probe);
|
|
29
|
+
try {
|
|
30
|
+
for (const token of tokens) {
|
|
31
|
+
if (rootStyle.getPropertyValue(token).trim() === "") {
|
|
32
|
+
resolved.set(token, TOKEN_FALLBACKS[token]);
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
probe.style.color = `var(${token})`;
|
|
36
|
+
resolved.set(token, getComputedStyle(probe).color);
|
|
37
|
+
}
|
|
38
|
+
} finally {
|
|
39
|
+
probe.remove();
|
|
40
|
+
}
|
|
41
|
+
return resolved;
|
|
42
|
+
}
|
|
43
|
+
function resolveChartColors(scheme) {
|
|
44
|
+
const tokens = [...CATEGORICAL_COLOR_TOKENS, ...Object.keys(TOKEN_FALLBACKS)];
|
|
45
|
+
const colors = resolveColorTokens([...new Set(tokens)], scheme);
|
|
46
|
+
return {
|
|
47
|
+
categorical: CATEGORICAL_COLOR_TOKENS.map((token) => colors.get(token)),
|
|
48
|
+
primary: colors.get("--chart_color_1"),
|
|
49
|
+
critical: colors.get("--color_danger_fg"),
|
|
50
|
+
grid: colors.get("--color_border_muted"),
|
|
51
|
+
label: colors.get("--color_neutral_fg"),
|
|
52
|
+
title: colors.get("--color_fg_muted"),
|
|
53
|
+
text: colors.get("--color_fg"),
|
|
54
|
+
surface: colors.get("--color_bg_card")
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
function resolveFont() {
|
|
58
|
+
const family = getComputedStyle(document.documentElement).getPropertyValue("--font_family").trim();
|
|
59
|
+
return family === "" ? CHART_FALLBACK_FONT : `${family}, ${CHART_FALLBACK_FONT}`;
|
|
60
|
+
}
|
|
61
|
+
function createVegaLiteConfig(colors) {
|
|
62
|
+
return createChartConfig(colors, resolveFont());
|
|
63
|
+
}
|
|
64
|
+
function createVegaLitePreviewConfig(colors) {
|
|
65
|
+
const base = createVegaLiteConfig(colors);
|
|
66
|
+
return {
|
|
67
|
+
...base,
|
|
68
|
+
line: {
|
|
69
|
+
...base.line,
|
|
70
|
+
strokeWidth: 1.5
|
|
71
|
+
},
|
|
72
|
+
point: {
|
|
73
|
+
...base.point,
|
|
74
|
+
size: 24,
|
|
75
|
+
strokeWidth: 1
|
|
76
|
+
},
|
|
77
|
+
text: {
|
|
78
|
+
...base.text,
|
|
79
|
+
fontSize: 9
|
|
80
|
+
},
|
|
81
|
+
axis: {
|
|
82
|
+
...base.axis,
|
|
83
|
+
labelFontSize: 8,
|
|
84
|
+
labelPadding: 3,
|
|
85
|
+
labelLimit: 64,
|
|
86
|
+
tickCount: 4,
|
|
87
|
+
titleFontSize: 9,
|
|
88
|
+
titlePadding: 4
|
|
89
|
+
},
|
|
90
|
+
axisX: {
|
|
91
|
+
...base.axisX,
|
|
92
|
+
labelAngle: 0
|
|
93
|
+
},
|
|
94
|
+
legend: {
|
|
95
|
+
...base.legend,
|
|
96
|
+
labelFontSize: 8,
|
|
97
|
+
titleFontSize: 9,
|
|
98
|
+
symbolSize: 32
|
|
99
|
+
},
|
|
100
|
+
header: {
|
|
101
|
+
...base.header,
|
|
102
|
+
labelFontSize: 9,
|
|
103
|
+
titleFontSize: 9
|
|
104
|
+
},
|
|
105
|
+
title: {
|
|
106
|
+
...base.title,
|
|
107
|
+
fontSize: 10,
|
|
108
|
+
offset: 4
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
var VEGA_TOOLTIP_THEME = "dashql";
|
|
113
|
+
function createEmbedOptions(colors, expressionInterpreter) {
|
|
114
|
+
return {
|
|
115
|
+
actions: false,
|
|
116
|
+
renderer: "canvas",
|
|
117
|
+
ast: true,
|
|
118
|
+
expr: expressionInterpreter,
|
|
119
|
+
config: createVegaLiteConfig(colors),
|
|
120
|
+
tooltip: { theme: VEGA_TOOLTIP_THEME },
|
|
121
|
+
logLevel: VEGA_LOG_LEVEL_ERROR
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
var VEGA_LOG_LEVEL_ERROR = 1;
|
|
125
|
+
export { CATEGORICAL_COLOR_TOKENS, VEGA_TOOLTIP_THEME, createEmbedOptions, createVegaLiteConfig, createVegaLitePreviewConfig, resolveChartColors };
|
|
Binary file
|
|
Binary file
|