@marimo-team/islands 0.16.2 → 0.16.3
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/{ConnectedDataExplorerComponent-KvtsEmcw.js → ConnectedDataExplorerComponent-CareOso9.js} +2 -2
- package/dist/{ImageComparisonComponent-R2tjqLSx.js → ImageComparisonComponent-I_Z738Uj.js} +1 -1
- package/dist/{_baseUniq-BykZEXIq.js → _baseUniq-D-Kb4EU4.js} +1 -1
- package/dist/{any-language-editor-CMt4Y6oz.js → any-language-editor-BRWmYor8.js} +1 -1
- package/dist/{architectureDiagram-W76B3OCA-mQ3sJdEW.js → architectureDiagram-W76B3OCA-bZJcJYGH.js} +4 -4
- package/dist/assets/{worker-B0C57BK8.js → worker-DMlIUTIq.js} +18 -17
- package/dist/{blockDiagram-QIGZ2CNN-BxLRv5EM.js → blockDiagram-QIGZ2CNN-DyXjO8fR.js} +5 -5
- package/dist/{c4Diagram-FPNF74CW-Cfz16aWq.js → c4Diagram-FPNF74CW-Bfs9ui2r.js} +2 -2
- package/dist/{channel-zr1uJJ5g.js → channel-CMup9X3Z.js} +1 -1
- package/dist/{chunk-4BX2VUAB-B8iHvpDe.js → chunk-4BX2VUAB-CW-ni6M_.js} +1 -1
- package/dist/{chunk-55IACEB6-CJs4dL1H.js → chunk-55IACEB6-Bj-Indya.js} +1 -1
- package/dist/{chunk-FMBD7UC4-C5irHg20.js → chunk-FMBD7UC4-9IC8qSSk.js} +1 -1
- package/dist/{chunk-K7UQS3LO-B2XW75WS.js → chunk-K7UQS3LO-aapkEuWN.js} +4 -4
- package/dist/{chunk-QN33PNHL-BtwctqGa.js → chunk-QN33PNHL-Bo5dJ5T5.js} +1 -1
- package/dist/{chunk-QZHKN3VN-Sb8ZD0FY.js → chunk-QZHKN3VN-BkMzjJYY.js} +1 -1
- package/dist/{chunk-TVAH2DTR-CEJ5zkLX.js → chunk-TVAH2DTR-Wqy_C_Rn.js} +3 -3
- package/dist/{chunk-TZMSLE5B-Ccm4T92V.js → chunk-TZMSLE5B-DjBmEAUz.js} +1 -1
- package/dist/{classDiagram-v2-RKCZMP56-DWTbT0ww.js → classDiagram-KNZD7YFC-DUsaN1O4.js} +2 -2
- package/dist/{classDiagram-KNZD7YFC-DWTbT0ww.js → classDiagram-v2-RKCZMP56-DUsaN1O4.js} +2 -2
- package/dist/{clone-CDDiMerE.js → clone-Dkt_7KOK.js} +1 -1
- package/dist/{cose-bilkent-S5V4N54A-B74aLjZ_.js → cose-bilkent-S5V4N54A-ClBuGZWI.js} +2 -2
- package/dist/{dagre-5GWH7T2D-Cie_wUzI.js → dagre-5GWH7T2D-BzmDIGaM.js} +6 -6
- package/dist/{data-grid-overlay-editor-OsCMRzfP.js → data-grid-overlay-editor-NiU9Ea77.js} +2 -2
- package/dist/{diagram-N5W7TBWH-CCeFeV2B.js → diagram-N5W7TBWH-BlO1yw_g.js} +5 -5
- package/dist/{diagram-QEK2KX5R-BPROiVV7.js → diagram-QEK2KX5R-BvK83LUx.js} +3 -3
- package/dist/{diagram-S2PKOQOG-BkLFbUa_.js → diagram-S2PKOQOG-DvBzRYd7.js} +3 -3
- package/dist/{dockerfile-CuJXUZQ_.js → dockerfile-CPQG2tLO.js} +1 -1
- package/dist/{erDiagram-AWTI2OKA-CpBWOTMK.js → erDiagram-AWTI2OKA-Doy9FRTX.js} +4 -4
- package/dist/{flowDiagram-PVAE7QVJ-C_X4bmq3.js → flowDiagram-PVAE7QVJ-D_tX_HU1.js} +5 -5
- package/dist/{ganttDiagram-OWAHRB6G-CruldwEp.js → ganttDiagram-OWAHRB6G-CV03BHVY.js} +4 -4
- package/dist/{gitGraphDiagram-NY62KEGX-ZJnVxaQP.js → gitGraphDiagram-NY62KEGX-w3szEguZ.js} +4 -4
- package/dist/{glide-data-editor-CnOBht4I.js → glide-data-editor-akznFrmp.js} +3 -3
- package/dist/{graph-DjTtWtcG.js → graph-CjrrDHdT.js} +3 -3
- package/dist/index-CIJJs0Tu.js +40382 -0
- package/dist/{index-CZ9vIBEc.js → index-DMo6cbcV.js} +3 -3
- package/dist/{index-saLjL5eo.js → index-DlV2CtJb.js} +1 -1
- package/dist/{index-DSpjUDnr.js → index-Y-Vbae6Z.js} +1 -1
- package/dist/{infoDiagram-STP46IZ2-RZgl96nR.js → infoDiagram-STP46IZ2-BcBV2j75.js} +2 -2
- package/dist/{journeyDiagram-BIP6EPQ6-9ytZy-zY.js → journeyDiagram-BIP6EPQ6-BTGMSgvB.js} +3 -3
- package/dist/{kanban-definition-6OIFK2YF-CpjPWkgX.js → kanban-definition-6OIFK2YF-aopNqZ1Y.js} +2 -2
- package/dist/{layout-BAvhX25D.js → layout-Dvo9pb_w.js} +4 -4
- package/dist/{linear-BKZuvJrK.js → linear-CHnELER9.js} +1 -1
- package/dist/{main-pE28kbH0.js → main-kLZGkzVQ.js} +34849 -34052
- package/dist/main.js +1 -1
- package/dist/{mermaid-BGd7kEsf.js → mermaid-DgM4_4bD.js} +30 -30
- package/dist/{min-DmsBJf5S.js → min-cX4DuL_n.js} +2 -2
- package/dist/{mindmap-definition-Q6HEUPPD-BerypnVD.js → mindmap-definition-Q6HEUPPD-DZjbYryy.js} +3 -3
- package/dist/{number-overlay-editor-A7ZQ6sSs.js → number-overlay-editor-8MpIObf7.js} +2 -2
- package/dist/{pieDiagram-ADFJNKIX-ChcQLZM2.js → pieDiagram-ADFJNKIX-D6L1IYAc.js} +3 -3
- package/dist/{quadrantDiagram-LMRXKWRM-BOMxo-5G.js → quadrantDiagram-LMRXKWRM-nOyuc3Bf.js} +2 -2
- package/dist/{react-plotly-8f0vAPdB.js → react-plotly-ChkfYiVe.js} +1 -1
- package/dist/{requirementDiagram-4UW4RH46-rql0vkIr.js → requirementDiagram-4UW4RH46-OVV8wsju.js} +3 -3
- package/dist/{sankeyDiagram-GR3RE2ED-BMz3hqw4.js → sankeyDiagram-GR3RE2ED-qZHMdnE_.js} +1 -1
- package/dist/{sequenceDiagram-C3RYC4MD-DFK39LUK.js → sequenceDiagram-C3RYC4MD-D0bOqf-t.js} +3 -3
- package/dist/{slides-component-BNsZuUgg.js → slides-component-CNzLDdA3.js} +1 -1
- package/dist/{stateDiagram-KXAO66HF-B_3SWOCl.js → stateDiagram-KXAO66HF-CFNCnNJS.js} +4 -4
- package/dist/{stateDiagram-v2-UMBNRL4Z-BWAYN6aU.js → stateDiagram-v2-UMBNRL4Z-CnIh27m8.js} +2 -2
- package/dist/style.css +1 -1
- package/dist/{time-DCvYzQ5t.js → time-Z7CJSfOW.js} +2 -2
- package/dist/{timeline-definition-XQNQX7LJ-CSbxJ5mV.js → timeline-definition-XQNQX7LJ-BYLMfrvK.js} +1 -1
- package/dist/{treemap-75Q7IDZK-LMXGKln_.js → treemap-75Q7IDZK-BEh1HacP.js} +5 -5
- package/dist/{vega-component-CRmon7pH.js → vega-component-iMjXd3tD.js} +2 -2
- package/dist/{xychartDiagram-6GGTOJPD-DaUD4dq3.js → xychartDiagram-6GGTOJPD-Bmi13ZSG.js} +2 -2
- package/package.json +6 -6
- package/src/__mocks__/common.ts +5 -3
- package/src/__mocks__/notebook.ts +2 -2
- package/src/__tests__/main.test.tsx +2 -2
- package/src/components/ai/ai-provider-icon.tsx +2 -0
- package/src/components/app-config/ai-config.tsx +32 -1
- package/src/components/app-config/common.tsx +2 -2
- package/src/components/app-config/user-config-form.tsx +26 -0
- package/src/components/audio/audio-recorder.tsx +0 -1
- package/src/components/chat/acp/blocks.tsx +2 -2
- package/src/components/chat/acp/thread.tsx +3 -5
- package/src/components/chat/acp/utils.ts +5 -5
- package/src/components/chat/chat-panel.tsx +1 -1
- package/src/components/data-table/__tests__/data-table.test.tsx +2 -2
- package/src/components/data-table/charts/__tests__/altair-generator.test.ts +1 -1
- package/src/components/data-table/charts/chart-spec/tooltips.ts +3 -3
- package/src/components/data-table/charts/components/chart-items.tsx +1 -1
- package/src/components/data-table/charts/components/form-fields.tsx +2 -2
- package/src/components/data-table/charts/constants.ts +1 -1
- package/src/components/data-table/column-explorer-panel/column-explorer.tsx +1 -1
- package/src/components/data-table/column-summary/chart-spec-model.tsx +2 -2
- package/src/components/data-table/columns.tsx +1 -1
- package/src/components/data-table/data-table.tsx +35 -3
- package/src/components/data-table/date-popover.tsx +1 -1
- package/src/components/data-table/download-actions.tsx +1 -1
- package/src/components/data-table/range-focus/__tests__/utils.test.ts +5 -5
- package/src/components/data-table/renderers.tsx +6 -5
- package/src/components/data-table/row-viewer-panel/row-viewer.tsx +1 -1
- package/src/components/data-table/types.ts +4 -3
- package/src/components/datasources/column-preview.tsx +9 -6
- package/src/components/debugger/debugger-code.tsx +1 -1
- package/src/components/dependency-graph/custom-node.tsx +15 -6
- package/src/components/dependency-graph/dependency-graph-minimap.tsx +2 -2
- package/src/components/dependency-graph/dependency-graph-tree.tsx +2 -2
- package/src/components/dependency-graph/dependency-graph.tsx +1 -1
- package/src/components/dependency-graph/elements.ts +7 -7
- package/src/components/dependency-graph/utils/changes.ts +4 -4
- package/src/components/editor/Cell.tsx +6 -2
- package/src/components/editor/ai/transport/chat-transport.tsx +1 -1
- package/src/components/editor/chrome/panels/outline/useActiveOutline.tsx +1 -1
- package/src/components/editor/chrome/panels/packages-panel.tsx +1 -1
- package/src/components/editor/columns/storage.ts +1 -1
- package/src/components/editor/database/__tests__/__snapshots__/as-code.test.ts.snap +36 -0
- package/src/components/editor/database/__tests__/as-code.test.ts +30 -7
- package/src/components/editor/database/add-database-form.tsx +11 -0
- package/src/components/editor/database/as-code.ts +104 -5
- package/src/components/editor/database/schemas.ts +36 -18
- package/src/components/editor/errors/auto-fix.tsx +12 -2
- package/src/components/editor/errors/sql-validation-errors.tsx +12 -6
- package/src/components/editor/navigation/clipboard.ts +2 -2
- package/src/components/editor/output/ConsoleOutput.tsx +1 -1
- package/src/components/editor/output/JsonOutput.tsx +1 -1
- package/src/components/editor/output/MarimoErrorOutput.tsx +25 -25
- package/src/components/editor/output/MarimoTracebackOutput.tsx +17 -2
- package/src/components/editor/renderers/grid-layout/types.ts +2 -2
- package/src/components/editor/renderers/plugins.ts +1 -1
- package/src/components/editor/renderers/types.ts +1 -1
- package/src/components/editor/renderers/vertical-layout/vertical-layout.tsx +7 -7
- package/src/components/forms/form.tsx +5 -5
- package/src/components/ui/links.tsx +1 -0
- package/src/core/ai/__tests__/model-registry.test.ts +0 -10
- package/src/core/ai/context/providers/error.ts +2 -2
- package/src/core/ai/ids/ids.ts +1 -0
- package/src/core/ai/model-registry.ts +2 -1
- package/src/core/cells/cells.ts +5 -5
- package/src/core/cells/logs.ts +1 -1
- package/src/core/cells/types.ts +1 -1
- package/src/core/codemirror/__tests__/format.test.ts +6 -0
- package/src/core/codemirror/cells/traceback-decorations.ts +1 -1
- package/src/core/codemirror/editing/commands.ts +2 -2
- package/src/core/codemirror/find-replace/navigate.ts +1 -1
- package/src/core/codemirror/language/__tests__/extension.test.ts +1 -1
- package/src/core/codemirror/language/__tests__/sql-validation.test.ts +1 -1
- package/src/core/codemirror/language/__tests__/sql.test.ts +764 -79
- package/src/core/codemirror/language/languages/markdown.ts +4 -1
- package/src/core/codemirror/language/languages/sql/{validation-errors.ts → banner-validation-errors.ts} +9 -3
- package/src/core/codemirror/language/languages/sql/completion-builder.ts +160 -0
- package/src/core/codemirror/language/languages/sql/completion-sources.tsx +9 -3
- package/src/core/codemirror/language/languages/sql/completion-store.ts +46 -50
- package/src/core/codemirror/language/languages/sql/renderers.tsx +485 -0
- package/src/core/codemirror/language/languages/sql/sql.ts +151 -24
- package/src/core/codemirror/language/languages/sql/utils.ts +4 -1
- package/src/core/codemirror/language/panel/sql.tsx +6 -1
- package/src/core/codemirror/language/utils/ast.ts +3 -3
- package/src/core/codemirror/lsp/federated-lsp.ts +4 -4
- package/src/core/codemirror/lsp/lens.ts +4 -4
- package/src/core/codemirror/lsp/notebook-lsp.ts +1 -1
- package/src/core/codemirror/lsp/types.ts +1 -1
- package/src/core/codemirror/markdown/completions.ts +1 -1
- package/src/core/codemirror/reactive-references/analyzer.ts +2 -2
- package/src/core/codemirror/rtc/loro/awareness.ts +1 -1
- package/src/core/config/config-schema.ts +1 -0
- package/src/core/config/feature-flag.tsx +3 -1
- package/src/core/datasets/request-registry.ts +17 -10
- package/src/core/dom/events.ts +1 -1
- package/src/core/dom/outline.ts +2 -2
- package/src/core/dom/uiregistry.ts +2 -8
- package/src/core/errors/__tests__/errors.test.ts +22 -4
- package/src/core/errors/errors.ts +29 -1
- package/src/core/errors/state.ts +1 -1
- package/src/core/islands/main.ts +2 -2
- package/src/core/islands/parse.ts +1 -3
- package/src/core/kernel/messages.ts +1 -1
- package/src/core/network/CachingRequestRegistry.ts +74 -0
- package/src/core/network/DeferredRequestRegistry.ts +3 -1
- package/src/core/network/__tests__/CachingRequestRegistry.test.ts +73 -0
- package/src/core/network/types.ts +1 -1
- package/src/core/variables/state.ts +2 -2
- package/src/core/wasm/__tests__/state.test.ts +1 -1
- package/src/core/websocket/useMarimoWebSocket.tsx +5 -2
- package/src/custom.d.ts +1 -1
- package/src/hooks/useCellRenderCount.ts +1 -0
- package/src/hooks/useResizeHandle.ts +4 -1
- package/src/plugins/core/RenderHTML.tsx +1 -2
- package/src/plugins/impl/DataTablePlugin.tsx +7 -2
- package/src/plugins/impl/FileUploadPlugin.tsx +1 -1
- package/src/plugins/impl/RefreshPlugin.tsx +1 -1
- package/src/plugins/impl/SliderPlugin.tsx +4 -0
- package/src/plugins/impl/anywidget/AnyWidgetPlugin.tsx +27 -9
- package/src/plugins/impl/anywidget/__tests__/AnyWidgetPlugin.test.tsx +58 -2
- package/src/plugins/impl/anywidget/__tests__/model.test.ts +3 -4
- package/src/plugins/impl/anywidget/model.ts +2 -3
- package/src/plugins/impl/data-editor/types.ts +1 -1
- package/src/plugins/impl/data-explorer/components/query-form.tsx +1 -1
- package/src/plugins/impl/data-frames/types.ts +1 -1
- package/src/plugins/impl/panel/PanelPlugin.tsx +2 -2
- package/src/plugins/impl/plotly/PlotlyPlugin.tsx +3 -3
- package/src/plugins/impl/vega/__tests__/loader.test.ts +2 -2
- package/src/plugins/impl/vega/loader.ts +1 -1
- package/src/plugins/impl/vega/vega-component.tsx +1 -1
- package/src/plugins/impl/vega/vega-loader.ts +2 -2
- package/src/plugins/layout/NavigationMenuPlugin.tsx +1 -1
- package/src/plugins/layout/RoutesPlugin.tsx +1 -2
- package/src/plugins/plugins.ts +2 -2
- package/src/utils/Logger.ts +1 -1
- package/src/utils/__tests__/data-views.test.ts +30 -68
- package/src/utils/__tests__/dom.test.ts +10 -10
- package/src/utils/__tests__/id-tree.test.ts +49 -1
- package/src/utils/__tests__/storage.test.ts +1 -1
- package/src/utils/__tests__/traceback.test.ts +13 -2
- package/src/utils/arrays.ts +1 -1
- package/src/utils/createReducer.ts +1 -5
- package/src/utils/data-views.ts +6 -19
- package/src/utils/edit-distance.ts +1 -1
- package/src/utils/fileToBase64.ts +1 -1
- package/src/utils/id-tree.tsx +20 -18
- package/src/utils/json/base64.ts +13 -0
- package/src/utils/json/json-parser.ts +2 -2
- package/src/utils/lru.ts +4 -0
- package/src/utils/mergeRefs.ts +1 -1
- package/src/utils/objects.ts +3 -3
- package/src/utils/pluralize.ts +1 -1
- package/src/utils/routes.ts +2 -2
- package/src/utils/sets.ts +1 -1
- package/src/utils/traceback.ts +45 -15
- package/src/utils/tracer.ts +11 -9
- package/dist/index-DeOkA9fC.js +0 -40315
- package/src/__tests__/lru.test.ts +0 -74
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { R as q, r as ln, o as P, q as X, C as Z, u as D, v as fn } from "./timer-B0-z63CM.js";
|
|
2
|
-
import { c as hn, a as on } from "./linear-
|
|
2
|
+
import { c as hn, a as on } from "./linear-CHnELER9.js";
|
|
3
3
|
import { i as bn } from "./init-DxzjmxYy.js";
|
|
4
|
-
import { W as gn, X as d, Y as v, Z as k, _ as x, $ as L, a0 as yn, a1 as R, a2 as H, a3 as W, a4 as pn, a5 as mn, a6 as wn, a7 as Mn, a8 as dn, a9 as vn, aa as kn, ab as $, ac as A, ad as B, ae as K, af as _, ag as j, ah as xn } from "./main-
|
|
4
|
+
import { W as gn, X as d, Y as v, Z as k, _ as x, $ as L, a0 as yn, a1 as R, a2 as H, a3 as W, a4 as pn, a5 as mn, a6 as wn, a7 as Mn, a8 as dn, a9 as vn, aa as kn, ab as $, ac as A, ad as B, ae as K, af as _, ag as j, ah as xn } from "./main-kLZGkzVQ.js";
|
|
5
5
|
function Pn(n, t) {
|
|
6
6
|
let i;
|
|
7
7
|
if (t === void 0)
|
package/dist/{timeline-definition-XQNQX7LJ-CSbxJ5mV.js → timeline-definition-XQNQX7LJ-BYLMfrvK.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as s, c as xt, l as E, d as j, V as kt, W as vt, X as _t, Y as bt, D as wt, $ as St, z as Et } from "./mermaid-
|
|
1
|
+
import { _ as s, c as xt, l as E, d as j, V as kt, W as vt, X as _t, Y as bt, D as wt, $ as St, z as Et } from "./mermaid-DgM4_4bD.js";
|
|
2
2
|
import { d as nt } from "./arc-BOhn-m2C.js";
|
|
3
3
|
var Q = (function() {
|
|
4
4
|
var n = /* @__PURE__ */ s(function(x, r, a, c) {
|
|
@@ -2,11 +2,11 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
4
|
var _a2, _b, _c2, _d2, _e, _f2, _g, _h2, _i2, _j, _k, _l2, _m2, _n2, _o2, _p2, _q;
|
|
5
|
-
import { d_ as Kl, bQ as Vl, al as Ma, aT as Hl, u as _t, aO as Wl, ao as Z, bk as jl, bl as zl, k as ql, n as Ni, m as Da, am as Zs, d$ as Fa, aK as Yl, b0 as Ga, e0 as Ua, aM as Xl, b2 as wi, an as Jl, e1 as Ql, bg as Zl, e2 as eu, aP as Ie, q as vt, ar as _i, b3 as tu, e3 as H, e4 as Re } from "./main-
|
|
6
|
-
import { g as ei, d as bt, k as nu, v as W, l as Ba, m as ru, n as su, a as Ka, c as x, i as qe, r as ae, f as ke, o as z } from "./_baseUniq-
|
|
7
|
-
import { m as k, f as Lt, h as I, e as ti, l as Ot, d as iu } from "./min-
|
|
8
|
-
import { ad as P } from "./mermaid-
|
|
9
|
-
import { c as te } from "./clone-
|
|
5
|
+
import { d_ as Kl, bQ as Vl, al as Ma, aT as Hl, u as _t, aO as Wl, ao as Z, bk as jl, bl as zl, k as ql, n as Ni, m as Da, am as Zs, d$ as Fa, aK as Yl, b0 as Ga, e0 as Ua, aM as Xl, b2 as wi, an as Jl, e1 as Ql, bg as Zl, e2 as eu, aP as Ie, q as vt, ar as _i, b3 as tu, e3 as H, e4 as Re } from "./main-kLZGkzVQ.js";
|
|
6
|
+
import { g as ei, d as bt, k as nu, v as W, l as Ba, m as ru, n as su, a as Ka, c as x, i as qe, r as ae, f as ke, o as z } from "./_baseUniq-D-Kb4EU4.js";
|
|
7
|
+
import { m as k, f as Lt, h as I, e as ti, l as Ot, d as iu } from "./min-cX4DuL_n.js";
|
|
8
|
+
import { ad as P } from "./mermaid-DgM4_4bD.js";
|
|
9
|
+
import { c as te } from "./clone-Dkt_7KOK.js";
|
|
10
10
|
var au = Object.prototype, ou = au.hasOwnProperty, Ee = Kl(function(n, e) {
|
|
11
11
|
if (Vl(e) || Ma(e)) {
|
|
12
12
|
Hl(e, _t(e), n);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as V, F as K, A as Z, G as z, H as R, I as G, j as d, E as W, J as U, r as k, K as j, M, N as $, L as x, O as _, P as B, Q, S as q, T as J, U as Y, V as X } from "./main-
|
|
2
|
-
import { M as m, V as ee } from "./index-
|
|
1
|
+
import { D as V, F as K, A as Z, G as z, H as R, I as G, j as d, E as W, J as U, r as k, K as j, M, N as $, L as x, O as _, P as B, Q, S as q, T as J, U as Y, V as X } from "./main-kLZGkzVQ.js";
|
|
2
|
+
import { M as m, V as ee } from "./index-DMo6cbcV.js";
|
|
3
3
|
function te(e) {
|
|
4
4
|
return e.data && "url" in e.data && (e.data.url = V(e.data.url).href), e;
|
|
5
5
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i2, _j;
|
|
2
|
-
import { _ as a, s as ei, g as si, t as Lt, q as ni, a as ai, b as oi, l as Et, K as ri, e as hi, z as li, G as xt, F as It, H as ci, M as ui, i as gi, ac as xi } from "./mermaid-
|
|
2
|
+
import { _ as a, s as ei, g as si, t as Lt, q as ni, a as ai, b as oi, l as Et, K as ri, e as hi, z as li, G as xt, F as It, H as ci, M as ui, i as gi, ac as xi } from "./mermaid-DgM4_4bD.js";
|
|
3
3
|
import { i as di } from "./init-DxzjmxYy.js";
|
|
4
4
|
import { o as fi } from "./ordinal-CYN5qNoq.js";
|
|
5
5
|
import { r as pi } from "./range-DdOGybNB.js";
|
|
6
|
-
import { l as Tt } from "./linear-
|
|
6
|
+
import { l as Tt } from "./linear-CHnELER9.js";
|
|
7
7
|
import { l as Dt } from "./timer-B0-z63CM.js";
|
|
8
8
|
function ht() {
|
|
9
9
|
var t = fi().unknown(void 0), i = t.domain, e = t.range, s = 0, n = 1, d, g, m = false, S = 0, D = 0, v = 0.5;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@marimo-team/islands",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.3",
|
|
4
4
|
"main": "dist/main.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"@marimo-team/codemirror-ai": "^0.3.2",
|
|
53
53
|
"@marimo-team/codemirror-languageserver": "1.15.24",
|
|
54
54
|
"@marimo-team/codemirror-mcp": "^0.1.5",
|
|
55
|
-
"@marimo-team/codemirror-sql": "^0.2.
|
|
55
|
+
"@marimo-team/codemirror-sql": "^0.2.3",
|
|
56
56
|
"@marimo-team/llm-info": "workspace:*",
|
|
57
57
|
"@marimo-team/marimo-api": "workspace:*",
|
|
58
58
|
"@marimo-team/react-slotz": "^0.2.0",
|
|
@@ -205,9 +205,9 @@
|
|
|
205
205
|
"@codecov/vite-plugin": "^1.9.1",
|
|
206
206
|
"@csstools/postcss-light-dark-function": "^2.0.10",
|
|
207
207
|
"@playwright/test": "^1.55.0",
|
|
208
|
-
"@storybook/addon-docs": "^9.1.
|
|
209
|
-
"@storybook/addon-links": "^9.1.
|
|
210
|
-
"@storybook/react-vite": "^9.1.
|
|
208
|
+
"@storybook/addon-docs": "^9.1.8",
|
|
209
|
+
"@storybook/addon-links": "^9.1.8",
|
|
210
|
+
"@storybook/react-vite": "^9.1.8",
|
|
211
211
|
"@swc-jotai/react-refresh": "^0.3.0",
|
|
212
212
|
"@testing-library/jest-dom": "^6.8.0",
|
|
213
213
|
"@testing-library/react": "^16.3.0",
|
|
@@ -242,7 +242,7 @@
|
|
|
242
242
|
"react": "^19.1.1",
|
|
243
243
|
"react-compiler-runtime": "19.1.0-rc.3",
|
|
244
244
|
"react-dom": "^19.1.1",
|
|
245
|
-
"storybook": "^9.1.
|
|
245
|
+
"storybook": "^9.1.8",
|
|
246
246
|
"stylelint": "^16.23.1",
|
|
247
247
|
"stylelint-config-standard": "^36.0.1",
|
|
248
248
|
"tailwindcss": "^4.1.13",
|
package/src/__mocks__/common.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* Copyright 2024 Marimo. All rights reserved. */
|
|
2
|
-
|
|
2
|
+
/** biome-ignore-all lint/suspicious/noConsole: for debugging */
|
|
3
3
|
import { type Mock, vi } from "vitest";
|
|
4
4
|
import { invariant } from "@/utils/invariant";
|
|
5
5
|
|
|
@@ -108,8 +108,10 @@ export const SetupMocks = {
|
|
|
108
108
|
delete store[key];
|
|
109
109
|
}),
|
|
110
110
|
clear: vi.fn(() => {
|
|
111
|
-
|
|
112
|
-
|
|
111
|
+
for (const key of Object.keys(store)) {
|
|
112
|
+
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
|
113
|
+
delete store[key];
|
|
114
|
+
}
|
|
113
115
|
}),
|
|
114
116
|
key: vi.fn((index: number) => Object.keys(store)[index] || null),
|
|
115
117
|
get length() {
|
|
@@ -134,11 +134,11 @@ export const MockNotebook = {
|
|
|
134
134
|
* Create a notebook state with error outputs for testing ErrorContextProvider
|
|
135
135
|
*/
|
|
136
136
|
notebookStateWithErrors: (
|
|
137
|
-
errors:
|
|
137
|
+
errors: {
|
|
138
138
|
cellId: CellId;
|
|
139
139
|
cellName: string;
|
|
140
140
|
errorData: MarimoError[];
|
|
141
|
-
}
|
|
141
|
+
}[],
|
|
142
142
|
): NotebookState => {
|
|
143
143
|
const cellData: Record<string, Partial<CellData>> = {};
|
|
144
144
|
|
|
@@ -23,7 +23,7 @@ vi.mock("../utils/vitals", () => ({
|
|
|
23
23
|
}));
|
|
24
24
|
|
|
25
25
|
vi.mock("react-dom/client", () => ({
|
|
26
|
-
createRoot: vi.fn().mockImplementation((
|
|
26
|
+
createRoot: vi.fn().mockImplementation((_el) => {
|
|
27
27
|
return {
|
|
28
28
|
render: vi.fn(),
|
|
29
29
|
};
|
|
@@ -47,7 +47,7 @@ describe("main", () => {
|
|
|
47
47
|
|
|
48
48
|
it.each(["edit", "read", "home", "run"])(
|
|
49
49
|
"should mount with mode %s",
|
|
50
|
-
(
|
|
50
|
+
(_mode) => {
|
|
51
51
|
const el = document.createElement("div");
|
|
52
52
|
mount({ mode: "edit" }, el);
|
|
53
53
|
|
|
@@ -8,6 +8,7 @@ import GitHubIcon from "@marimo-team/llm-info/icons/github.svg?inline";
|
|
|
8
8
|
import GeminiIcon from "@marimo-team/llm-info/icons/googlegemini.svg?inline";
|
|
9
9
|
import OllamaIcon from "@marimo-team/llm-info/icons/ollama.svg?inline";
|
|
10
10
|
import OpenAIIcon from "@marimo-team/llm-info/icons/openai.svg?inline";
|
|
11
|
+
import OpenRouterIcon from "@marimo-team/llm-info/icons/openrouter.svg?inline";
|
|
11
12
|
import { BotIcon } from "lucide-react";
|
|
12
13
|
import * as React from "react";
|
|
13
14
|
import type { ProviderId } from "@/core/ai/ids/ids";
|
|
@@ -27,6 +28,7 @@ const icons: Record<ProviderId | Aliases, string> = {
|
|
|
27
28
|
bedrock: BedrockIcon,
|
|
28
29
|
deepseek: DeepseekIcon,
|
|
29
30
|
github: GitHubIcon,
|
|
31
|
+
openrouter: OpenRouterIcon,
|
|
30
32
|
marimo: marimoIcon,
|
|
31
33
|
};
|
|
32
34
|
|
|
@@ -734,6 +734,36 @@ export const AiProvidersConfig: React.FC<AiConfigProps> = ({
|
|
|
734
734
|
/>
|
|
735
735
|
</AccordionFormItem>
|
|
736
736
|
|
|
737
|
+
<AccordionFormItem
|
|
738
|
+
title="OpenRouter"
|
|
739
|
+
provider="openrouter"
|
|
740
|
+
isConfigured={hasValue("ai.openrouter.api_key")}
|
|
741
|
+
>
|
|
742
|
+
<ApiKey
|
|
743
|
+
form={form}
|
|
744
|
+
config={config}
|
|
745
|
+
name="ai.openrouter.api_key"
|
|
746
|
+
placeholder="or-..."
|
|
747
|
+
testId="ai-openrouter-api-key-input"
|
|
748
|
+
description={
|
|
749
|
+
<>
|
|
750
|
+
Your OpenRouter API key from {""}
|
|
751
|
+
<ExternalLink href="https://openrouter.ai/keys">
|
|
752
|
+
openrouter.ai
|
|
753
|
+
</ExternalLink>
|
|
754
|
+
.
|
|
755
|
+
</>
|
|
756
|
+
}
|
|
757
|
+
/>
|
|
758
|
+
<BaseUrl
|
|
759
|
+
form={form}
|
|
760
|
+
config={config}
|
|
761
|
+
name="ai.openrouter.base_url"
|
|
762
|
+
placeholder="https://openrouter.ai/api/v1/"
|
|
763
|
+
testId="ai-openrouter-base-url-input"
|
|
764
|
+
/>
|
|
765
|
+
</AccordionFormItem>
|
|
766
|
+
|
|
737
767
|
<AccordionFormItem
|
|
738
768
|
title="Azure"
|
|
739
769
|
provider="azure"
|
|
@@ -761,7 +791,8 @@ export const AiProvidersConfig: React.FC<AiConfigProps> = ({
|
|
|
761
791
|
form={form}
|
|
762
792
|
config={config}
|
|
763
793
|
name="ai.azure.base_url"
|
|
764
|
-
placeholder="https://<your-resource-name>.openai.azure.com"
|
|
794
|
+
placeholder="https://<your-resource-name>.openai.azure.com/openai/deployments/<deployment-name>?api-version=<api-version>"
|
|
795
|
+
defaultValue="https://<your-resource-name>.openai.azure.com/openai/deployments/<deployment-name>?api-version=<api-version>"
|
|
765
796
|
testId="ai-azure-base-url-input"
|
|
766
797
|
/>
|
|
767
798
|
</AccordionFormItem>
|
|
@@ -36,10 +36,10 @@ export const SettingDescription: React.FC<PropsWithChildren> = ({
|
|
|
36
36
|
return <p className="text-sm text-muted-foreground">{children}</p>;
|
|
37
37
|
};
|
|
38
38
|
|
|
39
|
-
export const SQL_OUTPUT_SELECT_OPTIONS:
|
|
39
|
+
export const SQL_OUTPUT_SELECT_OPTIONS: {
|
|
40
40
|
label: string;
|
|
41
41
|
value: SqlOutputType;
|
|
42
|
-
}
|
|
42
|
+
}[] = [
|
|
43
43
|
{ label: "Auto (Default)", value: "auto" },
|
|
44
44
|
{ label: "Native", value: "native" },
|
|
45
45
|
{ label: "Polars", value: "polars" },
|
|
@@ -1359,6 +1359,32 @@ export const UserConfigForm: React.FC = () => {
|
|
|
1359
1359
|
</div>
|
|
1360
1360
|
)}
|
|
1361
1361
|
/>
|
|
1362
|
+
<FormField
|
|
1363
|
+
control={form.control}
|
|
1364
|
+
name="experimental.chat_modes"
|
|
1365
|
+
render={({ field }) => (
|
|
1366
|
+
<div className="flex flex-col gap-y-1">
|
|
1367
|
+
<FormItem className={formItemClasses}>
|
|
1368
|
+
<FormLabel className="font-normal">Chat Mode</FormLabel>
|
|
1369
|
+
<FormControl>
|
|
1370
|
+
<Checkbox
|
|
1371
|
+
data-testid="chat-mode-checkbox"
|
|
1372
|
+
checked={field.value === true}
|
|
1373
|
+
onCheckedChange={field.onChange}
|
|
1374
|
+
/>
|
|
1375
|
+
</FormControl>
|
|
1376
|
+
</FormItem>
|
|
1377
|
+
<IsOverridden
|
|
1378
|
+
userConfig={config}
|
|
1379
|
+
name="experimental.chat_modes"
|
|
1380
|
+
/>
|
|
1381
|
+
<FormDescription>
|
|
1382
|
+
Switch between different modes in the Chat sidebar, to
|
|
1383
|
+
enable tool use.
|
|
1384
|
+
</FormDescription>
|
|
1385
|
+
</div>
|
|
1386
|
+
)}
|
|
1387
|
+
/>
|
|
1362
1388
|
</SettingGroup>
|
|
1363
1389
|
);
|
|
1364
1390
|
}
|
|
@@ -528,7 +528,7 @@ export const CurrentModeBlock = (props: {
|
|
|
528
528
|
};
|
|
529
529
|
|
|
530
530
|
export const ToolNotificationsBlock = (props: {
|
|
531
|
-
data:
|
|
531
|
+
data: (ToolCallNotificationEvent | ToolCallUpdateNotificationEvent)[];
|
|
532
532
|
}) => {
|
|
533
533
|
const toolCalls = mergeToolCalls(props.data);
|
|
534
534
|
|
|
@@ -561,7 +561,7 @@ export const ToolNotificationsBlock = (props: {
|
|
|
561
561
|
};
|
|
562
562
|
|
|
563
563
|
export const DiffBlocks = (props: {
|
|
564
|
-
data:
|
|
564
|
+
data: Extract<ToolCallContent, { type: "diff" }>[];
|
|
565
565
|
}) => {
|
|
566
566
|
return (
|
|
567
567
|
<div className="flex flex-col gap-2 text-muted-foreground">
|
|
@@ -99,23 +99,21 @@ export const AgentThread = ({
|
|
|
99
99
|
|
|
100
100
|
function isErrorGroup(
|
|
101
101
|
group: NotificationEvent[],
|
|
102
|
-
): group is
|
|
102
|
+
): group is Extract<NotificationEvent, { type: "error" }>[] {
|
|
103
103
|
// We only check the first since we know the group is the same type
|
|
104
104
|
return group[0].type === "error";
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
function isConnectionChangeGroup(
|
|
108
108
|
group: NotificationEvent[],
|
|
109
|
-
): group is
|
|
109
|
+
): group is Extract<NotificationEvent, { type: "connection_change" }>[] {
|
|
110
110
|
// We only check the first since we know the group is the same type
|
|
111
111
|
return group[0].type === "connection_change";
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
function isSessionNotificationGroup(
|
|
115
115
|
group: NotificationEvent[],
|
|
116
|
-
): group is
|
|
117
|
-
Extract<NotificationEvent, { type: "session_notification" }>
|
|
118
|
-
> {
|
|
116
|
+
): group is Extract<NotificationEvent, { type: "session_notification" }>[] {
|
|
119
117
|
// We only check the first since we know the group is the same type
|
|
120
118
|
return group[0].type === "session_notification";
|
|
121
119
|
}
|
|
@@ -3,7 +3,7 @@ import type { NotificationDataOf, SessionNotificationEventData } from "./types";
|
|
|
3
3
|
|
|
4
4
|
export function isToolCalls(
|
|
5
5
|
group: SessionNotificationEventData[],
|
|
6
|
-
): group is
|
|
6
|
+
): group is NotificationDataOf<"tool_call" | "tool_call_update">[] {
|
|
7
7
|
// We only check the first since we know the group is the same type
|
|
8
8
|
const first = group[0];
|
|
9
9
|
return (
|
|
@@ -14,7 +14,7 @@ export function isToolCalls(
|
|
|
14
14
|
|
|
15
15
|
export function isAgentThoughts(
|
|
16
16
|
group: SessionNotificationEventData[],
|
|
17
|
-
): group is
|
|
17
|
+
): group is NotificationDataOf<"agent_thought_chunk">[] {
|
|
18
18
|
// We only check the first since we know the group is the same type
|
|
19
19
|
const first = group[0];
|
|
20
20
|
return first.sessionUpdate === "agent_thought_chunk";
|
|
@@ -22,7 +22,7 @@ export function isAgentThoughts(
|
|
|
22
22
|
|
|
23
23
|
export function isUserMessages(
|
|
24
24
|
group: SessionNotificationEventData[],
|
|
25
|
-
): group is
|
|
25
|
+
): group is NotificationDataOf<"user_message_chunk">[] {
|
|
26
26
|
// We only check the first since we know the group is the same type
|
|
27
27
|
const first = group[0];
|
|
28
28
|
return first.sessionUpdate === "user_message_chunk";
|
|
@@ -30,7 +30,7 @@ export function isUserMessages(
|
|
|
30
30
|
|
|
31
31
|
export function isAgentMessages(
|
|
32
32
|
group: SessionNotificationEventData[],
|
|
33
|
-
): group is
|
|
33
|
+
): group is NotificationDataOf<"agent_message_chunk">[] {
|
|
34
34
|
// We only check the first since we know the group is the same type
|
|
35
35
|
const first = group[0];
|
|
36
36
|
return first.sessionUpdate === "agent_message_chunk";
|
|
@@ -38,7 +38,7 @@ export function isAgentMessages(
|
|
|
38
38
|
|
|
39
39
|
export function isPlans(
|
|
40
40
|
group: SessionNotificationEventData[],
|
|
41
|
-
): group is
|
|
41
|
+
): group is NotificationDataOf<"plan">[] {
|
|
42
42
|
// We only check the first since we know the group is the same type
|
|
43
43
|
const first = group[0];
|
|
44
44
|
return first.sessionUpdate === "plan";
|
|
@@ -369,7 +369,7 @@ const ChatInputFooter: React.FC<ChatInputFooterProps> = memo(
|
|
|
369
369
|
<TooltipProvider>
|
|
370
370
|
<div className="px-3 py-2 border-t border-border/20 flex flex-row items-center justify-between">
|
|
371
371
|
<div className="flex items-center gap-2">
|
|
372
|
-
<FeatureFlagged feature="
|
|
372
|
+
<FeatureFlagged feature="chat_modes">
|
|
373
373
|
<Select value={currentMode} onValueChange={saveModeChange}>
|
|
374
374
|
<SelectTrigger className="h-6 text-xs border-border shadow-none! ring-0! bg-muted hover:bg-muted/30 py-0 px-2 gap-1 capitalize">
|
|
375
375
|
{currentMode}
|
|
@@ -18,7 +18,7 @@ describe("DataTable", () => {
|
|
|
18
18
|
{ id: 2, name: "Test 2" },
|
|
19
19
|
];
|
|
20
20
|
|
|
21
|
-
const columns:
|
|
21
|
+
const columns: ColumnDef<TestData>[] = [
|
|
22
22
|
{ accessorKey: "name", header: "Name" },
|
|
23
23
|
];
|
|
24
24
|
|
|
@@ -70,7 +70,7 @@ describe("DataTable", () => {
|
|
|
70
70
|
{ id: 2, first: "Jim", last: "Halpert" },
|
|
71
71
|
];
|
|
72
72
|
|
|
73
|
-
const columns:
|
|
73
|
+
const columns: ColumnDef<RowData>[] = [
|
|
74
74
|
{ accessorKey: "first", header: "First" },
|
|
75
75
|
{ accessorKey: "last", header: "Last" },
|
|
76
76
|
];
|
|
@@ -11,7 +11,7 @@ function createSpec(spec: {
|
|
|
11
11
|
encoding: Record<
|
|
12
12
|
string,
|
|
13
13
|
| { field: string; type?: string }
|
|
14
|
-
|
|
|
14
|
+
| { field: string; tooltip?: Record<string, string> }[]
|
|
15
15
|
>;
|
|
16
16
|
resolve?: Record<string, unknown>;
|
|
17
17
|
title?: string;
|
|
@@ -29,7 +29,7 @@ interface GetTooltipParams {
|
|
|
29
29
|
|
|
30
30
|
export function getTooltips(
|
|
31
31
|
params: GetTooltipParams,
|
|
32
|
-
):
|
|
32
|
+
): StringFieldDef<string>[] | undefined {
|
|
33
33
|
const { formValues, xEncoding, yEncoding, colorByEncoding } = params;
|
|
34
34
|
|
|
35
35
|
if (!formValues.tooltips) {
|
|
@@ -73,7 +73,7 @@ export function getTooltips(
|
|
|
73
73
|
|
|
74
74
|
// If autoTooltips is enabled, we manually add the x, y, and color columns to the tooltips
|
|
75
75
|
if (formValues.tooltips.auto) {
|
|
76
|
-
const tooltips:
|
|
76
|
+
const tooltips: StringFieldDef<string>[] = [];
|
|
77
77
|
const xTooltip = addTooltip(
|
|
78
78
|
xEncoding,
|
|
79
79
|
formValues.general?.xColumn?.type || "string",
|
|
@@ -105,7 +105,7 @@ export function getTooltips(
|
|
|
105
105
|
|
|
106
106
|
// Selected tooltips from the form.
|
|
107
107
|
const selectedTooltips = formValues.tooltips.fields ?? [];
|
|
108
|
-
const tooltips:
|
|
108
|
+
const tooltips: StringFieldDef<string>[] = [];
|
|
109
109
|
|
|
110
110
|
// We need to find the matching columns for the selected tooltips if they exist
|
|
111
111
|
// Otherwise, we can add them without other parameters
|
|
@@ -103,7 +103,7 @@ const ColumnSelectorWithAggregation: React.FC<{
|
|
|
103
103
|
selectedDataType?: SelectedDataType;
|
|
104
104
|
};
|
|
105
105
|
defaultAggregation?: AggregationFn;
|
|
106
|
-
columns:
|
|
106
|
+
columns: { name: string; type: DataType }[];
|
|
107
107
|
binFieldName: FieldName;
|
|
108
108
|
}> = ({
|
|
109
109
|
columnFieldName,
|
|
@@ -86,7 +86,7 @@ export const ColumnSelector = ({
|
|
|
86
86
|
includeCountField = true,
|
|
87
87
|
}: {
|
|
88
88
|
fieldName: FieldName;
|
|
89
|
-
columns:
|
|
89
|
+
columns: { name: string; type: DataType }[];
|
|
90
90
|
onValueChange?: (fieldName: string, type: DataType | undefined) => void;
|
|
91
91
|
includeCountField?: boolean;
|
|
92
92
|
}) => {
|
|
@@ -197,7 +197,7 @@ export const SelectField = ({
|
|
|
197
197
|
}: {
|
|
198
198
|
fieldName: FieldName;
|
|
199
199
|
label: string;
|
|
200
|
-
options:
|
|
200
|
+
options: { display: React.ReactNode; value: string }[];
|
|
201
201
|
defaultValue: string;
|
|
202
202
|
}) => {
|
|
203
203
|
const form = useFormContext();
|
|
@@ -79,7 +79,7 @@ export const AGGREGATION_TYPE_DESCRIPTIONS: Record<AggregationFn, string> = {
|
|
|
79
79
|
bin: "Group values into bins",
|
|
80
80
|
};
|
|
81
81
|
|
|
82
|
-
export const COLOR_SCHEMES:
|
|
82
|
+
export const COLOR_SCHEMES: (ColorScheme | typeof DEFAULT_COLOR_SCHEME)[] = [
|
|
83
83
|
DEFAULT_COLOR_SCHEME,
|
|
84
84
|
// Categorical schemes
|
|
85
85
|
"accent",
|
|
@@ -211,7 +211,7 @@ const ColumnPreview = ({
|
|
|
211
211
|
refetchPreview,
|
|
212
212
|
});
|
|
213
213
|
|
|
214
|
-
const previewStats = stats && renderStats(stats, dataType, locale);
|
|
214
|
+
const previewStats = stats && renderStats({ stats, dataType, locale });
|
|
215
215
|
|
|
216
216
|
const chart = chart_spec && renderChart(chart_spec, theme);
|
|
217
217
|
|
|
@@ -778,14 +778,14 @@ export class ColumnChartSpecModel<T> {
|
|
|
778
778
|
const yField = "value";
|
|
779
779
|
|
|
780
780
|
// Calculate xStart and xEnd for each value count
|
|
781
|
-
const newValueCounts:
|
|
781
|
+
const newValueCounts: {
|
|
782
782
|
count: number;
|
|
783
783
|
value: string;
|
|
784
784
|
xStart: number;
|
|
785
785
|
xEnd: number;
|
|
786
786
|
xMid: number;
|
|
787
787
|
proportion: number;
|
|
788
|
-
}
|
|
788
|
+
}[] = [];
|
|
789
789
|
let xStart = 0;
|
|
790
790
|
for (const valueCount of valueCounts) {
|
|
791
791
|
const xEnd = xStart + valueCount.count;
|
|
@@ -117,7 +117,7 @@ export function generateColumns<T>({
|
|
|
117
117
|
headerTooltip?: Record<string, string>;
|
|
118
118
|
showDataTypes?: boolean;
|
|
119
119
|
calculateTopKRows?: CalculateTopKRows;
|
|
120
|
-
}):
|
|
120
|
+
}): ColumnDef<T>[] {
|
|
121
121
|
// Row-headers are typically index columns
|
|
122
122
|
const rowHeadersSet = new Set(rowHeaders.map(([columnName]) => columnName));
|
|
123
123
|
|
|
@@ -47,7 +47,8 @@ import { getStableRowId } from "./utils";
|
|
|
47
47
|
interface DataTableProps<TData> extends Partial<DownloadActionProps> {
|
|
48
48
|
wrapperClassName?: string;
|
|
49
49
|
className?: string;
|
|
50
|
-
|
|
50
|
+
maxHeight?: number;
|
|
51
|
+
columns: ColumnDef<TData>[];
|
|
51
52
|
data: TData[];
|
|
52
53
|
// Sorting
|
|
53
54
|
manualSorting?: boolean; // server-side sorting
|
|
@@ -95,6 +96,7 @@ interface DataTableProps<TData> extends Partial<DownloadActionProps> {
|
|
|
95
96
|
const DataTableInternal = <TData,>({
|
|
96
97
|
wrapperClassName,
|
|
97
98
|
className,
|
|
99
|
+
maxHeight,
|
|
98
100
|
columns,
|
|
99
101
|
data,
|
|
100
102
|
selection,
|
|
@@ -250,6 +252,36 @@ const DataTableInternal = <TData,>({
|
|
|
250
252
|
|
|
251
253
|
const rowViewerPanelOpen = isPanelOpen?.("row-viewer") ?? false;
|
|
252
254
|
|
|
255
|
+
const tableRef = React.useRef<HTMLTableElement | null>(null);
|
|
256
|
+
|
|
257
|
+
// Why use a ref to set max-height on the wrapper?
|
|
258
|
+
// - position: sticky only works when the sticky element's nearest scrollable
|
|
259
|
+
// ancestor is its immediate container. If max-height/overflow are applied
|
|
260
|
+
// on a grandparent, sticky table headers (th) will not stick.
|
|
261
|
+
// - We keep the scroll wrapper colocated with the base Table component, but
|
|
262
|
+
// derive the scroll boundary from maxHeight here to avoid coupling UI base
|
|
263
|
+
// components to data-table specifics or expanding their API surface.
|
|
264
|
+
// - Setting styles on the table's direct wrapper ensures the header sticks
|
|
265
|
+
// reliably across browsers without changing upstream components.
|
|
266
|
+
React.useEffect(() => {
|
|
267
|
+
if (!tableRef.current) {
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
const wrapper = tableRef.current.parentElement as HTMLDivElement | null;
|
|
271
|
+
if (!wrapper) {
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
if (maxHeight) {
|
|
275
|
+
wrapper.style.maxHeight = `${maxHeight}px`;
|
|
276
|
+
// Ensure wrapper scrolls
|
|
277
|
+
if (!wrapper.style.overflow) {
|
|
278
|
+
wrapper.style.overflow = "auto";
|
|
279
|
+
}
|
|
280
|
+
} else {
|
|
281
|
+
wrapper.style.removeProperty("max-height");
|
|
282
|
+
}
|
|
283
|
+
}, [maxHeight]);
|
|
284
|
+
|
|
253
285
|
return (
|
|
254
286
|
<div className={cn(wrapperClassName, "flex flex-col space-y-1")}>
|
|
255
287
|
<FilterPills filters={filters} table={table} />
|
|
@@ -263,11 +295,11 @@ const DataTableInternal = <TData,>({
|
|
|
263
295
|
reloading={reloading}
|
|
264
296
|
/>
|
|
265
297
|
)}
|
|
266
|
-
<Table className="relative">
|
|
298
|
+
<Table className="relative" ref={tableRef}>
|
|
267
299
|
{showLoadingBar && (
|
|
268
300
|
<div className="absolute top-0 left-0 h-[3px] w-1/2 bg-primary animate-slide" />
|
|
269
301
|
)}
|
|
270
|
-
{renderTableHeader(table)}
|
|
302
|
+
{renderTableHeader(table, Boolean(maxHeight))}
|
|
271
303
|
<CellSelectionProvider>
|
|
272
304
|
<DataTableBody
|
|
273
305
|
table={table}
|
|
@@ -124,7 +124,7 @@ const RelativeTime = ({ date }: { date: Date }) => {
|
|
|
124
124
|
const differenceInSeconds = (currentTime.getTime() - date.getTime()) / 1000;
|
|
125
125
|
|
|
126
126
|
// Define time units with their thresholds and conversion factors
|
|
127
|
-
const timeUnits:
|
|
127
|
+
const timeUnits: [number, number, string][] = [
|
|
128
128
|
[60, 1, "second"], // Less than 60 seconds
|
|
129
129
|
[60, 60, "minute"], // Less than 60 minutes
|
|
130
130
|
[24, 3600, "hour"], // Less than 24 hours
|
|
@@ -167,7 +167,7 @@ export const DownloadAs: React.FC<DownloadActionProps> = (props) => {
|
|
|
167
167
|
);
|
|
168
168
|
};
|
|
169
169
|
|
|
170
|
-
function fetchJson(url: string): Promise<
|
|
170
|
+
function fetchJson(url: string): Promise<Record<string, unknown>[]> {
|
|
171
171
|
return fetch(url).then((res) => {
|
|
172
172
|
if (!res.ok) {
|
|
173
173
|
throw new Error(res.statusText);
|
|
@@ -20,17 +20,17 @@ function createMockCell(id: string, value: unknown): Cell<unknown, unknown> {
|
|
|
20
20
|
function createMockColumn(id: string): Column<unknown> {
|
|
21
21
|
return {
|
|
22
22
|
id: id,
|
|
23
|
-
getIndex: () => Number.parseInt(id),
|
|
23
|
+
getIndex: () => Number.parseInt(id, 10),
|
|
24
24
|
} as unknown as Column<unknown>;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
function createMockRow(
|
|
28
28
|
id: string,
|
|
29
|
-
cells:
|
|
29
|
+
cells: Cell<unknown, unknown>[],
|
|
30
30
|
): Row<unknown> {
|
|
31
31
|
return {
|
|
32
32
|
id,
|
|
33
|
-
index: Number.parseInt(id),
|
|
33
|
+
index: Number.parseInt(id, 10),
|
|
34
34
|
getAllCells: () => cells,
|
|
35
35
|
original: {},
|
|
36
36
|
depth: 0,
|
|
@@ -43,8 +43,8 @@ function createMockRow(
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
function createMockTable(
|
|
46
|
-
rows:
|
|
47
|
-
columns:
|
|
46
|
+
rows: Row<unknown>[],
|
|
47
|
+
columns: Column<unknown>[],
|
|
48
48
|
): Table<unknown> {
|
|
49
49
|
return {
|
|
50
50
|
getRow: (id: string) => rows.find((row) => row.id === id),
|