@pixldocs/canvas-renderer 0.3.4 → 0.3.6

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
@@ -58,7 +58,13 @@ export { InferredSection }
58
58
  * Load a Google Font by injecting a <link> stylesheet.
59
59
  * Resolves when the font is ready for use.
60
60
  */
61
- export declare function loadGoogleFontCSS(fontFamily: string): Promise<void>;
61
+ export declare function loadGoogleFontCSS(rawFontFamily: string): Promise<void>;
62
+
63
+ /**
64
+ * Normalize a CSS font-family stack to the first Google-compatible family name.
65
+ * e.g. `"Roboto, sans-serif"` → `"Roboto"`, `"'Open Sans', Arial"` → `"Open Sans"`
66
+ */
67
+ export declare function normalizeFontFamily(fontStack: string): string;
62
68
 
63
69
  export declare interface PageSettings {
64
70
  backgroundColor?: string;
package/dist/index.js CHANGED
@@ -10066,18 +10066,18 @@ async function resolveFromForm(options) {
10066
10066
  }
10067
10067
  }
10068
10068
  const flatFormData = flattenSectionStateToFormData(mergedSectionState, inferredSections);
10069
- const dynamicFields = templateConfig.dynamicFields;
10069
+ const configDynamicFields = templateConfig.dynamicFields;
10070
+ const formSchemaDynamicFields = templateFormSchema == null ? void 0 : templateFormSchema.dynamicFields;
10071
+ const dynamicFields = ((configDynamicFields == null ? void 0 : configDynamicFields.length) ? configDynamicFields : formSchemaDynamicFields) || [];
10070
10072
  const mappings = [];
10071
- if (dynamicFields) {
10072
- for (const field of dynamicFields) {
10073
- if (field.mappings) {
10074
- for (const m of field.mappings) {
10075
- mappings.push({
10076
- field_key: field.id,
10077
- element_id: m.elementId,
10078
- target_property: m.targetProperty
10079
- });
10080
- }
10073
+ for (const field of dynamicFields) {
10074
+ if (field.mappings) {
10075
+ for (const m of field.mappings) {
10076
+ mappings.push({
10077
+ field_key: field.id,
10078
+ element_id: m.elementId,
10079
+ target_property: m.targetProperty
10080
+ });
10081
10081
  }
10082
10082
  }
10083
10083
  }
@@ -10257,10 +10257,16 @@ function PixldocsPreview(props) {
10257
10257
  }
10258
10258
  ) });
10259
10259
  }
10260
+ function normalizeFontFamily(fontStack) {
10261
+ const first = fontStack.split(",")[0].trim();
10262
+ return first.replace(/^['"]|['"]$/g, "");
10263
+ }
10260
10264
  const loadedFonts = /* @__PURE__ */ new Set();
10261
10265
  const loadingPromises = /* @__PURE__ */ new Map();
10262
- async function loadGoogleFontCSS(fontFamily) {
10263
- if (!fontFamily || typeof document === "undefined") return;
10266
+ async function loadGoogleFontCSS(rawFontFamily) {
10267
+ if (!rawFontFamily || typeof document === "undefined") return;
10268
+ const fontFamily = normalizeFontFamily(rawFontFamily);
10269
+ if (!fontFamily) return;
10264
10270
  if (loadedFonts.has(fontFamily)) return;
10265
10271
  const existing = loadingPromises.get(fontFamily);
10266
10272
  if (existing) return existing;
@@ -10605,6 +10611,7 @@ export {
10605
10611
  applyThemeToConfig,
10606
10612
  collectFontsFromConfig,
10607
10613
  loadGoogleFontCSS,
10614
+ normalizeFontFamily,
10608
10615
  resolveFromForm,
10609
10616
  resolveTemplateData
10610
10617
  };