@ocelescope/resources 0.1.2 → 0.1.3

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 (2) hide show
  1. package/dist/index.js +7 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -2,10 +2,10 @@ import { ActionIcon, Alert, Badge, Box, Button, ButtonGroup, Code, Group, Loadin
2
2
  import { useResource, useResources } from "@ocelescope/api-base";
3
3
  import { DownloadIcon, EyeOffIcon, Maximize2Icon, MaximizeIcon, MinusIcon, PlusIcon, XIcon } from "lucide-react";
4
4
  import { Graphviz } from "@hpcc-js/wasm-graphviz";
5
- import { saveAs } from "file-saver";
5
+ import FileSaver from "file-saver";
6
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
7
  import { memo, useCallback, useEffect, useMemo, useRef, useState } from "react";
7
8
  import { TransformComponent, TransformWrapper } from "react-zoom-pan-pinch";
8
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
9
9
  import { Background, BaseEdge, ControlButton, Controls, EdgeLabelRenderer, Handle, Position, ReactFlow, ReactFlowProvider, applyNodeChanges, getBezierPath, getSmoothStepPath, useInternalNode, useNodes, useNodesInitialized, useReactFlow } from "@xyflow/react";
10
10
  import ELK from "elkjs/lib/elk.bundled.js";
11
11
  import { toPng, toSvg } from "html-to-image";
@@ -15,6 +15,7 @@ import { DataTable } from "mantine-datatable";
15
15
  import dayjs from "dayjs";
16
16
  import isBetween from "dayjs/plugin/isBetween.js";
17
17
  //#region src/components/ResourceView/Viewers/SVG.tsx
18
+ const { saveAs: saveAs$2 } = FileSaver;
18
19
  const SvgPanWrapper = ({ children, onDownload }) => {
19
20
  return /* @__PURE__ */ jsx(Box, {
20
21
  w: "100%",
@@ -69,7 +70,7 @@ const SvgViewer = ({ visualization, isPreview }) => {
69
70
  const cleanedSvg = visualization.svg.replace(/width="[^"]+"/, "width=\"100%\"").replace(/height="[^"]+"/, "height=\"100%\"").replace(/<svg(?![^>]*xmlns=)/, "<svg xmlns=\"http://www.w3.org/2000/svg\"");
70
71
  const handleDownload = () => {
71
72
  if (!cleanedSvg) return;
72
- saveAs(new Blob([cleanedSvg], { type: "image/svg+xml;charset=utf-8" }), "resource.svg");
73
+ saveAs$2(new Blob([cleanedSvg], { type: "image/svg+xml;charset=utf-8" }), "resource.svg");
73
74
  };
74
75
  const content = /* @__PURE__ */ jsx("div", {
75
76
  style: {
@@ -86,6 +87,7 @@ const SvgViewer = ({ visualization, isPreview }) => {
86
87
  };
87
88
  //#endregion
88
89
  //#region src/components/ResourceView/Viewers/Dot.tsx
90
+ const { saveAs: saveAs$1 } = FileSaver;
89
91
  const DotToSvgViewer = ({ isPreview, visualization }) => {
90
92
  const [svg, setSvg] = useState(null);
91
93
  const [error, setError] = useState(null);
@@ -114,7 +116,7 @@ const DotToSvgViewer = ({ isPreview, visualization }) => {
114
116
  }, [svg]);
115
117
  const handleDownload = () => {
116
118
  if (!cleanedSvg) return;
117
- saveAs(new Blob([cleanedSvg], { type: "image/svg+xml;charset=utf-8" }), "resource.svg");
119
+ saveAs$1(new Blob([cleanedSvg], { type: "image/svg+xml;charset=utf-8" }), "resource.svg");
118
120
  };
119
121
  const content = /* @__PURE__ */ jsxs("div", {
120
122
  style: {
@@ -1538,6 +1540,7 @@ function getContentBounds(nodes, viewportEl, getNodesBounds) {
1538
1540
  }
1539
1541
  //#endregion
1540
1542
  //#region src/components/ResourceView/Viewers/GraphFlow/utils/download.ts
1543
+ const { saveAs } = FileSaver;
1541
1544
  const MAX_PX = 2048;
1542
1545
  const EXPORT_PADDING = .05;
1543
1546
  function buildCaptureOptions(imageWidth, imageHeight, x, y, zoom) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ocelescope/resources",
3
3
  "type": "module",
4
- "version": "0.1.2",
4
+ "version": "0.1.3",
5
5
  "description": "Ocelescope resources: helpers and UI components for rendering and exporting data.",
6
6
  "author": "Görkem-Emre Öztürk <goerkem.oeztuerk@rwth-aachen.de>",
7
7
  "license": "MIT",