uhuu-components 0.2.76 → 0.2.78

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/index.d.ts ADDED
@@ -0,0 +1,264 @@
1
+ // Public API for `uhuu-components` (mirrors src/index.js). Copied to dist/index.d.ts on build.
2
+ import type {
3
+ ComponentType,
4
+ CSSProperties,
5
+ ImgHTMLAttributes,
6
+ Key,
7
+ ReactElement,
8
+ ReactEventHandler,
9
+ ReactNode,
10
+ } from "react";
11
+
12
+ export interface StaticFlowItemMeta {
13
+ breakBefore?: boolean;
14
+ breakAfter?: boolean;
15
+ keepWithNext?: boolean | number;
16
+ avoidBreakInside?: boolean;
17
+ groupKey?: string;
18
+ }
19
+
20
+ export interface ImageBlockDialog {
21
+ path: string;
22
+ type: "image" | "satellite";
23
+ [key: string]: unknown;
24
+ }
25
+
26
+ export interface ImageBlockAnnotationValue {
27
+ annotationSvg?: string;
28
+ annotations?: unknown[];
29
+ }
30
+
31
+ export interface ImageBlockAnnotation {
32
+ path: string;
33
+ value?: ImageBlockAnnotationValue;
34
+ [key: string]: unknown;
35
+ }
36
+
37
+ export interface ImageBlockProps {
38
+ src?: string;
39
+ alt?: string;
40
+ onError?: ReactEventHandler<HTMLImageElement>;
41
+ className?: string;
42
+ imageClassName?: string;
43
+ style?: CSSProperties;
44
+ imageStyle?: CSSProperties;
45
+ backgroundColor?: string;
46
+ mode?: "bleed" | "spread" | "auto";
47
+ side?: "start" | "end";
48
+ width?: number;
49
+ height?: number;
50
+ left?: number;
51
+ right?: number;
52
+ top?: number;
53
+ bottom?: number;
54
+ pageWidth?: number;
55
+ pageHeight?: number;
56
+ bleed?: number;
57
+ dialog?: ImageBlockDialog;
58
+ annotation?: ImageBlockAnnotation;
59
+ overlaySvg?: string;
60
+ overlayClassName?: string;
61
+ options?: unknown[];
62
+ dialogProps?: Record<string, unknown>;
63
+ placeholder?: ReactNode;
64
+ children?: ReactNode;
65
+ imageProps?: ImgHTMLAttributes<HTMLImageElement>;
66
+ renderImage?: (props: ImgHTMLAttributes<HTMLImageElement>) => ReactNode;
67
+ }
68
+
69
+ export const ImageBlock: ComponentType<ImageBlockProps>;
70
+
71
+ export interface EditableProps {
72
+ className?: string;
73
+ dialog?: object;
74
+ children?: ReactNode;
75
+ }
76
+
77
+ export const Editable: ComponentType<EditableProps>;
78
+
79
+ export interface InteractiveModeContextValue {
80
+ interactive: boolean;
81
+ setInteractive: (interactive: boolean) => void;
82
+ enableDevTools?: boolean;
83
+ }
84
+
85
+ export interface BrandKitOption {
86
+ id: string;
87
+ name: string;
88
+ }
89
+
90
+ export interface PageEditorItem {
91
+ id?: string;
92
+ templateId?: string;
93
+ componentKey?: string;
94
+ pages?: PageEditorItem[];
95
+ [key: string]: unknown;
96
+ }
97
+
98
+ export interface PageEditorState {
99
+ items?: PageEditorItem[];
100
+ [key: string]: unknown;
101
+ }
102
+
103
+ export interface PageFilterConfig {
104
+ mode?: "all" | "cover" | "text" | "custom" | string;
105
+ coverPageCount?: number;
106
+ ranges?: Array<{ start: number; end: number }>;
107
+ [key: string]: unknown;
108
+ }
109
+
110
+ export interface PrintConfig {
111
+ label: string;
112
+ filter: PageFilterConfig | null;
113
+ pageFormat?: { bleed?: number; [key: string]: unknown };
114
+ }
115
+
116
+ export type PrintConfigMap = Record<string, PrintConfig>;
117
+
118
+ export interface PageEditorProps {
119
+ templateConfig: Record<string, unknown>;
120
+ payload?: Record<string, unknown>;
121
+ onPayloadChange?: (nextPayload: Record<string, unknown>) => void;
122
+ pageFormat?: { width: number; height: number; preview?: string; bleed?: number; [key: string]: unknown };
123
+ pageOptions?: unknown[];
124
+ pageFilter?: PageFilterConfig;
125
+ printConfigs?: PrintConfigMap;
126
+ onItemsChange?: (items: PageEditorItem[], state: PageEditorState) => void;
127
+ onStateChange?: (state: PageEditorState) => void;
128
+ renderOverlay?: (context: {
129
+ pageNo?: number;
130
+ total?: number;
131
+ pageId?: string;
132
+ parent?: unknown;
133
+ }) => ReactNode;
134
+ reorderTitle?: string;
135
+ reorderDescription?: string;
136
+ stateKey?: string;
137
+ brandKits?: BrandKitOption[];
138
+ activeBrandKitId?: string;
139
+ onSelectBrandKit?: (id: string) => void;
140
+ onAddBrandKit?: (input: string) => void;
141
+ [key: string]: unknown;
142
+ }
143
+
144
+ export interface TemplateDataProviderProps {
145
+ payload?: Record<string, unknown>;
146
+ onPayloadChange?: (nextPayload: Record<string, unknown>) => void;
147
+ children: ReactNode;
148
+ stateKey?: string;
149
+ }
150
+
151
+ export interface IntegrationAdapterConfig {
152
+ dataBinding?: Record<string, unknown>;
153
+ integration?: Record<string, unknown>;
154
+ resolver?: Record<string, unknown> | ((integration: unknown, payload?: unknown) => unknown);
155
+ galleryPath?: string | ((integration: unknown) => string | null);
156
+ defaults?: Record<string, unknown>;
157
+ [key: string]: unknown;
158
+ }
159
+
160
+ export interface IntegrationAdapter {
161
+ dialog: (...args: unknown[]) => Record<string, unknown> | null;
162
+ dialogProps: (...args: unknown[]) => Record<string, unknown>;
163
+ [key: string]: unknown;
164
+ }
165
+
166
+ export const EditorShell: {
167
+ TemplateDataProvider: ComponentType<TemplateDataProviderProps>;
168
+ PageEditor: ComponentType<PageEditorProps>;
169
+ InteractiveModeProvider: ComponentType<{
170
+ children: ReactNode;
171
+ defaultInteractive?: boolean;
172
+ enableDevTools?: boolean;
173
+ }>;
174
+ useInteractive: () => InteractiveModeContextValue;
175
+ useIntegrationAdapter: (config: IntegrationAdapterConfig) => IntegrationAdapter;
176
+ };
177
+
178
+ export interface StaticSheetProps {
179
+ children: ReactNode;
180
+ className?: string;
181
+ style?: CSSProperties;
182
+ pageNo: number;
183
+ showBleed?: boolean;
184
+ overlay?: (args: { pageNo: number }) => ReactNode;
185
+ "data-page-key"?: string;
186
+ }
187
+
188
+ export interface StaticPaginationProps {
189
+ children: ReactNode;
190
+ className?: string;
191
+ setup: Record<string, unknown>;
192
+ }
193
+
194
+ export interface StaticFlowAreaProps {
195
+ children: ReactNode;
196
+ className?: string;
197
+ style?: CSSProperties;
198
+ }
199
+
200
+ export interface StaticFlowPageProps {
201
+ children: ReactNode;
202
+ header?: ReactNode;
203
+ footer?: ReactNode;
204
+ className?: string;
205
+ style?: CSSProperties;
206
+ flowAreaClassName?: string;
207
+ flowAreaStyle?: CSSProperties;
208
+ }
209
+
210
+ export interface StaticFlowProps<TItem = unknown> {
211
+ id: string;
212
+ items: TItem[];
213
+ getKey: (item: TItem, index: number) => Key;
214
+ renderItem: (item: TItem, index: number) => ReactNode;
215
+ getItemMeta?: (item: TItem, index: number) => StaticFlowItemMeta | undefined;
216
+ metaDefaults?: Partial<Record<string, StaticFlowItemMeta>>;
217
+ getItemType?: (item: TItem, index: number) => string | undefined;
218
+ className?: string;
219
+ itemClassName?: string | ((item: TItem, index: number) => string | undefined);
220
+ }
221
+
222
+ export type HtmlFlowItem = {
223
+ id: string;
224
+ type: string;
225
+ html: string;
226
+ breakBefore: boolean;
227
+ };
228
+
229
+ export interface StaticFlowDocumentProps {
230
+ html: string;
231
+ header?: ReactNode;
232
+ footer?: ReactNode;
233
+ className?: string;
234
+ style?: CSSProperties;
235
+ flowAreaClassName?: string;
236
+ flowAreaStyle?: CSSProperties;
237
+ id?: string;
238
+ idPrefix?: string;
239
+ flowClassName?: string;
240
+ itemClassName?: string | ((item: HtmlFlowItem, index: number) => string | undefined);
241
+ metaDefaults?: Partial<Record<string, StaticFlowItemMeta>>;
242
+ getItemMeta?: (item: HtmlFlowItem, index: number) => StaticFlowItemMeta | undefined;
243
+ renderItem?: (item: HtmlFlowItem, index: number) => ReactNode;
244
+ sanitize?: ((html: string) => string) | false;
245
+ editable?: { path: string; type?: string; [key: string]: unknown };
246
+ parseHtml?: (html: string) => unknown[];
247
+ }
248
+
249
+ export const Static: {
250
+ Pagination: ComponentType<StaticPaginationProps>;
251
+ Sheet: ComponentType<StaticSheetProps>;
252
+ FlowArea: ComponentType<StaticFlowAreaProps>;
253
+ FlowPage: ComponentType<StaticFlowPageProps>;
254
+ Flow: <TItem = unknown>(props: StaticFlowProps<TItem>) => ReactElement | null;
255
+ FlowDocument: ComponentType<StaticFlowDocumentProps>;
256
+ markdownToFlowItems: (
257
+ markdown?: string,
258
+ options?: Record<string, unknown>
259
+ ) => HtmlFlowItem[];
260
+ htmlToFlowItems: (
261
+ html?: string,
262
+ options?: Record<string, unknown>
263
+ ) => HtmlFlowItem[];
264
+ };
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
- "version": "0.2.76",
2
+ "version": "0.2.78",
3
3
  "name": "uhuu-components",
4
4
  "main": "uhuu-components.umd.js",
5
5
  "module": "uhuu-components.es.js",
6
6
  "browser": "uhuu-components.es.js",
7
+ "types": "index.d.ts",
7
8
  "type": "module",
8
9
  "license": "https://uhuu.io/license",
9
10
  "peerDependencies": {