@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.cjs CHANGED
@@ -10085,18 +10085,18 @@ async function resolveFromForm(options) {
10085
10085
  }
10086
10086
  }
10087
10087
  const flatFormData = flattenSectionStateToFormData(mergedSectionState, inferredSections);
10088
- const dynamicFields = templateConfig.dynamicFields;
10088
+ const configDynamicFields = templateConfig.dynamicFields;
10089
+ const formSchemaDynamicFields = templateFormSchema == null ? void 0 : templateFormSchema.dynamicFields;
10090
+ const dynamicFields = ((configDynamicFields == null ? void 0 : configDynamicFields.length) ? configDynamicFields : formSchemaDynamicFields) || [];
10089
10091
  const mappings = [];
10090
- if (dynamicFields) {
10091
- for (const field of dynamicFields) {
10092
- if (field.mappings) {
10093
- for (const m of field.mappings) {
10094
- mappings.push({
10095
- field_key: field.id,
10096
- element_id: m.elementId,
10097
- target_property: m.targetProperty
10098
- });
10099
- }
10092
+ for (const field of dynamicFields) {
10093
+ if (field.mappings) {
10094
+ for (const m of field.mappings) {
10095
+ mappings.push({
10096
+ field_key: field.id,
10097
+ element_id: m.elementId,
10098
+ target_property: m.targetProperty
10099
+ });
10100
10100
  }
10101
10101
  }
10102
10102
  }
@@ -10276,10 +10276,16 @@ function PixldocsPreview(props) {
10276
10276
  }
10277
10277
  ) });
10278
10278
  }
10279
+ function normalizeFontFamily(fontStack) {
10280
+ const first = fontStack.split(",")[0].trim();
10281
+ return first.replace(/^['"]|['"]$/g, "");
10282
+ }
10279
10283
  const loadedFonts = /* @__PURE__ */ new Set();
10280
10284
  const loadingPromises = /* @__PURE__ */ new Map();
10281
- async function loadGoogleFontCSS(fontFamily) {
10282
- if (!fontFamily || typeof document === "undefined") return;
10285
+ async function loadGoogleFontCSS(rawFontFamily) {
10286
+ if (!rawFontFamily || typeof document === "undefined") return;
10287
+ const fontFamily = normalizeFontFamily(rawFontFamily);
10288
+ if (!fontFamily) return;
10283
10289
  if (loadedFonts.has(fontFamily)) return;
10284
10290
  const existing = loadingPromises.get(fontFamily);
10285
10291
  if (existing) return existing;
@@ -10623,6 +10629,7 @@ exports.PixldocsRenderer = PixldocsRenderer;
10623
10629
  exports.applyThemeToConfig = applyThemeToConfig;
10624
10630
  exports.collectFontsFromConfig = collectFontsFromConfig;
10625
10631
  exports.loadGoogleFontCSS = loadGoogleFontCSS;
10632
+ exports.normalizeFontFamily = normalizeFontFamily;
10626
10633
  exports.resolveFromForm = resolveFromForm;
10627
10634
  exports.resolveTemplateData = resolveTemplateData;
10628
10635
  //# sourceMappingURL=index.cjs.map