@bambamboole/pdf-ua-template-builder 0.2.0 → 0.3.1
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 +119 -17
- package/dist/builder/Builder.d.ts +7 -0
- package/dist/builder/TemplateBuilder.d.ts +10 -13
- package/dist/builder/blocks/Palette.d.ts +7 -0
- package/dist/builder/canvas/BlockDataPreview.d.ts +7 -0
- package/dist/builder/canvas/BuilderCanvas.d.ts +8 -4
- package/dist/builder/canvas/Canvas.d.ts +4 -0
- package/dist/builder/canvas/ColumnResizer.d.ts +2 -1
- package/dist/builder/canvas/PageSheet.d.ts +3 -1
- package/dist/builder/canvas/SortableBlock.d.ts +7 -5
- package/dist/builder/canvas/columns.d.ts +9 -0
- package/dist/builder/context/BuilderContext.d.ts +66 -0
- package/dist/builder/controls/AlignSelect.d.ts +7 -0
- package/dist/builder/controls/BuilderField.d.ts +74 -0
- package/dist/builder/controls/Field.d.ts +6 -0
- package/dist/builder/controls/fieldConverters.d.ts +4 -0
- package/dist/builder/controls/index.d.ts +7 -0
- package/dist/builder/controls/inputs.d.ts +5 -0
- package/dist/builder/hooks/useBuilderDragDrop.d.ts +25 -0
- package/dist/builder/inspector/BlockContentControls.d.ts +9 -0
- package/dist/builder/inspector/BlockInspector.d.ts +14 -0
- package/dist/builder/inspector/BlockLayoutControls.d.ts +7 -0
- package/dist/builder/inspector/DocumentSettings.d.ts +18 -0
- package/dist/builder/inspector/Inspector.d.ts +1 -0
- package/dist/builder/inspector/InspectorShell.d.ts +19 -0
- package/dist/builder/inspector/PageSettings.d.ts +4 -0
- package/dist/builder/inspector/SpacingControls.d.ts +15 -0
- package/dist/builder/inspector/TypographyControls.d.ts +19 -0
- package/dist/builder/inspector/alignOptions.d.ts +10 -0
- package/dist/builder/inspector/editors/ImageBlockEditor.d.ts +3 -0
- package/dist/builder/inspector/editors/KeyValueBlockEditor.d.ts +11 -0
- package/dist/builder/inspector/editors/SortableList.d.ts +7 -0
- package/dist/builder/inspector/editors/SortableRow.d.ts +10 -0
- package/dist/builder/inspector/editors/TableBlockEditor.d.ts +20 -0
- package/dist/builder/inspector/editors/blockEditors.d.ts +7 -0
- package/dist/builder/lib/records.d.ts +4 -0
- package/dist/builder/lib/sensors.d.ts +1 -0
- package/dist/builder/primitives/Button.d.ts +10 -0
- package/dist/builder/primitives/Chip.d.ts +7 -0
- package/dist/builder/schema/schemaAdapter.d.ts +2 -5
- package/dist/builder/state/configUpdates.d.ts +23 -0
- package/dist/builder/state/dragDrop.d.ts +17 -0
- package/dist/builder/state/editorModel.d.ts +5 -0
- package/dist/builder/state/editorReducer.d.ts +71 -0
- package/dist/editor/CodeEditor.d.ts +4 -0
- package/dist/editor/TemplateEditor.d.ts +23 -0
- package/dist/editor/TemplateEditorContext.d.ts +20 -0
- package/dist/editor/editorTheme.d.ts +1 -0
- package/dist/editor/parseTemplate.d.ts +6 -0
- package/dist/editor/templateSchema.d.ts +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +3906 -5260
- package/dist/index.js.map +1 -1
- package/dist/render/PdfPane.d.ts +14 -0
- package/dist/render/Preview.d.ts +4 -0
- package/dist/render/RenderContext.d.ts +17 -0
- package/dist/render/usePdfUaApi.d.ts +19 -0
- package/dist/style.css +3 -1
- package/dist/types/template.d.ts +5 -1
- package/package.json +25 -9
- package/dist/builder/forms/InlineBlockForm.d.ts +0 -9
- package/dist/builder/pdf/PdfPane.d.ts +0 -11
- package/dist/builder/topbar/BuilderTopbar.d.ts +0 -17
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { Block, Template } from '../../types/generated/template';
|
|
3
|
+
import { TemplateSchemaMetadata } from '../../types/template';
|
|
4
|
+
interface TypographyControlsBaseProps {
|
|
5
|
+
metadata?: Pick<TemplateSchemaMetadata, "bundledFonts">;
|
|
6
|
+
}
|
|
7
|
+
export interface BlockTypographyControlsProps extends TypographyControlsBaseProps {
|
|
8
|
+
target: "block";
|
|
9
|
+
block: Block;
|
|
10
|
+
onChangeBlock: (block: Block) => void;
|
|
11
|
+
}
|
|
12
|
+
export interface TemplateTypographyControlsProps extends TypographyControlsBaseProps {
|
|
13
|
+
target: "template";
|
|
14
|
+
template: Template;
|
|
15
|
+
onChangeTemplate: (template: Template) => void;
|
|
16
|
+
}
|
|
17
|
+
export type TypographyControlsProps = BlockTypographyControlsProps | TemplateTypographyControlsProps;
|
|
18
|
+
export declare function TypographyControls(props: TypographyControlsProps): ReactNode;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { KeyValueBlock, KeyValueField } from '../../../types/generated/template';
|
|
3
|
+
import { BlockEditorProps } from './blockEditors';
|
|
4
|
+
export declare function moveField(fields: readonly KeyValueField[], sourceIndex: number, targetIndex: number): KeyValueField[];
|
|
5
|
+
export declare function addField(block: KeyValueBlock): KeyValueBlock;
|
|
6
|
+
export declare function removeField(block: KeyValueBlock, index: number): KeyValueBlock;
|
|
7
|
+
export declare function renameFieldKey(block: KeyValueBlock, index: number, nextKey: string): KeyValueBlock;
|
|
8
|
+
export declare function setFieldLabel(block: KeyValueBlock, index: number, nextLabel: string): KeyValueBlock;
|
|
9
|
+
export declare function setValue(block: KeyValueBlock, key: string, nextValue: string): KeyValueBlock;
|
|
10
|
+
export declare function reorderFields(block: KeyValueBlock, sourceIndex: number, targetIndex: number): KeyValueBlock;
|
|
11
|
+
export declare function KeyValueBlockEditor({ block, onChangeBlock }: BlockEditorProps): ReactNode;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface SortableListProps {
|
|
3
|
+
count: number;
|
|
4
|
+
onReorder: (sourceIndex: number, targetIndex: number) => void;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export declare function SortableList({ count, onReorder, children }: SortableListProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface SortableRowProps {
|
|
3
|
+
id: string;
|
|
4
|
+
dragLabel: string;
|
|
5
|
+
removeLabel: string;
|
|
6
|
+
removeName?: string;
|
|
7
|
+
onRemove: () => void;
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
export declare function SortableRow({ id, dragLabel, removeLabel, removeName, onRemove, children, }: SortableRowProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { TableBlock, TableColumn } from '../../../types/generated/template';
|
|
3
|
+
import { BlockEditorProps } from './blockEditors';
|
|
4
|
+
type TableRow = Record<string, string>;
|
|
5
|
+
export declare function moveColumn(columns: readonly TableColumn[], sourceIndex: number, targetIndex: number): TableColumn[];
|
|
6
|
+
export declare function moveRow(rows: readonly TableRow[], sourceIndex: number, targetIndex: number): TableRow[];
|
|
7
|
+
export declare function addColumn(block: TableBlock): TableBlock;
|
|
8
|
+
export declare function removeColumn(block: TableBlock, index: number): TableBlock;
|
|
9
|
+
export declare function renameColumnKey(block: TableBlock, index: number, nextKey: string): TableBlock;
|
|
10
|
+
export declare function setColumnLabel(block: TableBlock, index: number, nextLabel: string): TableBlock;
|
|
11
|
+
export declare function setColumnAlign(block: TableBlock, index: number, nextAlign: string): TableBlock;
|
|
12
|
+
export declare function setTableNumberRows(block: TableBlock, value: boolean | undefined): TableBlock;
|
|
13
|
+
export declare function reorderColumns(block: TableBlock, sourceIndex: number, targetIndex: number): TableBlock;
|
|
14
|
+
export declare function addRow(rows: readonly TableRow[], columns: readonly TableColumn[]): TableRow[];
|
|
15
|
+
export declare function removeRow(rows: readonly TableRow[], index: number): TableRow[];
|
|
16
|
+
export declare function setCellValue(rows: readonly TableRow[], index: number, key: string, nextValue: string): TableRow[];
|
|
17
|
+
export declare function removeColumnKeyFromRows(rows: readonly TableRow[], key: string): TableRow[];
|
|
18
|
+
export declare function renameColumnKeyInRows(rows: readonly TableRow[], previousKey: string, nextKey: string): TableRow[];
|
|
19
|
+
export declare function TableBlockEditor({ block, rowData, onChangeBlock, onChangeRowData, }: BlockEditorProps): ReactNode;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function isRecord(value: unknown): value is Record<string, unknown>;
|
|
2
|
+
export declare function omitKey<TValue>(record: Record<string, TValue>, key: string): Record<string, TValue>;
|
|
3
|
+
export declare function renameKey<TValue>(record: Record<string, TValue>, previousKey: string, nextKey: string): Record<string, TValue>;
|
|
4
|
+
export declare function nextKeyIndex(keys: readonly string[], prefix: string): number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useBuilderSensors(): import('@dnd-kit/core').SensorDescriptor<import('@dnd-kit/core').SensorOptions>[];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ButtonHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export type ButtonVariant = "default" | "primary" | "danger" | "ghost";
|
|
3
|
+
export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
4
|
+
variant?: ButtonVariant;
|
|
5
|
+
/** Render as a square icon button (no label padding). */
|
|
6
|
+
icon?: boolean;
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export declare function Button({ variant, icon, type, className, children, ...rest }: ButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare function AddButton({ type, className, children, ...rest }: ButtonHTMLAttributes<HTMLButtonElement>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface ChipProps {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
/** Grow to fit multi-character labels instead of staying a 22×22 square. */
|
|
5
|
+
wide?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare function Chip({ children, wide }: ChipProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { Block } from '../../types/generated/template';
|
|
2
|
-
import { TemplateSchemaMetadata } from '../../types/template';
|
|
3
|
-
export type
|
|
4
|
-
export interface JsonSchemaObject {
|
|
5
|
-
[key: string]: unknown;
|
|
6
|
-
}
|
|
2
|
+
import { JsonSchemaObject, JsonSchemaValue, TemplateSchemaMetadata } from '../../types/template';
|
|
3
|
+
export type { JsonSchemaObject, JsonSchemaValue };
|
|
7
4
|
export declare function getSchemaMetadata(schema: JsonSchemaObject): TemplateSchemaMetadata;
|
|
8
5
|
export declare function resolveRef(schema: JsonSchemaObject, ref: string): JsonSchemaObject;
|
|
9
6
|
export declare function getBlockTypes(schema: JsonSchemaObject): string[];
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Block, BlockConfig, DividerConfig, HeadingConfig, ImageConfig, KeyValueConfig, SpacingConfig, SpacerConfig, TableConfig, Template, TypographyConfig } from '../../types/generated/template';
|
|
2
|
+
type EmptyConfigValue = "" | null | undefined;
|
|
3
|
+
type BlockType = Block["type"];
|
|
4
|
+
type BlockByType<TType extends BlockType> = Extract<Block, {
|
|
5
|
+
type: TType;
|
|
6
|
+
}>;
|
|
7
|
+
type BlockConfigByType = {
|
|
8
|
+
text: BlockConfig;
|
|
9
|
+
html: BlockConfig;
|
|
10
|
+
heading: HeadingConfig;
|
|
11
|
+
image: ImageConfig;
|
|
12
|
+
"key-value": KeyValueConfig;
|
|
13
|
+
spacer: SpacerConfig;
|
|
14
|
+
divider: DividerConfig;
|
|
15
|
+
table: TableConfig;
|
|
16
|
+
};
|
|
17
|
+
type BlockConfigFor<TType extends BlockType> = BlockConfigByType[TType];
|
|
18
|
+
export declare function setBlockConfigField<TType extends BlockType, TKey extends keyof BlockConfigFor<TType>>(block: BlockByType<TType>, field: TKey, value: BlockConfigFor<TType>[TKey] | EmptyConfigValue): BlockByType<TType>;
|
|
19
|
+
export declare function setBlockTypographyField<TType extends BlockType, TKey extends keyof TypographyConfig>(block: BlockByType<TType>, field: TKey, value: TypographyConfig[TKey] | EmptyConfigValue): BlockByType<TType>;
|
|
20
|
+
export declare function setBlockSpacingField<TType extends BlockType, TKey extends keyof SpacingConfig>(block: BlockByType<TType>, field: TKey, value: SpacingConfig[TKey] | EmptyConfigValue): BlockByType<TType>;
|
|
21
|
+
export declare function setTemplateTypographyField<TKey extends keyof TypographyConfig>(template: Template, field: TKey, value: TypographyConfig[TKey] | EmptyConfigValue): Template;
|
|
22
|
+
export declare function setTemplatePageMargin<TKey extends keyof SpacingConfig>(template: Template, field: TKey, value: SpacingConfig[TKey] | EmptyConfigValue): Template;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { UniqueIdentifier } from '@dnd-kit/core';
|
|
2
|
+
import { EditorArea, EditorModel } from './editorModel';
|
|
3
|
+
export interface DragData {
|
|
4
|
+
source?: string;
|
|
5
|
+
type?: string;
|
|
6
|
+
rowUid?: string;
|
|
7
|
+
blockUid?: string;
|
|
8
|
+
area?: EditorArea;
|
|
9
|
+
}
|
|
10
|
+
export interface DropTarget {
|
|
11
|
+
rowUid: string | null;
|
|
12
|
+
index: number;
|
|
13
|
+
area: EditorArea;
|
|
14
|
+
}
|
|
15
|
+
export declare function getDragData(value: unknown): DragData;
|
|
16
|
+
export declare function getDropTarget(model: EditorModel, overId: UniqueIdentifier | undefined, overData: DragData): DropTarget;
|
|
17
|
+
export declare function getRowIndex(model: EditorModel, overId: UniqueIdentifier | undefined, overData: DragData): number | null;
|
|
@@ -27,6 +27,7 @@ export declare function removeBlock(model: EditorModel, blockUid: string): Edito
|
|
|
27
27
|
export declare function moveBlock(model: EditorModel, blockUid: string, rowUid: string | null, index: number, area?: EditorArea): EditorModel;
|
|
28
28
|
export declare function moveRow(model: EditorModel, rowUid: string, index: number): EditorModel;
|
|
29
29
|
export declare function updateBlock(model: EditorModel, blockUid: string, block: Block): EditorModel;
|
|
30
|
+
export declare function updateTemplateSettings(model: EditorModel, template: Template): EditorModel;
|
|
30
31
|
export declare function getPageSize(model: EditorModel): ResolvedPageSize;
|
|
31
32
|
export declare function setPageSize(model: EditorModel, format: PageFormat, orientation: Orientation): EditorModel;
|
|
32
33
|
export declare function setRowWidths(model: EditorModel, rowUid: string, widths: string[]): EditorModel;
|
|
@@ -34,3 +35,7 @@ export declare function getFooterRepeat(model: EditorModel): boolean;
|
|
|
34
35
|
export declare function setFooterRepeat(model: EditorModel, repeat: boolean): EditorModel;
|
|
35
36
|
export declare function getPageNumbers(model: EditorModel): PageNumbersValue;
|
|
36
37
|
export declare function setPageNumbers(model: EditorModel, value: PageNumbersValue): EditorModel;
|
|
38
|
+
export declare function findEditorBlock(model: EditorModel, blockUid: string): EditorBlock | undefined;
|
|
39
|
+
export declare function resolveSelectedEditorBlock(model: EditorModel, blockUid: string | null): EditorBlock | null;
|
|
40
|
+
export declare function reconcileSelectedBlockUid(model: EditorModel, blockUid: string | null): string | null;
|
|
41
|
+
export declare function createNextBlockId(model: EditorModel, blockType: string): string;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { UniqueIdentifier } from '@dnd-kit/core';
|
|
2
|
+
import { Block, Orientation, PageFormat, Template } from '../../types/generated/template';
|
|
3
|
+
import { JsonSchemaObject, TemplateData } from '../../types/template';
|
|
4
|
+
import { DragData } from './dragDrop';
|
|
5
|
+
import { EditorModel, PageNumbersValue } from './editorModel';
|
|
6
|
+
export interface EditorState {
|
|
7
|
+
model: EditorModel;
|
|
8
|
+
data: TemplateData;
|
|
9
|
+
selectedBlockUid: string | null;
|
|
10
|
+
}
|
|
11
|
+
export type EditorAction = {
|
|
12
|
+
type: "selectBlock";
|
|
13
|
+
blockUid: string;
|
|
14
|
+
} | {
|
|
15
|
+
type: "deselect";
|
|
16
|
+
} | {
|
|
17
|
+
type: "changeBlock";
|
|
18
|
+
blockUid: string;
|
|
19
|
+
block: Block;
|
|
20
|
+
} | {
|
|
21
|
+
type: "removeBlock";
|
|
22
|
+
blockUid: string;
|
|
23
|
+
} | {
|
|
24
|
+
type: "changeTemplateSettings";
|
|
25
|
+
template: Template;
|
|
26
|
+
} | {
|
|
27
|
+
type: "setRowWidths";
|
|
28
|
+
rowUid: string;
|
|
29
|
+
widths: string[];
|
|
30
|
+
} | {
|
|
31
|
+
type: "addBlock";
|
|
32
|
+
schema: JsonSchemaObject;
|
|
33
|
+
blockType: string;
|
|
34
|
+
} | {
|
|
35
|
+
type: "setFormat";
|
|
36
|
+
format: PageFormat;
|
|
37
|
+
} | {
|
|
38
|
+
type: "setOrientation";
|
|
39
|
+
orientation: Orientation;
|
|
40
|
+
} | {
|
|
41
|
+
type: "setFooterRepeat";
|
|
42
|
+
repeat: boolean;
|
|
43
|
+
} | {
|
|
44
|
+
type: "setPageNumbers";
|
|
45
|
+
value: PageNumbersValue;
|
|
46
|
+
} | {
|
|
47
|
+
type: "setData";
|
|
48
|
+
data: TemplateData;
|
|
49
|
+
} | {
|
|
50
|
+
type: "loadExample";
|
|
51
|
+
template: Template;
|
|
52
|
+
data: TemplateData;
|
|
53
|
+
} | {
|
|
54
|
+
type: "dropFromPalette";
|
|
55
|
+
schema: JsonSchemaObject;
|
|
56
|
+
blockType: string;
|
|
57
|
+
overId?: UniqueIdentifier;
|
|
58
|
+
overData: DragData;
|
|
59
|
+
} | {
|
|
60
|
+
type: "moveRowTo";
|
|
61
|
+
rowUid: string;
|
|
62
|
+
overId?: UniqueIdentifier;
|
|
63
|
+
overData: DragData;
|
|
64
|
+
} | {
|
|
65
|
+
type: "moveBlockTo";
|
|
66
|
+
blockUid: string;
|
|
67
|
+
overId?: UniqueIdentifier;
|
|
68
|
+
overData: DragData;
|
|
69
|
+
};
|
|
70
|
+
export declare function createEditorState(template: Template, data: TemplateData): EditorState;
|
|
71
|
+
export declare function editorReducer(state: EditorState, action: EditorAction): EditorState;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Template } from '../types/generated/template';
|
|
2
|
+
import { TemplateData } from '../types/template';
|
|
3
|
+
export interface TemplateEditorProps {
|
|
4
|
+
/** Base URL of a running pdf-ua-api instance. Defaults to "" (relative URLs / proxy). */
|
|
5
|
+
apiUrl?: string;
|
|
6
|
+
/** Template seeded into the editor as pretty-printed JSON on first render. */
|
|
7
|
+
initialTemplate?: Template;
|
|
8
|
+
/** Runtime data keyed by block id, passed through to render. */
|
|
9
|
+
data?: TemplateData;
|
|
10
|
+
/** Fires on every edit; `template` is null while the JSON is invalid. */
|
|
11
|
+
onChange?: (template: Template | null, text: string) => void;
|
|
12
|
+
/** Fires after a successful render with the produced PDF blob. */
|
|
13
|
+
onRendered?: (pdf: Blob) => void;
|
|
14
|
+
/** Optional className appended to the root element. */
|
|
15
|
+
className?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* All-in-one preset: a JSON template editor and a rendered-PDF preview side by side.
|
|
19
|
+
*
|
|
20
|
+
* For custom layouts, compose directly with `TemplateEditorProvider`, `CodeEditor`,
|
|
21
|
+
* and `Preview`.
|
|
22
|
+
*/
|
|
23
|
+
export declare function TemplateEditor({ apiUrl, initialTemplate, data, onChange, onRendered, className, }?: TemplateEditorProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { Template } from '../types/generated/template';
|
|
3
|
+
import { TemplateData } from '../types/template';
|
|
4
|
+
export interface TemplateEditorProviderProps {
|
|
5
|
+
apiUrl?: string;
|
|
6
|
+
initialTemplate?: Template;
|
|
7
|
+
data?: TemplateData;
|
|
8
|
+
onChange?: (template: Template | null, text: string) => void;
|
|
9
|
+
onRendered?: (pdf: Blob) => void;
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
}
|
|
12
|
+
export interface TemplateEditorContextValue {
|
|
13
|
+
text: string;
|
|
14
|
+
setText: (text: string) => void;
|
|
15
|
+
template: Template | null;
|
|
16
|
+
error: string | null;
|
|
17
|
+
data: TemplateData;
|
|
18
|
+
}
|
|
19
|
+
export declare function useTemplateEditor(): TemplateEditorContextValue;
|
|
20
|
+
export declare function TemplateEditorProvider({ apiUrl: apiUrlProp, initialTemplate, data, onChange, onRendered, children, }: TemplateEditorProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const editorTheme: import('@codemirror/state').Extension[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const templateSchema: Record<string, unknown>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,23 @@
|
|
|
1
1
|
export { TemplateBuilder } from './builder/TemplateBuilder';
|
|
2
2
|
export type { TemplateBuilderProps } from './builder/TemplateBuilder';
|
|
3
|
+
export { Builder } from './builder/Builder';
|
|
4
|
+
export type { BuilderProps } from './builder/Builder';
|
|
5
|
+
export { Preview } from './render/Preview';
|
|
6
|
+
export type { PreviewProps } from './render/Preview';
|
|
7
|
+
export { TemplateBuilderProvider, useTemplateBuilder } from './builder/context/BuilderContext';
|
|
8
|
+
export type { TemplateBuilderProviderProps, BuilderContextValue, TemplateExample, } from './builder/context/BuilderContext';
|
|
3
9
|
export { createInvoiceExample } from './builder/schema/invoiceExample';
|
|
4
10
|
export type { InvoiceExample, InvoiceData, TableRow } from './builder/schema/invoiceExample';
|
|
5
11
|
export { PAGE_SIZES_MM, pageSizeForFormat } from './builder/lib/pageSizes';
|
|
6
12
|
export { mmToPx } from './builder/lib/displayScale';
|
|
7
13
|
export { createEditorModel, serializeTemplate, getPageSize, setPageSize, getFooterRepeat, setFooterRepeat, getPageNumbers, setPageNumbers, } from './builder/state/editorModel';
|
|
8
14
|
export type { EditorArea, EditorBlock, EditorModel, EditorRow, PageNumbersValue, ResolvedPageSize, } from './builder/state/editorModel';
|
|
15
|
+
export { TemplateEditor } from './editor/TemplateEditor';
|
|
16
|
+
export type { TemplateEditorProps } from './editor/TemplateEditor';
|
|
17
|
+
export { CodeEditor } from './editor/CodeEditor';
|
|
18
|
+
export type { CodeEditorProps } from './editor/CodeEditor';
|
|
19
|
+
export { TemplateEditorProvider, useTemplateEditor, } from './editor/TemplateEditorContext';
|
|
20
|
+
export type { TemplateEditorProviderProps, TemplateEditorContextValue, } from './editor/TemplateEditorContext';
|
|
9
21
|
export { fetchTemplateSchema, renderTemplatePdf, resolveDefaultApiUrl } from './api/pdfUaApi';
|
|
10
22
|
export type { TemplateData, TemplateSchemaResponse } from './types/template';
|
|
11
23
|
export type { Align, Block, HeadingBlock, ImageBlock, KeyValueBlock, Orientation, PageConfig, PageFormat, PageSize, Row, SpacerBlock, TableBlock, Template, TextBlock, } from './types/generated/template';
|