embroidery-qc-image 1.0.33 → 1.0.34
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/components/EmbroideryQCImage.d.ts.map +1 -1
- package/dist/index.esm.js +24 -12
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +24 -12
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmbroideryQCImage.d.ts","sourceRoot":"","sources":["../../src/components/EmbroideryQCImage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAY,MAAM,UAAU,CAAC;AAChF,OAAO,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"EmbroideryQCImage.d.ts","sourceRoot":"","sources":["../../src/components/EmbroideryQCImage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAY,MAAM,UAAU,CAAC;AAChF,OAAO,yBAAyB,CAAC;AAgLjC,MAAM,WAAW,8BAA8B;IAC7C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,WAAW,GAAG,YAAY,GAAG,YAAY,CAAC;IACrD,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAiiBD,QAAA,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CA2HvD,CAAC;AA8nFF,eAAO,MAAM,6BAA6B,GACxC,QAAQ,kBAAkB,EAC1B,UAAS,8BAAmC,KAC3C,OAAO,CAAC,IAAI,GAAG,IAAI,CAuBrB,CAAC;AAEF,eAAO,MAAM,6BAA6B,GACxC,QAAQ,kBAAkB,EAC1B,UAAS,8BAAmC,KAC3C,OAAO,CAAC,MAAM,GAAG,IAAI,CAuBvB,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
package/dist/index.esm.js
CHANGED
|
@@ -141,18 +141,30 @@ const loadFont = (fontName) => {
|
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
143
|
return new Promise((resolve) => {
|
|
144
|
-
const
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
.
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
144
|
+
const fontFormats = ['woff2', 'ttf', 'otf'];
|
|
145
|
+
let currentFormatIndex = 0;
|
|
146
|
+
const tryLoadFont = () => {
|
|
147
|
+
if (currentFormatIndex >= fontFormats.length) {
|
|
148
|
+
console.warn(`Could not load font ${fontName} from CDN (tried all formats)`);
|
|
149
|
+
resolve();
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
const format = fontFormats[currentFormatIndex];
|
|
153
|
+
const fontUrl = `${BASE_URLS.FONT}/${encodeURIComponent(fontName)}.${format}`;
|
|
154
|
+
const fontFace = new FontFace(fontName, `url(${fontUrl})`);
|
|
155
|
+
fontFace
|
|
156
|
+
.load()
|
|
157
|
+
.then((loadedFont) => {
|
|
158
|
+
document.fonts.add(loadedFont);
|
|
159
|
+
resolve();
|
|
160
|
+
})
|
|
161
|
+
.catch(() => {
|
|
162
|
+
// Try next format
|
|
163
|
+
currentFormatIndex++;
|
|
164
|
+
tryLoadFont();
|
|
165
|
+
});
|
|
166
|
+
};
|
|
167
|
+
tryLoadFont();
|
|
156
168
|
});
|
|
157
169
|
};
|
|
158
170
|
const getImageUrl = (type, value) => {
|