@pixldocs/canvas-renderer 0.5.53 → 0.5.55
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.cjs +27 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +37 -9
- package/dist/index.js +27 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -231,7 +231,7 @@ export declare function normalizeFontFamily(fontStack: string): string;
|
|
|
231
231
|
* Package version banner. Bump alongside package.json so we can confirm
|
|
232
232
|
* (via browser:log) that the deployed bundle matches the expected build.
|
|
233
233
|
*/
|
|
234
|
-
export declare const PACKAGE_VERSION = "0.5.
|
|
234
|
+
export declare const PACKAGE_VERSION = "0.5.54";
|
|
235
235
|
|
|
236
236
|
export declare interface PageSettings {
|
|
237
237
|
backgroundColor?: string;
|
|
@@ -482,16 +482,29 @@ export declare function resolveFromForm(options: ResolveFromFormOptions): Promis
|
|
|
482
482
|
export declare interface ResolveFromFormOptions {
|
|
483
483
|
/** Template UUID */
|
|
484
484
|
templateId: string;
|
|
485
|
-
/**
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
485
|
+
/**
|
|
486
|
+
* Form schema UUID. Optional — omit for templates with manual `dynamicFields`
|
|
487
|
+
* that are not bound to a saved form schema.
|
|
488
|
+
*/
|
|
489
|
+
formSchemaId?: string;
|
|
490
|
+
/**
|
|
491
|
+
* V2 section state (same shape sent to /render-from-form). Optional when
|
|
492
|
+
* `flatFormData` is provided (manual-fields path).
|
|
493
|
+
*/
|
|
494
|
+
sectionState?: SectionFormState;
|
|
495
|
+
/**
|
|
496
|
+
* Flat key/value map of dynamic-field values, keyed by `dynamicField.id`.
|
|
497
|
+
* Use this for manual-fields templates with no `formSchemaId` — values
|
|
498
|
+
* are applied directly through `applyFormDataToConfig` without going
|
|
499
|
+
* through the section-state flatten step.
|
|
500
|
+
*/
|
|
501
|
+
flatFormData?: Record<string, unknown>;
|
|
489
502
|
/** Optional theme variant ID (default: 'default') */
|
|
490
503
|
themeId?: string;
|
|
491
504
|
/** Supabase project URL */
|
|
492
|
-
supabaseUrl
|
|
505
|
+
supabaseUrl?: string;
|
|
493
506
|
/** Supabase anon key */
|
|
494
|
-
supabaseAnonKey
|
|
507
|
+
supabaseAnonKey?: string;
|
|
495
508
|
/** Optional prefetched rows from a trusted server so browser-side package resolution can skip REST fetches entirely. */
|
|
496
509
|
prefetched?: {
|
|
497
510
|
templateRow?: {
|
|
@@ -530,9 +543,24 @@ export declare interface ResolveOptions {
|
|
|
530
543
|
/** Optional flat formData (legacy, simple fields only) */
|
|
531
544
|
formData?: Record<string, any>;
|
|
532
545
|
/** Supabase project URL */
|
|
533
|
-
supabaseUrl
|
|
546
|
+
supabaseUrl?: string;
|
|
534
547
|
/** Supabase anon key */
|
|
535
|
-
supabaseAnonKey
|
|
548
|
+
supabaseAnonKey?: string;
|
|
549
|
+
/**
|
|
550
|
+
* Optional prefetched template row from a trusted server. When provided
|
|
551
|
+
* the resolver skips the REST fetch — useful for the EC2 v2 pipeline where
|
|
552
|
+
* the server already has the row in memory.
|
|
553
|
+
*/
|
|
554
|
+
prefetched?: {
|
|
555
|
+
templateRow?: {
|
|
556
|
+
id?: string;
|
|
557
|
+
name?: string;
|
|
558
|
+
price?: number;
|
|
559
|
+
config: TemplateConfig;
|
|
560
|
+
form_schema?: unknown;
|
|
561
|
+
default_data?: unknown;
|
|
562
|
+
};
|
|
563
|
+
};
|
|
536
564
|
}
|
|
537
565
|
|
|
538
566
|
export declare function resolveTemplateData(options: ResolveOptions): Promise<ResolvedTemplate>;
|
package/dist/index.js
CHANGED
|
@@ -11674,8 +11674,8 @@ function deriveRepeatablePagesFromTemplate(config, inlineFormSchema, formData) {
|
|
|
11674
11674
|
return out;
|
|
11675
11675
|
}
|
|
11676
11676
|
async function resolveTemplateData(options) {
|
|
11677
|
-
const { templateId, formData, supabaseUrl, supabaseAnonKey } = options;
|
|
11678
|
-
const template = await fetchRow(supabaseUrl, supabaseAnonKey, "templates", templateId);
|
|
11677
|
+
const { templateId, formData, supabaseUrl, supabaseAnonKey, prefetched } = options;
|
|
11678
|
+
const template = (prefetched == null ? void 0 : prefetched.templateRow) ? prefetched.templateRow : await fetchRow(supabaseUrl, supabaseAnonKey, "templates", templateId);
|
|
11679
11679
|
let config = template.config;
|
|
11680
11680
|
const inlineFormSchema = template.form_schema;
|
|
11681
11681
|
const defaultData = template.default_data;
|
|
@@ -11742,7 +11742,16 @@ async function resolveTemplateData(options) {
|
|
|
11742
11742
|
}
|
|
11743
11743
|
async function resolveFromForm(options) {
|
|
11744
11744
|
var _a, _b, _c;
|
|
11745
|
-
const { templateId, formSchemaId, sectionState, themeId, supabaseUrl, supabaseAnonKey, prefetched } = options;
|
|
11745
|
+
const { templateId, formSchemaId, sectionState, flatFormData: directFlatFormData, themeId, supabaseUrl, supabaseAnonKey, prefetched } = options;
|
|
11746
|
+
if (!formSchemaId) {
|
|
11747
|
+
return resolveTemplateData({
|
|
11748
|
+
templateId,
|
|
11749
|
+
formData: directFlatFormData ?? sectionState ?? {},
|
|
11750
|
+
supabaseUrl,
|
|
11751
|
+
supabaseAnonKey,
|
|
11752
|
+
prefetched: (prefetched == null ? void 0 : prefetched.templateRow) ? { templateRow: prefetched.templateRow } : void 0
|
|
11753
|
+
});
|
|
11754
|
+
}
|
|
11746
11755
|
const [templateRow, formSchemaRow, defaultForm] = await Promise.all([
|
|
11747
11756
|
(prefetched == null ? void 0 : prefetched.templateRow) ? Promise.resolve(prefetched.templateRow) : fetchRow(supabaseUrl, supabaseAnonKey, "templates", templateId),
|
|
11748
11757
|
(prefetched == null ? void 0 : prefetched.formSchemaRow) !== void 0 ? Promise.resolve(prefetched.formSchemaRow) : fetchRow(supabaseUrl, supabaseAnonKey, "form_schemas", formSchemaId),
|
|
@@ -12221,7 +12230,20 @@ function PixldocsPreview(props) {
|
|
|
12221
12230
|
onDynamicFieldClick,
|
|
12222
12231
|
onReady,
|
|
12223
12232
|
onError,
|
|
12224
|
-
|
|
12233
|
+
// Default `false` so PageCanvas blocks textbox creation until the host
|
|
12234
|
+
// browser actually has the @font-face rules registered. This matters for
|
|
12235
|
+
// `overflowPolicy: 'auto-shrink'` text — `createText` runs the shrink
|
|
12236
|
+
// loop synchronously at mount time using whatever font metrics Fabric
|
|
12237
|
+
// can measure right then. If the real font hasn't loaded yet, Fabric
|
|
12238
|
+
// falls back to the system font (typically narrower), the shrink loop
|
|
12239
|
+
// decides "fits, no shrink needed", and when the real font finally
|
|
12240
|
+
// loads the text overflows the box.
|
|
12241
|
+
//
|
|
12242
|
+
// The renderer's imperative PNG/PDF paths (`renderPageViaPreviewCanvas`,
|
|
12243
|
+
// `captureSvgViaPreviewCanvas`) already pass `skipFontReadyWait: false`
|
|
12244
|
+
// for this exact reason — that's why the downloaded PDF was correct
|
|
12245
|
+
// while the on-screen preview wasn't.
|
|
12246
|
+
skipFontReadyWait = false
|
|
12225
12247
|
} = props;
|
|
12226
12248
|
useEffect(() => {
|
|
12227
12249
|
setPackageApiUrl(imageProxyUrl);
|
|
@@ -12390,7 +12412,7 @@ function PixldocsPreview(props) {
|
|
|
12390
12412
|
!canvasSettled && /* @__PURE__ */ jsx("div", { style: { position: "absolute", inset: 0, display: "flex", alignItems: "center", justifyContent: "center", minHeight: 200 }, children: /* @__PURE__ */ jsx("div", { style: { color: "#888", fontSize: 14 }, children: "Loading preview..." }) })
|
|
12391
12413
|
] });
|
|
12392
12414
|
}
|
|
12393
|
-
const PACKAGE_VERSION = "0.5.
|
|
12415
|
+
const PACKAGE_VERSION = "0.5.54";
|
|
12394
12416
|
let __underlineFixInstalled = false;
|
|
12395
12417
|
function installUnderlineFix(fab) {
|
|
12396
12418
|
var _a;
|