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.
@@ -27,6 +27,13 @@ var utilities = require('@dnd-kit/utilities');
27
27
  var SelectPrimitive = require('@radix-ui/react-select');
28
28
  var ProgressPrimitive = require('@radix-ui/react-progress');
29
29
  var TooltipPrimitive = require('@radix-ui/react-tooltip');
30
+ var extensionColor = require('@tiptap/extension-color');
31
+ var ListItem = require('@tiptap/extension-list-item');
32
+ var TextStyle = require('@tiptap/extension-text-style');
33
+ var react = require('@tiptap/react');
34
+ var StarterKit = require('@tiptap/starter-kit');
35
+ var ToggleGroupPrimitive = require('@radix-ui/react-toggle-group');
36
+ require('@radix-ui/react-toggle');
30
37
  var natsort = require('natsort');
31
38
  var ScrollAreaPrimitive = require('@radix-ui/react-scroll-area');
32
39
  var d3Array = require('d3-array');
@@ -73,6 +80,10 @@ var SwitchPrimitive__namespace = /*#__PURE__*/_interopNamespace(SwitchPrimitive)
73
80
  var SelectPrimitive__namespace = /*#__PURE__*/_interopNamespace(SelectPrimitive);
74
81
  var ProgressPrimitive__namespace = /*#__PURE__*/_interopNamespace(ProgressPrimitive);
75
82
  var TooltipPrimitive__namespace = /*#__PURE__*/_interopNamespace(TooltipPrimitive);
83
+ var ListItem__default = /*#__PURE__*/_interopDefault(ListItem);
84
+ var TextStyle__default = /*#__PURE__*/_interopDefault(TextStyle);
85
+ var StarterKit__default = /*#__PURE__*/_interopDefault(StarterKit);
86
+ var ToggleGroupPrimitive__namespace = /*#__PURE__*/_interopNamespace(ToggleGroupPrimitive);
76
87
  var natsort__default = /*#__PURE__*/_interopDefault(natsort);
77
88
  var ScrollAreaPrimitive__namespace = /*#__PURE__*/_interopNamespace(ScrollAreaPrimitive);
78
89
  var TabsPrimitive__namespace = /*#__PURE__*/_interopNamespace(TabsPrimitive);
@@ -1174,11 +1185,9 @@ function useFilterExtent({
1174
1185
  }, [settings, xScale, yScale, innerHeight, convertFilterRangeToExtent]);
1175
1186
  return extent2;
1176
1187
  }
1177
- var defaultMargin = { top: 20, right: 20, bottom: 30, left: 60 };
1178
1188
  function BaseChart({
1179
1189
  width,
1180
1190
  height,
1181
- margin = defaultMargin,
1182
1191
  xScale,
1183
1192
  yScale,
1184
1193
  brushingMode = "none",
@@ -1187,6 +1196,7 @@ function BaseChart({
1187
1196
  className,
1188
1197
  settings
1189
1198
  }) {
1199
+ const margin = settings.margin;
1190
1200
  const innerWidth = width - margin.left - margin.right;
1191
1201
  const innerHeight = height - margin.top - margin.bottom;
1192
1202
  const svgRef = React2.useRef(null);
@@ -1328,7 +1338,7 @@ function BarChart({ settings, width, height, facetIds }) {
1328
1338
  const { getColorForValue } = useColorScales();
1329
1339
  const registerAxisLimits = useFacetAxis((s) => s.registerAxisLimits);
1330
1340
  const getGlobalAxisLimits = useFacetAxis((s) => s.getGlobalAxisLimits);
1331
- const margin = { top: 20, right: 20, bottom: 30, left: 60 };
1341
+ const margin = settings.margin;
1332
1342
  const innerWidth = width - margin.left - margin.right;
1333
1343
  const innerHeight = height - margin.top - margin.bottom;
1334
1344
  const isNumeric2 = React2.useMemo(
@@ -1529,7 +1539,6 @@ function BarChart({ settings, width, height, facetIds }) {
1529
1539
  {
1530
1540
  width,
1531
1541
  height,
1532
- margin,
1533
1542
  xScale,
1534
1543
  yScale,
1535
1544
  brushingMode: isBandScale ? "none" : "horizontal",
@@ -2130,7 +2139,7 @@ var barChartDefinition = {
2130
2139
  type: "bar",
2131
2140
  title: "Bar Chart",
2132
2141
  layout,
2133
- margin: {},
2142
+ margin: { top: 20, right: 20, bottom: 30, left: 60 },
2134
2143
  filters: []
2135
2144
  }),
2136
2145
  validateSettings: (settings) => {
@@ -2297,7 +2306,7 @@ function ScatterPlot({
2297
2306
  canvas.height = height * dpr;
2298
2307
  ctx.scale(dpr, dpr);
2299
2308
  ctx.clearRect(0, 0, width, height);
2300
- ctx.translate(60, 20);
2309
+ ctx.translate(settings.margin.left, settings.margin.top);
2301
2310
  const xFilter = getRangeFilterForField(settings.filters, settings.xField);
2302
2311
  const yFilter = getRangeFilterForField(settings.filters, settings.yField);
2303
2312
  for (let i = 0; i < xValues.length; i++) {
@@ -2413,7 +2422,7 @@ var scatterPlotDefinition = {
2413
2422
  type: "scatter",
2414
2423
  title: "Scatter Plot",
2415
2424
  layout,
2416
- margin: {},
2425
+ margin: { top: 20, right: 20, bottom: 20, left: 20 },
2417
2426
  xField: "__ID",
2418
2427
  yField: field ?? "",
2419
2428
  filters: []
@@ -3235,7 +3244,7 @@ function PivotTable({
3235
3244
  return /* @__PURE__ */ jsxRuntime.jsx(
3236
3245
  "div",
3237
3246
  {
3238
- className: cn("w-full h-full border rounded-md flex flex-col"),
3247
+ className: cn("w-full h-full border rounded-md flex flex-col p-4"),
3239
3248
  style: { height },
3240
3249
  children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-auto flex-1", children: /* @__PURE__ */ jsxRuntime.jsxs("table", { className: "w-full border-collapse relative", children: [
3241
3250
  /* @__PURE__ */ jsxRuntime.jsxs("thead", { className: "sticky top-0 bg-background z-40", children: [
@@ -3937,7 +3946,7 @@ var pivotTableDefinition = {
3937
3946
  type: "pivot",
3938
3947
  title: "Pivot Table",
3939
3948
  layout,
3940
- margin: {},
3949
+ margin: { top: 0, right: 0, bottom: 0, left: 0 },
3941
3950
  rowFields: [],
3942
3951
  columnField: "",
3943
3952
  valueFields: [{ field: "", aggregation: "count" }],
@@ -4702,7 +4711,7 @@ var dataTableDefinition = {
4702
4711
  type: "data-table",
4703
4712
  title: "Data Table",
4704
4713
  layout,
4705
- margin: {},
4714
+ margin: { top: 5, right: 5, bottom: 5, left: 5 },
4706
4715
  columns: [],
4707
4716
  pageSize: 25,
4708
4717
  currentPage: 1,
@@ -5381,7 +5390,7 @@ var summaryTableDefinition = {
5381
5390
  type: "summary",
5382
5391
  title: "Summary Table",
5383
5392
  layout,
5384
- margin: {}
5393
+ margin: { top: 20, right: 20, bottom: 20, left: 20 }
5385
5394
  }),
5386
5395
  validateSettings: (settings) => {
5387
5396
  return true;
@@ -5390,32 +5399,398 @@ var summaryTableDefinition = {
5390
5399
  return (d) => true;
5391
5400
  }
5392
5401
  };
5393
- function Textarea({ className, ...props }) {
5402
+ var toggleVariants = classVarianceAuthority.cva(
5403
+ "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]",
5404
+ {
5405
+ variants: {
5406
+ variant: {
5407
+ default: "bg-transparent",
5408
+ outline: "border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground"
5409
+ },
5410
+ size: {
5411
+ default: "h-9 px-2 min-w-9",
5412
+ sm: "h-8 px-1.5 min-w-8",
5413
+ lg: "h-10 px-2.5 min-w-10"
5414
+ }
5415
+ },
5416
+ defaultVariants: {
5417
+ variant: "default",
5418
+ size: "default"
5419
+ }
5420
+ }
5421
+ );
5422
+ var ToggleGroupContext = React2__namespace.createContext({
5423
+ size: "default",
5424
+ variant: "default"
5425
+ });
5426
+ function ToggleGroup({
5427
+ className,
5428
+ variant,
5429
+ size,
5430
+ children,
5431
+ ...props
5432
+ }) {
5394
5433
  return /* @__PURE__ */ jsxRuntime.jsx(
5395
- "textarea",
5434
+ ToggleGroupPrimitive__namespace.Root,
5396
5435
  {
5397
- "data-slot": "textarea",
5436
+ "data-slot": "toggle-group",
5437
+ "data-variant": variant,
5438
+ "data-size": size,
5398
5439
  className: cn(
5399
- "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",
5440
+ "group/toggle-group flex items-center justify-center rounded-md data-[variant=outline]:shadow-xs",
5400
5441
  className
5401
5442
  ),
5402
- ...props
5443
+ ...props,
5444
+ children: /* @__PURE__ */ jsxRuntime.jsx(ToggleGroupContext.Provider, { value: { variant, size }, children })
5445
+ }
5446
+ );
5447
+ }
5448
+ function ToggleGroupItem({
5449
+ className,
5450
+ children,
5451
+ variant,
5452
+ size,
5453
+ ...props
5454
+ }) {
5455
+ const context = React2__namespace.useContext(ToggleGroupContext);
5456
+ return /* @__PURE__ */ jsxRuntime.jsx(
5457
+ ToggleGroupPrimitive__namespace.Item,
5458
+ {
5459
+ "data-slot": "toggle-group-item",
5460
+ "data-variant": context.variant || variant,
5461
+ "data-size": context.size || size,
5462
+ className: cn(
5463
+ toggleVariants({
5464
+ variant: context.variant || variant,
5465
+ size: context.size || size
5466
+ }),
5467
+ "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",
5468
+ className
5469
+ ),
5470
+ ...props,
5471
+ children
5403
5472
  }
5404
5473
  );
5405
5474
  }
5406
- var Markdown = ({
5475
+ function MenuBar() {
5476
+ const { editor } = react.useCurrentEditor();
5477
+ const [showControls, setShowControls] = React2.useState(false);
5478
+ const [displayMode, setDisplayMode] = React2.useState("icon");
5479
+ if (!editor) {
5480
+ return null;
5481
+ }
5482
+ const renderContent = (icon, text) => {
5483
+ if (displayMode === "icon") {
5484
+ return icon;
5485
+ }
5486
+ if (displayMode === "text") {
5487
+ return text;
5488
+ }
5489
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5490
+ icon,
5491
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-2", children: text })
5492
+ ] });
5493
+ };
5494
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "control-group", children: [
5495
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-2 mb-2", children: [
5496
+ /* @__PURE__ */ jsxRuntime.jsx(
5497
+ Button,
5498
+ {
5499
+ variant: "outline",
5500
+ size: "sm",
5501
+ onClick: () => setShowControls(!showControls),
5502
+ title: showControls ? "Hide toolbar controls" : "Show toolbar controls",
5503
+ children: showControls ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5504
+ "Hide Controls ",
5505
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronUp, { className: "ml-2 h-4 w-4" })
5506
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5507
+ "Show Controls ",
5508
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: "ml-2 h-4 w-4" })
5509
+ ] })
5510
+ }
5511
+ ),
5512
+ showControls && /* @__PURE__ */ jsxRuntime.jsxs(
5513
+ ToggleGroup,
5514
+ {
5515
+ type: "single",
5516
+ value: displayMode,
5517
+ onValueChange: (value) => value && setDisplayMode(value),
5518
+ children: [
5519
+ /* @__PURE__ */ jsxRuntime.jsxs(ToggleGroupItem, { value: "icon", title: "Show icons only", children: [
5520
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Eye, { className: "h-4 w-4" }),
5521
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-2", children: "Icons Only" })
5522
+ ] }),
5523
+ /* @__PURE__ */ jsxRuntime.jsxs(ToggleGroupItem, { value: "text", title: "Show text only", children: [
5524
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Type, { className: "h-4 w-4" }),
5525
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-2", children: "Text Only" })
5526
+ ] }),
5527
+ /* @__PURE__ */ jsxRuntime.jsxs(ToggleGroupItem, { value: "both", title: "Show both icons and text", children: [
5528
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Monitor, { className: "h-4 w-4" }),
5529
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-2", children: "Icons & Text" })
5530
+ ] })
5531
+ ]
5532
+ }
5533
+ )
5534
+ ] }),
5535
+ showControls && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "button-group flex flex-wrap gap-2", children: [
5536
+ /* @__PURE__ */ jsxRuntime.jsx(
5537
+ Button,
5538
+ {
5539
+ size: "sm",
5540
+ onClick: () => editor.chain().focus().toggleBold().run(),
5541
+ disabled: !editor.can().chain().focus().toggleBold().run(),
5542
+ className: editor.isActive("bold") ? "is-active" : "",
5543
+ title: "Toggle bold text",
5544
+ children: renderContent(/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Bold, { className: "h-4 w-4" }), "Bold")
5545
+ }
5546
+ ),
5547
+ /* @__PURE__ */ jsxRuntime.jsx(
5548
+ Button,
5549
+ {
5550
+ size: "sm",
5551
+ onClick: () => editor.chain().focus().toggleItalic().run(),
5552
+ disabled: !editor.can().chain().focus().toggleItalic().run(),
5553
+ className: editor.isActive("italic") ? "is-active" : "",
5554
+ title: "Toggle italic text",
5555
+ children: renderContent(/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Italic, { className: "h-4 w-4" }), "Italic")
5556
+ }
5557
+ ),
5558
+ /* @__PURE__ */ jsxRuntime.jsx(
5559
+ Button,
5560
+ {
5561
+ size: "sm",
5562
+ onClick: () => editor.chain().focus().toggleStrike().run(),
5563
+ disabled: !editor.can().chain().focus().toggleStrike().run(),
5564
+ className: editor.isActive("strike") ? "is-active" : "",
5565
+ title: "Toggle strikethrough text",
5566
+ children: renderContent(/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Strikethrough, { className: "h-4 w-4" }), "Strike")
5567
+ }
5568
+ ),
5569
+ /* @__PURE__ */ jsxRuntime.jsx(
5570
+ Button,
5571
+ {
5572
+ size: "sm",
5573
+ onClick: () => editor.chain().focus().toggleCode().run(),
5574
+ disabled: !editor.can().chain().focus().toggleCode().run(),
5575
+ className: editor.isActive("code") ? "is-active" : "",
5576
+ title: "Toggle inline code",
5577
+ children: renderContent(/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Code, { className: "h-4 w-4" }), "Code")
5578
+ }
5579
+ ),
5580
+ /* @__PURE__ */ jsxRuntime.jsx(
5581
+ Button,
5582
+ {
5583
+ size: "sm",
5584
+ onClick: () => editor.chain().focus().unsetAllMarks().run(),
5585
+ title: "Clear all text formatting",
5586
+ children: renderContent(/* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "h-4 w-4" }), "Clear marks")
5587
+ }
5588
+ ),
5589
+ /* @__PURE__ */ jsxRuntime.jsx(
5590
+ Button,
5591
+ {
5592
+ size: "sm",
5593
+ onClick: () => editor.chain().focus().clearNodes().run(),
5594
+ title: "Clear all block formatting",
5595
+ children: renderContent(/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Trash2, { className: "h-4 w-4" }), "Clear nodes")
5596
+ }
5597
+ ),
5598
+ /* @__PURE__ */ jsxRuntime.jsx(
5599
+ Button,
5600
+ {
5601
+ size: "sm",
5602
+ onClick: () => editor.chain().focus().setParagraph().run(),
5603
+ className: editor.isActive("paragraph") ? "is-active" : "",
5604
+ title: "Convert to paragraph",
5605
+ children: renderContent(/* @__PURE__ */ jsxRuntime.jsx(lucideReact.PilcrowSquare, { className: "h-4 w-4" }), "Paragraph")
5606
+ }
5607
+ ),
5608
+ /* @__PURE__ */ jsxRuntime.jsx(
5609
+ Button,
5610
+ {
5611
+ size: "sm",
5612
+ onClick: () => editor.chain().focus().toggleHeading({ level: 1 }).run(),
5613
+ className: editor.isActive("heading", { level: 1 }) ? "is-active" : "",
5614
+ title: "Toggle heading 1",
5615
+ children: renderContent(/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Heading1, { className: "h-4 w-4" }), "H1")
5616
+ }
5617
+ ),
5618
+ /* @__PURE__ */ jsxRuntime.jsx(
5619
+ Button,
5620
+ {
5621
+ size: "sm",
5622
+ onClick: () => editor.chain().focus().toggleHeading({ level: 2 }).run(),
5623
+ className: editor.isActive("heading", { level: 2 }) ? "is-active" : "",
5624
+ title: "Toggle heading 2",
5625
+ children: renderContent(/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Heading2, { className: "h-4 w-4" }), "H2")
5626
+ }
5627
+ ),
5628
+ /* @__PURE__ */ jsxRuntime.jsx(
5629
+ Button,
5630
+ {
5631
+ size: "sm",
5632
+ onClick: () => editor.chain().focus().toggleHeading({ level: 3 }).run(),
5633
+ className: editor.isActive("heading", { level: 3 }) ? "is-active" : "",
5634
+ title: "Toggle heading 3",
5635
+ children: renderContent(/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Heading3, { className: "h-4 w-4" }), "H3")
5636
+ }
5637
+ ),
5638
+ /* @__PURE__ */ jsxRuntime.jsx(
5639
+ Button,
5640
+ {
5641
+ size: "sm",
5642
+ onClick: () => editor.chain().focus().toggleHeading({ level: 4 }).run(),
5643
+ className: editor.isActive("heading", { level: 4 }) ? "is-active" : "",
5644
+ title: "Toggle heading 4",
5645
+ children: renderContent(/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Heading4, { className: "h-4 w-4" }), "H4")
5646
+ }
5647
+ ),
5648
+ /* @__PURE__ */ jsxRuntime.jsx(
5649
+ Button,
5650
+ {
5651
+ size: "sm",
5652
+ onClick: () => editor.chain().focus().toggleHeading({ level: 5 }).run(),
5653
+ className: editor.isActive("heading", { level: 5 }) ? "is-active" : "",
5654
+ title: "Toggle heading 5",
5655
+ children: renderContent(/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Heading5, { className: "h-4 w-4" }), "H5")
5656
+ }
5657
+ ),
5658
+ /* @__PURE__ */ jsxRuntime.jsx(
5659
+ Button,
5660
+ {
5661
+ size: "sm",
5662
+ onClick: () => editor.chain().focus().toggleHeading({ level: 6 }).run(),
5663
+ className: editor.isActive("heading", { level: 6 }) ? "is-active" : "",
5664
+ title: "Toggle heading 6",
5665
+ children: renderContent(/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Heading6, { className: "h-4 w-4" }), "H6")
5666
+ }
5667
+ ),
5668
+ /* @__PURE__ */ jsxRuntime.jsx(
5669
+ Button,
5670
+ {
5671
+ size: "sm",
5672
+ onClick: () => editor.chain().focus().toggleBulletList().run(),
5673
+ className: editor.isActive("bulletList") ? "is-active" : "",
5674
+ title: "Toggle bullet list",
5675
+ children: renderContent(/* @__PURE__ */ jsxRuntime.jsx(lucideReact.List, { className: "h-4 w-4" }), "Bullet list")
5676
+ }
5677
+ ),
5678
+ /* @__PURE__ */ jsxRuntime.jsx(
5679
+ Button,
5680
+ {
5681
+ size: "sm",
5682
+ onClick: () => editor.chain().focus().toggleOrderedList().run(),
5683
+ className: editor.isActive("orderedList") ? "is-active" : "",
5684
+ title: "Toggle ordered list",
5685
+ children: renderContent(/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ListOrdered, { className: "h-4 w-4" }), "Ordered list")
5686
+ }
5687
+ ),
5688
+ /* @__PURE__ */ jsxRuntime.jsx(
5689
+ Button,
5690
+ {
5691
+ size: "sm",
5692
+ onClick: () => editor.chain().focus().toggleCodeBlock().run(),
5693
+ className: editor.isActive("codeBlock") ? "is-active" : "",
5694
+ title: "Toggle code block",
5695
+ children: renderContent(/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Code, { className: "h-4 w-4" }), "Code block")
5696
+ }
5697
+ ),
5698
+ /* @__PURE__ */ jsxRuntime.jsx(
5699
+ Button,
5700
+ {
5701
+ size: "sm",
5702
+ onClick: () => editor.chain().focus().toggleBlockquote().run(),
5703
+ className: editor.isActive("blockquote") ? "is-active" : "",
5704
+ title: "Toggle blockquote",
5705
+ children: renderContent(/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Quote, { className: "h-4 w-4" }), "Blockquote")
5706
+ }
5707
+ ),
5708
+ /* @__PURE__ */ jsxRuntime.jsx(
5709
+ Button,
5710
+ {
5711
+ size: "sm",
5712
+ onClick: () => editor.chain().focus().setHorizontalRule().run(),
5713
+ title: "Insert horizontal rule",
5714
+ children: renderContent(/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Minus, { className: "h-4 w-4" }), "Horizontal rule")
5715
+ }
5716
+ ),
5717
+ /* @__PURE__ */ jsxRuntime.jsx(
5718
+ Button,
5719
+ {
5720
+ size: "sm",
5721
+ onClick: () => editor.chain().focus().setHardBreak().run(),
5722
+ title: "Insert hard break",
5723
+ children: renderContent(/* @__PURE__ */ jsxRuntime.jsx(lucideReact.WrapText, { className: "h-4 w-4" }), "Hard break")
5724
+ }
5725
+ ),
5726
+ /* @__PURE__ */ jsxRuntime.jsx(
5727
+ Button,
5728
+ {
5729
+ size: "sm",
5730
+ onClick: () => editor.chain().focus().undo().run(),
5731
+ disabled: !editor.can().chain().focus().undo().run(),
5732
+ title: "Undo last change",
5733
+ children: renderContent(/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Undo2, { className: "h-4 w-4" }), "Undo")
5734
+ }
5735
+ ),
5736
+ /* @__PURE__ */ jsxRuntime.jsx(
5737
+ Button,
5738
+ {
5739
+ size: "sm",
5740
+ onClick: () => editor.chain().focus().redo().run(),
5741
+ disabled: !editor.can().chain().focus().redo().run(),
5742
+ title: "Redo last change",
5743
+ children: renderContent(/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Redo2, { className: "h-4 w-4" }), "Redo")
5744
+ }
5745
+ ),
5746
+ /* @__PURE__ */ jsxRuntime.jsx(
5747
+ Button,
5748
+ {
5749
+ size: "sm",
5750
+ onClick: () => editor.chain().focus().setColor("#958DF1").run(),
5751
+ className: editor.isActive("textStyle", { color: "#958DF1" }) ? "is-active" : "",
5752
+ title: "Set text color to purple",
5753
+ children: renderContent(/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Palette, { className: "h-4 w-4" }), "Purple")
5754
+ }
5755
+ )
5756
+ ] })
5757
+ ] });
5758
+ }
5759
+ function Markdown({
5407
5760
  settings,
5408
5761
  width,
5409
5762
  height
5410
- }) => {
5411
- useDataLayer((s) => s.updateChart);
5412
- const [localContent, setLocalContent] = React2.useState(settings.content);
5413
- localContent !== settings.content;
5414
- const handleChange = (value) => {
5415
- setLocalContent(value);
5416
- };
5417
- return /* @__PURE__ */ jsxRuntime.jsx("div", { style: { width, height }, className: "flex flex-col", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 overflow-auto", children: /* @__PURE__ */ jsxRuntime.jsx(Textarea, { value: localContent, onChange: handleChange }) }) });
5418
- };
5763
+ }) {
5764
+ const updateChart = useDataLayer((s) => s.updateChart);
5765
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { style: { width, height }, className: "flex flex-col overflow-auto p-1", children: /* @__PURE__ */ jsxRuntime.jsx(
5766
+ react.EditorProvider,
5767
+ {
5768
+ slotBefore: /* @__PURE__ */ jsxRuntime.jsx(MenuBar, {}),
5769
+ extensions,
5770
+ content: settings.content,
5771
+ onUpdate: (value) => {
5772
+ updateChart(settings.id, {
5773
+ ...settings,
5774
+ content: value.editor.getHTML()
5775
+ });
5776
+ }
5777
+ }
5778
+ ) });
5779
+ }
5780
+ var extensions = [
5781
+ extensionColor.Color.configure({ types: [TextStyle__default.default.name, ListItem__default.default.name] }),
5782
+ TextStyle__default.default.configure({ types: [ListItem__default.default.name] }),
5783
+ StarterKit__default.default.configure({
5784
+ bulletList: {
5785
+ keepMarks: true,
5786
+ keepAttributes: false
5787
+ },
5788
+ orderedList: {
5789
+ keepMarks: true,
5790
+ keepAttributes: false
5791
+ }
5792
+ })
5793
+ ];
5419
5794
 
5420
5795
  // src/components/charts/Markdown/definition.ts
5421
5796
  var markdownDefinition = {
@@ -5585,7 +5960,7 @@ function BoxPlot({
5585
5960
  facetIds
5586
5961
  );
5587
5962
  const hasColorField = !!settings.colorField;
5588
- const margin = { top: 20, right: 20, bottom: 30, left: 60 };
5963
+ const margin = settings.margin;
5589
5964
  const innerWidth = width - margin.left - margin.right;
5590
5965
  const innerHeight = height - margin.top - margin.bottom;
5591
5966
  const groupedData = React2.useMemo(() => {
@@ -5812,7 +6187,6 @@ function BoxPlot({
5812
6187
  {
5813
6188
  width,
5814
6189
  height,
5815
- margin,
5816
6190
  xScale,
5817
6191
  yScale,
5818
6192
  brushingMode: "2d",
@@ -6519,6 +6893,52 @@ var colorLegendDefinition = {
6519
6893
  getFilterFunction: () => () => true
6520
6894
  };
6521
6895
 
6896
+ // src/lib/chartUtils.ts
6897
+ function reduceDataPoints(data, numBuckets) {
6898
+ if (!data || data.length === 0) {
6899
+ return [];
6900
+ }
6901
+ const validBuckets = Math.max(1, Math.min(1e3, Math.floor(numBuckets)));
6902
+ if (data.length <= validBuckets * 3) {
6903
+ return data.map((point2) => ({ ...point2, type: "start" }));
6904
+ }
6905
+ const xExtent = {
6906
+ min: Math.min(...data.map((d) => d.x)),
6907
+ max: Math.max(...data.map((d) => d.x))
6908
+ };
6909
+ if (xExtent.min === xExtent.max) {
6910
+ return [{ ...data[0], type: "start" }];
6911
+ }
6912
+ const buckets = Array(validBuckets).fill(null).map(() => []);
6913
+ data.forEach((point2) => {
6914
+ const bucketIndex = Math.min(
6915
+ Math.floor(
6916
+ (point2.x - xExtent.min) / (xExtent.max - xExtent.min) * validBuckets
6917
+ ),
6918
+ validBuckets - 1
6919
+ );
6920
+ buckets[bucketIndex].push({ ...point2, type: "start" });
6921
+ });
6922
+ const result = [];
6923
+ buckets.forEach((bucket) => {
6924
+ if (bucket.length === 0) {
6925
+ return;
6926
+ }
6927
+ result.push({ ...bucket[0], type: "start" });
6928
+ if (bucket.length > 1) {
6929
+ const minPoint = bucket.reduce((min, p) => p.y < min.y ? p : min);
6930
+ const maxPoint = bucket.reduce((max, p) => p.y > max.y ? p : max);
6931
+ if (minPoint !== bucket[0]) {
6932
+ result.push({ ...minPoint, type: "min" });
6933
+ }
6934
+ if (maxPoint !== bucket[0] && maxPoint !== minPoint) {
6935
+ result.push({ ...maxPoint, type: "max" });
6936
+ }
6937
+ }
6938
+ });
6939
+ return result.sort((a, b) => a.x - b.x);
6940
+ }
6941
+
6522
6942
  // ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/constant.js
6523
6943
  function constant_default(x2) {
6524
6944
  return function constant() {
@@ -6840,52 +7260,6 @@ Step.prototype = {
6840
7260
  function stepAfter(context) {
6841
7261
  return new Step(context, 1);
6842
7262
  }
6843
-
6844
- // src/lib/chartUtils.ts
6845
- function reduceDataPoints(data, numBuckets) {
6846
- if (!data || data.length === 0) {
6847
- return [];
6848
- }
6849
- const validBuckets = Math.max(1, Math.min(1e3, Math.floor(numBuckets)));
6850
- if (data.length <= validBuckets * 3) {
6851
- return data.map((point2) => ({ ...point2, type: "start" }));
6852
- }
6853
- const xExtent = {
6854
- min: Math.min(...data.map((d) => d.x)),
6855
- max: Math.max(...data.map((d) => d.x))
6856
- };
6857
- if (xExtent.min === xExtent.max) {
6858
- return [{ ...data[0], type: "start" }];
6859
- }
6860
- const buckets = Array(validBuckets).fill(null).map(() => []);
6861
- data.forEach((point2) => {
6862
- const bucketIndex = Math.min(
6863
- Math.floor(
6864
- (point2.x - xExtent.min) / (xExtent.max - xExtent.min) * validBuckets
6865
- ),
6866
- validBuckets - 1
6867
- );
6868
- buckets[bucketIndex].push({ ...point2, type: "start" });
6869
- });
6870
- const result = [];
6871
- buckets.forEach((bucket) => {
6872
- if (bucket.length === 0) {
6873
- return;
6874
- }
6875
- result.push({ ...bucket[0], type: "start" });
6876
- if (bucket.length > 1) {
6877
- const minPoint = bucket.reduce((min, p) => p.y < min.y ? p : min);
6878
- const maxPoint = bucket.reduce((max, p) => p.y > max.y ? p : max);
6879
- if (minPoint !== bucket[0]) {
6880
- result.push({ ...minPoint, type: "min" });
6881
- }
6882
- if (maxPoint !== bucket[0] && maxPoint !== minPoint) {
6883
- result.push({ ...maxPoint, type: "max" });
6884
- }
6885
- }
6886
- });
6887
- return result.sort((a, b) => a.x - b.x);
6888
- }
6889
7263
  var curveTypes = {
6890
7264
  linear: linear_default,
6891
7265
  monotoneX,
@@ -6941,7 +7315,7 @@ var LineChart2 = ({
6941
7315
  settings.seriesField,
6942
7316
  facetIds
6943
7317
  );
6944
- const margin = { top: 20, right: 60, bottom: 30, left: 60 };
7318
+ const margin = settings.margin;
6945
7319
  if (settings.showLegend) {
6946
7320
  switch (settings.legendPosition) {
6947
7321
  case "top":
@@ -7130,7 +7504,6 @@ var LineChart2 = ({
7130
7504
  {
7131
7505
  width,
7132
7506
  height,
7133
- margin,
7134
7507
  xScale,
7135
7508
  yScale: leftYScale,
7136
7509
  settings,
@@ -7598,7 +7971,7 @@ var lineChartDefinition = {
7598
7971
  },
7599
7972
  xAxis: {},
7600
7973
  yAxis: {},
7601
- margin: {},
7974
+ margin: { top: 20, right: 60, bottom: 30, left: 60 },
7602
7975
  filters: [],
7603
7976
  xAxisLabel: "",
7604
7977
  yAxisLabel: "",
@@ -7651,7 +8024,7 @@ function RowChart({ settings, width, height, facetIds }) {
7651
8024
  filters: newFilters
7652
8025
  });
7653
8026
  };
7654
- const margin = { top: 20, right: 40, bottom: 30, left: 100 };
8027
+ const margin = settings.margin;
7655
8028
  const innerWidth = width - margin.left - margin.right;
7656
8029
  const innerHeight = height - margin.top - margin.bottom;
7657
8030
  const { displayCounts } = React2.useMemo(() => {
@@ -7719,7 +8092,6 @@ function RowChart({ settings, width, height, facetIds }) {
7719
8092
  {
7720
8093
  width,
7721
8094
  height,
7722
- margin,
7723
8095
  xScale,
7724
8096
  yScale,
7725
8097
  settings,
@@ -9679,10 +10051,7 @@ function GridBackground({
9679
10051
  return /* @__PURE__ */ jsxRuntime.jsx(
9680
10052
  "div",
9681
10053
  {
9682
- className: cn(
9683
- "absolute inset-0 pointer-events-none border border-dashed border-gray-200",
9684
- className
9685
- ),
10054
+ className: cn("absolute inset-0 pointer-events-none", className),
9686
10055
  style: {
9687
10056
  width,
9688
10057
  height
@@ -9690,7 +10059,7 @@ function GridBackground({
9690
10059
  children: /* @__PURE__ */ jsxRuntime.jsxs(
9691
10060
  "div",
9692
10061
  {
9693
- className: "absolute inset-0",
10062
+ className: "absolute inset-0 border border-dashed border-gray-200",
9694
10063
  style: {
9695
10064
  margin: settings.containerPadding
9696
10065
  },
@@ -9758,17 +10127,77 @@ function ChartGridLayout({
9758
10127
  cols: gridSettings.columnCount,
9759
10128
  rowHeight: gridSettings.rowHeight,
9760
10129
  width: containerWidth,
10130
+ margin: [0, 0],
9761
10131
  containerPadding: [
9762
10132
  gridSettings.containerPadding,
9763
10133
  gridSettings.containerPadding
9764
10134
  ],
9765
10135
  onLayoutChange,
9766
10136
  draggableHandle: ".drag-handle",
10137
+ style: { position: "absolute", inset: 0 },
10138
+ resizeHandle: /* @__PURE__ */ jsxRuntime.jsx(BottomRightHandle, {}),
9767
10139
  children
9768
10140
  }
9769
10141
  )
9770
10142
  ] });
9771
10143
  }
10144
+ var SouthEastArrow = () => {
10145
+ const size = 100;
10146
+ const margin = 20;
10147
+ const rightEdgeX = size - margin;
10148
+ const startX = margin;
10149
+ const startY = size - margin;
10150
+ const bottomRightX = rightEdgeX;
10151
+ const bottomRightY = size - margin;
10152
+ const topRightX = rightEdgeX;
10153
+ const topRightY = margin;
10154
+ const controlX = Math.floor(startX + (rightEdgeX - startX) * 0.7);
10155
+ const controlY = Math.floor(startY - (startY - topRightY) * 0.3);
10156
+ const path2 = `
10157
+ M ${startX} ${startY}
10158
+ L ${bottomRightX} ${bottomRightY}
10159
+ L ${topRightX} ${topRightY}
10160
+ Q ${controlX} ${controlY} ${startX} ${startY}
10161
+ Z
10162
+ `;
10163
+ return /* @__PURE__ */ jsxRuntime.jsx(
10164
+ "svg",
10165
+ {
10166
+ width: "20px",
10167
+ height: "20px",
10168
+ version: "1.1",
10169
+ viewBox: `0 0 ${size} ${size}`,
10170
+ xmlns: "http://www.w3.org/2000/svg",
10171
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: path2, fill: "currentColor" })
10172
+ }
10173
+ );
10174
+ };
10175
+ var BottomRightHandle = React2__namespace.default.forwardRef(
10176
+ (props, ref) => {
10177
+ return /* @__PURE__ */ jsxRuntime.jsxs(
10178
+ "div",
10179
+ {
10180
+ style: {
10181
+ width: "20px",
10182
+ height: "20px",
10183
+ position: "absolute",
10184
+ bottom: 0,
10185
+ right: 0,
10186
+ padding: 0,
10187
+ cursor: "se-resize"
10188
+ },
10189
+ className: "handle-se",
10190
+ ref,
10191
+ ...props,
10192
+ children: [
10193
+ " ",
10194
+ /* @__PURE__ */ jsxRuntime.jsx(SouthEastArrow, {}),
10195
+ " "
10196
+ ]
10197
+ }
10198
+ );
10199
+ }
10200
+ );
9772
10201
  function ChartRenderer({
9773
10202
  settings,
9774
10203
  width,
@@ -10543,16 +10972,18 @@ function PlotChartPanel({
10543
10972
  onDelete();
10544
10973
  }
10545
10974
  };
10975
+ const widthWithPadding = width - 8;
10976
+ const heightWithPadding = height - 8;
10546
10977
  return /* @__PURE__ */ jsxRuntime.jsxs(
10547
10978
  "div",
10548
10979
  {
10549
- className: "bg-card border rounded-lg",
10550
- style: { width, height },
10980
+ className: "bg-card border rounded-lg flex flex-col overflow-hidden m-1",
10981
+ style: { width: widthWithPadding, height: heightWithPadding },
10551
10982
  children: [
10552
10983
  /* @__PURE__ */ jsxRuntime.jsxs(
10553
10984
  "div",
10554
10985
  {
10555
- className: "flex items-center justify-between select-none",
10986
+ className: "flex items-center justify-between select-none px-2",
10556
10987
  style: { height: 24 },
10557
10988
  children: [
10558
10989
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "drag-handle cursor-move flex items-center gap-2", children: [
@@ -10579,20 +11010,19 @@ function PlotChartPanel({
10579
11010
  ]
10580
11011
  }
10581
11012
  ),
10582
- /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(FacetAxisProvider, { children: settings.facet?.enabled ? /* @__PURE__ */ jsxRuntime.jsx(
11013
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsxRuntime.jsx(FacetAxisProvider, { children: settings.facet?.enabled ? /* @__PURE__ */ jsxRuntime.jsx(
10583
11014
  FacetContainer,
10584
11015
  {
10585
11016
  settings,
10586
11017
  width: width - 32,
10587
- height: height - 56
11018
+ height: height - 36
10588
11019
  }
10589
11020
  ) : /* @__PURE__ */ jsxRuntime.jsx(
10590
11021
  ChartRenderer,
10591
11022
  {
10592
11023
  settings,
10593
11024
  width: width - 32,
10594
- height: height - 56,
10595
- facetIds: void 0
11025
+ height: height - 36
10596
11026
  }
10597
11027
  ) }) })
10598
11028
  ]