@pixldocs/canvas-renderer 0.5.6 → 0.5.8

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/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { FormConfig } from '../../../src/lib/formsApi';
1
2
  import { InferredSection } from '../../../src/lib/inferFormSchemaFromTemplate';
2
3
  import { jsPDF } from 'jspdf';
3
4
  import { JSX as JSX_2 } from 'react/jsx-runtime';
@@ -147,6 +148,52 @@ declare type FontWeightFiles = {
147
148
  semiboldItalic?: string;
148
149
  };
149
150
 
151
+ declare type FormDefField = {
152
+ id: string;
153
+ label: string;
154
+ key: string;
155
+ type: 'text' | 'textarea' | 'email' | 'tel' | 'url' | 'date' | 'number' | 'image' | 'color' | 'select' | 'toggle' | 'currency' | 'rating';
156
+ placeholder?: string;
157
+ options?: {
158
+ value: string;
159
+ label: string;
160
+ }[];
161
+ order: number;
162
+ width?: 'full' | 'half' | 'third';
163
+ description?: string;
164
+ };
165
+
166
+ declare type FormDefRepeatablePage = {
167
+ id: string;
168
+ label: string;
169
+ description?: string;
170
+ order: number;
171
+ templateKeyPrefix: string;
172
+ fields: FormDefField[];
173
+ minEntries?: number;
174
+ maxEntries?: number;
175
+ children?: FormDefSection[];
176
+ };
177
+
178
+ declare type FormDefSchema = {
179
+ sections: FormDefSection[];
180
+ repeatablePages?: FormDefRepeatablePage[];
181
+ formRenderPreset?: 'default' | 'compact' | 'cards' | 'minimal' | 'biodata';
182
+ };
183
+
184
+ declare type FormDefSection = {
185
+ id: string;
186
+ label: string;
187
+ description?: string;
188
+ order: number;
189
+ fields: FormDefField[];
190
+ repeatable?: boolean;
191
+ minEntries?: number;
192
+ maxEntries?: number;
193
+ templateKeyPrefix?: string;
194
+ children?: FormDefSection[];
195
+ };
196
+
150
197
  /**
151
198
  * Get the embedded jsPDF font name for a given font family + weight + italic.
152
199
  * This is the name used for pdf.setFont() and must match the font-family
@@ -197,6 +244,8 @@ export declare interface PdfFromFormOptions {
197
244
  themeId?: string;
198
245
  /** Whether to inject watermark. Default: auto (true for paid templates, false for free). */
199
246
  watermark?: boolean;
247
+ /** Optional prefetched rows from a trusted server to skip browser-side REST fetching. */
248
+ prefetched?: ResolveFromFormOptions['prefetched'];
200
249
  /** PDF document title */
201
250
  title?: string;
202
251
  /** Base URL for TTF font files for PDF font embedding */
@@ -359,6 +408,8 @@ export declare interface RenderFromFormOptions extends Omit<RenderOptions, 'page
359
408
  themeId?: string;
360
409
  /** Whether to inject watermark on preview. Default: auto (true for paid templates, false for free). */
361
410
  watermark?: boolean;
411
+ /** Optional prefetched rows from a trusted server to skip browser-side REST fetching. */
412
+ prefetched?: ResolveFromFormOptions['prefetched'];
362
413
  }
363
414
 
364
415
  export declare interface RenderOptions {
@@ -417,6 +468,36 @@ export declare interface ResolveFromFormOptions {
417
468
  supabaseUrl: string;
418
469
  /** Supabase anon key */
419
470
  supabaseAnonKey: string;
471
+ /** Optional prefetched rows from a trusted server so browser-side package resolution can skip REST fetches entirely. */
472
+ prefetched?: {
473
+ templateRow?: {
474
+ id?: string;
475
+ name?: string;
476
+ price?: number;
477
+ config: TemplateConfig;
478
+ form_schema?: {
479
+ repeatableSections?: {
480
+ nodeId: string;
481
+ label: string;
482
+ minEntries?: number;
483
+ maxEntries?: number;
484
+ }[];
485
+ repeatablePages?: unknown[];
486
+ dynamicFields?: DynamicField[];
487
+ fieldGroups?: any[];
488
+ } | null;
489
+ default_data?: unknown;
490
+ };
491
+ formSchemaRow?: {
492
+ id?: string;
493
+ schema: FormDefSchema;
494
+ } | null;
495
+ defaultForm?: {
496
+ config: FormConfig;
497
+ values: Record<string, any>;
498
+ saved_data: Record<string, any>;
499
+ } | null;
500
+ };
420
501
  }
421
502
 
422
503
  export declare interface ResolveOptions {