@claspo/document-connector 16.7.12 → 16.7.13-ctx.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.
@@ -1 +1 @@
1
- import ErrorLogger from"@claspo/renderer/error/ErrorLogger";import{buildFallbackRequest,buildMetadataRequest,fetchMetadata,getMetadataCacheKey,makeFontDescriptor,mergeResourceCss,parseFontFaces,resolveResources}from"./GoogleFontsMetadataService";import{buildGoogleFontsLogMessage,normalizeFontInput,parseGoogleFontsLogMessage,sortFontVariations}from"./GoogleFontsUtils";class GoogleFontsRegistry{constructor(){this.statesByDocument=new WeakMap}async loadFonts(e){const t=e.document||document,s=this.normalizeFontsForLoading(e.fonts);if(!s.length)return;const o=s.map(e=>e.fontFamily).join(", "),r=this.getState(t),n=this.getOwner(r,e.ownerId);try{const a=await this.getFontFaces(r,s);if(!this.isCurrentOwner(r,e.ownerId,n))return;if(!a.length)throw new Error(buildGoogleFontsLogMessage("metadata response contained no @font-face rules",{fontFamilies:o}));const i=resolveResources(s,a);if(!this.isCurrentOwner(r,e.ownerId,n))return;if(i.warnings.forEach(t=>this.logError(t.message,e.context)),!i.resources.length)throw new Error(buildGoogleFontsLogMessage("metadata response contained no matching font faces",{fontFamilies:o}));const l=i.resources.map(s=>this.addResource(r,n,t,e.ownerId,s));await this.waitForFonts(l.map(e=>e.resource),r,t,e.context)}catch(a){if(!this.isCurrentOwner(r,e.ownerId,n))return;const i=parseGoogleFontsLogMessage(a instanceof Error?a.message:String(a));if(this.logError(buildGoogleFontsLogMessage("optimized CSS load failed, falling back to stylesheet link",Object.assign({fontFamilies:o,cause:i.message},i.props)),e.context),await this.addFallbackLink(r,n,t,e.ownerId,s,e.context),!this.isCurrentOwner(r,e.ownerId,n))return;await this.waitForFonts(this.generateFallbackResources(s),r,t,e.context)}}releaseOwner(e){if(!e.document)return;const t=this.statesByDocument.get(e.document);if(!t)return;const s=t.ownersById.get(e.ownerId);s&&(s.resourceKeys.forEach(s=>{const o=t.resourcesByKey.get(s);o&&(o.owners.delete(e.ownerId),o.owners.size||(o.element.remove(),t.resourcesByKey.delete(s)))}),s.fallbackUrls.forEach(s=>{const o=t.fallbackLinksByUrl.get(s);o&&(o.owners.delete(e.ownerId),o.owners.size||(o.element.remove(),t.fallbackLinksByUrl.delete(s)))}),t.ownersById.delete(e.ownerId))}resetForTests(){this.statesByDocument=new WeakMap}normalizeFontsForLoading(e){const t=[];return(e||[]).forEach(e=>{const s=normalizeFontInput(e);if(!s)return;if("string"!=typeof e&&e.variations&&e.variations.length)return void t.push(s);const o=[];s.variations.forEach(e=>{o.push({style:"normal",weight:e.weight}),o.push({style:"italic",weight:e.weight})}),t.push({fontFamily:s.fontFamily,variations:sortFontVariations(o)})}),this.mergeFontRequests(t)}mergeFontRequests(e){const t=new Map;return e.forEach(e=>{const s=t.get(e.fontFamily);s?s.variations=sortFontVariations(s.variations.concat(e.variations)):t.set(e.fontFamily,{fontFamily:e.fontFamily,variations:sortFontVariations(e.variations)})}),Array.from(t.values())}getState(e){let t=this.statesByDocument.get(e);return t||(t={metadataByCacheKey:new Map,pendingMetadataByUrl:new Map,fallbackLinksByUrl:new Map,resourcesByKey:new Map,browserLoadsByResourceKey:new Map,ownersById:new Map},this.statesByDocument.set(e,t)),t}getOwner(e,t){let s=e.ownersById.get(t);return s||(s={resourceKeys:new Set,fallbackUrls:new Set},e.ownersById.set(t,s)),s}isCurrentOwner(e,t,s){return e.ownersById.get(t)===s}async getFontFaces(e,t){const s=this.getCachedFontFaces(e,t);if(!s.missingFonts.length)return s.cachedFontFaces;const o=this.getPendingFontFaces(e,s.missingFonts),r=o.pendingPromises.slice(),n=buildMetadataRequest(o.missingFonts);if(n){let t=e.pendingMetadataByUrl.get(n.url);if(!t){const s=fetchMetadata(n).then(t=>{const s=parseFontFaces(t);return this.cacheFontFaces(e,o.missingFonts,s),s}).finally(()=>e.pendingMetadataByUrl.delete(n.url));t={url:n.url,fonts:o.missingFonts,promise:s},e.pendingMetadataByUrl.set(n.url,t)}r.push(t.promise)}if(!r.length)return s.cachedFontFaces;const a=await Promise.all(r);return s.cachedFontFaces.concat(...a)}getCachedFontFaces(e,t){const s=[],o=new Set,r=[];for(const n of t){const t=getMetadataCacheKey(n).split("|")[0],a=[];Array.from(new Set((n.variations||[]).map(e=>e.style))).forEach(r=>{const i=Array.from(e.metadataByCacheKey.values()).find(e=>e.families.has(t)&&e.styles.has(r));i?i.fontFaces.filter(e=>this.isMatchingFontFace(e,t,r)).forEach(e=>{const t=this.getFontFaceCacheIdentity(e);o.has(t)||(o.add(t),s.push(e))}):a.push(...(n.variations||[]).filter(e=>e.style===r))}),a.length&&r.push({fontFamily:n.fontFamily,variations:sortFontVariations(a)})}return{cachedFontFaces:s,missingFonts:r}}getPendingFontFaces(e,t){const s=[],o=new Set,r=[];for(const n of t){const t=getMetadataCacheKey(n).split("|")[0],a=[];Array.from(new Set((n.variations||[]).map(e=>e.style))).forEach(r=>{const i=Array.from(e.pendingMetadataByUrl.values()).find(e=>this.hasFontStyleCoverage(e.fonts,t,r));i?o.has(i.url)||(o.add(i.url),s.push(i.promise)):a.push(...(n.variations||[]).filter(e=>e.style===r))}),a.length&&r.push({fontFamily:n.fontFamily,variations:sortFontVariations(a)})}return{pendingPromises:s,missingFonts:r}}cacheFontFaces(e,t,s){t.forEach(t=>{const o=getMetadataCacheKey(t).split("|")[0],r=new Set((t.variations||[]).map(e=>e.style)),n=s.filter(e=>this.isMatchingFontFace(e,o));e.metadataByCacheKey.set(`${o}|${Array.from(r).sort().join(",")||"normal"}`,{families:new Set([o]),styles:r,fontFaces:n})})}isMatchingFontFace(e,t,s){if(!e||!e.family)return!1;return!!getMetadataCacheKey({fontFamily:e.family,variations:[{style:e.style,weight:e.minWeight}]}).startsWith(t+"|")&&(!s||e.style===s)}getFontFaceCacheIdentity(e){return[e.family,e.style,e.minWeight,e.maxWeight,e.src,e.unicodeRange].join("|")}hasFontStyleCoverage(e,t,s){return(e||[]).some(e=>getMetadataCacheKey(e).split("|")[0]===t&&(e.variations||[]).some(e=>e.style===s))}addResource(e,t,s,o,r){const n=e.resourcesByKey.get(r.key);if(n){n.owners.add(o),t.resourceKeys.add(r.key);const e=Math.min(n.minWeight,r.minWeight),s=Math.max(n.maxWeight,r.maxWeight);return e===n.minWeight&&s===n.maxWeight||(n.minWeight=e,n.maxWeight=s,n.resource.minWeight=e,n.resource.maxWeight=s,n.resource.css=mergeResourceCss(n.resource,e,s),n.resource.descriptor=makeFontDescriptor(n.resource.family,n.resource.style,e),n.element.textContent=n.resource.css),n}const a=s.createElement("style");a.setAttribute("data-cl-google-fonts","true"),a.textContent=r.css,s.head&&s.head.appendChild(a);const i={resource:r,element:a,owners:new Set([o]),minWeight:r.minWeight,maxWeight:r.maxWeight};return e.resourcesByKey.set(r.key,i),t.resourceKeys.add(r.key),i}addFallbackLink(e,t,s,o,r,n){const a=buildFallbackRequest(r);if(!a||!s.head)return Promise.resolve();const i=e.fallbackLinksByUrl.get(a.url);if(i)return i.owners.add(o),t.fallbackUrls.add(a.url),i.promise;const l=s.createElement("link");l.rel="stylesheet",l.href=a.url;const c=new Promise((t,s)=>{l.onload=()=>t(),l.onerror=()=>{this.logError(buildGoogleFontsLogMessage("fallback stylesheet failed to load",{url:a.url,fontFamilies:a.fontFamilyLabel}),n),l.remove(),e.fallbackLinksByUrl.delete(a.url),s(new Error(buildGoogleFontsLogMessage("fallback stylesheet failed to load",{url:a.url})))}}),d={url:a.url,element:l,owners:new Set([o]),promise:c.catch(()=>{})};return e.fallbackLinksByUrl.set(a.url,d),t.fallbackUrls.add(a.url),s.head.appendChild(l),d.promise}generateFallbackResources(e){return e.reduce((e,t)=>((t.variations||[]).forEach(s=>{const o=makeFontDescriptor(t.fontFamily,s.style,s.weight);e.push({key:`${t.fontFamily}|${s.style}|${s.weight}|fallback`,family:t.fontFamily,style:s.style,minWeight:s.weight,maxWeight:s.weight,src:"",unicodeRange:"",css:"",descriptor:o})}),e),[])}async waitForFonts(e,t,s,o){if(!e.length||!s.fonts)return;const r=this.prepareFontResourceLoads(e,t,s,o);if(!r.length)return;const n=this.createFontTester(r.map(e=>e.resource),s);n&&s.body&&s.body.appendChild(n);const a=this.waitForAllFontsToLoad(r);let i=null;const l=new Promise(e=>{i=setTimeout(()=>{this.logError(buildGoogleFontsLogMessage("font loading timed out",{timeoutMs:2e3,pending:r.map(e=>e.resource.descriptor).join("; "),src:r.map(e=>e.resource.src).join("; ")}),o),e()},2e3)});try{await Promise.race([a,l])}finally{i&&clearTimeout(i),n&&n.remove()}}prepareFontResourceLoads(e,t,s,o){return e.reduce((e,r)=>{const n=t.browserLoadsByResourceKey.get(r.key);if(n&&n.loaded)return e;if(n&&n.promise)return e;const a={loaded:!1,promise:null},i=this.loadBrowserFont(r,s).then(()=>{a.loaded=!0,a.promise=null}).catch(e=>{t.browserLoadsByResourceKey.delete(r.key),this.logError(buildGoogleFontsLogMessage("font face failed to load",{descriptor:r.descriptor,src:r.src,error:String(e)}),o)});return a.promise=i,t.browserLoadsByResourceKey.set(r.key,a),e.push({resource:r,promise:i}),e},[])}async waitForAllFontsToLoad(e){for(let t=0;t<e.length;t+=10)await Promise.all(e.slice(t,t+10).map(e=>e.promise))}async loadBrowserFont(e,t){const s=t.fonts;if(!s)return;let o=!1;try{o=s.check(e.descriptor)}catch(e){}o||await s.load(e.descriptor)}createFontTester(e,t){if(!t.body)return null;const s=t.createElement("div");s.setAttribute("aria-hidden","true"),s.style.cssText="\n position: fixed;\n top: -9999px;\n left: -9999px;\n width: 1px;\n height: 1px;\n overflow: hidden;\n visibility: hidden;\n pointer-events: none;\n user-select: none;\n z-index: -1;\n ";const o={latin:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",cyrillic:"АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдеёжзийклмнопрстуфхцчшщъыьэюя"};return e.forEach(e=>{Object.entries(o).forEach(([o,r])=>{const n=t.createElement("span");n.textContent=r,n.style.cssText=`\n font-family: "${e.family}", sans-serif;\n font-weight: ${e.minWeight};\n font-style: ${e.style};\n font-size: 20px;\n display: inline-block;\n white-space: nowrap;\n `,n.dataset.font=`${e.family}-${e.minWeight}-${e.style}`,n.dataset.subset=o,s.appendChild(n)})}),s}logError(e,t){const{message:s,props:o}=parseGoogleFontsLogMessage(e);t&&void 0!==t.widgetId&&null!==t.widgetId&&(o.widgetId=t.widgetId),t&&t.siteId&&(o.siteId=t.siteId);const r=Object.keys(o).map(e=>`${e}: ${o[e]}`),n=r.length?` (${r.join(", ")})`:"";ErrorLogger.log(`GoogleFontsLoader error: ${s}${n}`)}}export default new GoogleFontsRegistry;
1
+ import ErrorLogger from"@claspo/renderer/error/ErrorLogger";import{buildFallbackRequest,buildMetadataRequest,fetchMetadata,getMetadataCacheKey,makeFontDescriptor,mergeResourceCss,parseFontFaces,resolveResources}from"./GoogleFontsMetadataService";import{buildGoogleFontsLogMessage,normalizeFontInput,parseGoogleFontsLogMessage,sortFontVariations}from"./GoogleFontsUtils";class GoogleFontsRegistry{constructor(){this.statesByDocument=new WeakMap}async loadFonts(e){const t=e.document||document,s=this.normalizeFontsForLoading(e.fonts);if(!s.length)return;const o=s.map(e=>e.fontFamily).join(", "),r=this.getState(t),n=this.getOwner(r,e.ownerId);try{const a=await this.getFontFaces(r,s);if(!this.isCurrentOwner(r,e.ownerId,n))return;if(!a.length)throw new Error(buildGoogleFontsLogMessage("metadata response contained no @font-face rules",{fontFamilies:o}));const i=resolveResources(s,a);if(!this.isCurrentOwner(r,e.ownerId,n))return;if(i.warnings.forEach(t=>this.logError(t.message,e.context)),!i.resources.length)throw new Error(buildGoogleFontsLogMessage("metadata response contained no matching font faces",{fontFamilies:o}));const l=i.resources.map(s=>this.addResource(r,n,t,e.ownerId,s));await this.waitForFonts(l.map(e=>e.resource),r,t,e.context)}catch(a){if(!this.isCurrentOwner(r,e.ownerId,n))return;const i=parseGoogleFontsLogMessage(a instanceof Error?a.message:String(a));if(this.logError(buildGoogleFontsLogMessage("optimized CSS load failed, falling back to stylesheet link",Object.assign({fontFamilies:o,cause:i.message},i.props)),e.context),await this.addFallbackLink(r,n,t,e.ownerId,s,e.context),!this.isCurrentOwner(r,e.ownerId,n))return;await this.waitForFonts(this.generateFallbackResources(s),r,t,e.context)}}releaseOwner(e){if(!e.document)return;const t=this.statesByDocument.get(e.document);if(!t)return;const s=t.ownersById.get(e.ownerId);s&&(s.resourceKeys.forEach(s=>{const o=t.resourcesByKey.get(s);o&&(o.owners.delete(e.ownerId),o.owners.size||(o.element.remove(),t.resourcesByKey.delete(s)))}),s.fallbackUrls.forEach(s=>{const o=t.fallbackLinksByUrl.get(s);o&&(o.owners.delete(e.ownerId),o.owners.size||(o.element.remove(),t.fallbackLinksByUrl.delete(s)))}),t.ownersById.delete(e.ownerId))}resetForTests(){this.statesByDocument=new WeakMap}normalizeFontsForLoading(e){const t=[];return(e||[]).forEach(e=>{const s=normalizeFontInput(e);if(!s)return;if("string"!=typeof e&&e.variations&&e.variations.length)return void t.push(s);const o=[];s.variations.forEach(e=>{o.push({style:"normal",weight:e.weight}),o.push({style:"italic",weight:e.weight})}),t.push({fontFamily:s.fontFamily,variations:sortFontVariations(o)})}),this.mergeFontRequests(t)}mergeFontRequests(e){const t=new Map;return e.forEach(e=>{const s=t.get(e.fontFamily);s?s.variations=sortFontVariations(s.variations.concat(e.variations)):t.set(e.fontFamily,{fontFamily:e.fontFamily,variations:sortFontVariations(e.variations)})}),Array.from(t.values())}getState(e){let t=this.statesByDocument.get(e);return t||(t={metadataByCacheKey:new Map,pendingMetadataByUrl:new Map,fallbackLinksByUrl:new Map,resourcesByKey:new Map,browserLoadsByResourceKey:new Map,ownersById:new Map},this.statesByDocument.set(e,t)),t}getOwner(e,t){let s=e.ownersById.get(t);return s||(s={resourceKeys:new Set,fallbackUrls:new Set},e.ownersById.set(t,s)),s}isCurrentOwner(e,t,s){return e.ownersById.get(t)===s}async getFontFaces(e,t){const s=this.getCachedFontFaces(e,t);if(!s.missingFonts.length)return s.cachedFontFaces;const o=this.getPendingFontFaces(e,s.missingFonts),r=o.pendingPromises.slice(),n=buildMetadataRequest(o.missingFonts);if(n){let t=e.pendingMetadataByUrl.get(n.url);if(!t){const s=fetchMetadata(n).then(t=>{const s=parseFontFaces(t);return this.cacheFontFaces(e,o.missingFonts,s),s}).finally(()=>e.pendingMetadataByUrl.delete(n.url));t={url:n.url,fonts:o.missingFonts,promise:s},e.pendingMetadataByUrl.set(n.url,t)}r.push(t.promise)}if(!r.length)return s.cachedFontFaces;const a=await Promise.all(r);return s.cachedFontFaces.concat(...a)}getCachedFontFaces(e,t){const s=[],o=new Set,r=[];for(const n of t){const t=getMetadataCacheKey(n).split("|")[0],a=[];Array.from(new Set((n.variations||[]).map(e=>e.style))).forEach(r=>{const i=Array.from(e.metadataByCacheKey.values()).find(e=>e.families.has(t)&&e.styles.has(r));i?i.fontFaces.filter(e=>this.isMatchingFontFace(e,t,r)).forEach(e=>{const t=this.getFontFaceCacheIdentity(e);o.has(t)||(o.add(t),s.push(e))}):a.push(...(n.variations||[]).filter(e=>e.style===r))}),a.length&&r.push({fontFamily:n.fontFamily,variations:sortFontVariations(a)})}return{cachedFontFaces:s,missingFonts:r}}getPendingFontFaces(e,t){const s=[],o=new Set,r=[];for(const n of t){const t=getMetadataCacheKey(n).split("|")[0],a=[];Array.from(new Set((n.variations||[]).map(e=>e.style))).forEach(r=>{const i=Array.from(e.pendingMetadataByUrl.values()).find(e=>this.hasFontStyleCoverage(e.fonts,t,r));i?o.has(i.url)||(o.add(i.url),s.push(i.promise)):a.push(...(n.variations||[]).filter(e=>e.style===r))}),a.length&&r.push({fontFamily:n.fontFamily,variations:sortFontVariations(a)})}return{pendingPromises:s,missingFonts:r}}cacheFontFaces(e,t,s){t.forEach(t=>{const o=getMetadataCacheKey(t).split("|")[0],r=new Set((t.variations||[]).map(e=>e.style)),n=s.filter(e=>this.isMatchingFontFace(e,o));e.metadataByCacheKey.set(`${o}|${Array.from(r).sort().join(",")||"normal"}`,{families:new Set([o]),styles:r,fontFaces:n})})}isMatchingFontFace(e,t,s){if(!e||!e.family)return!1;return!!getMetadataCacheKey({fontFamily:e.family,variations:[{style:e.style,weight:e.minWeight}]}).startsWith(t+"|")&&(!s||e.style===s)}getFontFaceCacheIdentity(e){return[e.family,e.style,e.minWeight,e.maxWeight,e.src,e.unicodeRange].join("|")}hasFontStyleCoverage(e,t,s){return(e||[]).some(e=>getMetadataCacheKey(e).split("|")[0]===t&&(e.variations||[]).some(e=>e.style===s))}addResource(e,t,s,o,r){const n=e.resourcesByKey.get(r.key);if(n){n.owners.add(o),t.resourceKeys.add(r.key);const e=Math.min(n.minWeight,r.minWeight),s=Math.max(n.maxWeight,r.maxWeight);return e===n.minWeight&&s===n.maxWeight||(n.minWeight=e,n.maxWeight=s,n.resource.minWeight=e,n.resource.maxWeight=s,n.resource.css=mergeResourceCss(n.resource,e,s),n.resource.descriptor=makeFontDescriptor(n.resource.family,n.resource.style,e),n.element.textContent=n.resource.css),n}const a=s.createElement("style");a.setAttribute("data-cl-google-fonts","true"),a.textContent=r.css,s.head&&s.head.appendChild(a);const i={resource:r,element:a,owners:new Set([o]),minWeight:r.minWeight,maxWeight:r.maxWeight};return e.resourcesByKey.set(r.key,i),t.resourceKeys.add(r.key),i}addFallbackLink(e,t,s,o,r,n){const a=buildFallbackRequest(r);if(!a||!s.head)return Promise.resolve();const i=e.fallbackLinksByUrl.get(a.url);if(i)return i.owners.add(o),t.fallbackUrls.add(a.url),i.promise;const l=s.createElement("link");l.rel="stylesheet",l.href=a.url;const c=new Promise((t,s)=>{l.onload=()=>t(),l.onerror=()=>{this.logError(buildGoogleFontsLogMessage("fallback stylesheet failed to load",{url:a.url,fontFamilies:a.fontFamilyLabel}),n),l.remove(),e.fallbackLinksByUrl.delete(a.url),s(new Error(buildGoogleFontsLogMessage("fallback stylesheet failed to load",{url:a.url})))}}),d={url:a.url,element:l,owners:new Set([o]),promise:c.catch(()=>{})};return e.fallbackLinksByUrl.set(a.url,d),t.fallbackUrls.add(a.url),s.head.appendChild(l),d.promise}generateFallbackResources(e){return e.reduce((e,t)=>((t.variations||[]).forEach(s=>{const o=makeFontDescriptor(t.fontFamily,s.style,s.weight);e.push({key:`${t.fontFamily}|${s.style}|${s.weight}|fallback`,family:t.fontFamily,style:s.style,minWeight:s.weight,maxWeight:s.weight,src:"",unicodeRange:"",css:"",descriptor:o})}),e),[])}async waitForFonts(e,t,s,o){if(!e.length||!s.fonts)return;const r=this.prepareFontResourceLoads(e,t,s,o);if(!r.length)return;const n=this.createFontTester(r.map(e=>e.resource),s);n&&s.body&&s.body.appendChild(n);const a=this.waitForAllFontsToLoad(r);let i=null;const l=new Promise(e=>{i=setTimeout(e,2e3)});try{await Promise.race([a,l])}finally{i&&clearTimeout(i),n&&n.remove()}}prepareFontResourceLoads(e,t,s,o){return e.reduce((e,r)=>{const n=t.browserLoadsByResourceKey.get(r.key);if(n&&n.loaded)return e;if(n&&n.promise)return e;const a={loaded:!1,promise:null},i=this.loadBrowserFont(r,s).then(()=>{a.loaded=!0,a.promise=null}).catch(e=>{t.browserLoadsByResourceKey.delete(r.key),this.logError(buildGoogleFontsLogMessage("font face failed to load",{descriptor:r.descriptor,src:r.src,error:String(e)}),o)});return a.promise=i,t.browserLoadsByResourceKey.set(r.key,a),e.push({resource:r,promise:i}),e},[])}async waitForAllFontsToLoad(e){for(let t=0;t<e.length;t+=10)await Promise.all(e.slice(t,t+10).map(e=>e.promise))}async loadBrowserFont(e,t){const s=t.fonts;if(!s)return;let o=!1;try{o=s.check(e.descriptor)}catch(e){}o||await s.load(e.descriptor)}createFontTester(e,t){if(!t.body)return null;const s=t.createElement("div");s.setAttribute("aria-hidden","true"),s.style.cssText="\n position: fixed;\n top: -9999px;\n left: -9999px;\n width: 1px;\n height: 1px;\n overflow: hidden;\n visibility: hidden;\n pointer-events: none;\n user-select: none;\n z-index: -1;\n ";const o={latin:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",cyrillic:"АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдеёжзийклмнопрстуфхцчшщъыьэюя"};return e.forEach(e=>{Object.entries(o).forEach(([o,r])=>{const n=t.createElement("span");n.textContent=r,n.style.cssText=`\n font-family: "${e.family}", sans-serif;\n font-weight: ${e.minWeight};\n font-style: ${e.style};\n font-size: 20px;\n display: inline-block;\n white-space: nowrap;\n `,n.dataset.font=`${e.family}-${e.minWeight}-${e.style}`,n.dataset.subset=o,s.appendChild(n)})}),s}logError(e,t){const{message:s,props:o}=parseGoogleFontsLogMessage(e);t&&void 0!==t.widgetId&&null!==t.widgetId&&(o.widgetId=t.widgetId),t&&t.siteId&&(o.siteId=t.siteId);const r=Object.keys(o).map(e=>`${e}: ${o[e]}`),n=r.length?` (${r.join(", ")})`:"";ErrorLogger.log(`GoogleFontsLoader error: ${s}${n}`)}}export default new GoogleFontsRegistry;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@claspo/document-connector",
3
- "version": "16.7.12",
3
+ "version": "16.7.13-ctx.7",
4
4
  "scripts": {
5
5
  "test": "jest --no-cache --coverage",
6
6
  "build": "rm -rf out && tsc --project tsconfig.json && npm run minify",
@@ -15,7 +15,7 @@
15
15
  },
16
16
  "dependencies": {
17
17
  "@claspo/common": "7.3.0",
18
- "@claspo/renderer": "18.7.4"
18
+ "@claspo/renderer": "18.7.4-ctx.7"
19
19
  },
20
20
  "devDependencies": {
21
21
  "@babel/core": "^7.28.5",