@pdfme/ui 5.4.0-dev.6 → 5.4.0-dev.65

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pdfme/ui",
3
- "version": "5.4.0-dev.6",
3
+ "version": "5.4.0-dev.65",
4
4
  "sideEffects": false,
5
5
  "author": "hand-dot",
6
6
  "license": "MIT",
@@ -40,11 +40,11 @@
40
40
  "@dnd-kit/sortable": "^10.0.0",
41
41
  "@pdfme/converter": "*",
42
42
  "@scena/react-guides": "^0.28.2",
43
- "antd": "^5.25.0",
44
- "form-render": "^2.2.16",
43
+ "antd": "^5.25.4",
44
+ "form-render": "^2.5.3",
45
45
  "globrex": "^0.1.2",
46
- "hotkeys-js": "^3.13.10",
47
- "lucide-react": "^0.508.0",
46
+ "hotkeys-js": "^3.13.14",
47
+ "lucide-react": "^0.525.0",
48
48
  "react": "^16.14.0",
49
49
  "react-dom": "^16.14.0",
50
50
  "react-moveable": "^0.56.0",
@@ -56,11 +56,11 @@
56
56
  "@pdfme/schemas": "*",
57
57
  "@testing-library/jest-dom": "^6.6.3",
58
58
  "@testing-library/react": "^12.1.2",
59
- "@types/jest": "^29.5.14",
59
+ "@types/jest": "^30.0.0",
60
60
  "@types/react": "^17.0.52",
61
61
  "@types/react-dom": "^17.0.18",
62
62
  "@ungap/structured-clone": "^1.3.0",
63
- "@vitejs/plugin-react": "^4.4.1",
63
+ "@vitejs/plugin-react": "^4.6.0",
64
64
  "csstype": "^3.1.2",
65
65
  "esbuild": "^0.25.5",
66
66
  "eslint-plugin-react": "^7.37.5",
@@ -68,10 +68,10 @@
68
68
  "is-path-inside": "^4.0.0",
69
69
  "jest-canvas-mock": "^2.3.1",
70
70
  "jest-environment-jsdom": "^29.7.0",
71
- "postcss": "^8.5.4",
71
+ "postcss": "^8.5.6",
72
72
  "process": "^0.11.10",
73
- "rollup": "^4.40.2",
74
- "vite": "^6.3.5",
73
+ "rollup": "^4.44.1",
74
+ "vite": "^7.0.0",
75
75
  "vite-plugin-css-injected-by-js": "^3.3.0",
76
76
  "vite-tsconfig-paths": "^5.1.4"
77
77
  },
package/src/Viewer.tsx CHANGED
@@ -9,7 +9,9 @@ import AppContextProvider from './components/AppContextProvider.js';
9
9
  class Viewer extends PreviewUI {
10
10
  constructor(props: PreviewProps) {
11
11
  super(props);
12
- console.warn('[@pdfme/ui] Viewer component is deprecated and will be removed in a future version.');
12
+ console.warn(
13
+ '[@pdfme/ui] Viewer component is deprecated and will be removed in a future version.',
14
+ );
13
15
  }
14
16
 
15
17
  protected render() {
@@ -6,7 +6,7 @@ import MoveableComponent, {
6
6
  OnClick,
7
7
  OnResize,
8
8
  } from 'react-moveable';
9
- import { uuid } from '../../../helper.js'
9
+ import { uuid } from '../../../helper.js';
10
10
  import { theme } from 'antd';
11
11
 
12
12
  type Props = {
@@ -508,20 +508,21 @@ const Canvas = (props: Props, ref: Ref<HTMLDivElement>) => {
508
508
  onChange={
509
509
  (schemasList[pageCursor] || []).some((s) => s.id === schema.id)
510
510
  ? (arg) => {
511
- // Use type assertion to safely handle the argument
512
- type ChangeArg = { key: string; value: unknown };
513
- const args = Array.isArray(arg) ? (arg as ChangeArg[]) : [arg as ChangeArg];
514
- changeSchemas(
515
- args.map(({ key, value }) => ({ key, value, schemaId: schema.id })),
516
- );
517
- }
511
+ // Use type assertion to safely handle the argument
512
+ type ChangeArg = { key: string; value: unknown };
513
+ const args = Array.isArray(arg) ? (arg as ChangeArg[]) : [arg as ChangeArg];
514
+ changeSchemas(
515
+ args.map(({ key, value }) => ({ key, value, schemaId: schema.id })),
516
+ );
517
+ }
518
518
  : undefined
519
519
  }
520
520
  stopEditing={() => setEditing(false)}
521
- outline={`1px ${hoveringSchemaId === schema.id ? 'solid' : 'dashed'} ${schema.readOnly && hoveringSchemaId !== schema.id
521
+ outline={`1px ${hoveringSchemaId === schema.id ? 'solid' : 'dashed'} ${
522
+ schema.readOnly && hoveringSchemaId !== schema.id
522
523
  ? 'transparent'
523
524
  : token.colorPrimary
524
- }`}
525
+ }`}
525
526
  scale={scale}
526
527
  />
527
528
  );
@@ -27,21 +27,24 @@ const Draggable = (props: {
27
27
  const { listeners, setNodeRef, attributes, transform, isDragging } = draggable;
28
28
  const style = { transform: CSS.Translate.toString(transform) };
29
29
 
30
- const renderedSchema = React.useMemo(() => (
31
- <div style={{ transform: `scale(${scale})` }}>
32
- <Renderer
33
- schema={{ ...defaultSchema, id: defaultSchema.type }}
34
- basePdf={basePdf}
35
- value={defaultSchema.content || ''}
36
- onChangeHoveringSchemaId={() => {
37
- void 0;
38
- }}
39
- mode={'viewer'}
40
- outline={`1px solid ${token.colorPrimary}`}
41
- scale={scale}
42
- />
43
- </div>
44
- ), [defaultSchema, basePdf, scale, token.colorPrimary]);
30
+ const renderedSchema = React.useMemo(
31
+ () => (
32
+ <div style={{ transform: `scale(${scale})` }}>
33
+ <Renderer
34
+ schema={{ ...defaultSchema, id: defaultSchema.type }}
35
+ basePdf={basePdf}
36
+ value={defaultSchema.content || ''}
37
+ onChangeHoveringSchemaId={() => {
38
+ void 0;
39
+ }}
40
+ mode={'viewer'}
41
+ outline={`1px solid ${token.colorPrimary}`}
42
+ scale={scale}
43
+ />
44
+ </div>
45
+ ),
46
+ [defaultSchema, basePdf, scale, token.colorPrimary],
47
+ );
45
48
 
46
49
  return (
47
50
  <div ref={setNodeRef} style={style} {...listeners} {...attributes}>
@@ -25,11 +25,15 @@ const StaticSchema = (props: {
25
25
  key={schema.name}
26
26
  schema={{ ...schema, id: uuid() }}
27
27
  basePdf={basePdf}
28
- value={schema.readOnly ? replacePlaceholders({
29
- content: schema.content || '',
30
- variables: { ...input, totalPages, currentPage },
31
- schemas,
32
- }) : schema.content || ''}
28
+ value={
29
+ schema.readOnly
30
+ ? replacePlaceholders({
31
+ content: schema.content || '',
32
+ variables: { ...input, totalPages, currentPage },
33
+ schemas,
34
+ })
35
+ : schema.content || ''
36
+ }
33
37
  onChangeHoveringSchemaId={() => {
34
38
  void 0;
35
39
  }}
package/src/helper.ts CHANGED
@@ -526,7 +526,11 @@ export const setFontNameRecursively = (
526
526
  seen.add(obj);
527
527
 
528
528
  for (const key in obj) {
529
- if (key === 'fontName' && Object.prototype.hasOwnProperty.call(obj, key) && obj[key] === undefined) {
529
+ if (
530
+ key === 'fontName' &&
531
+ Object.prototype.hasOwnProperty.call(obj, key) &&
532
+ obj[key] === undefined
533
+ ) {
530
534
  obj[key] = fontName;
531
535
  } else if (typeof obj[key] === 'object' && obj[key] !== null) {
532
536
  setFontNameRecursively(obj[key] as Record<string, unknown>, fontName, seen);