exploreda 0.0.5 → 0.0.6

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/ExplorEda.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import * as THREE2 from 'three';
2
2
  import { Vector3 } from 'three';
3
- import { X, SearchIcon, BarChart as BarChart$1, ChartBarBig, ScatterChart, Box, Table, Info, FileText, Palette, LineChart, Filter, Download, Loader2, ChevronsUpDown, Check, Search, ChevronUp, ChevronDown, ChevronLeft, ChevronRight, ArrowUpDown, AlertCircle, ArrowRight, ChevronDownIcon, CheckIcon, Table2 as Table2$1, HelpCircle, ToggleLeft, Type, Calendar, Hash, ArrowUp, ArrowDown, ChevronUpIcon, Calculator as Calculator$1, FilterX, MoreHorizontal, Copy, Grid, Plus, XIcon, GripVertical, Settings2, PlusCircle, Eye, Edit, Shapes, RotateCcw } from 'lucide-react';
3
+ import { X, SearchIcon, BarChart as BarChart$1, ChartBarBig, ScatterChart, Box, Table, Info, FileText, Palette, LineChart, Filter, Download, Loader2, ChevronsUpDown, Check, Search, ChevronUp, ChevronDown, ChevronLeft, ChevronRight, ArrowUpDown, AlertCircle, Eye, Type, Monitor, ArrowRight, ChevronDownIcon, CheckIcon, Table2 as Table2$1, HelpCircle, ToggleLeft, Calendar, Hash, ArrowUp, ArrowDown, ChevronUpIcon, Bold, Italic, Strikethrough, Code, Trash2, PilcrowSquare, Heading1, Heading2, Heading3, Heading4, Heading5, Heading6, List, ListOrdered, Quote, Minus, WrapText, Undo2, Redo2, Calculator as Calculator$1, FilterX, MoreHorizontal, Copy, Grid, Plus, XIcon, GripVertical, Settings2, PlusCircle, Edit, Shapes, RotateCcw } from 'lucide-react';
4
4
  import { schemeCategory10, schemeSet3, interpolateViridis, interpolateInferno, interpolateMagma, interpolatePlasma, interpolateWarm, interpolateCool } from 'd3-scale-chromatic';
5
5
  import { scaleLinear, scaleBand, scaleSequential, scaleOrdinal } from 'd3-scale';
6
6
  import * as React2 from 'react';
7
- import { createContext, forwardRef, useEffect, useMemo, useCallback, useRef, useState, useContext } from 'react';
7
+ import React2__default, { createContext, forwardRef, useEffect, useMemo, useCallback, useRef, useState, useContext } from 'react';
8
8
  import isEqual from 'react-fast-compare';
9
9
  import { create, useStore, createStore } from 'zustand';
10
10
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
@@ -27,6 +27,13 @@ import { CSS } from '@dnd-kit/utilities';
27
27
  import * as SelectPrimitive from '@radix-ui/react-select';
28
28
  import * as ProgressPrimitive from '@radix-ui/react-progress';
29
29
  import * as TooltipPrimitive from '@radix-ui/react-tooltip';
30
+ import { Color } from '@tiptap/extension-color';
31
+ import ListItem from '@tiptap/extension-list-item';
32
+ import TextStyle from '@tiptap/extension-text-style';
33
+ import { EditorProvider, useCurrentEditor } from '@tiptap/react';
34
+ import StarterKit from '@tiptap/starter-kit';
35
+ import * as ToggleGroupPrimitive from '@radix-ui/react-toggle-group';
36
+ import '@radix-ui/react-toggle';
30
37
  import natsort from 'natsort';
31
38
  import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
32
39
  import { extent } from 'd3-array';
@@ -1134,11 +1141,9 @@ function useFilterExtent({
1134
1141
  }, [settings, xScale, yScale, innerHeight, convertFilterRangeToExtent]);
1135
1142
  return extent2;
1136
1143
  }
1137
- var defaultMargin = { top: 20, right: 20, bottom: 30, left: 60 };
1138
1144
  function BaseChart({
1139
1145
  width,
1140
1146
  height,
1141
- margin = defaultMargin,
1142
1147
  xScale,
1143
1148
  yScale,
1144
1149
  brushingMode = "none",
@@ -1147,6 +1152,7 @@ function BaseChart({
1147
1152
  className,
1148
1153
  settings
1149
1154
  }) {
1155
+ const margin = settings.margin;
1150
1156
  const innerWidth = width - margin.left - margin.right;
1151
1157
  const innerHeight = height - margin.top - margin.bottom;
1152
1158
  const svgRef = useRef(null);
@@ -1288,7 +1294,7 @@ function BarChart({ settings, width, height, facetIds }) {
1288
1294
  const { getColorForValue } = useColorScales();
1289
1295
  const registerAxisLimits = useFacetAxis((s) => s.registerAxisLimits);
1290
1296
  const getGlobalAxisLimits = useFacetAxis((s) => s.getGlobalAxisLimits);
1291
- const margin = { top: 20, right: 20, bottom: 30, left: 60 };
1297
+ const margin = settings.margin;
1292
1298
  const innerWidth = width - margin.left - margin.right;
1293
1299
  const innerHeight = height - margin.top - margin.bottom;
1294
1300
  const isNumeric2 = useMemo(
@@ -1489,7 +1495,6 @@ function BarChart({ settings, width, height, facetIds }) {
1489
1495
  {
1490
1496
  width,
1491
1497
  height,
1492
- margin,
1493
1498
  xScale,
1494
1499
  yScale,
1495
1500
  brushingMode: isBandScale ? "none" : "horizontal",
@@ -2090,7 +2095,7 @@ var barChartDefinition = {
2090
2095
  type: "bar",
2091
2096
  title: "Bar Chart",
2092
2097
  layout,
2093
- margin: {},
2098
+ margin: { top: 20, right: 20, bottom: 30, left: 60 },
2094
2099
  filters: []
2095
2100
  }),
2096
2101
  validateSettings: (settings) => {
@@ -2257,7 +2262,7 @@ function ScatterPlot({
2257
2262
  canvas.height = height * dpr;
2258
2263
  ctx.scale(dpr, dpr);
2259
2264
  ctx.clearRect(0, 0, width, height);
2260
- ctx.translate(60, 20);
2265
+ ctx.translate(settings.margin.left, settings.margin.top);
2261
2266
  const xFilter = getRangeFilterForField(settings.filters, settings.xField);
2262
2267
  const yFilter = getRangeFilterForField(settings.filters, settings.yField);
2263
2268
  for (let i = 0; i < xValues.length; i++) {
@@ -2373,7 +2378,7 @@ var scatterPlotDefinition = {
2373
2378
  type: "scatter",
2374
2379
  title: "Scatter Plot",
2375
2380
  layout,
2376
- margin: {},
2381
+ margin: { top: 20, right: 20, bottom: 20, left: 20 },
2377
2382
  xField: "__ID",
2378
2383
  yField: field ?? "",
2379
2384
  filters: []
@@ -3195,7 +3200,7 @@ function PivotTable({
3195
3200
  return /* @__PURE__ */ jsx(
3196
3201
  "div",
3197
3202
  {
3198
- className: cn("w-full h-full border rounded-md flex flex-col"),
3203
+ className: cn("w-full h-full border rounded-md flex flex-col p-4"),
3199
3204
  style: { height },
3200
3205
  children: /* @__PURE__ */ jsx("div", { className: "overflow-auto flex-1", children: /* @__PURE__ */ jsxs("table", { className: "w-full border-collapse relative", children: [
3201
3206
  /* @__PURE__ */ jsxs("thead", { className: "sticky top-0 bg-background z-40", children: [
@@ -3897,7 +3902,7 @@ var pivotTableDefinition = {
3897
3902
  type: "pivot",
3898
3903
  title: "Pivot Table",
3899
3904
  layout,
3900
- margin: {},
3905
+ margin: { top: 0, right: 0, bottom: 0, left: 0 },
3901
3906
  rowFields: [],
3902
3907
  columnField: "",
3903
3908
  valueFields: [{ field: "", aggregation: "count" }],
@@ -4662,7 +4667,7 @@ var dataTableDefinition = {
4662
4667
  type: "data-table",
4663
4668
  title: "Data Table",
4664
4669
  layout,
4665
- margin: {},
4670
+ margin: { top: 5, right: 5, bottom: 5, left: 5 },
4666
4671
  columns: [],
4667
4672
  pageSize: 25,
4668
4673
  currentPage: 1,
@@ -5341,7 +5346,7 @@ var summaryTableDefinition = {
5341
5346
  type: "summary",
5342
5347
  title: "Summary Table",
5343
5348
  layout,
5344
- margin: {}
5349
+ margin: { top: 20, right: 20, bottom: 20, left: 20 }
5345
5350
  }),
5346
5351
  validateSettings: (settings) => {
5347
5352
  return true;
@@ -5350,32 +5355,398 @@ var summaryTableDefinition = {
5350
5355
  return (d) => true;
5351
5356
  }
5352
5357
  };
5353
- function Textarea({ className, ...props }) {
5358
+ var toggleVariants = cva(
5359
+ "inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium transition-colors hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 ring-ring/10 dark:ring-ring/20 dark:outline-ring/40 outline-ring/50 focus-visible:ring-4 focus-visible:outline-1 aria-invalid:focus-visible:ring-0 transition-[color,box-shadow]",
5360
+ {
5361
+ variants: {
5362
+ variant: {
5363
+ default: "bg-transparent",
5364
+ outline: "border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground"
5365
+ },
5366
+ size: {
5367
+ default: "h-9 px-2 min-w-9",
5368
+ sm: "h-8 px-1.5 min-w-8",
5369
+ lg: "h-10 px-2.5 min-w-10"
5370
+ }
5371
+ },
5372
+ defaultVariants: {
5373
+ variant: "default",
5374
+ size: "default"
5375
+ }
5376
+ }
5377
+ );
5378
+ var ToggleGroupContext = React2.createContext({
5379
+ size: "default",
5380
+ variant: "default"
5381
+ });
5382
+ function ToggleGroup({
5383
+ className,
5384
+ variant,
5385
+ size,
5386
+ children,
5387
+ ...props
5388
+ }) {
5354
5389
  return /* @__PURE__ */ jsx(
5355
- "textarea",
5390
+ ToggleGroupPrimitive.Root,
5356
5391
  {
5357
- "data-slot": "textarea",
5392
+ "data-slot": "toggle-group",
5393
+ "data-variant": variant,
5394
+ "data-size": size,
5358
5395
  className: cn(
5359
- "border-input placeholder:text-muted-foreground ring-ring/10 dark:ring-ring/20 dark:outline-ring/40 outline-ring/50 aria-invalid:outline-destructive/60 dark:aria-invalid:outline-destructive dark:aria-invalid:ring-destructive/40 aria-invalid:ring-destructive/20 aria-invalid:border-destructive/60 dark:aria-invalid:border-destructive dark:aria-invalid:ring-destructive/50 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] focus-visible:ring-4 focus-visible:outline-1 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:focus-visible:ring-[3px] aria-invalid:focus-visible:outline-none md:text-sm dark:aria-invalid:focus-visible:ring-4",
5396
+ "group/toggle-group flex items-center justify-center rounded-md data-[variant=outline]:shadow-xs",
5360
5397
  className
5361
5398
  ),
5362
- ...props
5399
+ ...props,
5400
+ children: /* @__PURE__ */ jsx(ToggleGroupContext.Provider, { value: { variant, size }, children })
5401
+ }
5402
+ );
5403
+ }
5404
+ function ToggleGroupItem({
5405
+ className,
5406
+ children,
5407
+ variant,
5408
+ size,
5409
+ ...props
5410
+ }) {
5411
+ const context = React2.useContext(ToggleGroupContext);
5412
+ return /* @__PURE__ */ jsx(
5413
+ ToggleGroupPrimitive.Item,
5414
+ {
5415
+ "data-slot": "toggle-group-item",
5416
+ "data-variant": context.variant || variant,
5417
+ "data-size": context.size || size,
5418
+ className: cn(
5419
+ toggleVariants({
5420
+ variant: context.variant || variant,
5421
+ size: context.size || size
5422
+ }),
5423
+ "min-w-0 shrink-0 rounded-none shadow-none first:rounded-l-md last:rounded-r-md focus:z-10 focus-visible:z-10 data-[variant=outline]:border-l-0 data-[variant=outline]:first:border-l",
5424
+ className
5425
+ ),
5426
+ ...props,
5427
+ children
5363
5428
  }
5364
5429
  );
5365
5430
  }
5366
- var Markdown = ({
5431
+ function MenuBar() {
5432
+ const { editor } = useCurrentEditor();
5433
+ const [showControls, setShowControls] = useState(false);
5434
+ const [displayMode, setDisplayMode] = useState("icon");
5435
+ if (!editor) {
5436
+ return null;
5437
+ }
5438
+ const renderContent = (icon, text) => {
5439
+ if (displayMode === "icon") {
5440
+ return icon;
5441
+ }
5442
+ if (displayMode === "text") {
5443
+ return text;
5444
+ }
5445
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
5446
+ icon,
5447
+ /* @__PURE__ */ jsx("span", { className: "ml-2", children: text })
5448
+ ] });
5449
+ };
5450
+ return /* @__PURE__ */ jsxs("div", { className: "control-group", children: [
5451
+ /* @__PURE__ */ jsxs("div", { className: "flex gap-2 mb-2", children: [
5452
+ /* @__PURE__ */ jsx(
5453
+ Button,
5454
+ {
5455
+ variant: "outline",
5456
+ size: "sm",
5457
+ onClick: () => setShowControls(!showControls),
5458
+ title: showControls ? "Hide toolbar controls" : "Show toolbar controls",
5459
+ children: showControls ? /* @__PURE__ */ jsxs(Fragment, { children: [
5460
+ "Hide Controls ",
5461
+ /* @__PURE__ */ jsx(ChevronUp, { className: "ml-2 h-4 w-4" })
5462
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
5463
+ "Show Controls ",
5464
+ /* @__PURE__ */ jsx(ChevronDown, { className: "ml-2 h-4 w-4" })
5465
+ ] })
5466
+ }
5467
+ ),
5468
+ showControls && /* @__PURE__ */ jsxs(
5469
+ ToggleGroup,
5470
+ {
5471
+ type: "single",
5472
+ value: displayMode,
5473
+ onValueChange: (value) => value && setDisplayMode(value),
5474
+ children: [
5475
+ /* @__PURE__ */ jsxs(ToggleGroupItem, { value: "icon", title: "Show icons only", children: [
5476
+ /* @__PURE__ */ jsx(Eye, { className: "h-4 w-4" }),
5477
+ /* @__PURE__ */ jsx("span", { className: "ml-2", children: "Icons Only" })
5478
+ ] }),
5479
+ /* @__PURE__ */ jsxs(ToggleGroupItem, { value: "text", title: "Show text only", children: [
5480
+ /* @__PURE__ */ jsx(Type, { className: "h-4 w-4" }),
5481
+ /* @__PURE__ */ jsx("span", { className: "ml-2", children: "Text Only" })
5482
+ ] }),
5483
+ /* @__PURE__ */ jsxs(ToggleGroupItem, { value: "both", title: "Show both icons and text", children: [
5484
+ /* @__PURE__ */ jsx(Monitor, { className: "h-4 w-4" }),
5485
+ /* @__PURE__ */ jsx("span", { className: "ml-2", children: "Icons & Text" })
5486
+ ] })
5487
+ ]
5488
+ }
5489
+ )
5490
+ ] }),
5491
+ showControls && /* @__PURE__ */ jsxs("div", { className: "button-group flex flex-wrap gap-2", children: [
5492
+ /* @__PURE__ */ jsx(
5493
+ Button,
5494
+ {
5495
+ size: "sm",
5496
+ onClick: () => editor.chain().focus().toggleBold().run(),
5497
+ disabled: !editor.can().chain().focus().toggleBold().run(),
5498
+ className: editor.isActive("bold") ? "is-active" : "",
5499
+ title: "Toggle bold text",
5500
+ children: renderContent(/* @__PURE__ */ jsx(Bold, { className: "h-4 w-4" }), "Bold")
5501
+ }
5502
+ ),
5503
+ /* @__PURE__ */ jsx(
5504
+ Button,
5505
+ {
5506
+ size: "sm",
5507
+ onClick: () => editor.chain().focus().toggleItalic().run(),
5508
+ disabled: !editor.can().chain().focus().toggleItalic().run(),
5509
+ className: editor.isActive("italic") ? "is-active" : "",
5510
+ title: "Toggle italic text",
5511
+ children: renderContent(/* @__PURE__ */ jsx(Italic, { className: "h-4 w-4" }), "Italic")
5512
+ }
5513
+ ),
5514
+ /* @__PURE__ */ jsx(
5515
+ Button,
5516
+ {
5517
+ size: "sm",
5518
+ onClick: () => editor.chain().focus().toggleStrike().run(),
5519
+ disabled: !editor.can().chain().focus().toggleStrike().run(),
5520
+ className: editor.isActive("strike") ? "is-active" : "",
5521
+ title: "Toggle strikethrough text",
5522
+ children: renderContent(/* @__PURE__ */ jsx(Strikethrough, { className: "h-4 w-4" }), "Strike")
5523
+ }
5524
+ ),
5525
+ /* @__PURE__ */ jsx(
5526
+ Button,
5527
+ {
5528
+ size: "sm",
5529
+ onClick: () => editor.chain().focus().toggleCode().run(),
5530
+ disabled: !editor.can().chain().focus().toggleCode().run(),
5531
+ className: editor.isActive("code") ? "is-active" : "",
5532
+ title: "Toggle inline code",
5533
+ children: renderContent(/* @__PURE__ */ jsx(Code, { className: "h-4 w-4" }), "Code")
5534
+ }
5535
+ ),
5536
+ /* @__PURE__ */ jsx(
5537
+ Button,
5538
+ {
5539
+ size: "sm",
5540
+ onClick: () => editor.chain().focus().unsetAllMarks().run(),
5541
+ title: "Clear all text formatting",
5542
+ children: renderContent(/* @__PURE__ */ jsx(X, { className: "h-4 w-4" }), "Clear marks")
5543
+ }
5544
+ ),
5545
+ /* @__PURE__ */ jsx(
5546
+ Button,
5547
+ {
5548
+ size: "sm",
5549
+ onClick: () => editor.chain().focus().clearNodes().run(),
5550
+ title: "Clear all block formatting",
5551
+ children: renderContent(/* @__PURE__ */ jsx(Trash2, { className: "h-4 w-4" }), "Clear nodes")
5552
+ }
5553
+ ),
5554
+ /* @__PURE__ */ jsx(
5555
+ Button,
5556
+ {
5557
+ size: "sm",
5558
+ onClick: () => editor.chain().focus().setParagraph().run(),
5559
+ className: editor.isActive("paragraph") ? "is-active" : "",
5560
+ title: "Convert to paragraph",
5561
+ children: renderContent(/* @__PURE__ */ jsx(PilcrowSquare, { className: "h-4 w-4" }), "Paragraph")
5562
+ }
5563
+ ),
5564
+ /* @__PURE__ */ jsx(
5565
+ Button,
5566
+ {
5567
+ size: "sm",
5568
+ onClick: () => editor.chain().focus().toggleHeading({ level: 1 }).run(),
5569
+ className: editor.isActive("heading", { level: 1 }) ? "is-active" : "",
5570
+ title: "Toggle heading 1",
5571
+ children: renderContent(/* @__PURE__ */ jsx(Heading1, { className: "h-4 w-4" }), "H1")
5572
+ }
5573
+ ),
5574
+ /* @__PURE__ */ jsx(
5575
+ Button,
5576
+ {
5577
+ size: "sm",
5578
+ onClick: () => editor.chain().focus().toggleHeading({ level: 2 }).run(),
5579
+ className: editor.isActive("heading", { level: 2 }) ? "is-active" : "",
5580
+ title: "Toggle heading 2",
5581
+ children: renderContent(/* @__PURE__ */ jsx(Heading2, { className: "h-4 w-4" }), "H2")
5582
+ }
5583
+ ),
5584
+ /* @__PURE__ */ jsx(
5585
+ Button,
5586
+ {
5587
+ size: "sm",
5588
+ onClick: () => editor.chain().focus().toggleHeading({ level: 3 }).run(),
5589
+ className: editor.isActive("heading", { level: 3 }) ? "is-active" : "",
5590
+ title: "Toggle heading 3",
5591
+ children: renderContent(/* @__PURE__ */ jsx(Heading3, { className: "h-4 w-4" }), "H3")
5592
+ }
5593
+ ),
5594
+ /* @__PURE__ */ jsx(
5595
+ Button,
5596
+ {
5597
+ size: "sm",
5598
+ onClick: () => editor.chain().focus().toggleHeading({ level: 4 }).run(),
5599
+ className: editor.isActive("heading", { level: 4 }) ? "is-active" : "",
5600
+ title: "Toggle heading 4",
5601
+ children: renderContent(/* @__PURE__ */ jsx(Heading4, { className: "h-4 w-4" }), "H4")
5602
+ }
5603
+ ),
5604
+ /* @__PURE__ */ jsx(
5605
+ Button,
5606
+ {
5607
+ size: "sm",
5608
+ onClick: () => editor.chain().focus().toggleHeading({ level: 5 }).run(),
5609
+ className: editor.isActive("heading", { level: 5 }) ? "is-active" : "",
5610
+ title: "Toggle heading 5",
5611
+ children: renderContent(/* @__PURE__ */ jsx(Heading5, { className: "h-4 w-4" }), "H5")
5612
+ }
5613
+ ),
5614
+ /* @__PURE__ */ jsx(
5615
+ Button,
5616
+ {
5617
+ size: "sm",
5618
+ onClick: () => editor.chain().focus().toggleHeading({ level: 6 }).run(),
5619
+ className: editor.isActive("heading", { level: 6 }) ? "is-active" : "",
5620
+ title: "Toggle heading 6",
5621
+ children: renderContent(/* @__PURE__ */ jsx(Heading6, { className: "h-4 w-4" }), "H6")
5622
+ }
5623
+ ),
5624
+ /* @__PURE__ */ jsx(
5625
+ Button,
5626
+ {
5627
+ size: "sm",
5628
+ onClick: () => editor.chain().focus().toggleBulletList().run(),
5629
+ className: editor.isActive("bulletList") ? "is-active" : "",
5630
+ title: "Toggle bullet list",
5631
+ children: renderContent(/* @__PURE__ */ jsx(List, { className: "h-4 w-4" }), "Bullet list")
5632
+ }
5633
+ ),
5634
+ /* @__PURE__ */ jsx(
5635
+ Button,
5636
+ {
5637
+ size: "sm",
5638
+ onClick: () => editor.chain().focus().toggleOrderedList().run(),
5639
+ className: editor.isActive("orderedList") ? "is-active" : "",
5640
+ title: "Toggle ordered list",
5641
+ children: renderContent(/* @__PURE__ */ jsx(ListOrdered, { className: "h-4 w-4" }), "Ordered list")
5642
+ }
5643
+ ),
5644
+ /* @__PURE__ */ jsx(
5645
+ Button,
5646
+ {
5647
+ size: "sm",
5648
+ onClick: () => editor.chain().focus().toggleCodeBlock().run(),
5649
+ className: editor.isActive("codeBlock") ? "is-active" : "",
5650
+ title: "Toggle code block",
5651
+ children: renderContent(/* @__PURE__ */ jsx(Code, { className: "h-4 w-4" }), "Code block")
5652
+ }
5653
+ ),
5654
+ /* @__PURE__ */ jsx(
5655
+ Button,
5656
+ {
5657
+ size: "sm",
5658
+ onClick: () => editor.chain().focus().toggleBlockquote().run(),
5659
+ className: editor.isActive("blockquote") ? "is-active" : "",
5660
+ title: "Toggle blockquote",
5661
+ children: renderContent(/* @__PURE__ */ jsx(Quote, { className: "h-4 w-4" }), "Blockquote")
5662
+ }
5663
+ ),
5664
+ /* @__PURE__ */ jsx(
5665
+ Button,
5666
+ {
5667
+ size: "sm",
5668
+ onClick: () => editor.chain().focus().setHorizontalRule().run(),
5669
+ title: "Insert horizontal rule",
5670
+ children: renderContent(/* @__PURE__ */ jsx(Minus, { className: "h-4 w-4" }), "Horizontal rule")
5671
+ }
5672
+ ),
5673
+ /* @__PURE__ */ jsx(
5674
+ Button,
5675
+ {
5676
+ size: "sm",
5677
+ onClick: () => editor.chain().focus().setHardBreak().run(),
5678
+ title: "Insert hard break",
5679
+ children: renderContent(/* @__PURE__ */ jsx(WrapText, { className: "h-4 w-4" }), "Hard break")
5680
+ }
5681
+ ),
5682
+ /* @__PURE__ */ jsx(
5683
+ Button,
5684
+ {
5685
+ size: "sm",
5686
+ onClick: () => editor.chain().focus().undo().run(),
5687
+ disabled: !editor.can().chain().focus().undo().run(),
5688
+ title: "Undo last change",
5689
+ children: renderContent(/* @__PURE__ */ jsx(Undo2, { className: "h-4 w-4" }), "Undo")
5690
+ }
5691
+ ),
5692
+ /* @__PURE__ */ jsx(
5693
+ Button,
5694
+ {
5695
+ size: "sm",
5696
+ onClick: () => editor.chain().focus().redo().run(),
5697
+ disabled: !editor.can().chain().focus().redo().run(),
5698
+ title: "Redo last change",
5699
+ children: renderContent(/* @__PURE__ */ jsx(Redo2, { className: "h-4 w-4" }), "Redo")
5700
+ }
5701
+ ),
5702
+ /* @__PURE__ */ jsx(
5703
+ Button,
5704
+ {
5705
+ size: "sm",
5706
+ onClick: () => editor.chain().focus().setColor("#958DF1").run(),
5707
+ className: editor.isActive("textStyle", { color: "#958DF1" }) ? "is-active" : "",
5708
+ title: "Set text color to purple",
5709
+ children: renderContent(/* @__PURE__ */ jsx(Palette, { className: "h-4 w-4" }), "Purple")
5710
+ }
5711
+ )
5712
+ ] })
5713
+ ] });
5714
+ }
5715
+ function Markdown({
5367
5716
  settings,
5368
5717
  width,
5369
5718
  height
5370
- }) => {
5371
- useDataLayer((s) => s.updateChart);
5372
- const [localContent, setLocalContent] = useState(settings.content);
5373
- localContent !== settings.content;
5374
- const handleChange = (value) => {
5375
- setLocalContent(value);
5376
- };
5377
- return /* @__PURE__ */ jsx("div", { style: { width, height }, className: "flex flex-col", children: /* @__PURE__ */ jsx("div", { className: "flex-1 overflow-auto", children: /* @__PURE__ */ jsx(Textarea, { value: localContent, onChange: handleChange }) }) });
5378
- };
5719
+ }) {
5720
+ const updateChart = useDataLayer((s) => s.updateChart);
5721
+ return /* @__PURE__ */ jsx("div", { style: { width, height }, className: "flex flex-col overflow-auto p-1", children: /* @__PURE__ */ jsx(
5722
+ EditorProvider,
5723
+ {
5724
+ slotBefore: /* @__PURE__ */ jsx(MenuBar, {}),
5725
+ extensions,
5726
+ content: settings.content,
5727
+ onUpdate: (value) => {
5728
+ updateChart(settings.id, {
5729
+ ...settings,
5730
+ content: value.editor.getHTML()
5731
+ });
5732
+ }
5733
+ }
5734
+ ) });
5735
+ }
5736
+ var extensions = [
5737
+ Color.configure({ types: [TextStyle.name, ListItem.name] }),
5738
+ TextStyle.configure({ types: [ListItem.name] }),
5739
+ StarterKit.configure({
5740
+ bulletList: {
5741
+ keepMarks: true,
5742
+ keepAttributes: false
5743
+ },
5744
+ orderedList: {
5745
+ keepMarks: true,
5746
+ keepAttributes: false
5747
+ }
5748
+ })
5749
+ ];
5379
5750
 
5380
5751
  // src/components/charts/Markdown/definition.ts
5381
5752
  var markdownDefinition = {
@@ -5545,7 +5916,7 @@ function BoxPlot({
5545
5916
  facetIds
5546
5917
  );
5547
5918
  const hasColorField = !!settings.colorField;
5548
- const margin = { top: 20, right: 20, bottom: 30, left: 60 };
5919
+ const margin = settings.margin;
5549
5920
  const innerWidth = width - margin.left - margin.right;
5550
5921
  const innerHeight = height - margin.top - margin.bottom;
5551
5922
  const groupedData = useMemo(() => {
@@ -5772,7 +6143,6 @@ function BoxPlot({
5772
6143
  {
5773
6144
  width,
5774
6145
  height,
5775
- margin,
5776
6146
  xScale,
5777
6147
  yScale,
5778
6148
  brushingMode: "2d",
@@ -6479,6 +6849,52 @@ var colorLegendDefinition = {
6479
6849
  getFilterFunction: () => () => true
6480
6850
  };
6481
6851
 
6852
+ // src/lib/chartUtils.ts
6853
+ function reduceDataPoints(data, numBuckets) {
6854
+ if (!data || data.length === 0) {
6855
+ return [];
6856
+ }
6857
+ const validBuckets = Math.max(1, Math.min(1e3, Math.floor(numBuckets)));
6858
+ if (data.length <= validBuckets * 3) {
6859
+ return data.map((point2) => ({ ...point2, type: "start" }));
6860
+ }
6861
+ const xExtent = {
6862
+ min: Math.min(...data.map((d) => d.x)),
6863
+ max: Math.max(...data.map((d) => d.x))
6864
+ };
6865
+ if (xExtent.min === xExtent.max) {
6866
+ return [{ ...data[0], type: "start" }];
6867
+ }
6868
+ const buckets = Array(validBuckets).fill(null).map(() => []);
6869
+ data.forEach((point2) => {
6870
+ const bucketIndex = Math.min(
6871
+ Math.floor(
6872
+ (point2.x - xExtent.min) / (xExtent.max - xExtent.min) * validBuckets
6873
+ ),
6874
+ validBuckets - 1
6875
+ );
6876
+ buckets[bucketIndex].push({ ...point2, type: "start" });
6877
+ });
6878
+ const result = [];
6879
+ buckets.forEach((bucket) => {
6880
+ if (bucket.length === 0) {
6881
+ return;
6882
+ }
6883
+ result.push({ ...bucket[0], type: "start" });
6884
+ if (bucket.length > 1) {
6885
+ const minPoint = bucket.reduce((min, p) => p.y < min.y ? p : min);
6886
+ const maxPoint = bucket.reduce((max, p) => p.y > max.y ? p : max);
6887
+ if (minPoint !== bucket[0]) {
6888
+ result.push({ ...minPoint, type: "min" });
6889
+ }
6890
+ if (maxPoint !== bucket[0] && maxPoint !== minPoint) {
6891
+ result.push({ ...maxPoint, type: "max" });
6892
+ }
6893
+ }
6894
+ });
6895
+ return result.sort((a, b) => a.x - b.x);
6896
+ }
6897
+
6482
6898
  // ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/constant.js
6483
6899
  function constant_default(x2) {
6484
6900
  return function constant() {
@@ -6800,52 +7216,6 @@ Step.prototype = {
6800
7216
  function stepAfter(context) {
6801
7217
  return new Step(context, 1);
6802
7218
  }
6803
-
6804
- // src/lib/chartUtils.ts
6805
- function reduceDataPoints(data, numBuckets) {
6806
- if (!data || data.length === 0) {
6807
- return [];
6808
- }
6809
- const validBuckets = Math.max(1, Math.min(1e3, Math.floor(numBuckets)));
6810
- if (data.length <= validBuckets * 3) {
6811
- return data.map((point2) => ({ ...point2, type: "start" }));
6812
- }
6813
- const xExtent = {
6814
- min: Math.min(...data.map((d) => d.x)),
6815
- max: Math.max(...data.map((d) => d.x))
6816
- };
6817
- if (xExtent.min === xExtent.max) {
6818
- return [{ ...data[0], type: "start" }];
6819
- }
6820
- const buckets = Array(validBuckets).fill(null).map(() => []);
6821
- data.forEach((point2) => {
6822
- const bucketIndex = Math.min(
6823
- Math.floor(
6824
- (point2.x - xExtent.min) / (xExtent.max - xExtent.min) * validBuckets
6825
- ),
6826
- validBuckets - 1
6827
- );
6828
- buckets[bucketIndex].push({ ...point2, type: "start" });
6829
- });
6830
- const result = [];
6831
- buckets.forEach((bucket) => {
6832
- if (bucket.length === 0) {
6833
- return;
6834
- }
6835
- result.push({ ...bucket[0], type: "start" });
6836
- if (bucket.length > 1) {
6837
- const minPoint = bucket.reduce((min, p) => p.y < min.y ? p : min);
6838
- const maxPoint = bucket.reduce((max, p) => p.y > max.y ? p : max);
6839
- if (minPoint !== bucket[0]) {
6840
- result.push({ ...minPoint, type: "min" });
6841
- }
6842
- if (maxPoint !== bucket[0] && maxPoint !== minPoint) {
6843
- result.push({ ...maxPoint, type: "max" });
6844
- }
6845
- }
6846
- });
6847
- return result.sort((a, b) => a.x - b.x);
6848
- }
6849
7219
  var curveTypes = {
6850
7220
  linear: linear_default,
6851
7221
  monotoneX,
@@ -6901,7 +7271,7 @@ var LineChart2 = ({
6901
7271
  settings.seriesField,
6902
7272
  facetIds
6903
7273
  );
6904
- const margin = { top: 20, right: 60, bottom: 30, left: 60 };
7274
+ const margin = settings.margin;
6905
7275
  if (settings.showLegend) {
6906
7276
  switch (settings.legendPosition) {
6907
7277
  case "top":
@@ -7090,7 +7460,6 @@ var LineChart2 = ({
7090
7460
  {
7091
7461
  width,
7092
7462
  height,
7093
- margin,
7094
7463
  xScale,
7095
7464
  yScale: leftYScale,
7096
7465
  settings,
@@ -7558,7 +7927,7 @@ var lineChartDefinition = {
7558
7927
  },
7559
7928
  xAxis: {},
7560
7929
  yAxis: {},
7561
- margin: {},
7930
+ margin: { top: 20, right: 60, bottom: 30, left: 60 },
7562
7931
  filters: [],
7563
7932
  xAxisLabel: "",
7564
7933
  yAxisLabel: "",
@@ -7611,7 +7980,7 @@ function RowChart({ settings, width, height, facetIds }) {
7611
7980
  filters: newFilters
7612
7981
  });
7613
7982
  };
7614
- const margin = { top: 20, right: 40, bottom: 30, left: 100 };
7983
+ const margin = settings.margin;
7615
7984
  const innerWidth = width - margin.left - margin.right;
7616
7985
  const innerHeight = height - margin.top - margin.bottom;
7617
7986
  const { displayCounts } = useMemo(() => {
@@ -7679,7 +8048,6 @@ function RowChart({ settings, width, height, facetIds }) {
7679
8048
  {
7680
8049
  width,
7681
8050
  height,
7682
- margin,
7683
8051
  xScale,
7684
8052
  yScale,
7685
8053
  settings,
@@ -9639,10 +10007,7 @@ function GridBackground({
9639
10007
  return /* @__PURE__ */ jsx(
9640
10008
  "div",
9641
10009
  {
9642
- className: cn(
9643
- "absolute inset-0 pointer-events-none border border-dashed border-gray-200",
9644
- className
9645
- ),
10010
+ className: cn("absolute inset-0 pointer-events-none", className),
9646
10011
  style: {
9647
10012
  width,
9648
10013
  height
@@ -9650,7 +10015,7 @@ function GridBackground({
9650
10015
  children: /* @__PURE__ */ jsxs(
9651
10016
  "div",
9652
10017
  {
9653
- className: "absolute inset-0",
10018
+ className: "absolute inset-0 border border-dashed border-gray-200",
9654
10019
  style: {
9655
10020
  margin: settings.containerPadding
9656
10021
  },
@@ -9718,17 +10083,77 @@ function ChartGridLayout({
9718
10083
  cols: gridSettings.columnCount,
9719
10084
  rowHeight: gridSettings.rowHeight,
9720
10085
  width: containerWidth,
10086
+ margin: [0, 0],
9721
10087
  containerPadding: [
9722
10088
  gridSettings.containerPadding,
9723
10089
  gridSettings.containerPadding
9724
10090
  ],
9725
10091
  onLayoutChange,
9726
10092
  draggableHandle: ".drag-handle",
10093
+ style: { position: "absolute", inset: 0 },
10094
+ resizeHandle: /* @__PURE__ */ jsx(BottomRightHandle, {}),
9727
10095
  children
9728
10096
  }
9729
10097
  )
9730
10098
  ] });
9731
10099
  }
10100
+ var SouthEastArrow = () => {
10101
+ const size = 100;
10102
+ const margin = 20;
10103
+ const rightEdgeX = size - margin;
10104
+ const startX = margin;
10105
+ const startY = size - margin;
10106
+ const bottomRightX = rightEdgeX;
10107
+ const bottomRightY = size - margin;
10108
+ const topRightX = rightEdgeX;
10109
+ const topRightY = margin;
10110
+ const controlX = Math.floor(startX + (rightEdgeX - startX) * 0.7);
10111
+ const controlY = Math.floor(startY - (startY - topRightY) * 0.3);
10112
+ const path2 = `
10113
+ M ${startX} ${startY}
10114
+ L ${bottomRightX} ${bottomRightY}
10115
+ L ${topRightX} ${topRightY}
10116
+ Q ${controlX} ${controlY} ${startX} ${startY}
10117
+ Z
10118
+ `;
10119
+ return /* @__PURE__ */ jsx(
10120
+ "svg",
10121
+ {
10122
+ width: "20px",
10123
+ height: "20px",
10124
+ version: "1.1",
10125
+ viewBox: `0 0 ${size} ${size}`,
10126
+ xmlns: "http://www.w3.org/2000/svg",
10127
+ children: /* @__PURE__ */ jsx("path", { d: path2, fill: "currentColor" })
10128
+ }
10129
+ );
10130
+ };
10131
+ var BottomRightHandle = React2__default.forwardRef(
10132
+ (props, ref) => {
10133
+ return /* @__PURE__ */ jsxs(
10134
+ "div",
10135
+ {
10136
+ style: {
10137
+ width: "20px",
10138
+ height: "20px",
10139
+ position: "absolute",
10140
+ bottom: 0,
10141
+ right: 0,
10142
+ padding: 0,
10143
+ cursor: "se-resize"
10144
+ },
10145
+ className: "handle-se",
10146
+ ref,
10147
+ ...props,
10148
+ children: [
10149
+ " ",
10150
+ /* @__PURE__ */ jsx(SouthEastArrow, {}),
10151
+ " "
10152
+ ]
10153
+ }
10154
+ );
10155
+ }
10156
+ );
9732
10157
  function ChartRenderer({
9733
10158
  settings,
9734
10159
  width,
@@ -10503,16 +10928,18 @@ function PlotChartPanel({
10503
10928
  onDelete();
10504
10929
  }
10505
10930
  };
10931
+ const widthWithPadding = width - 8;
10932
+ const heightWithPadding = height - 8;
10506
10933
  return /* @__PURE__ */ jsxs(
10507
10934
  "div",
10508
10935
  {
10509
- className: "bg-card border rounded-lg",
10510
- style: { width, height },
10936
+ className: "bg-card border rounded-lg flex flex-col overflow-hidden m-1",
10937
+ style: { width: widthWithPadding, height: heightWithPadding },
10511
10938
  children: [
10512
10939
  /* @__PURE__ */ jsxs(
10513
10940
  "div",
10514
10941
  {
10515
- className: "flex items-center justify-between select-none",
10942
+ className: "flex items-center justify-between select-none px-2",
10516
10943
  style: { height: 24 },
10517
10944
  children: [
10518
10945
  /* @__PURE__ */ jsxs("div", { className: "drag-handle cursor-move flex items-center gap-2", children: [
@@ -10539,20 +10966,19 @@ function PlotChartPanel({
10539
10966
  ]
10540
10967
  }
10541
10968
  ),
10542
- /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(FacetAxisProvider, { children: settings.facet?.enabled ? /* @__PURE__ */ jsx(
10969
+ /* @__PURE__ */ jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsx(FacetAxisProvider, { children: settings.facet?.enabled ? /* @__PURE__ */ jsx(
10543
10970
  FacetContainer,
10544
10971
  {
10545
10972
  settings,
10546
10973
  width: width - 32,
10547
- height: height - 56
10974
+ height: height - 36
10548
10975
  }
10549
10976
  ) : /* @__PURE__ */ jsx(
10550
10977
  ChartRenderer,
10551
10978
  {
10552
10979
  settings,
10553
10980
  width: width - 32,
10554
- height: height - 56,
10555
- facetIds: void 0
10981
+ height: height - 36
10556
10982
  }
10557
10983
  ) }) })
10558
10984
  ]