@pdfme/ui 5.5.10-dev.13 → 5.5.10-dev.135
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/README.md +3 -1
- package/__mocks__/converter.ts +3 -0
- package/__mocks__/form-render.js +3 -3
- package/__mocks__/form-render.ts +18 -0
- package/__mocks__/lucide-react.ts +15 -0
- package/package.json +39 -86
- package/src/Designer.tsx +1 -3
- package/src/Form.tsx +1 -3
- package/src/Viewer.tsx +1 -3
- package/src/class.ts +17 -6
- package/src/components/CtlBar.tsx +7 -2
- package/src/components/Designer/PluginIcon.tsx +64 -16
- package/src/components/Designer/RightSidebar/DetailView/AlignWidget.tsx +1 -2
- package/src/components/Designer/RightSidebar/DetailView/WidgetRenderer.tsx +8 -7
- package/src/components/Designer/RightSidebar/DetailView/index.tsx +15 -17
- package/src/components/Designer/RightSidebar/ListView/Item.tsx +3 -5
- package/src/components/Designer/index.tsx +28 -17
- package/src/components/Preview.tsx +40 -14
- package/src/components/Renderer.tsx +73 -27
- package/src/components/Root.tsx +8 -2
- package/src/contexts.ts +1 -1
- package/src/helper.ts +1 -1
- package/src/hooks.ts +102 -67
- package/tsconfig.build.json +15 -0
- package/tsconfig.json +5 -40
- package/tsconfig.typecheck.json +19 -0
- package/vite.config.mts +46 -5
- package/vitest.setup.ts +47 -0
- package/dist/index.es.js +0 -159737
- package/dist/index.umd.js +0 -1060
- package/dist/types/__tests__/assets/helper.d.ts +0 -3
- package/dist/types/__tests__/components/Designer.test.d.ts +0 -1
- package/dist/types/__tests__/components/PluginIcon.test.d.ts +0 -1
- package/dist/types/__tests__/components/Preview.test.d.ts +0 -1
- package/dist/types/__tests__/helper.test.d.ts +0 -1
- package/dist/types/src/Designer.d.ts +0 -21
- package/dist/types/src/Form.d.ts +0 -24
- package/dist/types/src/Viewer.d.ts +0 -15
- package/dist/types/src/class.d.ts +0 -89
- package/dist/types/src/components/AppContextProvider.d.ts +0 -11
- package/dist/types/src/components/CtlBar.d.ts +0 -14
- package/dist/types/src/components/Designer/Canvas/Guides.d.ts +0 -9
- package/dist/types/src/components/Designer/Canvas/Mask.d.ts +0 -4
- package/dist/types/src/components/Designer/Canvas/Moveable.d.ts +0 -37
- package/dist/types/src/components/Designer/Canvas/Padding.d.ts +0 -6
- package/dist/types/src/components/Designer/Canvas/Selecto.d.ts +0 -10
- package/dist/types/src/components/Designer/Canvas/index.d.ts +0 -22
- package/dist/types/src/components/Designer/LeftSidebar.d.ts +0 -8
- package/dist/types/src/components/Designer/PluginIcon.d.ts +0 -10
- package/dist/types/src/components/Designer/RightSidebar/DetailView/AlignWidget.d.ts +0 -4
- package/dist/types/src/components/Designer/RightSidebar/DetailView/ButtonGroupWidget.d.ts +0 -4
- package/dist/types/src/components/Designer/RightSidebar/DetailView/WidgetRenderer.d.ts +0 -7
- package/dist/types/src/components/Designer/RightSidebar/DetailView/index.d.ts +0 -8
- package/dist/types/src/components/Designer/RightSidebar/ListView/Item.d.ts +0 -45
- package/dist/types/src/components/Designer/RightSidebar/ListView/SelectableSortableContainer.d.ts +0 -4
- package/dist/types/src/components/Designer/RightSidebar/ListView/SelectableSortableItem.d.ts +0 -14
- package/dist/types/src/components/Designer/RightSidebar/ListView/index.d.ts +0 -4
- package/dist/types/src/components/Designer/RightSidebar/index.d.ts +0 -4
- package/dist/types/src/components/Designer/RightSidebar/layout.d.ts +0 -15
- package/dist/types/src/components/Designer/index.d.ts +0 -11
- package/dist/types/src/components/ErrorScreen.d.ts +0 -7
- package/dist/types/src/components/Paper.d.ts +0 -20
- package/dist/types/src/components/Preview.d.ts +0 -15
- package/dist/types/src/components/Renderer.d.ts +0 -13
- package/dist/types/src/components/Root.d.ts +0 -9
- package/dist/types/src/components/Spinner.d.ts +0 -3
- package/dist/types/src/components/StaticSchema.d.ts +0 -10
- package/dist/types/src/components/UnitPager.d.ts +0 -10
- package/dist/types/src/constants.d.ts +0 -11
- package/dist/types/src/contexts.d.ts +0 -10
- package/dist/types/src/helper.d.ts +0 -73
- package/dist/types/src/hooks.d.ts +0 -46
- package/dist/types/src/i18n.d.ts +0 -3
- package/dist/types/src/index.d.ts +0 -4
- package/dist/types/src/theme.d.ts +0 -2
- package/dist/types/src/types.d.ts +0 -19
- package/eslint.config.mjs +0 -41
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { Template, BasePdf, SchemaForUI, Size, PluginRegistry } from '@pdfme/common';
|
|
2
|
-
export declare const uuid: () => string;
|
|
3
|
-
export declare const debounce: <T extends (...args: unknown[]) => unknown>(cb: T, wait?: number) => T;
|
|
4
|
-
export declare const round: (number: number, precision: number) => number;
|
|
5
|
-
export declare const flatten: <T>(arr: T[][]) => T[];
|
|
6
|
-
export declare const initShortCuts: (arg: {
|
|
7
|
-
move: (command: "up" | "down" | "left" | "right", isShift: boolean) => void;
|
|
8
|
-
remove: () => void;
|
|
9
|
-
esc: () => void;
|
|
10
|
-
copy: () => void;
|
|
11
|
-
paste: () => void;
|
|
12
|
-
redo: () => void;
|
|
13
|
-
undo: () => void;
|
|
14
|
-
save: () => void;
|
|
15
|
-
selectAll: () => void;
|
|
16
|
-
}) => void;
|
|
17
|
-
export declare const destroyShortCuts: () => void;
|
|
18
|
-
export declare const arrayBufferToBase64: (arrayBuffer: ArrayBuffer) => string;
|
|
19
|
-
export declare const template2SchemasList: (_template: Template) => Promise<{
|
|
20
|
-
name: string;
|
|
21
|
-
type: string;
|
|
22
|
-
position: {
|
|
23
|
-
x: number;
|
|
24
|
-
y: number;
|
|
25
|
-
};
|
|
26
|
-
width: number;
|
|
27
|
-
height: number;
|
|
28
|
-
id: string;
|
|
29
|
-
content?: string | undefined;
|
|
30
|
-
rotate?: number | undefined;
|
|
31
|
-
opacity?: number | undefined;
|
|
32
|
-
readOnly?: boolean | undefined;
|
|
33
|
-
required?: boolean | undefined;
|
|
34
|
-
__bodyRange?: {
|
|
35
|
-
start: number;
|
|
36
|
-
end?: number | undefined;
|
|
37
|
-
} | undefined;
|
|
38
|
-
__isSplit?: boolean | undefined;
|
|
39
|
-
}[][]>;
|
|
40
|
-
export declare const schemasList2template: (schemasList: SchemaForUI[][], basePdf: BasePdf) => Template;
|
|
41
|
-
export declare const getUniqueSchemaName: (arg: {
|
|
42
|
-
copiedSchemaName: string;
|
|
43
|
-
schema: SchemaForUI[];
|
|
44
|
-
stackUniqueSchemaNames: string[];
|
|
45
|
-
}) => string;
|
|
46
|
-
export declare const moveCommandToChangeSchemasArg: (props: {
|
|
47
|
-
command: "up" | "down" | "left" | "right";
|
|
48
|
-
activeSchemas: SchemaForUI[];
|
|
49
|
-
isShift: boolean;
|
|
50
|
-
pageSize: Size;
|
|
51
|
-
}) => {
|
|
52
|
-
key: string;
|
|
53
|
-
value: number;
|
|
54
|
-
schemaId: string;
|
|
55
|
-
}[];
|
|
56
|
-
export declare const getPagesScrollTopByIndex: (pageSizes: Size[], index: number, scale: number) => number;
|
|
57
|
-
export declare const changeSchemas: (args: {
|
|
58
|
-
objs: {
|
|
59
|
-
key: string;
|
|
60
|
-
value: unknown;
|
|
61
|
-
schemaId: string;
|
|
62
|
-
}[];
|
|
63
|
-
schemas: SchemaForUI[];
|
|
64
|
-
basePdf: BasePdf;
|
|
65
|
-
pluginsRegistry: PluginRegistry;
|
|
66
|
-
pageSize: {
|
|
67
|
-
width: number;
|
|
68
|
-
height: number;
|
|
69
|
-
};
|
|
70
|
-
commitSchemas: (newSchemas: SchemaForUI[]) => void;
|
|
71
|
-
}) => void;
|
|
72
|
-
export declare const useMaxZoom: () => number;
|
|
73
|
-
export declare const setFontNameRecursively: (obj: Record<string, unknown>, fontName: string, seen?: WeakSet<WeakKey>) => void;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { RefObject } from 'react';
|
|
2
|
-
import { Template, Size, SchemaForUI, ChangeSchemas } from '@pdfme/common';
|
|
3
|
-
export declare const usePrevious: <T>(value: T) => T | null;
|
|
4
|
-
type UIPreProcessorProps = {
|
|
5
|
-
template: Template;
|
|
6
|
-
size: Size;
|
|
7
|
-
zoomLevel: number;
|
|
8
|
-
maxZoom: number;
|
|
9
|
-
};
|
|
10
|
-
export declare const useUIPreProcessor: ({ template, size, zoomLevel, maxZoom }: UIPreProcessorProps) => {
|
|
11
|
-
backgrounds: string[];
|
|
12
|
-
pageSizes: {
|
|
13
|
-
height: number;
|
|
14
|
-
width: number;
|
|
15
|
-
}[];
|
|
16
|
-
scale: number;
|
|
17
|
-
error: Error | null;
|
|
18
|
-
refresh: (template: Template) => Promise<void>;
|
|
19
|
-
};
|
|
20
|
-
type ScrollPageCursorProps = {
|
|
21
|
-
ref: RefObject<HTMLDivElement>;
|
|
22
|
-
pageSizes: Size[];
|
|
23
|
-
scale: number;
|
|
24
|
-
pageCursor: number;
|
|
25
|
-
onChangePageCursor: (page: number) => void;
|
|
26
|
-
};
|
|
27
|
-
export declare const useScrollPageCursor: ({ ref, pageSizes, scale, pageCursor, onChangePageCursor, }: ScrollPageCursorProps) => void;
|
|
28
|
-
export declare const useMountStatus: () => boolean;
|
|
29
|
-
interface UseInitEventsParams {
|
|
30
|
-
pageCursor: number;
|
|
31
|
-
pageSizes: Size[];
|
|
32
|
-
activeElements: HTMLElement[];
|
|
33
|
-
template: Template;
|
|
34
|
-
schemasList: SchemaForUI[][];
|
|
35
|
-
changeSchemas: ChangeSchemas;
|
|
36
|
-
commitSchemas: (newSchemas: SchemaForUI[]) => void;
|
|
37
|
-
removeSchemas: (ids: string[]) => void;
|
|
38
|
-
onSaveTemplate: (t: Template) => void;
|
|
39
|
-
past: React.MutableRefObject<SchemaForUI[][]>;
|
|
40
|
-
future: React.MutableRefObject<SchemaForUI[][]>;
|
|
41
|
-
setSchemasList: React.Dispatch<React.SetStateAction<SchemaForUI[][]>>;
|
|
42
|
-
onEdit: (targets: HTMLElement[]) => void;
|
|
43
|
-
onEditEnd: () => void;
|
|
44
|
-
}
|
|
45
|
-
export declare const useInitEvents: ({ pageCursor, pageSizes, activeElements, template, schemasList, changeSchemas, commitSchemas, removeSchemas, onSaveTemplate, past, future, setSchemasList, onEdit, onEditEnd, }: UseInitEventsParams) => void;
|
|
46
|
-
export {};
|
package/dist/types/src/i18n.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { SchemaForUI, Size, ChangeSchemas, BasePdf } from '@pdfme/common';
|
|
2
|
-
export type SidebarProps = {
|
|
3
|
-
height: number;
|
|
4
|
-
hoveringSchemaId: string | null;
|
|
5
|
-
onChangeHoveringSchemaId: (id: string | null) => void;
|
|
6
|
-
size: Size;
|
|
7
|
-
pageSize: Size;
|
|
8
|
-
basePdf: BasePdf;
|
|
9
|
-
activeElements: HTMLElement[];
|
|
10
|
-
schemas: SchemaForUI[];
|
|
11
|
-
schemasList: SchemaForUI[][];
|
|
12
|
-
onSortEnd: (sortedSchemas: SchemaForUI[]) => void;
|
|
13
|
-
onEdit: (id: string) => void;
|
|
14
|
-
onEditEnd: () => void;
|
|
15
|
-
changeSchemas: ChangeSchemas;
|
|
16
|
-
deselectSchema: () => void;
|
|
17
|
-
sidebarOpen: boolean;
|
|
18
|
-
setSidebarOpen: (sidebarOpen: boolean) => void;
|
|
19
|
-
};
|
package/eslint.config.mjs
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { fileURLToPath } from 'url';
|
|
2
|
-
import { dirname, resolve } from 'path';
|
|
3
|
-
import reactPlugin from 'eslint-plugin-react';
|
|
4
|
-
import reactHooksPlugin from 'eslint-plugin-react-hooks';
|
|
5
|
-
|
|
6
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
7
|
-
const __dirname = dirname(__filename);
|
|
8
|
-
|
|
9
|
-
// Import the root config
|
|
10
|
-
const rootConfigPath = resolve(__dirname, '../../eslint.config.mjs');
|
|
11
|
-
const rootConfig = await import(rootConfigPath);
|
|
12
|
-
|
|
13
|
-
export default [
|
|
14
|
-
...rootConfig.default,
|
|
15
|
-
{
|
|
16
|
-
files: ['src/**/*.ts', 'src/**/*.tsx'],
|
|
17
|
-
languageOptions: {
|
|
18
|
-
parserOptions: {
|
|
19
|
-
project: ['./tsconfig.json'],
|
|
20
|
-
tsconfigRootDir: __dirname,
|
|
21
|
-
ecmaFeatures: {
|
|
22
|
-
jsx: true,
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
plugins: {
|
|
27
|
-
react: reactPlugin,
|
|
28
|
-
'react-hooks': reactHooksPlugin,
|
|
29
|
-
},
|
|
30
|
-
settings: {
|
|
31
|
-
react: {
|
|
32
|
-
version: 'detect',
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
rules: {
|
|
36
|
-
...reactPlugin.configs.recommended.rules,
|
|
37
|
-
'react-hooks/rules-of-hooks': 'error',
|
|
38
|
-
'react-hooks/exhaustive-deps': 'warn',
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
];
|