@pdfme/ui 5.3.13 → 5.3.14

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.
@@ -1,5 +1,8 @@
1
1
  import { PreviewProps } from '@pdfme/common';
2
2
  import { PreviewUI } from './class.js';
3
+ /**
4
+ * @deprecated This component will be removed in a future version. Consider using an alternative solution.
5
+ */
3
6
  declare class Viewer extends PreviewUI {
4
7
  constructor(props: PreviewProps);
5
8
  protected render(): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pdfme/ui",
3
- "version": "5.3.13",
3
+ "version": "5.3.14",
4
4
  "sideEffects": false,
5
5
  "author": "hand-dot",
6
6
  "license": "MIT",
@@ -38,20 +38,22 @@
38
38
  "dependencies": {
39
39
  "@dnd-kit/core": "^6.0.8",
40
40
  "@dnd-kit/sortable": "^10.0.0",
41
- "@pdfme/converter": "file:../converter",
41
+ "@pdfme/converter": "*",
42
42
  "@scena/react-guides": "^0.28.2",
43
- "antd": "^5.24.2",
43
+ "antd": "^5.24.4",
44
44
  "form-render": "^2.2.16",
45
+ "globrex": "^0.1.2",
45
46
  "hotkeys-js": "^3.8.7",
46
- "lucide-react": "^0.460.0",
47
+ "lucide-react": "^0.482.0",
47
48
  "react": "^16.14.0",
48
49
  "react-dom": "^16.14.0",
49
50
  "react-moveable": "^0.56.0",
51
+ "react-refresh": "^0.16.0",
50
52
  "react-selecto": "^1.12.0"
51
53
  },
52
54
  "devDependencies": {
53
- "@pdfme/common": "file:../common",
54
- "@pdfme/schemas": "file:../schemas",
55
+ "@pdfme/common": "*",
56
+ "@pdfme/schemas": "*",
55
57
  "@testing-library/jest-dom": "^6.6.3",
56
58
  "@testing-library/react": "^12.1.2",
57
59
  "@types/jest": "^29.5.14",
@@ -60,14 +62,16 @@
60
62
  "@ungap/structured-clone": "^1.3.0",
61
63
  "@vitejs/plugin-react": "^4.2.0",
62
64
  "csstype": "^3.1.2",
63
- "esbuild": "^0.25.0",
65
+ "esbuild": "^0.25.1",
64
66
  "eslint-plugin-react": "^7.37.4",
65
67
  "eslint-plugin-react-hooks": "^5.2.0",
66
68
  "is-path-inside": "^4.0.0",
67
69
  "jest-canvas-mock": "^2.3.1",
68
70
  "jest-environment-jsdom": "^29.7.0",
71
+ "postcss": "^8.5.3",
69
72
  "process": "^0.11.10",
70
- "vite": "^6.2.0",
73
+ "rollup": "^4.36.0",
74
+ "vite": "^6.2.1",
71
75
  "vite-plugin-css-injected-by-js": "^3.3.0",
72
76
  "vite-tsconfig-paths": "^5.1.4"
73
77
  },
package/src/Viewer.tsx CHANGED
@@ -6,9 +6,13 @@ import { DESTROYED_ERR_MSG } from './constants.js';
6
6
  import Preview from './components/Preview.js';
7
7
  import AppContextProvider from './components/AppContextProvider.js';
8
8
 
9
+ /**
10
+ * @deprecated This component will be removed in a future version. Consider using an alternative solution.
11
+ */
9
12
  class Viewer extends PreviewUI {
10
13
  constructor(props: PreviewProps) {
11
14
  super(props);
15
+ console.warn('[@pdfme/ui] Viewer component is deprecated and will be removed in a future version.');
12
16
  }
13
17
 
14
18
  protected render() {
@@ -1,4 +1,4 @@
1
- import React, { useEffect, forwardRef, Ref } from 'react';
1
+ import React, { useEffect, forwardRef, Ref, useRef } from 'react';
2
2
  import MoveableComponent, {
3
3
  OnDrag,
4
4
  OnRotate,
@@ -6,6 +6,7 @@ import MoveableComponent, {
6
6
  OnClick,
7
7
  OnResize,
8
8
  } from 'react-moveable';
9
+ import { uuid } from '../../../helper.js'
9
10
  import { theme } from 'antd';
10
11
 
11
12
  type Props = {
@@ -27,26 +28,29 @@ type Props = {
27
28
  onClick: (e: OnClick) => void;
28
29
  };
29
30
 
30
- const className = 'pdfme-moveable';
31
+ const baseClassName = 'pdfme-moveable';
31
32
 
32
33
  const Moveable = (props: Props, ref: Ref<MoveableComponent>) => {
33
34
  const { token } = theme.useToken();
35
+ const instanceId = useRef(uuid());
36
+ const uniqueClassName = `${baseClassName}-${instanceId.current}`;
37
+
34
38
  useEffect(() => {
35
- const containerElement = document.querySelector(`.${className}`);
36
- const containerElement2 = document.querySelectorAll(`.${className} .moveable-line`);
39
+ const containerElement = document.querySelector(`.${uniqueClassName}`);
40
+ const moveableLines = document.querySelectorAll(`.${uniqueClassName} .moveable-line`);
37
41
  if (containerElement instanceof HTMLElement) {
38
42
  containerElement.style.setProperty('--moveable-color', token.colorPrimary);
39
- Array.from(containerElement2).forEach((e) => {
43
+ moveableLines.forEach((e) => {
40
44
  if (e instanceof HTMLElement) {
41
45
  e.style.setProperty('--moveable-color', token.colorPrimary);
42
46
  }
43
47
  });
44
48
  }
45
- }, [props.target, token.colorPrimary]);
49
+ }, [props.target, token.colorPrimary, uniqueClassName]);
46
50
 
47
51
  return (
48
52
  <MoveableComponent
49
- className={className}
53
+ className={uniqueClassName}
50
54
  rootContainer={document ? document.body : undefined}
51
55
  snappable
52
56
  draggable