pxengine 0.1.144 → 0.1.146

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/index.cjs CHANGED
@@ -16843,7 +16843,7 @@ function hideDeckChrome(iframe) {
16843
16843
  style.id = "pxe-embed-chrome";
16844
16844
  (doc.head || doc.documentElement).appendChild(style);
16845
16845
  }
16846
- style.textContent = ".nav,.progress-bar,.dots{display:none!important}";
16846
+ style.textContent = "body>nav,body>.progress-bar,body>[class*='nav' i],body>[class*='pagination' i],body>[class*='slide-counter' i],body>[class*='dots' i]{display:none!important}";
16847
16847
  } catch {
16848
16848
  }
16849
16849
  }
@@ -18090,7 +18090,7 @@ var PresentationJobCard = ({
18090
18090
  "iframe",
18091
18091
  {
18092
18092
  ref: iframeRef,
18093
- src: formats.html_url,
18093
+ src: `${formats.html_url}#embedded=1`,
18094
18094
  title,
18095
18095
  sandbox: "allow-same-origin allow-scripts",
18096
18096
  onLoad: () => {
@@ -18156,7 +18156,7 @@ var PresentationJobCard = ({
18156
18156
  showFullscreen && hasHtml && /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
18157
18157
  FullscreenModal,
18158
18158
  {
18159
- url: formats.html_url,
18159
+ url: `${formats.html_url}#embedded=1`,
18160
18160
  title,
18161
18161
  slideCount,
18162
18162
  initialSlide: currentSlide,
@@ -19132,7 +19132,7 @@ var ResearchReportJobCard = (props) => {
19132
19132
  };
19133
19133
  const canApprove = !hideApproval && generationMode === "template" && reviewStatus === "pending_review" && Boolean(job_id);
19134
19134
  const canRegenerate = !hideApproval && generationMode === "template" && reviewStatus === "pending_review" && Boolean(job_id);
19135
- const canShare = Boolean(hasHTML || job_id) && (generationMode !== "template" || reviewStatus !== "pending_review");
19135
+ const canShare = Boolean(hasHTML || job_id);
19136
19136
  const handleApprove = async () => {
19137
19137
  if (!job_id || approving) return;
19138
19138
  const endpoint = approveUrl || `/api/reports/${job_id}/approve`;
@@ -19299,7 +19299,7 @@ var ResearchReportJobCard = (props) => {
19299
19299
  ActionIconButton,
19300
19300
  {
19301
19301
  icon: copied ? /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(CheckIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(ShareIcon, {}),
19302
- label: !canShare && reviewStatus === "pending_review" ? "Approve the report to enable sharing" : copied ? "Copied!" : "Copy shareable link",
19302
+ label: copied ? "Copied!" : "Copy shareable link",
19303
19303
  onClick: handleShare,
19304
19304
  disabled: !canShare,
19305
19305
  active: copied
@@ -24318,6 +24318,17 @@ function highchartsType(type) {
24318
24318
  if (type === "donut") return "pie";
24319
24319
  return type;
24320
24320
  }
24321
+ var DOWNSAMPLE_THRESHOLD = 800;
24322
+ function downsampleSeriesData(data, threshold = DOWNSAMPLE_THRESHOLD) {
24323
+ if (!Array.isArray(data) || data.length <= threshold) return data;
24324
+ if (data.every((p) => typeof p === "number")) return data;
24325
+ const stride = Math.ceil(data.length / threshold);
24326
+ const out = [];
24327
+ for (let i = 0; i < data.length; i += stride) out.push(data[i]);
24328
+ const last = data[data.length - 1];
24329
+ if (out[out.length - 1] !== last) out.push(last);
24330
+ return out;
24331
+ }
24321
24332
  function buildAxis(axis, fallbackCategories) {
24322
24333
  const cfg = {};
24323
24334
  if (!axis) {
@@ -24349,7 +24360,7 @@ function buildChartOptions(config, palette) {
24349
24360
  subtitle: { text: config.subtitle ?? void 0 },
24350
24361
  series: safeSeries.map((s, i) => ({
24351
24362
  name: s.name,
24352
- data: s.data,
24363
+ data: downsampleSeriesData(s.data),
24353
24364
  ...s.type && { type: highchartsType(s.type) },
24354
24365
  ...s.stack && { stack: s.stack },
24355
24366
  ...typeof s.yAxis === "number" && { yAxis: s.yAxis },
@@ -24568,6 +24579,14 @@ function loadHighcharts() {
24568
24579
  });
24569
24580
  return hcLoadPromise;
24570
24581
  }
24582
+ function structuralKey(config) {
24583
+ const type = config?.chart?.type;
24584
+ const xAxis = config?.xAxis;
24585
+ const yAxis = config?.yAxis;
24586
+ const xType = Array.isArray(xAxis) ? xAxis.map((a) => a?.type).join(",") : xAxis?.type;
24587
+ const yCount = Array.isArray(yAxis) ? yAxis.length : yAxis ? 1 : 0;
24588
+ return `${type}|${xType}|${yCount}`;
24589
+ }
24571
24590
  function buildTheme(height) {
24572
24591
  const colors = [1, 2, 3, 4, 5, 6, 7, 8].map((i) => getCSSVar(`--chart-${i}`)).filter(Boolean);
24573
24592
  return {
@@ -24636,6 +24655,7 @@ function AnalyticsChart({
24636
24655
  const [fetchError, setFetchError] = (0, import_react99.useState)(null);
24637
24656
  const containerRef = (0, import_react99.useRef)(null);
24638
24657
  const chartRef = (0, import_react99.useRef)(null);
24658
+ const structuralKeyRef = (0, import_react99.useRef)(null);
24639
24659
  const declarative = (0, import_react99.useMemo)(
24640
24660
  () => resolveDeclarativeConfig({
24641
24661
  chartConfig,
@@ -24705,8 +24725,17 @@ function AnalyticsChart({
24705
24725
  if (!mounted || !activeConfig || !containerRef.current) return;
24706
24726
  const container = containerRef.current;
24707
24727
  let cancelled = false;
24728
+ const nextConfig = normalizeConfig(stripNulls(activeConfig));
24729
+ const nextKey = structuralKey(nextConfig);
24708
24730
  loadHighcharts().then((HC) => {
24709
24731
  if (cancelled || !container) return;
24732
+ if (chartRef.current && structuralKeyRef.current === nextKey) {
24733
+ try {
24734
+ chartRef.current.update(nextConfig, true, true);
24735
+ return;
24736
+ } catch {
24737
+ }
24738
+ }
24710
24739
  if (chartRef.current) {
24711
24740
  try {
24712
24741
  chartRef.current.destroy();
@@ -24715,7 +24744,8 @@ function AnalyticsChart({
24715
24744
  chartRef.current = null;
24716
24745
  }
24717
24746
  HC.setOptions(buildTheme(height));
24718
- chartRef.current = HC.chart(container, normalizeConfig(stripNulls(activeConfig)));
24747
+ chartRef.current = HC.chart(container, nextConfig);
24748
+ structuralKeyRef.current = nextKey;
24719
24749
  });
24720
24750
  return () => {
24721
24751
  cancelled = true;