@liiift-studio/sanity-font-manager 2.5.7 → 2.5.9
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
CHANGED
|
@@ -18497,14 +18497,16 @@ var SingleUploaderTool = (props) => {
|
|
|
18497
18497
|
if (!(ttfAsset == null ? void 0 : ttfAsset.url)) throw new Error("Could not fetch TTF file URL");
|
|
18498
18498
|
const arrayBuffer = await (await fetch(ttfAsset.url)).arrayBuffer();
|
|
18499
18499
|
const font2 = await parseFont(arrayBuffer, `${doc_id}.ttf`);
|
|
18500
|
-
const { weightName, subfamilyName, style, variableFont } = extractFontMetadata(
|
|
18500
|
+
const { weightName, subfamilyName, fontTitle, style, variableFont } = extractFontMetadata(
|
|
18501
18501
|
font2,
|
|
18502
18502
|
doc_typefaceName,
|
|
18503
18503
|
weightKeywordList,
|
|
18504
|
-
italicKeywordList
|
|
18504
|
+
italicKeywordList,
|
|
18505
|
+
false,
|
|
18506
|
+
null
|
|
18505
18507
|
);
|
|
18506
18508
|
const weight = determineWeight(font2, weightName);
|
|
18507
|
-
await client.patch(doc_id).set({ weightName, subfamily: subfamilyName, style, variableFont, weight }).commit();
|
|
18509
|
+
await client.patch(doc_id).set({ title: fontTitle, weightName, subfamily: subfamilyName, style, variableFont, weight }).commit();
|
|
18508
18510
|
const fontData = await generateFontData({
|
|
18509
18511
|
url: ttfAsset.url,
|
|
18510
18512
|
fontKit: font2,
|
|
@@ -18654,15 +18656,17 @@ var SingleUploaderTool = (props) => {
|
|
|
18654
18656
|
if (code === "ttf") {
|
|
18655
18657
|
const fontBuffer = await readFontFile(file);
|
|
18656
18658
|
const font2 = await parseFont(fontBuffer, file.name);
|
|
18657
|
-
const { weightName, subfamilyName, style, variableFont } = extractFontMetadata(
|
|
18659
|
+
const { weightName, subfamilyName, fontTitle, style, variableFont } = extractFontMetadata(
|
|
18658
18660
|
font2,
|
|
18659
18661
|
doc_typefaceName,
|
|
18660
18662
|
weightKeywordList,
|
|
18661
|
-
italicKeywordList
|
|
18663
|
+
italicKeywordList,
|
|
18664
|
+
false,
|
|
18665
|
+
null
|
|
18662
18666
|
);
|
|
18663
18667
|
const weight = determineWeight(font2, weightName);
|
|
18664
18668
|
const normalizedId = doc_id.startsWith("drafts.") ? doc_id.replace("drafts.", "") : doc_id;
|
|
18665
|
-
await client.patch(normalizedId).set({ weightName, subfamily: subfamilyName, style, variableFont, weight }).commit();
|
|
18669
|
+
await client.patch(normalizedId).set({ title: fontTitle, weightName, subfamily: subfamilyName, style, variableFont, weight }).commit();
|
|
18666
18670
|
}
|
|
18667
18671
|
onChange((0, import_sanity6.set)(newFileInput));
|
|
18668
18672
|
setTimeout(() => {
|
|
@@ -19584,6 +19588,9 @@ function KeyValueReferenceInput(props) {
|
|
|
19584
19588
|
const [availableReferences, setAvailableReferences] = (0, import_react23.useState)([]);
|
|
19585
19589
|
const sanityClient = useSanityClient();
|
|
19586
19590
|
const formDocument = (0, import_sanity10.useFormValue)([]);
|
|
19591
|
+
(0, import_react23.useEffect)(() => {
|
|
19592
|
+
setPairs(value);
|
|
19593
|
+
}, [value]);
|
|
19587
19594
|
(0, import_react23.useEffect)(() => {
|
|
19588
19595
|
const refIds = pairs.filter((p2) => {
|
|
19589
19596
|
var _a2;
|
package/dist/index.mjs
CHANGED
|
@@ -18396,14 +18396,16 @@ var SingleUploaderTool = (props) => {
|
|
|
18396
18396
|
if (!(ttfAsset == null ? void 0 : ttfAsset.url)) throw new Error("Could not fetch TTF file URL");
|
|
18397
18397
|
const arrayBuffer = await (await fetch(ttfAsset.url)).arrayBuffer();
|
|
18398
18398
|
const font2 = await parseFont(arrayBuffer, `${doc_id}.ttf`);
|
|
18399
|
-
const { weightName, subfamilyName, style, variableFont } = extractFontMetadata(
|
|
18399
|
+
const { weightName, subfamilyName, fontTitle, style, variableFont } = extractFontMetadata(
|
|
18400
18400
|
font2,
|
|
18401
18401
|
doc_typefaceName,
|
|
18402
18402
|
weightKeywordList,
|
|
18403
|
-
italicKeywordList
|
|
18403
|
+
italicKeywordList,
|
|
18404
|
+
false,
|
|
18405
|
+
null
|
|
18404
18406
|
);
|
|
18405
18407
|
const weight = determineWeight(font2, weightName);
|
|
18406
|
-
await client.patch(doc_id).set({ weightName, subfamily: subfamilyName, style, variableFont, weight }).commit();
|
|
18408
|
+
await client.patch(doc_id).set({ title: fontTitle, weightName, subfamily: subfamilyName, style, variableFont, weight }).commit();
|
|
18407
18409
|
const fontData = await generateFontData({
|
|
18408
18410
|
url: ttfAsset.url,
|
|
18409
18411
|
fontKit: font2,
|
|
@@ -18553,15 +18555,17 @@ var SingleUploaderTool = (props) => {
|
|
|
18553
18555
|
if (code === "ttf") {
|
|
18554
18556
|
const fontBuffer = await readFontFile(file);
|
|
18555
18557
|
const font2 = await parseFont(fontBuffer, file.name);
|
|
18556
|
-
const { weightName, subfamilyName, style, variableFont } = extractFontMetadata(
|
|
18558
|
+
const { weightName, subfamilyName, fontTitle, style, variableFont } = extractFontMetadata(
|
|
18557
18559
|
font2,
|
|
18558
18560
|
doc_typefaceName,
|
|
18559
18561
|
weightKeywordList,
|
|
18560
|
-
italicKeywordList
|
|
18562
|
+
italicKeywordList,
|
|
18563
|
+
false,
|
|
18564
|
+
null
|
|
18561
18565
|
);
|
|
18562
18566
|
const weight = determineWeight(font2, weightName);
|
|
18563
18567
|
const normalizedId = doc_id.startsWith("drafts.") ? doc_id.replace("drafts.", "") : doc_id;
|
|
18564
|
-
await client.patch(normalizedId).set({ weightName, subfamily: subfamilyName, style, variableFont, weight }).commit();
|
|
18568
|
+
await client.patch(normalizedId).set({ title: fontTitle, weightName, subfamily: subfamilyName, style, variableFont, weight }).commit();
|
|
18565
18569
|
}
|
|
18566
18570
|
onChange(set2(newFileInput));
|
|
18567
18571
|
setTimeout(() => {
|
|
@@ -19483,6 +19487,9 @@ function KeyValueReferenceInput(props) {
|
|
|
19483
19487
|
const [availableReferences, setAvailableReferences] = useState16([]);
|
|
19484
19488
|
const sanityClient = useSanityClient();
|
|
19485
19489
|
const formDocument = useFormValue8([]);
|
|
19490
|
+
useEffect11(() => {
|
|
19491
|
+
setPairs(value);
|
|
19492
|
+
}, [value]);
|
|
19486
19493
|
useEffect11(() => {
|
|
19487
19494
|
const refIds = pairs.filter((p2) => {
|
|
19488
19495
|
var _a2;
|
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.9",
|
|
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",
|
|
@@ -29,6 +29,11 @@ export function KeyValueReferenceInput(props) {
|
|
|
29
29
|
const sanityClient = useSanityClient();
|
|
30
30
|
const formDocument = useFormValue([]);
|
|
31
31
|
|
|
32
|
+
/** Syncs local pairs state when the value prop changes externally (e.g. autofill from parent) */
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
setPairs(value);
|
|
35
|
+
}, [value]);
|
|
36
|
+
|
|
32
37
|
/** Fetches and caches display titles for all referenced documents whenever pairs change */
|
|
33
38
|
useEffect(() => {
|
|
34
39
|
const refIds = pairs.filter(p => p.value?._ref).map(p => p.value._ref);
|
|
@@ -194,15 +194,17 @@ export const SingleUploaderTool = (props) => {
|
|
|
194
194
|
const arrayBuffer = await (await fetch(ttfAsset.url)).arrayBuffer();
|
|
195
195
|
const font = await parseFont(arrayBuffer, `${doc_id}.ttf`);
|
|
196
196
|
|
|
197
|
-
const { weightName, subfamilyName, style, variableFont } = extractFontMetadata(
|
|
197
|
+
const { weightName, subfamilyName, fontTitle, style, variableFont } = extractFontMetadata(
|
|
198
198
|
font,
|
|
199
199
|
doc_typefaceName,
|
|
200
200
|
weightKeywordList,
|
|
201
201
|
italicKeywordList,
|
|
202
|
+
false,
|
|
203
|
+
null,
|
|
202
204
|
);
|
|
203
205
|
const weight = determineWeight(font, weightName);
|
|
204
206
|
|
|
205
|
-
await client.patch(doc_id).set({ weightName, subfamily: subfamilyName, style, variableFont, weight }).commit();
|
|
207
|
+
await client.patch(doc_id).set({ title: fontTitle, weightName, subfamily: subfamilyName, style, variableFont, weight }).commit();
|
|
206
208
|
|
|
207
209
|
const fontData = await generateFontData({
|
|
208
210
|
url: ttfAsset.url,
|
|
@@ -349,12 +351,12 @@ export const SingleUploaderTool = (props) => {
|
|
|
349
351
|
if (code === 'ttf') {
|
|
350
352
|
const fontBuffer = await readFontFile(file);
|
|
351
353
|
const font = await parseFont(fontBuffer, file.name);
|
|
352
|
-
const { weightName, subfamilyName, style, variableFont } = extractFontMetadata(
|
|
353
|
-
font, doc_typefaceName, weightKeywordList, italicKeywordList
|
|
354
|
+
const { weightName, subfamilyName, fontTitle, style, variableFont } = extractFontMetadata(
|
|
355
|
+
font, doc_typefaceName, weightKeywordList, italicKeywordList, false, null
|
|
354
356
|
);
|
|
355
357
|
const weight = determineWeight(font, weightName);
|
|
356
358
|
const normalizedId = doc_id.startsWith('drafts.') ? doc_id.replace('drafts.', '') : doc_id;
|
|
357
|
-
await client.patch(normalizedId).set({ weightName, subfamily: subfamilyName, style, variableFont, weight }).commit();
|
|
359
|
+
await client.patch(normalizedId).set({ title: fontTitle, weightName, subfamily: subfamilyName, style, variableFont, weight }).commit();
|
|
358
360
|
}
|
|
359
361
|
|
|
360
362
|
onChange(set(newFileInput));
|