@rebasepro/plugin-insights 0.0.1-canary.eae7889 → 0.1.0

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.
Files changed (47) hide show
  1. package/dist/core/src/components/BootstrapAdminBanner.d.ts +4 -0
  2. package/dist/core/src/components/LoginView/LoginView.d.ts +22 -0
  3. package/dist/core/src/components/common/useDataTableController.d.ts +3 -3
  4. package/dist/core/src/components/index.d.ts +1 -0
  5. package/dist/core/src/hooks/data/useRelationSelector.d.ts +2 -2
  6. package/dist/core/src/hooks/index.d.ts +1 -0
  7. package/dist/core/src/hooks/useCollapsedGroups.d.ts +16 -1
  8. package/dist/core/src/hooks/useResolvedComponent.d.ts +47 -0
  9. package/dist/index.es.js +314 -214
  10. package/dist/index.es.js.map +1 -1
  11. package/dist/index.umd.js +314 -214
  12. package/dist/index.umd.js.map +1 -1
  13. package/dist/plugin-insights/src/components/CollectionInsightsInline.d.ts +3 -2
  14. package/dist/plugin-insights/src/components/InsightWidget.d.ts +4 -1
  15. package/dist/plugin-insights/src/components/InsightWidgetSkeleton.d.ts +6 -0
  16. package/dist/plugin-insights/src/engine/useInsightsData.d.ts +2 -2
  17. package/dist/plugin-insights/src/types/engine.d.ts +10 -1
  18. package/dist/types/src/controllers/auth.d.ts +8 -2
  19. package/dist/types/src/controllers/client.d.ts +13 -0
  20. package/dist/types/src/controllers/collection_registry.d.ts +2 -1
  21. package/dist/types/src/controllers/data_driver.d.ts +36 -1
  22. package/dist/types/src/controllers/navigation.d.ts +18 -6
  23. package/dist/types/src/controllers/registry.d.ts +9 -1
  24. package/dist/types/src/controllers/side_entity_controller.d.ts +7 -0
  25. package/dist/types/src/rebase_context.d.ts +17 -0
  26. package/dist/types/src/types/backend_hooks.d.ts +187 -0
  27. package/dist/types/src/types/collections.d.ts +31 -11
  28. package/dist/types/src/types/component_ref.d.ts +47 -0
  29. package/dist/types/src/types/cron.d.ts +1 -1
  30. package/dist/types/src/types/entity_views.d.ts +6 -7
  31. package/dist/types/src/types/formex.d.ts +40 -0
  32. package/dist/types/src/types/index.d.ts +3 -0
  33. package/dist/types/src/types/plugins.d.ts +6 -3
  34. package/dist/types/src/types/properties.d.ts +72 -88
  35. package/dist/types/src/types/slots.d.ts +20 -10
  36. package/dist/types/src/types/translations.d.ts +6 -0
  37. package/dist/ui/src/components/FileUpload.d.ts +1 -1
  38. package/dist/ui/src/components/SearchBar.d.ts +5 -1
  39. package/dist/ui/src/styles.d.ts +2 -2
  40. package/package.json +3 -3
  41. package/src/components/CollectionInsightsInline.tsx +10 -2
  42. package/src/components/HomeCardInsightSlot.tsx +5 -1
  43. package/src/components/InsightWidget.tsx +5 -1
  44. package/src/components/InsightWidgetSkeleton.tsx +116 -34
  45. package/src/engine/useInsightsData.ts +5 -5
  46. package/src/types/engine.ts +11 -1
  47. package/src/useInsightsPlugin.tsx +1 -1
package/dist/index.umd.js CHANGED
@@ -85,8 +85,8 @@
85
85
  function useInsightsEngine() {
86
86
  return React.useContext(InsightsContext);
87
87
  }
88
- function useInsightsData(definition, collectionSlug) {
89
- const $ = reactCompilerRuntime.c(16);
88
+ function useInsightsData(definition, context) {
89
+ const $ = reactCompilerRuntime.c(18);
90
90
  const engine = useInsightsEngine();
91
91
  const cache = engine?.cache ?? null;
92
92
  const {
@@ -99,9 +99,9 @@
99
99
  const [data, setData] = React.useState(null);
100
100
  const [loading, setLoading] = React.useState(true);
101
101
  const [error, setError] = React.useState(null);
102
- const cacheKey = `${definition.id}:${collectionSlug ?? "global"}`;
102
+ const cacheKey = `${definition.id}:${context.path ?? context.collectionSlug ?? "global"}`;
103
103
  let t0;
104
- if ($[0] !== authReady || $[1] !== cache || $[2] !== cacheKey || $[3] !== definition) {
104
+ if ($[0] !== authReady || $[1] !== cache || $[2] !== cacheKey || $[3] !== context || $[4] !== definition) {
105
105
  t0 = () => {
106
106
  if (!authReady || !cache) {
107
107
  return;
@@ -134,7 +134,7 @@
134
134
  }
135
135
  setLoading(true);
136
136
  setError(null);
137
- const promise = definition.data();
137
+ const promise = definition.data(context);
138
138
  cache.setInflight(cacheKey, promise);
139
139
  promise.then((result_0) => {
140
140
  cache.set(cacheKey, result_0);
@@ -157,38 +157,40 @@
157
157
  $[0] = authReady;
158
158
  $[1] = cache;
159
159
  $[2] = cacheKey;
160
- $[3] = definition;
161
- $[4] = t0;
160
+ $[3] = context;
161
+ $[4] = definition;
162
+ $[5] = t0;
162
163
  } else {
163
- t0 = $[4];
164
+ t0 = $[5];
164
165
  }
165
166
  let t1;
166
- if ($[5] !== authReady || $[6] !== cache || $[7] !== cacheKey || $[8] !== collectionSlug || $[9] !== definition.data || $[10] !== definition.id) {
167
- t1 = [definition.id, definition.data, collectionSlug, cacheKey, cache, authReady];
168
- $[5] = authReady;
169
- $[6] = cache;
170
- $[7] = cacheKey;
171
- $[8] = collectionSlug;
172
- $[9] = definition.data;
173
- $[10] = definition.id;
174
- $[11] = t1;
175
- } else {
176
- t1 = $[11];
167
+ if ($[6] !== authReady || $[7] !== cache || $[8] !== cacheKey || $[9] !== context.collectionSlug || $[10] !== context.path || $[11] !== definition.data || $[12] !== definition.id) {
168
+ t1 = [definition.id, definition.data, context.path, context.collectionSlug, cacheKey, cache, authReady];
169
+ $[6] = authReady;
170
+ $[7] = cache;
171
+ $[8] = cacheKey;
172
+ $[9] = context.collectionSlug;
173
+ $[10] = context.path;
174
+ $[11] = definition.data;
175
+ $[12] = definition.id;
176
+ $[13] = t1;
177
+ } else {
178
+ t1 = $[13];
177
179
  }
178
180
  React.useEffect(t0, t1);
179
181
  let t2;
180
- if ($[12] !== data || $[13] !== error || $[14] !== loading) {
182
+ if ($[14] !== data || $[15] !== error || $[16] !== loading) {
181
183
  t2 = {
182
184
  data,
183
185
  loading,
184
186
  error
185
187
  };
186
- $[12] = data;
187
- $[13] = error;
188
- $[14] = loading;
189
- $[15] = t2;
188
+ $[14] = data;
189
+ $[15] = error;
190
+ $[16] = loading;
191
+ $[17] = t2;
190
192
  } else {
191
- t2 = $[15];
193
+ t2 = $[17];
192
194
  }
193
195
  return t2;
194
196
  }
@@ -478,7 +480,7 @@
478
480
  }
479
481
  InsightsScorecardView.displayName = "InsightsScorecardView";
480
482
  function InsightWidgetSkeleton(t0) {
481
- const $ = reactCompilerRuntime.c(35);
483
+ const $ = reactCompilerRuntime.c(17);
482
484
  const {
483
485
  config,
484
486
  compact: t1,
@@ -491,282 +493,363 @@
491
493
  const hasDateRange = Boolean(config.dateRange);
492
494
  if (compact) {
493
495
  const t32 = embedded ? "h-full px-2.5 py-2" : "flex flex-col gap-0.5 rounded-md bg-transparent border min-w-0 px-2.5 py-2";
494
- const t42 = !embedded && ui.defaultBorderMixin;
495
- let t52;
496
- if ($[0] !== t32 || $[1] !== t42) {
497
- t52 = ui.cls("animate-pulse", t32, t42);
496
+ const t4 = !embedded && ui.defaultBorderMixin;
497
+ let t5;
498
+ if ($[0] !== t32 || $[1] !== t4) {
499
+ t5 = ui.cls("animate-pulse", t32, t4);
498
500
  $[0] = t32;
499
- $[1] = t42;
500
- $[2] = t52;
501
+ $[1] = t4;
502
+ $[2] = t5;
501
503
  } else {
502
- t52 = $[2];
504
+ t5 = $[2];
503
505
  }
504
- let t62;
506
+ let t6;
505
507
  if ($[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
506
- t62 = /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-surface-200 dark:bg-surface-700 rounded-sm", style: {
508
+ t6 = /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-surface-200 dark:bg-surface-700 rounded-sm", style: {
507
509
  height: 14,
508
510
  width: 48
509
511
  } });
510
- $[3] = t62;
512
+ $[3] = t6;
511
513
  } else {
512
- t62 = $[3];
514
+ t6 = $[3];
513
515
  }
514
- let t72;
516
+ let t7;
515
517
  if ($[4] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
516
- t72 = /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-surface-200 dark:bg-surface-700 rounded-sm", style: {
518
+ t7 = /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-surface-200 dark:bg-surface-700 rounded-sm", style: {
517
519
  height: 20,
518
520
  width: 40
519
521
  } });
520
- $[4] = t72;
522
+ $[4] = t7;
521
523
  } else {
522
- t72 = $[4];
524
+ t7 = $[4];
523
525
  }
524
- let t82;
526
+ let t8;
525
527
  if ($[5] !== hasComparison) {
526
- t82 = hasComparison && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-surface-200/60 dark:bg-surface-700/60 rounded-sm", style: {
528
+ t8 = hasComparison && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-surface-200/60 dark:bg-surface-700/60 rounded-sm", style: {
527
529
  height: 14,
528
530
  width: 28
529
531
  } });
530
532
  $[5] = hasComparison;
531
- $[6] = t82;
533
+ $[6] = t8;
532
534
  } else {
533
- t82 = $[6];
535
+ t8 = $[6];
534
536
  }
535
- let t92;
536
- if ($[7] !== t82) {
537
- t92 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-baseline gap-1.5", children: [
538
- t72,
539
- t82
537
+ let t9;
538
+ if ($[7] !== t8) {
539
+ t9 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-baseline gap-1.5", children: [
540
+ t7,
541
+ t8
540
542
  ] });
541
- $[7] = t82;
542
- $[8] = t92;
543
+ $[7] = t8;
544
+ $[8] = t9;
543
545
  } else {
544
- t92 = $[8];
546
+ t9 = $[8];
545
547
  }
546
- let t102;
547
- if ($[9] !== t52 || $[10] !== t92) {
548
- t102 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: t52, children: [
549
- t62,
550
- t92
548
+ let t10;
549
+ if ($[9] !== t5 || $[10] !== t9) {
550
+ t10 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: t5, children: [
551
+ t6,
552
+ t9
551
553
  ] });
552
- $[9] = t52;
553
- $[10] = t92;
554
- $[11] = t102;
554
+ $[9] = t5;
555
+ $[10] = t9;
556
+ $[11] = t10;
555
557
  } else {
556
- t102 = $[11];
558
+ t10 = $[11];
557
559
  }
558
- return t102;
560
+ return t10;
559
561
  }
560
- const t3 = embedded ? "h-full px-5 py-4" : "rounded-lg bg-transparent border px-5 py-4";
561
- const t4 = !embedded && ui.defaultBorderMixin;
562
- let t5;
563
- if ($[12] !== t3 || $[13] !== t4) {
564
- t5 = ui.cls("animate-pulse", t3, t4);
565
- $[12] = t3;
566
- $[13] = t4;
567
- $[14] = t5;
562
+ let t3;
563
+ if ($[12] !== embedded || $[13] !== hasComparison || $[14] !== hasDateRange || $[15] !== hasIcon) {
564
+ t3 = /* @__PURE__ */ jsxRuntime.jsx(StandardSkeleton, { hasComparison, hasIcon, hasDateRange, embedded });
565
+ $[12] = embedded;
566
+ $[13] = hasComparison;
567
+ $[14] = hasDateRange;
568
+ $[15] = hasIcon;
569
+ $[16] = t3;
568
570
  } else {
569
- t5 = $[14];
571
+ t3 = $[16];
570
572
  }
571
- let t6;
572
- if ($[15] !== embedded) {
573
- t6 = embedded ? void 0 : {
574
- minHeight: 92
573
+ return t3;
574
+ }
575
+ function StandardSkeleton(t0) {
576
+ const $ = reactCompilerRuntime.c(36);
577
+ const {
578
+ hasComparison,
579
+ hasIcon,
580
+ hasDateRange,
581
+ embedded
582
+ } = t0;
583
+ const containerRef = React.useRef(null);
584
+ const [containerWidth, setContainerWidth] = React.useState(null);
585
+ let t1;
586
+ let t2;
587
+ if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
588
+ t1 = () => {
589
+ if (!containerRef.current) {
590
+ return;
591
+ }
592
+ setContainerWidth(containerRef.current.offsetWidth);
593
+ const observer = new ResizeObserver((entries) => {
594
+ for (const entry of entries) {
595
+ setContainerWidth(entry.contentRect.width);
596
+ }
597
+ });
598
+ observer.observe(containerRef.current);
599
+ return () => observer.disconnect();
600
+ };
601
+ t2 = [];
602
+ $[0] = t1;
603
+ $[1] = t2;
604
+ } else {
605
+ t1 = $[0];
606
+ t2 = $[1];
607
+ }
608
+ React.useLayoutEffect(t1, t2);
609
+ const isSmall = containerWidth !== null && containerWidth < 200;
610
+ const titleHeight = isSmall ? 15 : 16.5;
611
+ const valueHeight = isSmall ? 22.5 : containerWidth !== null && containerWidth < 300 ? 25 : 30;
612
+ const iconSize = isSmall ? 14 : 18;
613
+ let t3;
614
+ let t4;
615
+ if ($[2] !== embedded || $[3] !== isSmall) {
616
+ const baseClass = embedded ? `flex flex-col min-w-0 h-full ${isSmall ? "px-3.5 py-3" : "px-5 py-4"}` : ui.cls("rounded-lg flex flex-col min-w-0 bg-transparent border", ui.defaultBorderMixin, isSmall ? "px-3.5 py-3" : "px-5 py-4");
617
+ t3 = containerRef;
618
+ t4 = ui.cls("animate-pulse", baseClass);
619
+ $[2] = embedded;
620
+ $[3] = isSmall;
621
+ $[4] = t3;
622
+ $[5] = t4;
623
+ } else {
624
+ t3 = $[4];
625
+ t4 = $[5];
626
+ }
627
+ let t5;
628
+ if ($[6] !== embedded || $[7] !== isSmall) {
629
+ t5 = embedded ? void 0 : {
630
+ minHeight: isSmall ? 68 : 92
575
631
  };
576
- $[15] = embedded;
577
- $[16] = t6;
632
+ $[6] = embedded;
633
+ $[7] = isSmall;
634
+ $[8] = t5;
578
635
  } else {
579
- t6 = $[16];
636
+ t5 = $[8];
580
637
  }
638
+ const t6 = `flex items-center justify-between ${isSmall ? "mb-1" : "mb-2"}`;
581
639
  let t7;
582
- if ($[17] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
640
+ if ($[9] !== titleHeight) {
583
641
  t7 = /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-surface-200 dark:bg-surface-700 rounded", style: {
584
- height: 16,
642
+ height: titleHeight,
585
643
  width: "60%"
586
644
  } });
587
- $[17] = t7;
645
+ $[9] = titleHeight;
646
+ $[10] = t7;
588
647
  } else {
589
- t7 = $[17];
648
+ t7 = $[10];
590
649
  }
591
650
  let t8;
592
- if ($[18] !== hasDateRange) {
593
- t8 = hasDateRange && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-surface-200/60 dark:bg-surface-700/60 rounded mt-0.5", style: {
651
+ if ($[11] !== hasDateRange || $[12] !== isSmall) {
652
+ t8 = hasDateRange && !isSmall && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-surface-200/60 dark:bg-surface-700/60 rounded mt-0.5", style: {
594
653
  height: 14,
595
654
  width: "40%"
596
655
  } });
597
- $[18] = hasDateRange;
598
- $[19] = t8;
656
+ $[11] = hasDateRange;
657
+ $[12] = isSmall;
658
+ $[13] = t8;
599
659
  } else {
600
- t8 = $[19];
660
+ t8 = $[13];
601
661
  }
602
662
  let t9;
603
- if ($[20] !== t8) {
663
+ if ($[14] !== t7 || $[15] !== t8) {
604
664
  t9 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col min-w-0", children: [
605
665
  t7,
606
666
  t8
607
667
  ] });
608
- $[20] = t8;
609
- $[21] = t9;
668
+ $[14] = t7;
669
+ $[15] = t8;
670
+ $[16] = t9;
610
671
  } else {
611
- t9 = $[21];
672
+ t9 = $[16];
612
673
  }
613
674
  let t10;
614
- if ($[22] !== hasIcon) {
615
- t10 = hasIcon && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-surface-200 dark:bg-surface-700 rounded ml-2 shrink-0", style: {
616
- height: 18,
617
- width: 18
618
- } });
619
- $[22] = hasIcon;
620
- $[23] = t10;
675
+ if ($[17] !== hasIcon || $[18] !== iconSize) {
676
+ t10 = hasIcon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-2 shrink-0", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-surface-200 dark:bg-surface-700 rounded", style: {
677
+ height: iconSize,
678
+ width: iconSize
679
+ } }) });
680
+ $[17] = hasIcon;
681
+ $[18] = iconSize;
682
+ $[19] = t10;
621
683
  } else {
622
- t10 = $[23];
684
+ t10 = $[19];
623
685
  }
624
686
  let t11;
625
- if ($[24] !== t10 || $[25] !== t9) {
626
- t11 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between mb-2", children: [
687
+ if ($[20] !== t10 || $[21] !== t6 || $[22] !== t9) {
688
+ t11 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: t6, children: [
627
689
  t9,
628
690
  t10
629
691
  ] });
630
- $[24] = t10;
631
- $[25] = t9;
632
- $[26] = t11;
692
+ $[20] = t10;
693
+ $[21] = t6;
694
+ $[22] = t9;
695
+ $[23] = t11;
633
696
  } else {
634
- t11 = $[26];
697
+ t11 = $[23];
635
698
  }
636
699
  let t12;
637
- if ($[27] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
700
+ if ($[24] !== valueHeight) {
638
701
  t12 = /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-surface-200 dark:bg-surface-700 rounded", style: {
639
- height: 32,
702
+ height: valueHeight,
640
703
  width: "40%"
641
704
  } });
642
- $[27] = t12;
705
+ $[24] = valueHeight;
706
+ $[25] = t12;
643
707
  } else {
644
- t12 = $[27];
708
+ t12 = $[25];
645
709
  }
646
710
  let t13;
647
- if ($[28] !== hasComparison) {
648
- t13 = hasComparison && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-surface-200/60 dark:bg-surface-700/60 rounded mt-1", style: {
711
+ if ($[26] !== hasComparison || $[27] !== isSmall) {
712
+ t13 = hasComparison && /* @__PURE__ */ jsxRuntime.jsx("div", { className: isSmall ? "mt-0.5" : "mt-1", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-surface-200/60 dark:bg-surface-700/60 rounded", style: {
649
713
  height: 16,
650
714
  width: "25%"
651
- } });
652
- $[28] = hasComparison;
653
- $[29] = t13;
715
+ } }) });
716
+ $[26] = hasComparison;
717
+ $[27] = isSmall;
718
+ $[28] = t13;
654
719
  } else {
655
- t13 = $[29];
720
+ t13 = $[28];
656
721
  }
657
722
  let t14;
658
- if ($[30] !== t11 || $[31] !== t13 || $[32] !== t5 || $[33] !== t6) {
659
- t14 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: t5, style: t6, children: [
723
+ if ($[29] !== t11 || $[30] !== t12 || $[31] !== t13 || $[32] !== t3 || $[33] !== t4 || $[34] !== t5) {
724
+ t14 = /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: t3, className: t4, style: t5, children: [
660
725
  t11,
661
726
  t12,
662
727
  t13
663
728
  ] });
664
- $[30] = t11;
729
+ $[29] = t11;
730
+ $[30] = t12;
665
731
  $[31] = t13;
666
- $[32] = t5;
667
- $[33] = t6;
668
- $[34] = t14;
732
+ $[32] = t3;
733
+ $[33] = t4;
734
+ $[34] = t5;
735
+ $[35] = t14;
669
736
  } else {
670
- t14 = $[34];
737
+ t14 = $[35];
671
738
  }
672
739
  return t14;
673
740
  }
674
741
  InsightWidgetSkeleton.displayName = "InsightWidgetSkeleton";
675
742
  function InsightWidget(t0) {
676
- const $ = reactCompilerRuntime.c(21);
743
+ const $ = reactCompilerRuntime.c(25);
677
744
  const {
678
745
  definition,
679
746
  collectionSlug,
747
+ path,
748
+ parentCollectionSlugs,
680
749
  compact: t1,
681
750
  embedded: t2
682
751
  } = t0;
683
752
  const compact = t1 === void 0 ? false : t1;
684
753
  const embedded = t2 === void 0 ? false : t2;
754
+ let t3;
755
+ if ($[0] !== collectionSlug || $[1] !== parentCollectionSlugs || $[2] !== path) {
756
+ t3 = {
757
+ path,
758
+ collectionSlug,
759
+ parentCollectionSlugs
760
+ };
761
+ $[0] = collectionSlug;
762
+ $[1] = parentCollectionSlugs;
763
+ $[2] = path;
764
+ $[3] = t3;
765
+ } else {
766
+ t3 = $[3];
767
+ }
685
768
  const {
686
769
  data,
687
770
  loading,
688
771
  error
689
- } = useInsightsData(definition, collectionSlug);
772
+ } = useInsightsData(definition, t3);
690
773
  if (loading) {
691
- let t32;
692
- if ($[0] !== compact || $[1] !== definition.scorecard || $[2] !== embedded) {
693
- t32 = /* @__PURE__ */ jsxRuntime.jsx(InsightWidgetSkeleton, { config: definition.scorecard, compact, embedded });
694
- $[0] = compact;
695
- $[1] = definition.scorecard;
696
- $[2] = embedded;
697
- $[3] = t32;
774
+ let t42;
775
+ if ($[4] !== compact || $[5] !== definition.scorecard || $[6] !== embedded) {
776
+ t42 = /* @__PURE__ */ jsxRuntime.jsx(InsightWidgetSkeleton, { config: definition.scorecard, compact, embedded });
777
+ $[4] = compact;
778
+ $[5] = definition.scorecard;
779
+ $[6] = embedded;
780
+ $[7] = t42;
698
781
  } else {
699
- t32 = $[3];
782
+ t42 = $[7];
700
783
  }
701
- return t32;
784
+ return t42;
702
785
  }
703
786
  if (error) {
704
- const t32 = `text-red-500/70 dark:text-red-400/70 text-[0.8125rem] ${embedded ? "px-5 py-4 h-full" : `rounded-lg bg-red-500/5 dark:bg-red-400/5 border border-red-500/10 dark:border-red-400/10 ${compact ? "px-3.5 py-3" : "px-5 py-4"}`}`;
705
- let t42;
706
- if ($[4] !== definition.title) {
707
- t42 = /* @__PURE__ */ jsxRuntime.jsx("div", { className: "font-semibold mb-1", children: definition.title });
708
- $[4] = definition.title;
709
- $[5] = t42;
710
- } else {
711
- t42 = $[5];
712
- }
713
- let t5;
714
- if ($[6] !== error.message) {
715
- t5 = /* @__PURE__ */ jsxRuntime.jsx("div", { children: error.message });
716
- $[6] = error.message;
717
- $[7] = t5;
787
+ const t42 = `text-red-500/70 dark:text-red-400/70 text-[0.8125rem] ${embedded ? "px-5 py-4 h-full" : `rounded-lg bg-red-500/5 dark:bg-red-400/5 border border-red-500/10 dark:border-red-400/10 ${compact ? "px-3.5 py-3" : "px-5 py-4"}`}`;
788
+ let t52;
789
+ if ($[8] !== definition.title) {
790
+ t52 = /* @__PURE__ */ jsxRuntime.jsx("div", { className: "font-semibold mb-1", children: definition.title });
791
+ $[8] = definition.title;
792
+ $[9] = t52;
718
793
  } else {
719
- t5 = $[7];
794
+ t52 = $[9];
720
795
  }
721
796
  let t6;
722
- if ($[8] !== t32 || $[9] !== t42 || $[10] !== t5) {
723
- t6 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: t32, children: [
724
- t42,
725
- t5
726
- ] });
727
- $[8] = t32;
728
- $[9] = t42;
729
- $[10] = t5;
797
+ if ($[10] !== error.message) {
798
+ t6 = /* @__PURE__ */ jsxRuntime.jsx("div", { children: error.message });
799
+ $[10] = error.message;
730
800
  $[11] = t6;
731
801
  } else {
732
802
  t6 = $[11];
733
803
  }
734
- return t6;
804
+ let t7;
805
+ if ($[12] !== t42 || $[13] !== t52 || $[14] !== t6) {
806
+ t7 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: t42, children: [
807
+ t52,
808
+ t6
809
+ ] });
810
+ $[12] = t42;
811
+ $[13] = t52;
812
+ $[14] = t6;
813
+ $[15] = t7;
814
+ } else {
815
+ t7 = $[15];
816
+ }
817
+ return t7;
735
818
  }
736
819
  if (!data || data.rows.length === 0) {
737
- const t32 = `text-surface-400 dark:text-surface-500 text-[0.8125rem] ${embedded ? "px-5 py-4 h-full" : `rounded-lg bg-surface-100 dark:bg-surface-800 border border-surface-200 dark:border-surface-700 ${compact ? "px-3.5 py-3" : "px-5 py-4"}`}`;
738
- let t42;
739
- if ($[12] !== definition.title || $[13] !== t32) {
740
- t42 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: t32, children: [
820
+ const t42 = `text-surface-400 dark:text-surface-500 text-[0.8125rem] ${embedded ? "px-5 py-4 h-full" : `rounded-lg bg-surface-100 dark:bg-surface-800 border border-surface-200 dark:border-surface-700 ${compact ? "px-3.5 py-3" : "px-5 py-4"}`}`;
821
+ let t52;
822
+ if ($[16] !== definition.title || $[17] !== t42) {
823
+ t52 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: t42, children: [
741
824
  definition.title,
742
825
  " — No data"
743
826
  ] });
744
- $[12] = definition.title;
745
- $[13] = t32;
746
- $[14] = t42;
827
+ $[16] = definition.title;
828
+ $[17] = t42;
829
+ $[18] = t52;
747
830
  } else {
748
- t42 = $[14];
831
+ t52 = $[18];
749
832
  }
750
- return t42;
833
+ return t52;
751
834
  }
752
- const t3 = data.rows[0];
753
- let t4;
754
- if ($[15] !== compact || $[16] !== definition.scorecard || $[17] !== definition.title || $[18] !== embedded || $[19] !== t3) {
755
- t4 = /* @__PURE__ */ jsxRuntime.jsx(InsightsScorecardView, { config: definition.scorecard, data: t3, title: definition.title, compact, embedded });
756
- $[15] = compact;
757
- $[16] = definition.scorecard;
758
- $[17] = definition.title;
759
- $[18] = embedded;
760
- $[19] = t3;
761
- $[20] = t4;
762
- } else {
763
- t4 = $[20];
764
- }
765
- return t4;
835
+ const t4 = data.rows[0];
836
+ let t5;
837
+ if ($[19] !== compact || $[20] !== definition.scorecard || $[21] !== definition.title || $[22] !== embedded || $[23] !== t4) {
838
+ t5 = /* @__PURE__ */ jsxRuntime.jsx(InsightsScorecardView, { config: definition.scorecard, data: t4, title: definition.title, compact, embedded });
839
+ $[19] = compact;
840
+ $[20] = definition.scorecard;
841
+ $[21] = definition.title;
842
+ $[22] = embedded;
843
+ $[23] = t4;
844
+ $[24] = t5;
845
+ } else {
846
+ t5 = $[24];
847
+ }
848
+ return t5;
766
849
  }
767
850
  InsightWidget.displayName = "InsightWidget";
768
851
  function HomeCardInsightSlot(t0) {
769
- const $ = reactCompilerRuntime.c(8);
852
+ const $ = reactCompilerRuntime.c(10);
770
853
  const {
771
854
  slug,
772
855
  insights
@@ -774,39 +857,43 @@
774
857
  if (!insights || insights.length === 0) {
775
858
  return null;
776
859
  }
860
+ const estimatedRows = Math.ceil(insights.length / 2);
861
+ const minHeight = estimatedRows * 42 + (estimatedRows - 1) * 6;
777
862
  let t1;
778
- if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
863
+ if ($[0] !== minHeight) {
779
864
  t1 = {
780
- minHeight: 46
865
+ minHeight
781
866
  };
782
- $[0] = t1;
867
+ $[0] = minHeight;
868
+ $[1] = t1;
783
869
  } else {
784
- t1 = $[0];
870
+ t1 = $[1];
785
871
  }
786
872
  let t2;
787
- if ($[1] !== insights || $[2] !== slug) {
873
+ if ($[2] !== insights || $[3] !== slug) {
788
874
  let t32;
789
- if ($[4] !== slug) {
875
+ if ($[5] !== slug) {
790
876
  t32 = (def) => /* @__PURE__ */ jsxRuntime.jsx(InsightWidget, { definition: def, collectionSlug: slug, compact: true }, def.id);
791
- $[4] = slug;
792
- $[5] = t32;
877
+ $[5] = slug;
878
+ $[6] = t32;
793
879
  } else {
794
- t32 = $[5];
880
+ t32 = $[6];
795
881
  }
796
882
  t2 = insights.map(t32);
797
- $[1] = insights;
798
- $[2] = slug;
799
- $[3] = t2;
883
+ $[2] = insights;
884
+ $[3] = slug;
885
+ $[4] = t2;
800
886
  } else {
801
- t2 = $[3];
887
+ t2 = $[4];
802
888
  }
803
889
  let t3;
804
- if ($[6] !== t2) {
890
+ if ($[7] !== t1 || $[8] !== t2) {
805
891
  t3 = /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap items-center gap-1.5 mt-2", style: t1, children: t2 });
806
- $[6] = t2;
807
- $[7] = t3;
892
+ $[7] = t1;
893
+ $[8] = t2;
894
+ $[9] = t3;
808
895
  } else {
809
- t3 = $[7];
896
+ t3 = $[9];
810
897
  }
811
898
  return t3;
812
899
  }
@@ -830,7 +917,7 @@
830
917
  }
831
918
  let t2;
832
919
  if ($[1] !== insights) {
833
- t2 = insights.map(_temp$1);
920
+ t2 = insights.map(_temp);
834
921
  $[1] = insights;
835
922
  $[2] = t2;
836
923
  } else {
@@ -846,39 +933,52 @@
846
933
  }
847
934
  return t3;
848
935
  }
849
- function _temp$1(def) {
936
+ function _temp(def) {
850
937
  return /* @__PURE__ */ jsxRuntime.jsx(InsightWidget, { definition: def }, def.id);
851
938
  }
852
939
  HomeInsightsSlot.displayName = "HomeInsightsSlot";
853
940
  function CollectionInsightsInline(t0) {
854
- const $ = reactCompilerRuntime.c(4);
941
+ const $ = reactCompilerRuntime.c(11);
855
942
  const {
856
- insights
943
+ insights,
944
+ path,
945
+ parentCollectionSlugs,
946
+ parentEntityIds
857
947
  } = t0;
858
948
  if (!insights || insights.length === 0) {
859
949
  return null;
860
950
  }
861
951
  let t1;
862
- if ($[0] !== insights) {
863
- t1 = insights.map(_temp);
952
+ if ($[0] !== insights || $[1] !== parentCollectionSlugs || $[2] !== parentEntityIds || $[3] !== path) {
953
+ let t22;
954
+ if ($[5] !== parentCollectionSlugs || $[6] !== parentEntityIds || $[7] !== path) {
955
+ t22 = (def) => /* @__PURE__ */ jsxRuntime.jsx(InsightWidget, { definition: def, path, parentCollectionSlugs, parentEntityIds }, def.id);
956
+ $[5] = parentCollectionSlugs;
957
+ $[6] = parentEntityIds;
958
+ $[7] = path;
959
+ $[8] = t22;
960
+ } else {
961
+ t22 = $[8];
962
+ }
963
+ t1 = insights.map(t22);
864
964
  $[0] = insights;
865
- $[1] = t1;
965
+ $[1] = parentCollectionSlugs;
966
+ $[2] = parentEntityIds;
967
+ $[3] = path;
968
+ $[4] = t1;
866
969
  } else {
867
- t1 = $[1];
970
+ t1 = $[4];
868
971
  }
869
972
  let t2;
870
- if ($[2] !== t1) {
973
+ if ($[9] !== t1) {
871
974
  t2 = /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-3 pb-4", children: t1 });
872
- $[2] = t1;
873
- $[3] = t2;
975
+ $[9] = t1;
976
+ $[10] = t2;
874
977
  } else {
875
- t2 = $[3];
978
+ t2 = $[10];
876
979
  }
877
980
  return t2;
878
981
  }
879
- function _temp(def) {
880
- return /* @__PURE__ */ jsxRuntime.jsx(InsightWidget, { definition: def }, def.id);
881
- }
882
982
  CollectionInsightsInline.displayName = "CollectionInsightsInline";
883
983
  function useInsightsPlugin(config) {
884
984
  const {