@pixldocs/canvas-renderer 0.5.6 → 0.5.7
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 +13 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +81 -0
- package/dist/index.js +13 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -10516,11 +10516,11 @@ async function resolveTemplateData(options) {
|
|
|
10516
10516
|
}
|
|
10517
10517
|
async function resolveFromForm(options) {
|
|
10518
10518
|
var _a, _b, _c;
|
|
10519
|
-
const { templateId, formSchemaId, sectionState, themeId, supabaseUrl, supabaseAnonKey } = options;
|
|
10519
|
+
const { templateId, formSchemaId, sectionState, themeId, supabaseUrl, supabaseAnonKey, prefetched } = options;
|
|
10520
10520
|
const [templateRow, formSchemaRow, defaultForm] = await Promise.all([
|
|
10521
|
-
fetchRow(supabaseUrl, supabaseAnonKey, "templates", templateId),
|
|
10522
|
-
fetchRow(supabaseUrl, supabaseAnonKey, "form_schemas", formSchemaId),
|
|
10523
|
-
fetchDefaultForm(supabaseUrl, supabaseAnonKey, formSchemaId)
|
|
10521
|
+
(prefetched == null ? void 0 : prefetched.templateRow) ? Promise.resolve(prefetched.templateRow) : fetchRow(supabaseUrl, supabaseAnonKey, "templates", templateId),
|
|
10522
|
+
(prefetched == null ? void 0 : prefetched.formSchemaRow) !== void 0 ? Promise.resolve(prefetched.formSchemaRow) : fetchRow(supabaseUrl, supabaseAnonKey, "form_schemas", formSchemaId),
|
|
10523
|
+
(prefetched == null ? void 0 : prefetched.defaultForm) !== void 0 ? Promise.resolve(prefetched.defaultForm) : fetchDefaultForm(supabaseUrl, supabaseAnonKey, formSchemaId)
|
|
10524
10524
|
]);
|
|
10525
10525
|
const templateConfig = templateRow.config;
|
|
10526
10526
|
const templateFormSchema = templateRow.form_schema;
|
|
@@ -11133,14 +11133,15 @@ class PixldocsRenderer {
|
|
|
11133
11133
|
* This is the primary external API for the package.
|
|
11134
11134
|
*/
|
|
11135
11135
|
async renderFromForm(options) {
|
|
11136
|
-
const { templateId, formSchemaId, sectionState, themeId, watermark, ...renderOpts } = options;
|
|
11136
|
+
const { templateId, formSchemaId, sectionState, themeId, watermark, prefetched, ...renderOpts } = options;
|
|
11137
11137
|
const resolved = await resolveFromForm({
|
|
11138
11138
|
templateId,
|
|
11139
11139
|
formSchemaId,
|
|
11140
11140
|
sectionState,
|
|
11141
11141
|
themeId,
|
|
11142
11142
|
supabaseUrl: this.config.supabaseUrl,
|
|
11143
|
-
supabaseAnonKey: this.config.supabaseAnonKey
|
|
11143
|
+
supabaseAnonKey: this.config.supabaseAnonKey,
|
|
11144
|
+
prefetched
|
|
11144
11145
|
});
|
|
11145
11146
|
const shouldWatermark = watermark ?? resolved.price > 0;
|
|
11146
11147
|
let configToRender = resolved.config;
|
|
@@ -11185,14 +11186,15 @@ class PixldocsRenderer {
|
|
|
11185
11186
|
* Resolve from V2 sectionState and return SVGs for all pages (for server vector PDF).
|
|
11186
11187
|
*/
|
|
11187
11188
|
async renderSvgsFromForm(options) {
|
|
11188
|
-
const { templateId, formSchemaId, sectionState, themeId, watermark } = options;
|
|
11189
|
+
const { templateId, formSchemaId, sectionState, themeId, watermark, prefetched } = options;
|
|
11189
11190
|
const resolved = await resolveFromForm({
|
|
11190
11191
|
templateId,
|
|
11191
11192
|
formSchemaId,
|
|
11192
11193
|
sectionState,
|
|
11193
11194
|
themeId,
|
|
11194
11195
|
supabaseUrl: this.config.supabaseUrl,
|
|
11195
|
-
supabaseAnonKey: this.config.supabaseAnonKey
|
|
11196
|
+
supabaseAnonKey: this.config.supabaseAnonKey,
|
|
11197
|
+
prefetched
|
|
11196
11198
|
});
|
|
11197
11199
|
const shouldWatermark = watermark ?? resolved.price > 0;
|
|
11198
11200
|
let configToRender = resolved.config;
|
|
@@ -11216,14 +11218,15 @@ class PixldocsRenderer {
|
|
|
11216
11218
|
* This is the primary PDF export API — mirrors renderFromForm() but returns a PDF.
|
|
11217
11219
|
*/
|
|
11218
11220
|
async renderPdfFromForm(options) {
|
|
11219
|
-
const { templateId, formSchemaId, sectionState, themeId, watermark, title, fontBaseUrl } = options;
|
|
11221
|
+
const { templateId, formSchemaId, sectionState, themeId, watermark, prefetched, title, fontBaseUrl } = options;
|
|
11220
11222
|
const resolved = await resolveFromForm({
|
|
11221
11223
|
templateId,
|
|
11222
11224
|
formSchemaId,
|
|
11223
11225
|
sectionState,
|
|
11224
11226
|
themeId,
|
|
11225
11227
|
supabaseUrl: this.config.supabaseUrl,
|
|
11226
|
-
supabaseAnonKey: this.config.supabaseAnonKey
|
|
11228
|
+
supabaseAnonKey: this.config.supabaseAnonKey,
|
|
11229
|
+
prefetched
|
|
11227
11230
|
});
|
|
11228
11231
|
const shouldWatermark = watermark ?? resolved.price > 0;
|
|
11229
11232
|
let configToRender = resolved.config;
|