@liiift-studio/sanity-font-manager 2.5.2 → 2.5.4
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.js +17708 -827
- package/dist/index.mjs +17398 -620
- package/package.json +1 -3
- package/src/index.js +4 -0
- package/src/utils/parseFont.js +4 -29
- package/src/utils/setupDecompressors.js +10 -0
- package/dist/UploadModal-2AAJXZJK.js +0 -6
- package/dist/UploadModal-DDTVJ2MA.mjs +0 -6
- package/dist/chunk-FT7YTFZW.mjs +0 -7711
- package/dist/chunk-YMQEM4AO.js +0 -7711
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@liiift-studio/sanity-font-manager",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.4",
|
|
4
4
|
"description": "Sanity Studio plugin — full font management suite with batch upload, format conversion, metadata extraction, CSS generation, collection/pair generation, and script variant support. Supports Sanity v3, v4, and v5.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Liiift Studio",
|
|
@@ -51,9 +51,7 @@
|
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"base-64": "^1.0.0",
|
|
54
|
-
"lib-font": "^3.0.1",
|
|
55
54
|
"nanoid": "^5.0.0",
|
|
56
|
-
"pako": "^2.1.0",
|
|
57
55
|
"slugify": "^1.6.6"
|
|
58
56
|
},
|
|
59
57
|
"peerDependencies": {
|
package/src/index.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
// Entry point for @liiift-studio/sanity-font-manager — exports all font manager components, hooks, and utilities
|
|
2
2
|
|
|
3
|
+
// Bootstrap decompressors FIRST — sets globalThis.pako and globalThis.unbrotli
|
|
4
|
+
// before lib-font can be evaluated by any bundler. This must be the first import.
|
|
5
|
+
import './utils/setupDecompressors.js';
|
|
6
|
+
|
|
3
7
|
// Components
|
|
4
8
|
export { BatchUploadFonts } from './components/BatchUploadFonts.jsx';
|
|
5
9
|
export { GenerateCollectionsPairsComponent } from './components/GenerateCollectionsPairsComponent.jsx';
|
package/src/utils/parseFont.js
CHANGED
|
@@ -1,31 +1,8 @@
|
|
|
1
|
-
// Async font parser — wraps lib-font event model in a Promise
|
|
1
|
+
// Async font parser — wraps lib-font event model in a Promise.
|
|
2
|
+
// Decompressor globals (pako, unbrotli) are set by setupDecompressors.js
|
|
3
|
+
// which is imported at the top of index.js before this module loads.
|
|
2
4
|
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
// Set decompressor globals BEFORE lib-font is imported.
|
|
6
|
-
// lib-font reads globalThis.pako and globalThis.unbrotli at module evaluation time
|
|
7
|
-
// (top of woff.js / woff2.js), not at parse time. These must be set before lib-font
|
|
8
|
-
// is first evaluated, so we use dynamic import() below to guarantee ordering.
|
|
9
|
-
globalThis.pako = pako;
|
|
10
|
-
|
|
11
|
-
// unbrotli is a UMD that sets globalThis.unbrotli as a side effect on evaluation.
|
|
12
|
-
// We vendor it from lib-font/lib/unbrotli.js because the subpath is not in
|
|
13
|
-
// lib-font's exports map (ERR_PACKAGE_PATH_NOT_EXPORTED).
|
|
14
|
-
import '../vendor/unbrotli.js';
|
|
15
|
-
|
|
16
|
-
// Lazy-loaded lib-font Font constructor — resolved on first parseFont() call.
|
|
17
|
-
// Using dynamic import() guarantees globalThis.pako and globalThis.unbrotli are
|
|
18
|
-
// set before lib-font evaluates, which static imports cannot guarantee in ESM.
|
|
19
|
-
let _Font = null;
|
|
20
|
-
|
|
21
|
-
/** Returns the lib-font Font constructor, loading it on first call */
|
|
22
|
-
async function getFont() {
|
|
23
|
-
if (!_Font) {
|
|
24
|
-
const mod = await import('lib-font');
|
|
25
|
-
_Font = mod.Font;
|
|
26
|
-
}
|
|
27
|
-
return _Font;
|
|
28
|
-
}
|
|
5
|
+
import { Font } from 'lib-font';
|
|
29
6
|
|
|
30
7
|
/** Maximum font file size accepted for parsing (50 MB) */
|
|
31
8
|
const MAX_FONT_FILE_SIZE = 50 * 1024 * 1024;
|
|
@@ -44,8 +21,6 @@ export async function parseFont(buffer, filename) {
|
|
|
44
21
|
throw new Error(`Font file exceeds ${MAX_FONT_FILE_SIZE / 1024 / 1024}MB limit: ${filename} (${(buffer.byteLength / 1024 / 1024).toFixed(1)}MB)`);
|
|
45
22
|
}
|
|
46
23
|
|
|
47
|
-
const Font = await getFont();
|
|
48
|
-
|
|
49
24
|
return new Promise((resolve, reject) => {
|
|
50
25
|
const font = new Font('font', { skipStyleSheet: true });
|
|
51
26
|
font.onload = (evt) => resolve(evt.detail.font);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Sets up globalThis.pako and globalThis.unbrotli for lib-font WOFF/WOFF2 decompression.
|
|
2
|
+
// This module MUST be imported before lib-font is ever evaluated.
|
|
3
|
+
// It runs synchronously at module evaluation time to set the globals.
|
|
4
|
+
|
|
5
|
+
import pako from 'pako';
|
|
6
|
+
import '../vendor/unbrotli.js';
|
|
7
|
+
|
|
8
|
+
globalThis.pako = pako;
|
|
9
|
+
// unbrotli.js is a UMD that sets globalThis.unbrotli as a side effect on evaluation.
|
|
10
|
+
// The import above triggers that side effect.
|