@liiift-studio/sanity-font-manager 2.5.1 → 2.5.3
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/UploadModal-NQZGBJAH.js +7 -0
- package/dist/UploadModal-YJCVHM63.mjs +7 -0
- package/dist/chunk-EBO3CZXG.mjs +15 -0
- package/dist/chunk-MCKGQKYU.js +15 -0
- package/dist/{chunk-JCDZ7SWZ.js → chunk-PGSHWNGW.js} +7 -3468
- package/dist/{chunk-TMDE4A54.mjs → chunk-WSQYNIIZ.mjs} +6 -3467
- package/dist/index.js +108 -66
- package/dist/index.mjs +65 -23
- package/dist/unbrotli-CTU3FKHW.mjs +3434 -0
- package/dist/unbrotli-NSXTNE2T.js +3434 -0
- package/package.json +1 -1
- package/src/components/BatchUploadFonts.jsx +1 -1
- package/src/components/KeyValueReferenceInput.jsx +69 -61
- package/src/components/SingleUploaderTool.jsx +3 -3
- package/src/components/UploadStep1Settings.jsx +1 -1
- package/src/components/UploadStep3Execute.jsx +1 -1
- package/src/schema/stylesField.js +20 -0
- package/src/utils/parseFont.js +12 -16
- package/dist/UploadModal-ADNRGQUI.mjs +0 -6
- package/dist/UploadModal-WPK2CXLR.js +0 -6
package/dist/index.mjs
CHANGED
|
@@ -60,7 +60,8 @@ import {
|
|
|
60
60
|
sanitizeForSanityId,
|
|
61
61
|
sortFontObjects,
|
|
62
62
|
updateTypefaceDocument
|
|
63
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-WSQYNIIZ.mjs";
|
|
64
|
+
import "./chunk-EBO3CZXG.mjs";
|
|
64
65
|
|
|
65
66
|
// src/components/BatchUploadFonts.jsx
|
|
66
67
|
import React3, { useCallback, useState as useState2, useMemo as useMemo2, useRef, useEffect, lazy, Suspense } from "react";
|
|
@@ -636,7 +637,7 @@ var updateTypefaceSubfamilies = async (doc_id, stylesObject, newSubfamiliesArray
|
|
|
636
637
|
};
|
|
637
638
|
|
|
638
639
|
// src/components/BatchUploadFonts.jsx
|
|
639
|
-
var UploadModal2 = lazy(() => import("./UploadModal-
|
|
640
|
+
var UploadModal2 = lazy(() => import("./UploadModal-YJCVHM63.mjs"));
|
|
640
641
|
var ACCEPTED_EXTENSIONS = ["ttf", "otf", "woff", "woff2", "eot", "svg"];
|
|
641
642
|
var formatElapsed = (s) => {
|
|
642
643
|
const m = Math.floor(s / 60);
|
|
@@ -1021,7 +1022,7 @@ var BatchUploadFonts = () => {
|
|
|
1021
1022
|
style: { fontFamily: "monospace", minWidth: "2.5rem", flexShrink: 0 }
|
|
1022
1023
|
},
|
|
1023
1024
|
ext
|
|
1024
|
-
), /* @__PURE__ */ React3.createElement(Box2, { style: { flex: 1, minWidth: 0
|
|
1025
|
+
), /* @__PURE__ */ React3.createElement(Box2, { style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React3.createElement(Text3, { size: 1 }, file.name))), /* @__PURE__ */ React3.createElement(
|
|
1025
1026
|
Button2,
|
|
1026
1027
|
{
|
|
1027
1028
|
mode: "bleed",
|
|
@@ -1938,18 +1939,18 @@ var SingleUploaderTool = (props) => {
|
|
|
1938
1939
|
const formatUpper = format.toUpperCase();
|
|
1939
1940
|
const hasFile = !!((_b2 = (_a2 = fileInput == null ? void 0 : fileInput[format]) == null ? void 0 : _a2.asset) == null ? void 0 : _b2._ref);
|
|
1940
1941
|
const fileUrl = hasFile ? `https://cdn.sanity.io/files/${process.env.SANITY_STUDIO_PROJECT_ID}/${process.env.SANITY_STUDIO_DATASET}/${fileInput[format].asset._ref.replace("file-", "").replace("-", ".")}` : null;
|
|
1941
|
-
return /* @__PURE__ */ React6.createElement(Card3, { border: true, radius: 1, paddingX: 2, paddingY: 3 }, /* @__PURE__ */ React6.createElement(Flex4, { justify: "space-between", align: "center", gap: 2 }, /* @__PURE__ */ React6.createElement(Flex4, { gap: 3, align: "center", style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React6.createElement(Text6, { size: 0, style: { fontFamily: "monospace", minWidth: "2.5rem", flexShrink: 0, opacity: hasFile ? 1 : 0.5 } }, formatUpper), hasFile ? /* @__PURE__ */ React6.createElement(Box3, { style: { flex: 1, minWidth: 0
|
|
1942
|
+
return /* @__PURE__ */ React6.createElement(Card3, { border: true, radius: 1, paddingX: 2, paddingY: 3 }, /* @__PURE__ */ React6.createElement(Flex4, { justify: "space-between", align: "center", gap: 2 }, /* @__PURE__ */ React6.createElement(Flex4, { gap: 3, align: "center", style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React6.createElement(Text6, { size: 0, style: { fontFamily: "monospace", minWidth: "2.5rem", flexShrink: 0, opacity: hasFile ? 1 : 0.5 } }, formatUpper), hasFile ? /* @__PURE__ */ React6.createElement(Box3, { style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React6.createElement("a", { href: fileUrl, target: "_blank", rel: "noreferrer" }, (filenames == null ? void 0 : filenames[format]) || "File")) : /* @__PURE__ */ React6.createElement(Text6, { size: 1, muted: true }, "\u2014")), status === "ready" && /* @__PURE__ */ React6.createElement(Flex4, { gap: 1, align: "center", style: { flexShrink: 0 } }, buildSource && (fileInput == null ? void 0 : fileInput[buildSource]) && /* @__PURE__ */ React6.createElement(Button5, { mode: "ghost", tone: "primary", fontSize: 1, padding: 2, onClick: () => handleGenerateFontFile(format, fileInput[buildSource]), text: "Build" }), /* @__PURE__ */ React6.createElement(Button5, { as: "label", mode: "ghost", tone: "primary", fontSize: 1, padding: 2, style: { cursor: "pointer" } }, /* @__PURE__ */ React6.createElement(Text6, { size: 1 }, "Upload"), /* @__PURE__ */ React6.createElement("input", { ref, type: "file", hidden: true, onChange: (e) => handleUpload(e, format) })), hasFile && /* @__PURE__ */ React6.createElement(Button5, { mode: "bleed", tone: "critical", icon: TrashIcon2, padding: 2, onClick: () => handleDelete(format) }))));
|
|
1942
1943
|
};
|
|
1943
1944
|
const renderTopLevelAssetSection = (label, fieldName, assetRef, filename, onBuild) => {
|
|
1944
1945
|
const hasFile = !!assetRef;
|
|
1945
1946
|
const fileUrl = hasFile ? `https://cdn.sanity.io/files/${process.env.SANITY_STUDIO_PROJECT_ID}/${process.env.SANITY_STUDIO_DATASET}/${assetRef.replace("file-", "").replace("-", ".")}` : null;
|
|
1946
|
-
return /* @__PURE__ */ React6.createElement(Card3, { border: true, radius: 1, paddingX: 2, paddingY: 3 }, /* @__PURE__ */ React6.createElement(Flex4, { justify: "space-between", align: "center", gap: 2 }, /* @__PURE__ */ React6.createElement(Flex4, { gap: 3, align: "center", style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React6.createElement(Text6, { size: 0, style: { fontFamily: "monospace", minWidth: "2.5rem", flexShrink: 0, opacity: hasFile ? 1 : 0.5 } }, label), hasFile ? /* @__PURE__ */ React6.createElement(Box3, { style: { flex: 1, minWidth: 0
|
|
1947
|
+
return /* @__PURE__ */ React6.createElement(Card3, { border: true, radius: 1, paddingX: 2, paddingY: 3 }, /* @__PURE__ */ React6.createElement(Flex4, { justify: "space-between", align: "center", gap: 2 }, /* @__PURE__ */ React6.createElement(Flex4, { gap: 3, align: "center", style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React6.createElement(Text6, { size: 0, style: { fontFamily: "monospace", minWidth: "2.5rem", flexShrink: 0, opacity: hasFile ? 1 : 0.5 } }, label), hasFile ? /* @__PURE__ */ React6.createElement(Box3, { style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React6.createElement("a", { href: fileUrl, target: "_blank", rel: "noreferrer" }, filename || "File")) : /* @__PURE__ */ React6.createElement(Text6, { size: 1, muted: true }, "\u2014")), status === "ready" && /* @__PURE__ */ React6.createElement(Flex4, { gap: 1, align: "center", style: { flexShrink: 0 } }, onBuild && (fileInput == null ? void 0 : fileInput.woff2) && /* @__PURE__ */ React6.createElement(Button5, { mode: "ghost", tone: "primary", fontSize: 1, padding: 2, onClick: onBuild, text: "Build" }), /* @__PURE__ */ React6.createElement(Button5, { as: "label", mode: "ghost", tone: "primary", fontSize: 1, padding: 2, style: { cursor: "pointer" } }, /* @__PURE__ */ React6.createElement(Text6, { size: 1 }, "Upload"), /* @__PURE__ */ React6.createElement("input", { type: "file", hidden: true, onChange: (e) => handleUploadTopLevelFile(e, fieldName) })), hasFile && /* @__PURE__ */ React6.createElement(Button5, { mode: "bleed", tone: "critical", icon: TrashIcon2, padding: 2, onClick: () => handleDeleteTopLevel(fieldName) }))));
|
|
1947
1948
|
};
|
|
1948
1949
|
const renderCssSection = () => {
|
|
1949
1950
|
var _a2, _b2;
|
|
1950
1951
|
const hasFile = !!((_b2 = (_a2 = fileInput == null ? void 0 : fileInput.css) == null ? void 0 : _a2.asset) == null ? void 0 : _b2._ref);
|
|
1951
1952
|
const fileUrl = hasFile ? `https://cdn.sanity.io/files/${process.env.SANITY_STUDIO_PROJECT_ID}/${process.env.SANITY_STUDIO_DATASET}/${fileInput.css.asset._ref.replace("file-", "").replace("-", ".")}` : null;
|
|
1952
|
-
return /* @__PURE__ */ React6.createElement(Card3, { border: true, radius: 1, paddingX: 2, paddingY: 3 }, /* @__PURE__ */ React6.createElement(Flex4, { justify: "space-between", align: "center", gap: 2 }, /* @__PURE__ */ React6.createElement(Flex4, { gap: 3, align: "center", style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React6.createElement(Text6, { size: 0, style: { fontFamily: "monospace", minWidth: "2.5rem", flexShrink: 0, opacity: hasFile ? 1 : 0.5 } }, "CSS"), hasFile ? /* @__PURE__ */ React6.createElement(Box3, { style: { flex: 1, minWidth: 0
|
|
1953
|
+
return /* @__PURE__ */ React6.createElement(Card3, { border: true, radius: 1, paddingX: 2, paddingY: 3 }, /* @__PURE__ */ React6.createElement(Flex4, { justify: "space-between", align: "center", gap: 2 }, /* @__PURE__ */ React6.createElement(Flex4, { gap: 3, align: "center", style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React6.createElement(Text6, { size: 0, style: { fontFamily: "monospace", minWidth: "2.5rem", flexShrink: 0, opacity: hasFile ? 1 : 0.5 } }, "CSS"), hasFile ? /* @__PURE__ */ React6.createElement(Box3, { style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React6.createElement("a", { href: fileUrl, target: "_blank", rel: "noreferrer" }, (filenames == null ? void 0 : filenames.css) || "File")) : /* @__PURE__ */ React6.createElement(Text6, { size: 1, muted: true }, "\u2014")), status === "ready" && /* @__PURE__ */ React6.createElement(Flex4, { gap: 1, align: "center", style: { flexShrink: 0 } }, (fileInput == null ? void 0 : fileInput.woff2) && /* @__PURE__ */ React6.createElement(Button5, { mode: "ghost", tone: "primary", fontSize: 1, padding: 2, onClick: () => handleGenerateCssFile(), text: "Build" }), hasFile && /* @__PURE__ */ React6.createElement(Button5, { mode: "bleed", tone: "critical", icon: TrashIcon2, padding: 2, onClick: () => handleDelete("css") }))));
|
|
1953
1954
|
};
|
|
1954
1955
|
const renderDataSection = () => /* @__PURE__ */ React6.createElement(Card3, { border: true, radius: 1, paddingX: 2, paddingY: 3 }, /* @__PURE__ */ React6.createElement(Flex4, { justify: "space-between", align: "center", gap: 2 }, /* @__PURE__ */ React6.createElement(Flex4, { gap: 3, align: "center", style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React6.createElement(Text6, { size: 0, style: { fontFamily: "monospace", minWidth: "2.5rem", flexShrink: 0, opacity: (doc_metaData == null ? void 0 : doc_metaData.version) ? 1 : 0.5 } }, "DATA"), (doc_metaData == null ? void 0 : doc_metaData.version) ? /* @__PURE__ */ React6.createElement(Text6, { size: 1 }, "v", doc_metaData.version, " ", /* @__PURE__ */ React6.createElement(Text6, { as: "span", size: 1, muted: true }, "(", doc_metaData.genDate, ")")) : /* @__PURE__ */ React6.createElement(Text6, { size: 1, muted: true }, "\u2014")), status === "ready" && (fileInput == null ? void 0 : fileInput.ttf) && /* @__PURE__ */ React6.createElement(Flex4, { gap: 1, align: "center", style: { flexShrink: 0 } }, /* @__PURE__ */ React6.createElement(Button5, { mode: "ghost", tone: "primary", fontSize: 1, padding: 2, onClick: () => handleGenerateFontData(), text: "Build" }))));
|
|
1955
1956
|
return /* @__PURE__ */ React6.createElement(Stack5, { space: 2 }, /* @__PURE__ */ React6.createElement(
|
|
@@ -2811,21 +2812,36 @@ function KeyValueReferenceInput(props) {
|
|
|
2811
2812
|
const pickerLabel = referenceType || valueTitle.toLowerCase();
|
|
2812
2813
|
return /* @__PURE__ */ React12.createElement(Stack9, { space: 3 }, topActions && /* @__PURE__ */ React12.createElement(Box4, { paddingBottom: 2 }, topActions), /* @__PURE__ */ React12.createElement(Box4, null, /* @__PURE__ */ React12.createElement(Stack9, { space: 2 }, pairs.map((pair, index) => {
|
|
2813
2814
|
var _a2;
|
|
2814
|
-
return /* @__PURE__ */ React12.createElement(
|
|
2815
|
+
return /* @__PURE__ */ React12.createElement(Flex7, { key: index, gap: 1, align: "center" }, /* @__PURE__ */ React12.createElement(Flex7, { direction: "column", style: { flexShrink: 0 } }, /* @__PURE__ */ React12.createElement(
|
|
2816
|
+
Button10,
|
|
2817
|
+
{
|
|
2818
|
+
mode: "bleed",
|
|
2819
|
+
icon: ArrowUpIcon2,
|
|
2820
|
+
padding: 1,
|
|
2821
|
+
fontSize: 0,
|
|
2822
|
+
onClick: () => handleMoveUp(index),
|
|
2823
|
+
disabled: index === 0,
|
|
2824
|
+
style: { cursor: index === 0 ? "default" : "pointer" }
|
|
2825
|
+
}
|
|
2826
|
+
), /* @__PURE__ */ React12.createElement(
|
|
2827
|
+
Button10,
|
|
2828
|
+
{
|
|
2829
|
+
mode: "bleed",
|
|
2830
|
+
icon: ArrowDownIcon2,
|
|
2831
|
+
padding: 1,
|
|
2832
|
+
fontSize: 0,
|
|
2833
|
+
onClick: () => handleMoveDown(index),
|
|
2834
|
+
disabled: index === pairs.length - 1,
|
|
2835
|
+
style: { cursor: index === pairs.length - 1 ? "default" : "pointer" }
|
|
2836
|
+
}
|
|
2837
|
+
)), /* @__PURE__ */ React12.createElement(Box4, { flex: 1 }, /* @__PURE__ */ React12.createElement(
|
|
2815
2838
|
TextInput3,
|
|
2816
2839
|
{
|
|
2817
2840
|
value: pair.key,
|
|
2818
2841
|
onChange: (e) => handlePairChange(index, "key", e.target.value),
|
|
2819
2842
|
placeholder: keyPlaceholder
|
|
2820
2843
|
}
|
|
2821
|
-
)), /* @__PURE__ */ React12.createElement(Box4, { flex: 1
|
|
2822
|
-
Text10,
|
|
2823
|
-
{
|
|
2824
|
-
size: 2,
|
|
2825
|
-
style: { whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis", maxWidth: "90%" }
|
|
2826
|
-
},
|
|
2827
|
-
referenceData[pair.value._ref] || "Loading..."
|
|
2828
|
-
), /* @__PURE__ */ React12.createElement(
|
|
2844
|
+
)), /* @__PURE__ */ React12.createElement(Box4, { flex: 1 }, ((_a2 = pair.value) == null ? void 0 : _a2._ref) ? /* @__PURE__ */ React12.createElement(Card4, { radius: 2, tone: "primary", style: { paddingLeft: "0.75rem", height: "fit-content" } }, /* @__PURE__ */ React12.createElement(Flex7, { align: "center", justify: "space-between" }, /* @__PURE__ */ React12.createElement(Text10, { size: 2, style: { whiteSpace: "nowrap" } }, referenceData[pair.value._ref] || "Loading..."), /* @__PURE__ */ React12.createElement(
|
|
2829
2845
|
MenuButton2,
|
|
2830
2846
|
{
|
|
2831
2847
|
button: /* @__PURE__ */ React12.createElement(Button10, { icon: EllipsisHorizontalIcon, mode: "bleed", title: "Options" }),
|
|
@@ -2837,18 +2853,20 @@ function KeyValueReferenceInput(props) {
|
|
|
2837
2853
|
Box4,
|
|
2838
2854
|
{
|
|
2839
2855
|
padding: 2,
|
|
2840
|
-
style: {
|
|
2856
|
+
style: { border: "1px dashed #ccc", borderRadius: "4px", display: "flex", alignItems: "center", justifyContent: "center", cursor: "pointer" },
|
|
2841
2857
|
onClick: () => openReferenceSelector(index)
|
|
2842
2858
|
},
|
|
2843
2859
|
/* @__PURE__ */ React12.createElement(Text10, { muted: true, size: 2 }, "Click to select a ", pickerLabel)
|
|
2844
|
-
))
|
|
2845
|
-
|
|
2860
|
+
)), /* @__PURE__ */ React12.createElement(
|
|
2861
|
+
Button10,
|
|
2846
2862
|
{
|
|
2847
|
-
|
|
2863
|
+
mode: "bleed",
|
|
2864
|
+
tone: "critical",
|
|
2865
|
+
icon: TrashIcon4,
|
|
2866
|
+
padding: 2,
|
|
2848
2867
|
onClick: () => handleRemovePair(index),
|
|
2849
|
-
style: {
|
|
2850
|
-
}
|
|
2851
|
-
/* @__PURE__ */ React12.createElement(TrashIcon4, null)
|
|
2868
|
+
style: { flexShrink: 0, cursor: "pointer" }
|
|
2869
|
+
}
|
|
2852
2870
|
));
|
|
2853
2871
|
}))), /* @__PURE__ */ React12.createElement(Button10, { tone: "primary", mode: "ghost", onClick: handleAddPair, icon: AddIcon2, text: `Add ${keyTitle}` }), isDialogOpen && /* @__PURE__ */ React12.createElement(
|
|
2854
2872
|
Dialog,
|
|
@@ -5908,7 +5926,9 @@ function createStylesField({
|
|
|
5908
5926
|
subfamilyPreferredStyle = false,
|
|
5909
5927
|
subfamilyFontFilter = false,
|
|
5910
5928
|
subfamilyPreview = false,
|
|
5911
|
-
pairs = true
|
|
5929
|
+
pairs = true,
|
|
5930
|
+
generateCollections = false,
|
|
5931
|
+
generateFullFamilyCollection = false
|
|
5912
5932
|
} = {}) {
|
|
5913
5933
|
const subfamilyFields = [
|
|
5914
5934
|
{
|
|
@@ -6052,6 +6072,28 @@ function createStylesField({
|
|
|
6052
6072
|
type: "array",
|
|
6053
6073
|
of: [subfamilyItem]
|
|
6054
6074
|
},
|
|
6075
|
+
...field(generateCollections, {
|
|
6076
|
+
title: "Generate Collections and Pairs",
|
|
6077
|
+
name: "generateCollections",
|
|
6078
|
+
type: "string",
|
|
6079
|
+
description: "Generate Collections and Pairs from the typeface's fonts.",
|
|
6080
|
+
components: { input: GenerateCollectionsPairsComponent },
|
|
6081
|
+
hidden: ({ parent }) => {
|
|
6082
|
+
var _a;
|
|
6083
|
+
return !((_a = parent == null ? void 0 : parent.fonts) == null ? void 0 : _a.length);
|
|
6084
|
+
}
|
|
6085
|
+
}),
|
|
6086
|
+
...field(generateFullFamilyCollection, {
|
|
6087
|
+
title: "Generate Full Family Collection",
|
|
6088
|
+
name: "generateCollectionGroup",
|
|
6089
|
+
type: "string",
|
|
6090
|
+
description: "Generate a Collection that includes all styles from this typeface.",
|
|
6091
|
+
components: { input: PrimaryCollectionGeneratorTypeface },
|
|
6092
|
+
hidden: ({ parent }) => {
|
|
6093
|
+
var _a;
|
|
6094
|
+
return !((_a = parent == null ? void 0 : parent.fonts) == null ? void 0 : _a.length);
|
|
6095
|
+
}
|
|
6096
|
+
}),
|
|
6055
6097
|
{
|
|
6056
6098
|
title: "Collections",
|
|
6057
6099
|
name: "collections",
|