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.mjs CHANGED
@@ -16500,7 +16500,7 @@ function hideDeckChrome(iframe) {
16500
16500
  style.id = "pxe-embed-chrome";
16501
16501
  (doc.head || doc.documentElement).appendChild(style);
16502
16502
  }
16503
- style.textContent = ".nav,.progress-bar,.dots{display:none!important}";
16503
+ 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}";
16504
16504
  } catch {
16505
16505
  }
16506
16506
  }
@@ -17747,7 +17747,7 @@ var PresentationJobCard = ({
17747
17747
  "iframe",
17748
17748
  {
17749
17749
  ref: iframeRef,
17750
- src: formats.html_url,
17750
+ src: `${formats.html_url}#embedded=1`,
17751
17751
  title,
17752
17752
  sandbox: "allow-same-origin allow-scripts",
17753
17753
  onLoad: () => {
@@ -17813,7 +17813,7 @@ var PresentationJobCard = ({
17813
17813
  showFullscreen && hasHtml && /* @__PURE__ */ jsx152(
17814
17814
  FullscreenModal,
17815
17815
  {
17816
- url: formats.html_url,
17816
+ url: `${formats.html_url}#embedded=1`,
17817
17817
  title,
17818
17818
  slideCount,
17819
17819
  initialSlide: currentSlide,
@@ -18789,7 +18789,7 @@ var ResearchReportJobCard = (props) => {
18789
18789
  };
18790
18790
  const canApprove = !hideApproval && generationMode === "template" && reviewStatus === "pending_review" && Boolean(job_id);
18791
18791
  const canRegenerate = !hideApproval && generationMode === "template" && reviewStatus === "pending_review" && Boolean(job_id);
18792
- const canShare = Boolean(hasHTML || job_id) && (generationMode !== "template" || reviewStatus !== "pending_review");
18792
+ const canShare = Boolean(hasHTML || job_id);
18793
18793
  const handleApprove = async () => {
18794
18794
  if (!job_id || approving) return;
18795
18795
  const endpoint = approveUrl || `/api/reports/${job_id}/approve`;
@@ -18956,7 +18956,7 @@ var ResearchReportJobCard = (props) => {
18956
18956
  ActionIconButton,
18957
18957
  {
18958
18958
  icon: copied ? /* @__PURE__ */ jsx153(CheckIcon, {}) : /* @__PURE__ */ jsx153(ShareIcon, {}),
18959
- label: !canShare && reviewStatus === "pending_review" ? "Approve the report to enable sharing" : copied ? "Copied!" : "Copy shareable link",
18959
+ label: copied ? "Copied!" : "Copy shareable link",
18960
18960
  onClick: handleShare,
18961
18961
  disabled: !canShare,
18962
18962
  active: copied
@@ -23975,6 +23975,17 @@ function highchartsType(type) {
23975
23975
  if (type === "donut") return "pie";
23976
23976
  return type;
23977
23977
  }
23978
+ var DOWNSAMPLE_THRESHOLD = 800;
23979
+ function downsampleSeriesData(data, threshold = DOWNSAMPLE_THRESHOLD) {
23980
+ if (!Array.isArray(data) || data.length <= threshold) return data;
23981
+ if (data.every((p) => typeof p === "number")) return data;
23982
+ const stride = Math.ceil(data.length / threshold);
23983
+ const out = [];
23984
+ for (let i = 0; i < data.length; i += stride) out.push(data[i]);
23985
+ const last = data[data.length - 1];
23986
+ if (out[out.length - 1] !== last) out.push(last);
23987
+ return out;
23988
+ }
23978
23989
  function buildAxis(axis, fallbackCategories) {
23979
23990
  const cfg = {};
23980
23991
  if (!axis) {
@@ -24006,7 +24017,7 @@ function buildChartOptions(config, palette) {
24006
24017
  subtitle: { text: config.subtitle ?? void 0 },
24007
24018
  series: safeSeries.map((s, i) => ({
24008
24019
  name: s.name,
24009
- data: s.data,
24020
+ data: downsampleSeriesData(s.data),
24010
24021
  ...s.type && { type: highchartsType(s.type) },
24011
24022
  ...s.stack && { stack: s.stack },
24012
24023
  ...typeof s.yAxis === "number" && { yAxis: s.yAxis },
@@ -24225,6 +24236,14 @@ function loadHighcharts() {
24225
24236
  });
24226
24237
  return hcLoadPromise;
24227
24238
  }
24239
+ function structuralKey(config) {
24240
+ const type = config?.chart?.type;
24241
+ const xAxis = config?.xAxis;
24242
+ const yAxis = config?.yAxis;
24243
+ const xType = Array.isArray(xAxis) ? xAxis.map((a) => a?.type).join(",") : xAxis?.type;
24244
+ const yCount = Array.isArray(yAxis) ? yAxis.length : yAxis ? 1 : 0;
24245
+ return `${type}|${xType}|${yCount}`;
24246
+ }
24228
24247
  function buildTheme(height) {
24229
24248
  const colors = [1, 2, 3, 4, 5, 6, 7, 8].map((i) => getCSSVar(`--chart-${i}`)).filter(Boolean);
24230
24249
  return {
@@ -24293,6 +24312,7 @@ function AnalyticsChart({
24293
24312
  const [fetchError, setFetchError] = useState24(null);
24294
24313
  const containerRef = useRef16(null);
24295
24314
  const chartRef = useRef16(null);
24315
+ const structuralKeyRef = useRef16(null);
24296
24316
  const declarative = useMemo13(
24297
24317
  () => resolveDeclarativeConfig({
24298
24318
  chartConfig,
@@ -24362,8 +24382,17 @@ function AnalyticsChart({
24362
24382
  if (!mounted || !activeConfig || !containerRef.current) return;
24363
24383
  const container = containerRef.current;
24364
24384
  let cancelled = false;
24385
+ const nextConfig = normalizeConfig(stripNulls(activeConfig));
24386
+ const nextKey = structuralKey(nextConfig);
24365
24387
  loadHighcharts().then((HC) => {
24366
24388
  if (cancelled || !container) return;
24389
+ if (chartRef.current && structuralKeyRef.current === nextKey) {
24390
+ try {
24391
+ chartRef.current.update(nextConfig, true, true);
24392
+ return;
24393
+ } catch {
24394
+ }
24395
+ }
24367
24396
  if (chartRef.current) {
24368
24397
  try {
24369
24398
  chartRef.current.destroy();
@@ -24372,7 +24401,8 @@ function AnalyticsChart({
24372
24401
  chartRef.current = null;
24373
24402
  }
24374
24403
  HC.setOptions(buildTheme(height));
24375
- chartRef.current = HC.chart(container, normalizeConfig(stripNulls(activeConfig)));
24404
+ chartRef.current = HC.chart(container, nextConfig);
24405
+ structuralKeyRef.current = nextKey;
24376
24406
  });
24377
24407
  return () => {
24378
24408
  cancelled = true;