@pdfme/ui 6.2.1-dev.18 → 6.2.1-dev.26

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.
@@ -15,6 +15,8 @@ interface Props {
15
15
  activeElements: HTMLElement[];
16
16
  onEdit: (targets: HTMLElement[]) => void;
17
17
  changeSchemas: ChangeSchemas;
18
+ /** Layout-only updates (renderer height sync). Does not record history. */
19
+ syncSchemas: ChangeSchemas;
18
20
  removeSchemas: (ids: string[]) => void;
19
21
  paperRefs: MutableRefObject<HTMLDivElement[]>;
20
22
  sidebarOpen: boolean;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import type { SchemaForUI } from '@pdfme/common';
3
3
  import type { SidebarProps } from '../../../../types.js';
4
- type DetailViewProps = Pick<SidebarProps, 'size' | 'schemas' | 'schemasList' | 'pageSize' | 'basePdf' | 'changeSchemas' | 'activeElements' | 'deselectSchema'> & {
4
+ type DetailViewProps = Pick<SidebarProps, 'size' | 'schemas' | 'schemasList' | 'pageSize' | 'basePdf' | 'changeSchemas' | 'syncSchemas' | 'activeElements' | 'deselectSchema'> & {
5
5
  activeSchema: SchemaForUI;
6
6
  };
7
7
  declare const DetailView: (props: DetailViewProps) => React.JSX.Element;
package/dist/helper.d.ts CHANGED
@@ -14,6 +14,13 @@ export declare const stabilizeSchemaIds: <T extends {
14
14
  export declare const debounce: <T extends (...args: unknown[]) => unknown>(cb: T, wait?: number) => T;
15
15
  export declare const round: (number: number, precision: number) => number;
16
16
  export declare const flatten: <T>(arr: T[][]) => T[];
17
+ /**
18
+ * Single source of truth for whether a schema type supports rotation in the
19
+ * Designer (rotate handle on the canvas and rotate input in the detail view).
20
+ * A plugin opts out by omitting `rotate` from its propPanel.defaultSchema or
21
+ * setting it to `undefined` (e.g. `{ ...text.propPanel.defaultSchema, rotate: undefined }`).
22
+ */
23
+ export declare const isRotatableSchema: (defaultSchema?: Record<string, unknown>) => boolean;
17
24
  export declare const initShortCuts: (arg: {
18
25
  move: (command: 'up' | 'down' | 'left' | 'right', isShift: boolean) => void;
19
26
  remove: () => void;
@@ -49,6 +56,19 @@ export declare const template2SchemasList: (_template: Template) => Promise<{
49
56
  __isSplit?: boolean | undefined;
50
57
  id: string;
51
58
  }[][]>;
59
+ /**
60
+ * Pad or truncate schema pages so the list length matches `pageCount`.
61
+ * Empty pages are distinct arrays. This is the same alignment `template2SchemasList`
62
+ * uses when a base PDF's page count and the schema pages differ.
63
+ */
64
+ export declare const alignSchemasListToPageCount: <T>(schemasList: T[][], pageCount: number) => T[][];
65
+ /**
66
+ * Fit a history snapshot to the pages of the current base PDF.
67
+ * Blank PDFs follow the snapshot length. A non-blank PDF keeps `pageSizes.length`,
68
+ * using the same pad/truncate as `template2SchemasList`. A zero page count means
69
+ * sizes are not loaded yet, so the snapshot is left unchanged.
70
+ */
71
+ export declare const normalizeSchemasListForBasePdf: (schemasList: SchemaForUI[][], basePdf: BasePdf, pageCount: number) => SchemaForUI[][];
52
72
  export declare const schemasList2template: (schemasList: SchemaForUI[][], basePdf: BasePdf) => Template;
53
73
  export declare const getUniqueSchemaName: (arg: {
54
74
  copiedSchemaName: string;
package/dist/hooks.d.ts CHANGED
@@ -60,11 +60,10 @@ interface UseInitEventsParams {
60
60
  commitSchemas: (newSchemas: SchemaForUI[]) => void;
61
61
  removeSchemas: (ids: string[]) => void;
62
62
  onSaveTemplate: (t: Template) => void;
63
- past: React.MutableRefObject<SchemaForUI[][]>;
64
- future: React.MutableRefObject<SchemaForUI[][]>;
65
- setSchemasList: React.Dispatch<React.SetStateAction<SchemaForUI[][]>>;
63
+ undo: () => void;
64
+ redo: () => void;
66
65
  onEdit: (targets: Array<HTMLElement | null | undefined>) => void;
67
66
  onEditEnd: () => void;
68
67
  }
69
- export declare const useInitEvents: ({ pageCursor, pageSizes, activeElements, template, schemasList, changeSchemas, commitSchemas, removeSchemas, onSaveTemplate, past, future, setSchemasList, onEdit, onEditEnd, }: UseInitEventsParams) => void;
68
+ export declare const useInitEvents: ({ pageCursor, pageSizes, activeElements, template, schemasList, changeSchemas, commitSchemas, removeSchemas, onSaveTemplate, undo, redo, onEdit, onEditEnd, }: UseInitEventsParams) => void;
70
69
  export {};