@liiift-studio/sanity-font-manager 2.5.1 → 2.5.2
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-2AAJXZJK.js +6 -0
- package/dist/{UploadModal-ADNRGQUI.mjs → UploadModal-DDTVJ2MA.mjs} +1 -1
- package/dist/{chunk-TMDE4A54.mjs → chunk-FT7YTFZW.mjs} +2 -2
- package/dist/{chunk-JCDZ7SWZ.js → chunk-YMQEM4AO.js} +2 -2
- package/dist/index.js +107 -66
- package/dist/index.mjs +64 -23
- 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/dist/UploadModal-WPK2CXLR.js +0 -6
|
@@ -5190,7 +5190,7 @@ function UploadStep1Settings({ settings, onStartProcessing }) {
|
|
|
5190
5190
|
},
|
|
5191
5191
|
ext.toUpperCase()
|
|
5192
5192
|
),
|
|
5193
|
-
/* @__PURE__ */ React.createElement(Text, { size: 1, style: { flex: 1
|
|
5193
|
+
/* @__PURE__ */ React.createElement(Text, { size: 1, style: { flex: 1 } }, file.name),
|
|
5194
5194
|
/* @__PURE__ */ React.createElement(
|
|
5195
5195
|
Button,
|
|
5196
5196
|
{
|
|
@@ -7016,7 +7016,7 @@ function UploadStep3Execute({
|
|
|
7016
7016
|
)))), execState.status !== "complete" && execState.status !== "error" && /* @__PURE__ */ React7.createElement(Card5, { tone: "caution", border: true, radius: 2, padding: 2 }, /* @__PURE__ */ React7.createElement(Flex7, { align: "center", gap: 2 }, /* @__PURE__ */ React7.createElement(WarningOutlineIcon, { style: { flexShrink: 0 } }), /* @__PURE__ */ React7.createElement(Text7, { size: 1, weight: "semibold" }, "Do not close or reload this tab"))), /* @__PURE__ */ React7.createElement(Box6, { style: { maxHeight: 400, overflowY: "auto" } }, /* @__PURE__ */ React7.createElement(Stack5, { space: 1 }, fontEntries.map((entry) => {
|
|
7017
7017
|
const progress = execState.progress[entry.tempId];
|
|
7018
7018
|
const status = (progress == null ? void 0 : progress.status) || EXECUTION_STATUS.QUEUED;
|
|
7019
|
-
return /* @__PURE__ */ React7.createElement(Card5, { key: entry.tempId, border: true, radius: 1, padding: 2 }, /* @__PURE__ */ React7.createElement(Flex7, { align: "center", gap: 2 }, /* @__PURE__ */ React7.createElement(Text7, { size: 1, style: {
|
|
7019
|
+
return /* @__PURE__ */ React7.createElement(Card5, { key: entry.tempId, border: true, radius: 1, padding: 2 }, /* @__PURE__ */ React7.createElement(Flex7, { align: "center", gap: 2 }, /* @__PURE__ */ React7.createElement(Text7, { size: 1, style: { flex: 1 } }, entry.title), /* @__PURE__ */ React7.createElement(Box6, { style: { width: 120, flexShrink: 0, textAlign: "right" } }, status === EXECUTION_STATUS.QUEUED && /* @__PURE__ */ React7.createElement(Badge5, { mode: "outline", fontSize: 0 }, "Queued"), status === EXECUTION_STATUS.UPLOADING_ASSETS && /* @__PURE__ */ React7.createElement(Flex7, { gap: 1, align: "center", justify: "flex-end" }, /* @__PURE__ */ React7.createElement(Text7, { size: 0, muted: true }, (progress == null ? void 0 : progress.currentFile) || "Uploading..."), /* @__PURE__ */ React7.createElement(Spinner2, { style: { width: 12, height: 12 } })), (status === EXECUTION_STATUS.GENERATING_CSS || status === EXECUTION_STATUS.GENERATING_METADATA) && /* @__PURE__ */ React7.createElement(Flex7, { gap: 1, align: "center", justify: "flex-end" }, /* @__PURE__ */ React7.createElement(Text7, { size: 0, muted: true }, status === EXECUTION_STATUS.GENERATING_CSS ? "CSS" : "Metadata"), /* @__PURE__ */ React7.createElement(Spinner2, { style: { width: 12, height: 12 } })), status === EXECUTION_STATUS.CREATING_DOCUMENT && /* @__PURE__ */ React7.createElement(Flex7, { gap: 1, align: "center", justify: "flex-end" }, /* @__PURE__ */ React7.createElement(Text7, { size: 0, muted: true }, "Creating doc"), /* @__PURE__ */ React7.createElement(Spinner2, { style: { width: 12, height: 12 } })), status === EXECUTION_STATUS.COMPLETE && /* @__PURE__ */ React7.createElement(Badge5, { tone: "positive", fontSize: 0 }, "Done"), status === EXECUTION_STATUS.ERROR && /* @__PURE__ */ React7.createElement(Badge5, { tone: "critical", fontSize: 0 }, "Failed"))), status === EXECUTION_STATUS.ERROR && (progress == null ? void 0 : progress.error) && /* @__PURE__ */ React7.createElement(Text7, { size: 0, muted: true, style: { marginTop: 4 } }, progress.error));
|
|
7020
7020
|
}))), execState.error && /* @__PURE__ */ React7.createElement(Card5, { tone: "critical", border: true, padding: 3, radius: 2 }, /* @__PURE__ */ React7.createElement(Text7, { size: 1 }, execState.error)));
|
|
7021
7021
|
}
|
|
7022
7022
|
|
|
@@ -5190,7 +5190,7 @@ function UploadStep1Settings({ settings, onStartProcessing }) {
|
|
|
5190
5190
|
},
|
|
5191
5191
|
ext.toUpperCase()
|
|
5192
5192
|
),
|
|
5193
|
-
/* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 1, style: { flex: 1
|
|
5193
|
+
/* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 1, style: { flex: 1 } }, file.name),
|
|
5194
5194
|
/* @__PURE__ */ _react2.default.createElement(
|
|
5195
5195
|
_ui.Button,
|
|
5196
5196
|
{
|
|
@@ -7016,7 +7016,7 @@ function UploadStep3Execute({
|
|
|
7016
7016
|
)))), execState.status !== "complete" && execState.status !== "error" && /* @__PURE__ */ _react2.default.createElement(_ui.Card, { tone: "caution", border: true, radius: 2, padding: 2 }, /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { align: "center", gap: 2 }, /* @__PURE__ */ _react2.default.createElement(_icons.WarningOutlineIcon, { style: { flexShrink: 0 } }), /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 1, weight: "semibold" }, "Do not close or reload this tab"))), /* @__PURE__ */ _react2.default.createElement(_ui.Box, { style: { maxHeight: 400, overflowY: "auto" } }, /* @__PURE__ */ _react2.default.createElement(_ui.Stack, { space: 1 }, fontEntries.map((entry) => {
|
|
7017
7017
|
const progress = execState.progress[entry.tempId];
|
|
7018
7018
|
const status = (progress == null ? void 0 : progress.status) || EXECUTION_STATUS.QUEUED;
|
|
7019
|
-
return /* @__PURE__ */ _react2.default.createElement(_ui.Card, { key: entry.tempId, border: true, radius: 1, padding: 2 }, /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { align: "center", gap: 2 }, /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 1, style: {
|
|
7019
|
+
return /* @__PURE__ */ _react2.default.createElement(_ui.Card, { key: entry.tempId, border: true, radius: 1, padding: 2 }, /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { align: "center", gap: 2 }, /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 1, style: { flex: 1 } }, entry.title), /* @__PURE__ */ _react2.default.createElement(_ui.Box, { style: { width: 120, flexShrink: 0, textAlign: "right" } }, status === EXECUTION_STATUS.QUEUED && /* @__PURE__ */ _react2.default.createElement(_ui.Badge, { mode: "outline", fontSize: 0 }, "Queued"), status === EXECUTION_STATUS.UPLOADING_ASSETS && /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { gap: 1, align: "center", justify: "flex-end" }, /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 0, muted: true }, (progress == null ? void 0 : progress.currentFile) || "Uploading..."), /* @__PURE__ */ _react2.default.createElement(_ui.Spinner, { style: { width: 12, height: 12 } })), (status === EXECUTION_STATUS.GENERATING_CSS || status === EXECUTION_STATUS.GENERATING_METADATA) && /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { gap: 1, align: "center", justify: "flex-end" }, /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 0, muted: true }, status === EXECUTION_STATUS.GENERATING_CSS ? "CSS" : "Metadata"), /* @__PURE__ */ _react2.default.createElement(_ui.Spinner, { style: { width: 12, height: 12 } })), status === EXECUTION_STATUS.CREATING_DOCUMENT && /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { gap: 1, align: "center", justify: "flex-end" }, /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 0, muted: true }, "Creating doc"), /* @__PURE__ */ _react2.default.createElement(_ui.Spinner, { style: { width: 12, height: 12 } })), status === EXECUTION_STATUS.COMPLETE && /* @__PURE__ */ _react2.default.createElement(_ui.Badge, { tone: "positive", fontSize: 0 }, "Done"), status === EXECUTION_STATUS.ERROR && /* @__PURE__ */ _react2.default.createElement(_ui.Badge, { tone: "critical", fontSize: 0 }, "Failed"))), status === EXECUTION_STATUS.ERROR && (progress == null ? void 0 : progress.error) && /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 0, muted: true, style: { marginTop: 4 } }, progress.error));
|
|
7020
7020
|
}))), execState.error && /* @__PURE__ */ _react2.default.createElement(_ui.Card, { tone: "critical", border: true, padding: 3, radius: 2 }, /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 1 }, execState.error)));
|
|
7021
7021
|
}
|
|
7022
7022
|
|
package/dist/index.js
CHANGED
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
|
|
61
61
|
|
|
62
62
|
|
|
63
|
-
var
|
|
63
|
+
var _chunkYMQEM4AOjs = require('./chunk-YMQEM4AO.js');
|
|
64
64
|
|
|
65
65
|
// src/components/BatchUploadFonts.jsx
|
|
66
66
|
var _react = require('react'); var _react2 = _interopRequireDefault(_react);
|
|
@@ -114,7 +114,7 @@ var uploadFontFiles = async (fontsObjects, subfamilies, client, inputPrice, styl
|
|
|
114
114
|
if (fileType === "woff2") {
|
|
115
115
|
console.log(`[${i + 1}/${fontObjectKeys.length}][${j + 1}/${files.length}] Generating CSS for: ${fontObject.title}`);
|
|
116
116
|
setStatus(`[${i + 1}/${fontObjectKeys.length}][${j + 1}/${files.length}] Generating CSS for: ${fontObject.title}`);
|
|
117
|
-
newFileInput = await
|
|
117
|
+
newFileInput = await _chunkYMQEM4AOjs.generateCssFile.call(void 0, {
|
|
118
118
|
woff2File: file,
|
|
119
119
|
fileInput: newFileInput,
|
|
120
120
|
fontName: fontObject.title,
|
|
@@ -128,7 +128,7 @@ var uploadFontFiles = async (fontsObjects, subfamilies, client, inputPrice, styl
|
|
|
128
128
|
if (fileType === "ttf") {
|
|
129
129
|
console.log(`[${i + 1}/${fontObjectKeys.length}][${j + 1}/${files.length}] Generating font data for: ${fontObject.title}`);
|
|
130
130
|
setStatus(`[${i + 1}/${fontObjectKeys.length}][${j + 1}/${files.length}] Generating font data for: ${fontObject.title}`);
|
|
131
|
-
const metadata = await
|
|
131
|
+
const metadata = await _chunkYMQEM4AOjs.generateFontData.call(void 0, {
|
|
132
132
|
fontId: fontObject._id,
|
|
133
133
|
url: baseAsset.url,
|
|
134
134
|
fontKit,
|
|
@@ -241,7 +241,7 @@ var createOrUpdateFontDocument = async (font, client, setError) => {
|
|
|
241
241
|
delete font.fontKit;
|
|
242
242
|
delete font.originalFilename;
|
|
243
243
|
if (font.variableFont && font.variableInstances) {
|
|
244
|
-
const instanceMappings = await
|
|
244
|
+
const instanceMappings = await _chunkYMQEM4AOjs.parseVariableFontInstances.call(void 0, font, client);
|
|
245
245
|
if (instanceMappings.length > 0) {
|
|
246
246
|
font.variableInstanceReferences = instanceMappings;
|
|
247
247
|
}
|
|
@@ -406,9 +406,9 @@ var renameFontDocuments = async ({
|
|
|
406
406
|
const res = await fetch(ttfAsset.url);
|
|
407
407
|
file = await res.blob();
|
|
408
408
|
}
|
|
409
|
-
const fontBuffer = await
|
|
410
|
-
const font = await
|
|
411
|
-
const { weightName, subfamilyName, fontTitle } =
|
|
409
|
+
const fontBuffer = await _chunkYMQEM4AOjs.readFontFile.call(void 0, file);
|
|
410
|
+
const font = await _chunkYMQEM4AOjs.parseFont.call(void 0, fontBuffer, `${fontDoc._id}.ttf`);
|
|
411
|
+
const { weightName, subfamilyName, fontTitle } = _chunkYMQEM4AOjs.extractFontMetadata.call(void 0,
|
|
412
412
|
font,
|
|
413
413
|
typefaceName,
|
|
414
414
|
weightKeywordList,
|
|
@@ -588,7 +588,7 @@ var groupFontsBySubfamily = (fonts) => {
|
|
|
588
588
|
if ((_a = font.title) == null ? void 0 : _a.includes("VF")) {
|
|
589
589
|
subfamilies[`VF_${font.title}`] = [font];
|
|
590
590
|
} else {
|
|
591
|
-
const subfamilyName = font.subfamily ?
|
|
591
|
+
const subfamilyName = font.subfamily ? _chunkYMQEM4AOjs.expandAbbreviations.call(void 0, font.subfamily) : "Regular";
|
|
592
592
|
if (!subfamilies[subfamilyName]) subfamilies[subfamilyName] = [];
|
|
593
593
|
subfamilies[subfamilyName].push(font);
|
|
594
594
|
}
|
|
@@ -636,7 +636,7 @@ var updateTypefaceSubfamilies = async (doc_id, stylesObject, newSubfamiliesArray
|
|
|
636
636
|
};
|
|
637
637
|
|
|
638
638
|
// src/components/BatchUploadFonts.jsx
|
|
639
|
-
var UploadModal2 = _react.lazy.call(void 0, () => Promise.resolve().then(() => _interopRequireWildcard(require("./UploadModal-
|
|
639
|
+
var UploadModal2 = _react.lazy.call(void 0, () => Promise.resolve().then(() => _interopRequireWildcard(require("./UploadModal-2AAJXZJK.js"))));
|
|
640
640
|
var ACCEPTED_EXTENSIONS = ["ttf", "otf", "woff", "woff2", "eot", "svg"];
|
|
641
641
|
var formatElapsed = (s) => {
|
|
642
642
|
const m = Math.floor(s / 60);
|
|
@@ -665,7 +665,7 @@ var BatchUploadFonts = () => {
|
|
|
665
665
|
const slug = _sanity.useFormValue.call(void 0, ["slug"]);
|
|
666
666
|
const stylesObject = _sanity.useFormValue.call(void 0, ["styles"]) || { fonts: [], variableFont: [] };
|
|
667
667
|
const subfamiliesArray = (stylesObject == null ? void 0 : stylesObject.subfamilies) || [];
|
|
668
|
-
const { weightKeywordList, italicKeywordList } = _react.useMemo.call(void 0, () =>
|
|
668
|
+
const { weightKeywordList, italicKeywordList } = _react.useMemo.call(void 0, () => _chunkYMQEM4AOjs.generateStyleKeywords.call(void 0, ), []);
|
|
669
669
|
_react.useEffect.call(void 0, () => {
|
|
670
670
|
if (ready !== true) {
|
|
671
671
|
setElapsedSeconds(0);
|
|
@@ -778,7 +778,7 @@ var BatchUploadFonts = () => {
|
|
|
778
778
|
}
|
|
779
779
|
const sortedFiles = sortFilesByType(pendingFiles);
|
|
780
780
|
setPendingFiles([]);
|
|
781
|
-
const { fontsObjects, subfamilies, uniqueSubfamilies, newPreferredStyle, failedFiles } = await
|
|
781
|
+
const { fontsObjects, subfamilies, uniqueSubfamilies, newPreferredStyle, failedFiles } = await _chunkYMQEM4AOjs.processFontFiles.call(void 0,
|
|
782
782
|
sortedFiles,
|
|
783
783
|
title,
|
|
784
784
|
weightKeywordList,
|
|
@@ -797,7 +797,7 @@ var BatchUploadFonts = () => {
|
|
|
797
797
|
setError,
|
|
798
798
|
preserveFileNames
|
|
799
799
|
);
|
|
800
|
-
await
|
|
800
|
+
await _chunkYMQEM4AOjs.updateTypefaceDocument.call(void 0,
|
|
801
801
|
doc_id,
|
|
802
802
|
fontRefs,
|
|
803
803
|
variableRefs,
|
|
@@ -914,7 +914,7 @@ var BatchUploadFonts = () => {
|
|
|
914
914
|
const woff2Blob = await woff2Response.blob();
|
|
915
915
|
const woff2File = new File([woff2Blob], `${fontDoc._id}.woff2`, { type: "font/woff2" });
|
|
916
916
|
setStatus(`Regenerating CSS for font ${i + 1}/${fontRefs.length}: ${fontDoc.title}`);
|
|
917
|
-
const updatedFileInput = await
|
|
917
|
+
const updatedFileInput = await _chunkYMQEM4AOjs.generateCssFile.call(void 0, {
|
|
918
918
|
woff2File,
|
|
919
919
|
fileInput: fontDoc.fileInput,
|
|
920
920
|
fileName: fontDoc._id,
|
|
@@ -1021,7 +1021,7 @@ var BatchUploadFonts = () => {
|
|
|
1021
1021
|
style: { fontFamily: "monospace", minWidth: "2.5rem", flexShrink: 0 }
|
|
1022
1022
|
},
|
|
1023
1023
|
ext
|
|
1024
|
-
), /* @__PURE__ */ _react2.default.createElement(_ui.Box, { style: { flex: 1, minWidth: 0
|
|
1024
|
+
), /* @__PURE__ */ _react2.default.createElement(_ui.Box, { style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 1 }, file.name))), /* @__PURE__ */ _react2.default.createElement(
|
|
1025
1025
|
_ui.Button,
|
|
1026
1026
|
{
|
|
1027
1027
|
mode: "bleed",
|
|
@@ -1136,7 +1136,7 @@ var BatchUploadFonts = () => {
|
|
|
1136
1136
|
), renderTooltipLabel(
|
|
1137
1137
|
"Preserve shortened names",
|
|
1138
1138
|
'Abbreviations in font names are kept as-is (e.g. "XNarrow" stays "XNarrow", "Bd" stays "Bd").'
|
|
1139
|
-
)), ready === "rename" ? renderProcessing() : /* @__PURE__ */ _react2.default.createElement(_ui.Button, { mode: "ghost", tone: "primary", text: "Rename Existing Fonts", style: { width: "100%" }, onClick: handleRenameExistingFonts, disabled: ready !== true })), /* @__PURE__ */ _react2.default.createElement(_ui.Stack, { space: 3 }, /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 1, weight: "semibold", style: { lineHeight: 1.6 } }, "Update Font Prices"), ready === "price" ? renderProcessing() : /* @__PURE__ */ _react2.default.createElement(_ui.Stack, { space: 2 }, /* @__PURE__ */ _react2.default.createElement(
|
|
1139
|
+
)), ready === "rename" ? renderProcessing() : /* @__PURE__ */ _react2.default.createElement(_ui.Button, { mode: "ghost", tone: "primary", text: "Rename Existing Fonts", style: { width: "100%" }, onClick: handleRenameExistingFonts, disabled: ready !== true })), /* @__PURE__ */ _react2.default.createElement(_ui.Stack, { space: 3 }, /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 1, weight: "semibold", style: { lineHeight: 1.6 } }, "Update Font Prices"), ready === "price" ? renderProcessing() : /* @__PURE__ */ _react2.default.createElement(_ui.Stack, { space: 2 }, /* @__PURE__ */ _react2.default.createElement(_chunkYMQEM4AOjs.PriceInput_default, { inputPrice, handleInputChange }), /* @__PURE__ */ _react2.default.createElement(_ui.Button, { mode: "ghost", tone: "primary", text: "Update All Font Prices", style: { width: "100%" }, onClick: handleChangeFontPrice, disabled: ready !== true }))), /* @__PURE__ */ _react2.default.createElement(_ui.Stack, { space: 3 }, /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 1, weight: "semibold", style: { lineHeight: 1.6 } }, "Regenerate CSS"), /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 1, muted: true, style: { lineHeight: 1.6 } }, "Rebuilds the CSS @font-face files for all fonts in the typeface fonts list."), ready === "css" ? renderProcessing() : /* @__PURE__ */ _react2.default.createElement(_ui.Button, { mode: "ghost", tone: "primary", text: "Regenerate CSS Files", style: { width: "100%" }, onClick: handleRegenerateCssFiles, disabled: ready !== true }))))));
|
|
1140
1140
|
};
|
|
1141
1141
|
|
|
1142
1142
|
// src/components/GenerateCollectionsPairsComponent.jsx
|
|
@@ -1488,7 +1488,7 @@ var SingleUploaderTool = (props) => {
|
|
|
1488
1488
|
const doc_style = _sanity.useFormValue.call(void 0, ["style"]);
|
|
1489
1489
|
const doc_slug = _sanity.useFormValue.call(void 0, ["slug"]);
|
|
1490
1490
|
const doc_metaData = _sanity.useFormValue.call(void 0, ["metaData"]);
|
|
1491
|
-
const { weightKeywordList, italicKeywordList } = _react.useMemo.call(void 0, () =>
|
|
1491
|
+
const { weightKeywordList, italicKeywordList } = _react.useMemo.call(void 0, () => _chunkYMQEM4AOjs.generateStyleKeywords.call(void 0, ), []);
|
|
1492
1492
|
_react.useEffect.call(void 0, () => {
|
|
1493
1493
|
handleSetFilenames();
|
|
1494
1494
|
}, [fileInput]);
|
|
@@ -1542,7 +1542,7 @@ var SingleUploaderTool = (props) => {
|
|
|
1542
1542
|
{ id: woff2AssetRef }
|
|
1543
1543
|
);
|
|
1544
1544
|
const blob = await (await fetch(woff2Asset.url)).blob();
|
|
1545
|
-
const newFileInput = await
|
|
1545
|
+
const newFileInput = await _chunkYMQEM4AOjs.generateCssFile.call(void 0, {
|
|
1546
1546
|
woff2File: blob,
|
|
1547
1547
|
fileInput,
|
|
1548
1548
|
fontName: doc_title,
|
|
@@ -1633,16 +1633,16 @@ var SingleUploaderTool = (props) => {
|
|
|
1633
1633
|
);
|
|
1634
1634
|
if (!(ttfAsset == null ? void 0 : ttfAsset.url)) throw new Error("Could not fetch TTF file URL");
|
|
1635
1635
|
const arrayBuffer = await (await fetch(ttfAsset.url)).arrayBuffer();
|
|
1636
|
-
const font = await
|
|
1637
|
-
const { weightName, subfamilyName, style, variableFont } =
|
|
1636
|
+
const font = await _chunkYMQEM4AOjs.parseFont.call(void 0, arrayBuffer, `${doc_id}.ttf`);
|
|
1637
|
+
const { weightName, subfamilyName, style, variableFont } = _chunkYMQEM4AOjs.extractFontMetadata.call(void 0,
|
|
1638
1638
|
font,
|
|
1639
1639
|
doc_typefaceName,
|
|
1640
1640
|
weightKeywordList,
|
|
1641
1641
|
italicKeywordList
|
|
1642
1642
|
);
|
|
1643
|
-
const weight =
|
|
1643
|
+
const weight = _chunkYMQEM4AOjs.determineWeight.call(void 0, font, weightName);
|
|
1644
1644
|
await client.patch(doc_id).set({ weightName, subfamily: subfamilyName, style, variableFont, weight }).commit();
|
|
1645
|
-
const fontData = await
|
|
1645
|
+
const fontData = await _chunkYMQEM4AOjs.generateFontData.call(void 0, {
|
|
1646
1646
|
url: ttfAsset.url,
|
|
1647
1647
|
fontKit: font,
|
|
1648
1648
|
fontId: doc_id,
|
|
@@ -1656,7 +1656,7 @@ var SingleUploaderTool = (props) => {
|
|
|
1656
1656
|
variableFont,
|
|
1657
1657
|
variableInstances: fontData.variableInstances
|
|
1658
1658
|
};
|
|
1659
|
-
const instanceMappings = await
|
|
1659
|
+
const instanceMappings = await _chunkYMQEM4AOjs.parseVariableFontInstances.call(void 0, fontObj, client);
|
|
1660
1660
|
if (instanceMappings.length > 0) {
|
|
1661
1661
|
await client.patch(doc_id).set({ variableInstanceReferences: instanceMappings }).commit();
|
|
1662
1662
|
}
|
|
@@ -1775,7 +1775,7 @@ var SingleUploaderTool = (props) => {
|
|
|
1775
1775
|
if (code === "woff2") {
|
|
1776
1776
|
setMessage("Building CSS: " + doc_title + ".css");
|
|
1777
1777
|
setStatus("Building CSS file");
|
|
1778
|
-
newFileInput = await
|
|
1778
|
+
newFileInput = await _chunkYMQEM4AOjs.generateCssFile.call(void 0, {
|
|
1779
1779
|
woff2File: file,
|
|
1780
1780
|
fileInput: newFileInput,
|
|
1781
1781
|
fontName: doc_title,
|
|
@@ -1789,15 +1789,15 @@ var SingleUploaderTool = (props) => {
|
|
|
1789
1789
|
setStatus("CSS file built successfully");
|
|
1790
1790
|
}
|
|
1791
1791
|
if (code === "ttf") {
|
|
1792
|
-
const fontBuffer = await
|
|
1793
|
-
const font = await
|
|
1794
|
-
const { weightName, subfamilyName, style, variableFont } =
|
|
1792
|
+
const fontBuffer = await _chunkYMQEM4AOjs.readFontFile.call(void 0, file);
|
|
1793
|
+
const font = await _chunkYMQEM4AOjs.parseFont.call(void 0, fontBuffer, file.name);
|
|
1794
|
+
const { weightName, subfamilyName, style, variableFont } = _chunkYMQEM4AOjs.extractFontMetadata.call(void 0,
|
|
1795
1795
|
font,
|
|
1796
1796
|
doc_typefaceName,
|
|
1797
1797
|
weightKeywordList,
|
|
1798
1798
|
italicKeywordList
|
|
1799
1799
|
);
|
|
1800
|
-
const weight =
|
|
1800
|
+
const weight = _chunkYMQEM4AOjs.determineWeight.call(void 0, font, weightName);
|
|
1801
1801
|
const normalizedId = doc_id.startsWith("drafts.") ? doc_id.replace("drafts.", "") : doc_id;
|
|
1802
1802
|
await client.patch(normalizedId).set({ weightName, subfamily: subfamilyName, style, variableFont, weight }).commit();
|
|
1803
1803
|
}
|
|
@@ -1938,18 +1938,18 @@ var SingleUploaderTool = (props) => {
|
|
|
1938
1938
|
const formatUpper = format.toUpperCase();
|
|
1939
1939
|
const hasFile = !!((_b2 = (_a2 = fileInput == null ? void 0 : fileInput[format]) == null ? void 0 : _a2.asset) == null ? void 0 : _b2._ref);
|
|
1940
1940
|
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__ */ _react2.default.createElement(_ui.Card, { border: true, radius: 1, paddingX: 2, paddingY: 3 }, /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { justify: "space-between", align: "center", gap: 2 }, /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { gap: 3, align: "center", style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 0, style: { fontFamily: "monospace", minWidth: "2.5rem", flexShrink: 0, opacity: hasFile ? 1 : 0.5 } }, formatUpper), hasFile ? /* @__PURE__ */ _react2.default.createElement(_ui.Box, { style: { flex: 1, minWidth: 0
|
|
1941
|
+
return /* @__PURE__ */ _react2.default.createElement(_ui.Card, { border: true, radius: 1, paddingX: 2, paddingY: 3 }, /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { justify: "space-between", align: "center", gap: 2 }, /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { gap: 3, align: "center", style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 0, style: { fontFamily: "monospace", minWidth: "2.5rem", flexShrink: 0, opacity: hasFile ? 1 : 0.5 } }, formatUpper), hasFile ? /* @__PURE__ */ _react2.default.createElement(_ui.Box, { style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ _react2.default.createElement("a", { href: fileUrl, target: "_blank", rel: "noreferrer" }, (filenames == null ? void 0 : filenames[format]) || "File")) : /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 1, muted: true }, "\u2014")), status === "ready" && /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { gap: 1, align: "center", style: { flexShrink: 0 } }, buildSource && (fileInput == null ? void 0 : fileInput[buildSource]) && /* @__PURE__ */ _react2.default.createElement(_ui.Button, { mode: "ghost", tone: "primary", fontSize: 1, padding: 2, onClick: () => handleGenerateFontFile(format, fileInput[buildSource]), text: "Build" }), /* @__PURE__ */ _react2.default.createElement(_ui.Button, { as: "label", mode: "ghost", tone: "primary", fontSize: 1, padding: 2, style: { cursor: "pointer" } }, /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 1 }, "Upload"), /* @__PURE__ */ _react2.default.createElement("input", { ref, type: "file", hidden: true, onChange: (e) => handleUpload(e, format) })), hasFile && /* @__PURE__ */ _react2.default.createElement(_ui.Button, { mode: "bleed", tone: "critical", icon: _icons.TrashIcon, padding: 2, onClick: () => handleDelete(format) }))));
|
|
1942
1942
|
};
|
|
1943
1943
|
const renderTopLevelAssetSection = (label, fieldName, assetRef, filename, onBuild) => {
|
|
1944
1944
|
const hasFile = !!assetRef;
|
|
1945
1945
|
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__ */ _react2.default.createElement(_ui.Card, { border: true, radius: 1, paddingX: 2, paddingY: 3 }, /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { justify: "space-between", align: "center", gap: 2 }, /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { gap: 3, align: "center", style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 0, style: { fontFamily: "monospace", minWidth: "2.5rem", flexShrink: 0, opacity: hasFile ? 1 : 0.5 } }, label), hasFile ? /* @__PURE__ */ _react2.default.createElement(_ui.Box, { style: { flex: 1, minWidth: 0
|
|
1946
|
+
return /* @__PURE__ */ _react2.default.createElement(_ui.Card, { border: true, radius: 1, paddingX: 2, paddingY: 3 }, /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { justify: "space-between", align: "center", gap: 2 }, /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { gap: 3, align: "center", style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 0, style: { fontFamily: "monospace", minWidth: "2.5rem", flexShrink: 0, opacity: hasFile ? 1 : 0.5 } }, label), hasFile ? /* @__PURE__ */ _react2.default.createElement(_ui.Box, { style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ _react2.default.createElement("a", { href: fileUrl, target: "_blank", rel: "noreferrer" }, filename || "File")) : /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 1, muted: true }, "\u2014")), status === "ready" && /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { gap: 1, align: "center", style: { flexShrink: 0 } }, onBuild && (fileInput == null ? void 0 : fileInput.woff2) && /* @__PURE__ */ _react2.default.createElement(_ui.Button, { mode: "ghost", tone: "primary", fontSize: 1, padding: 2, onClick: onBuild, text: "Build" }), /* @__PURE__ */ _react2.default.createElement(_ui.Button, { as: "label", mode: "ghost", tone: "primary", fontSize: 1, padding: 2, style: { cursor: "pointer" } }, /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 1 }, "Upload"), /* @__PURE__ */ _react2.default.createElement("input", { type: "file", hidden: true, onChange: (e) => handleUploadTopLevelFile(e, fieldName) })), hasFile && /* @__PURE__ */ _react2.default.createElement(_ui.Button, { mode: "bleed", tone: "critical", icon: _icons.TrashIcon, padding: 2, onClick: () => handleDeleteTopLevel(fieldName) }))));
|
|
1947
1947
|
};
|
|
1948
1948
|
const renderCssSection = () => {
|
|
1949
1949
|
var _a2, _b2;
|
|
1950
1950
|
const hasFile = !!((_b2 = (_a2 = fileInput == null ? void 0 : fileInput.css) == null ? void 0 : _a2.asset) == null ? void 0 : _b2._ref);
|
|
1951
1951
|
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__ */ _react2.default.createElement(_ui.Card, { border: true, radius: 1, paddingX: 2, paddingY: 3 }, /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { justify: "space-between", align: "center", gap: 2 }, /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { gap: 3, align: "center", style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 0, style: { fontFamily: "monospace", minWidth: "2.5rem", flexShrink: 0, opacity: hasFile ? 1 : 0.5 } }, "CSS"), hasFile ? /* @__PURE__ */ _react2.default.createElement(_ui.Box, { style: { flex: 1, minWidth: 0
|
|
1952
|
+
return /* @__PURE__ */ _react2.default.createElement(_ui.Card, { border: true, radius: 1, paddingX: 2, paddingY: 3 }, /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { justify: "space-between", align: "center", gap: 2 }, /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { gap: 3, align: "center", style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 0, style: { fontFamily: "monospace", minWidth: "2.5rem", flexShrink: 0, opacity: hasFile ? 1 : 0.5 } }, "CSS"), hasFile ? /* @__PURE__ */ _react2.default.createElement(_ui.Box, { style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ _react2.default.createElement("a", { href: fileUrl, target: "_blank", rel: "noreferrer" }, (filenames == null ? void 0 : filenames.css) || "File")) : /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 1, muted: true }, "\u2014")), status === "ready" && /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { gap: 1, align: "center", style: { flexShrink: 0 } }, (fileInput == null ? void 0 : fileInput.woff2) && /* @__PURE__ */ _react2.default.createElement(_ui.Button, { mode: "ghost", tone: "primary", fontSize: 1, padding: 2, onClick: () => handleGenerateCssFile(), text: "Build" }), hasFile && /* @__PURE__ */ _react2.default.createElement(_ui.Button, { mode: "bleed", tone: "critical", icon: _icons.TrashIcon, padding: 2, onClick: () => handleDelete("css") }))));
|
|
1953
1953
|
};
|
|
1954
1954
|
const renderDataSection = () => /* @__PURE__ */ _react2.default.createElement(_ui.Card, { border: true, radius: 1, paddingX: 2, paddingY: 3 }, /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { justify: "space-between", align: "center", gap: 2 }, /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { gap: 3, align: "center", style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ _react2.default.createElement(_ui.Text, { 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__ */ _react2.default.createElement(_ui.Text, { size: 1 }, "v", doc_metaData.version, " ", /* @__PURE__ */ _react2.default.createElement(_ui.Text, { as: "span", size: 1, muted: true }, "(", doc_metaData.genDate, ")")) : /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 1, muted: true }, "\u2014")), status === "ready" && (fileInput == null ? void 0 : fileInput.ttf) && /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { gap: 1, align: "center", style: { flexShrink: 0 } }, /* @__PURE__ */ _react2.default.createElement(_ui.Button, { mode: "ghost", tone: "primary", fontSize: 1, padding: 2, onClick: () => handleGenerateFontData(), text: "Build" }))));
|
|
1955
1955
|
return /* @__PURE__ */ _react2.default.createElement(_ui.Stack, { space: 2 }, /* @__PURE__ */ _react2.default.createElement(
|
|
@@ -2036,7 +2036,7 @@ var UploadScriptsComponent = (props) => {
|
|
|
2036
2036
|
const stylesObject = _sanity.useFormValue.call(void 0, ["styles"]);
|
|
2037
2037
|
let subfamiliesArray = (stylesObject == null ? void 0 : stylesObject.subfamilies) || [];
|
|
2038
2038
|
const { weightKeywordList, italicKeywordList } = _react.useMemo.call(void 0,
|
|
2039
|
-
() =>
|
|
2039
|
+
() => _chunkYMQEM4AOjs.generateStyleKeywords.call(void 0, ),
|
|
2040
2040
|
[]
|
|
2041
2041
|
);
|
|
2042
2042
|
const readFontFile3 = (file) => {
|
|
@@ -2068,21 +2068,21 @@ var UploadScriptsComponent = (props) => {
|
|
|
2068
2068
|
for (var i = 0; i < event.target.files.length; i++) {
|
|
2069
2069
|
const file = event.target.files[i];
|
|
2070
2070
|
const fontBuffer = await readFontFile3(file);
|
|
2071
|
-
const font = await
|
|
2072
|
-
const fullName =
|
|
2073
|
-
const familyName =
|
|
2071
|
+
const font = await _chunkYMQEM4AOjs.parseFont.call(void 0, fontBuffer, file.name);
|
|
2072
|
+
const fullName = _chunkYMQEM4AOjs.getNameString.call(void 0, font, 4);
|
|
2073
|
+
const familyName = _chunkYMQEM4AOjs.getNameString.call(void 0, font, 1);
|
|
2074
2074
|
console.log("Reading font:", fullName, file.name);
|
|
2075
|
-
let weightName =
|
|
2075
|
+
let weightName = _chunkYMQEM4AOjs.getNameString.call(void 0, font, 17) || _chunkYMQEM4AOjs.getNameString.call(void 0, font, 2) || "";
|
|
2076
2076
|
weightName = weightName.replace("Italic", "").replace("It", "").trim();
|
|
2077
2077
|
if ((weightName == "" || weightName.toLowerCase() == "roman") && fullName) {
|
|
2078
2078
|
weightName = fullName.replace(title + " ", "").replace(title, "").trim();
|
|
2079
2079
|
weightName = weightName.replace("Italic", "").replace("It", "").trim();
|
|
2080
2080
|
}
|
|
2081
|
-
const axes =
|
|
2081
|
+
const axes = _chunkYMQEM4AOjs.getVariationAxes.call(void 0, font);
|
|
2082
2082
|
let variableFont = axes !== null;
|
|
2083
2083
|
let subfamilyName = familyName.toLowerCase().trim().replace(title.toLowerCase().trim(), "").trim();
|
|
2084
2084
|
let fontTitle = fullName;
|
|
2085
|
-
const italicAngle =
|
|
2085
|
+
const italicAngle = _chunkYMQEM4AOjs.getItalicAngle.call(void 0, font);
|
|
2086
2086
|
let style = italicAngle !== 0 || fullName.toLowerCase().includes("italic") ? "Italic" : "Regular";
|
|
2087
2087
|
if (fontTitle.toLowerCase().trim().includes(script)) {
|
|
2088
2088
|
fontTitle = fontTitle.toLowerCase().trim().replace(script, "").trim();
|
|
@@ -2118,7 +2118,7 @@ var UploadScriptsComponent = (props) => {
|
|
|
2118
2118
|
}
|
|
2119
2119
|
if (variableFont && !fontTitle.toLowerCase().trim().endsWith(" vf")) fontTitle = fontTitle + " VF";
|
|
2120
2120
|
if (italicKW.length > 0) {
|
|
2121
|
-
italicKW = italicKW.map((item) =>
|
|
2121
|
+
italicKW = italicKW.map((item) => _chunkYMQEM4AOjs.reverseSpellingLookup.call(void 0, item));
|
|
2122
2122
|
fontTitle = fontTitle + italicKW.join(" ");
|
|
2123
2123
|
style = "Italic";
|
|
2124
2124
|
}
|
|
@@ -2152,7 +2152,7 @@ var UploadScriptsComponent = (props) => {
|
|
|
2152
2152
|
variableFont,
|
|
2153
2153
|
weightName,
|
|
2154
2154
|
normalWeight: true,
|
|
2155
|
-
weight:
|
|
2155
|
+
weight: _chunkYMQEM4AOjs.getWeightClass.call(void 0, font) || (/hairline|extra thin|extrathin/.test(weightName == null ? void 0 : weightName.toLowerCase()) ? 100 : /thin|extra light|extralight/.test(weightName == null ? void 0 : weightName.toLowerCase()) ? 200 : /light|book/.test(weightName == null ? void 0 : weightName.toLowerCase()) ? 300 : /regular|normal/.test(weightName == null ? void 0 : weightName.toLowerCase()) ? 400 : /medium/.test(weightName == null ? void 0 : weightName.toLowerCase()) ? 500 : /semi bold|semibold/.test(weightName == null ? void 0 : weightName.toLowerCase()) ? 600 : /bold/.test(weightName == null ? void 0 : weightName.toLowerCase()) ? 700 : /extra bold|extrabold/.test(weightName == null ? void 0 : weightName.toLowerCase()) ? 800 : /black|ultra/.test(weightName == null ? void 0 : weightName.toLowerCase()) ? 900 : 400),
|
|
2156
2156
|
files: [file],
|
|
2157
2157
|
fontKit: font,
|
|
2158
2158
|
scriptFileInput: { [script]: {} }
|
|
@@ -2201,7 +2201,7 @@ var UploadScriptsComponent = (props) => {
|
|
|
2201
2201
|
if (file.name.endsWith(".woff2")) {
|
|
2202
2202
|
console.log("generating css file for: ", fontObject.title);
|
|
2203
2203
|
setStatus("generating css file for: " + fontObject.title);
|
|
2204
|
-
newFileInput = await
|
|
2204
|
+
newFileInput = await _chunkYMQEM4AOjs.generateCssFile.call(void 0, {
|
|
2205
2205
|
woff2File: file,
|
|
2206
2206
|
fileInput: newFileInput,
|
|
2207
2207
|
// script: script,
|
|
@@ -2453,7 +2453,7 @@ var FontScriptUploaderComponent = (props) => {
|
|
|
2453
2453
|
);
|
|
2454
2454
|
let blob = await fetch(woff2Buffer.url);
|
|
2455
2455
|
blob = await blob.blob();
|
|
2456
|
-
let newFileInput = await
|
|
2456
|
+
let newFileInput = await _chunkYMQEM4AOjs.generateCssFile.call(void 0, {
|
|
2457
2457
|
woff2File: blob,
|
|
2458
2458
|
fileInput: scriptFileInput,
|
|
2459
2459
|
language,
|
|
@@ -2538,7 +2538,7 @@ var FontScriptUploaderComponent = (props) => {
|
|
|
2538
2538
|
if (code === "woff2") {
|
|
2539
2539
|
console.log("woff2");
|
|
2540
2540
|
setMessage({ ...message, [language]: "Generating Css: " + doc_title + ".css" });
|
|
2541
|
-
newFileInput = await
|
|
2541
|
+
newFileInput = await _chunkYMQEM4AOjs.generateCssFile.call(void 0, {
|
|
2542
2542
|
woff2File: file,
|
|
2543
2543
|
fileInput: newFileInput,
|
|
2544
2544
|
language,
|
|
@@ -2811,21 +2811,36 @@ function KeyValueReferenceInput(props) {
|
|
|
2811
2811
|
const pickerLabel = referenceType || valueTitle.toLowerCase();
|
|
2812
2812
|
return /* @__PURE__ */ _react2.default.createElement(_ui.Stack, { space: 3 }, topActions && /* @__PURE__ */ _react2.default.createElement(_ui.Box, { paddingBottom: 2 }, topActions), /* @__PURE__ */ _react2.default.createElement(_ui.Box, null, /* @__PURE__ */ _react2.default.createElement(_ui.Stack, { space: 2 }, pairs.map((pair, index) => {
|
|
2813
2813
|
var _a2;
|
|
2814
|
-
return /* @__PURE__ */ _react2.default.createElement(_ui.
|
|
2814
|
+
return /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { key: index, gap: 1, align: "center" }, /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { direction: "column", style: { flexShrink: 0 } }, /* @__PURE__ */ _react2.default.createElement(
|
|
2815
|
+
_ui.Button,
|
|
2816
|
+
{
|
|
2817
|
+
mode: "bleed",
|
|
2818
|
+
icon: _icons.ArrowUpIcon,
|
|
2819
|
+
padding: 1,
|
|
2820
|
+
fontSize: 0,
|
|
2821
|
+
onClick: () => handleMoveUp(index),
|
|
2822
|
+
disabled: index === 0,
|
|
2823
|
+
style: { cursor: index === 0 ? "default" : "pointer" }
|
|
2824
|
+
}
|
|
2825
|
+
), /* @__PURE__ */ _react2.default.createElement(
|
|
2826
|
+
_ui.Button,
|
|
2827
|
+
{
|
|
2828
|
+
mode: "bleed",
|
|
2829
|
+
icon: _icons.ArrowDownIcon,
|
|
2830
|
+
padding: 1,
|
|
2831
|
+
fontSize: 0,
|
|
2832
|
+
onClick: () => handleMoveDown(index),
|
|
2833
|
+
disabled: index === pairs.length - 1,
|
|
2834
|
+
style: { cursor: index === pairs.length - 1 ? "default" : "pointer" }
|
|
2835
|
+
}
|
|
2836
|
+
)), /* @__PURE__ */ _react2.default.createElement(_ui.Box, { flex: 1 }, /* @__PURE__ */ _react2.default.createElement(
|
|
2815
2837
|
_ui.TextInput,
|
|
2816
2838
|
{
|
|
2817
2839
|
value: pair.key,
|
|
2818
2840
|
onChange: (e) => handlePairChange(index, "key", e.target.value),
|
|
2819
2841
|
placeholder: keyPlaceholder
|
|
2820
2842
|
}
|
|
2821
|
-
)), /* @__PURE__ */ _react2.default.createElement(_ui.Box, { flex: 1
|
|
2822
|
-
_ui.Text,
|
|
2823
|
-
{
|
|
2824
|
-
size: 2,
|
|
2825
|
-
style: { whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis", maxWidth: "90%" }
|
|
2826
|
-
},
|
|
2827
|
-
referenceData[pair.value._ref] || "Loading..."
|
|
2828
|
-
), /* @__PURE__ */ _react2.default.createElement(
|
|
2843
|
+
)), /* @__PURE__ */ _react2.default.createElement(_ui.Box, { flex: 1 }, ((_a2 = pair.value) == null ? void 0 : _a2._ref) ? /* @__PURE__ */ _react2.default.createElement(_ui.Card, { radius: 2, tone: "primary", style: { paddingLeft: "0.75rem", height: "fit-content" } }, /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { align: "center", justify: "space-between" }, /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 2, style: { whiteSpace: "nowrap" } }, referenceData[pair.value._ref] || "Loading..."), /* @__PURE__ */ _react2.default.createElement(
|
|
2829
2844
|
_ui.MenuButton,
|
|
2830
2845
|
{
|
|
2831
2846
|
button: /* @__PURE__ */ _react2.default.createElement(_ui.Button, { icon: _icons.EllipsisHorizontalIcon, mode: "bleed", title: "Options" }),
|
|
@@ -2837,18 +2852,20 @@ function KeyValueReferenceInput(props) {
|
|
|
2837
2852
|
_ui.Box,
|
|
2838
2853
|
{
|
|
2839
2854
|
padding: 2,
|
|
2840
|
-
style: {
|
|
2855
|
+
style: { border: "1px dashed #ccc", borderRadius: "4px", display: "flex", alignItems: "center", justifyContent: "center", cursor: "pointer" },
|
|
2841
2856
|
onClick: () => openReferenceSelector(index)
|
|
2842
2857
|
},
|
|
2843
2858
|
/* @__PURE__ */ _react2.default.createElement(_ui.Text, { muted: true, size: 2 }, "Click to select a ", pickerLabel)
|
|
2844
|
-
))
|
|
2845
|
-
|
|
2859
|
+
)), /* @__PURE__ */ _react2.default.createElement(
|
|
2860
|
+
_ui.Button,
|
|
2846
2861
|
{
|
|
2847
|
-
|
|
2862
|
+
mode: "bleed",
|
|
2863
|
+
tone: "critical",
|
|
2864
|
+
icon: _icons.TrashIcon,
|
|
2865
|
+
padding: 2,
|
|
2848
2866
|
onClick: () => handleRemovePair(index),
|
|
2849
|
-
style: {
|
|
2850
|
-
}
|
|
2851
|
-
/* @__PURE__ */ _react2.default.createElement(_icons.TrashIcon, null)
|
|
2867
|
+
style: { flexShrink: 0, cursor: "pointer" }
|
|
2868
|
+
}
|
|
2852
2869
|
));
|
|
2853
2870
|
}))), /* @__PURE__ */ _react2.default.createElement(_ui.Button, { tone: "primary", mode: "ghost", onClick: handleAddPair, icon: _icons.AddIcon, text: `Add ${keyTitle}` }), isDialogOpen && /* @__PURE__ */ _react2.default.createElement(
|
|
2854
2871
|
_ui.Dialog,
|
|
@@ -2910,7 +2927,7 @@ function VariableInstanceReferencesInput(props) {
|
|
|
2910
2927
|
console.warn("Cannot autofill: no variableInstances data on this document");
|
|
2911
2928
|
return;
|
|
2912
2929
|
}
|
|
2913
|
-
const mappings = await
|
|
2930
|
+
const mappings = await _chunkYMQEM4AOjs.parseVariableFontInstances.call(void 0, formDocument, sanityClient);
|
|
2914
2931
|
if (mappings.length === 0) {
|
|
2915
2932
|
console.warn("No variable instances could be parsed from this font");
|
|
2916
2933
|
return;
|
|
@@ -3324,12 +3341,12 @@ async function getEmptyFontKit({ title, files, weightKeywordList, italicKeywordL
|
|
|
3324
3341
|
for (var i = 0; i < files.length; i++) {
|
|
3325
3342
|
const file = files[i];
|
|
3326
3343
|
const fontBuffer = await readFontFile2(file);
|
|
3327
|
-
const font = await
|
|
3328
|
-
let weightName =
|
|
3329
|
-
const axes =
|
|
3344
|
+
const font = await _chunkYMQEM4AOjs.parseFont.call(void 0, fontBuffer, file.name);
|
|
3345
|
+
let weightName = _chunkYMQEM4AOjs.getNameString.call(void 0, font, 17) || _chunkYMQEM4AOjs.getNameString.call(void 0, font, 2) || "";
|
|
3346
|
+
const axes = _chunkYMQEM4AOjs.getVariationAxes.call(void 0, font);
|
|
3330
3347
|
let variableFont = axes !== null;
|
|
3331
|
-
const familyName =
|
|
3332
|
-
const fullName =
|
|
3348
|
+
const familyName = _chunkYMQEM4AOjs.getNameString.call(void 0, font, 1);
|
|
3349
|
+
const fullName = _chunkYMQEM4AOjs.getNameString.call(void 0, font, 4);
|
|
3333
3350
|
let subfamilyName = familyName.toLowerCase().trim().replace(title.toLowerCase().trim(), "").trim();
|
|
3334
3351
|
let fontTitle = fullName.toLowerCase().trim();
|
|
3335
3352
|
weightKeywordList.forEach((keyword) => {
|
|
@@ -5908,7 +5925,9 @@ function createStylesField({
|
|
|
5908
5925
|
subfamilyPreferredStyle = false,
|
|
5909
5926
|
subfamilyFontFilter = false,
|
|
5910
5927
|
subfamilyPreview = false,
|
|
5911
|
-
pairs = true
|
|
5928
|
+
pairs = true,
|
|
5929
|
+
generateCollections = false,
|
|
5930
|
+
generateFullFamilyCollection = false
|
|
5912
5931
|
} = {}) {
|
|
5913
5932
|
const subfamilyFields = [
|
|
5914
5933
|
{
|
|
@@ -6052,6 +6071,28 @@ function createStylesField({
|
|
|
6052
6071
|
type: "array",
|
|
6053
6072
|
of: [subfamilyItem]
|
|
6054
6073
|
},
|
|
6074
|
+
...field(generateCollections, {
|
|
6075
|
+
title: "Generate Collections and Pairs",
|
|
6076
|
+
name: "generateCollections",
|
|
6077
|
+
type: "string",
|
|
6078
|
+
description: "Generate Collections and Pairs from the typeface's fonts.",
|
|
6079
|
+
components: { input: GenerateCollectionsPairsComponent },
|
|
6080
|
+
hidden: ({ parent }) => {
|
|
6081
|
+
var _a;
|
|
6082
|
+
return !((_a = parent == null ? void 0 : parent.fonts) == null ? void 0 : _a.length);
|
|
6083
|
+
}
|
|
6084
|
+
}),
|
|
6085
|
+
...field(generateFullFamilyCollection, {
|
|
6086
|
+
title: "Generate Full Family Collection",
|
|
6087
|
+
name: "generateCollectionGroup",
|
|
6088
|
+
type: "string",
|
|
6089
|
+
description: "Generate a Collection that includes all styles from this typeface.",
|
|
6090
|
+
components: { input: PrimaryCollectionGeneratorTypeface },
|
|
6091
|
+
hidden: ({ parent }) => {
|
|
6092
|
+
var _a;
|
|
6093
|
+
return !((_a = parent == null ? void 0 : parent.fonts) == null ? void 0 : _a.length);
|
|
6094
|
+
}
|
|
6095
|
+
}),
|
|
6055
6096
|
{
|
|
6056
6097
|
title: "Collections",
|
|
6057
6098
|
name: "collections",
|
|
@@ -6175,4 +6216,4 @@ function createStylesField({
|
|
|
6175
6216
|
|
|
6176
6217
|
|
|
6177
6218
|
|
|
6178
|
-
exports.BatchUploadFonts = BatchUploadFonts; exports.BulkActions =
|
|
6219
|
+
exports.BatchUploadFonts = BatchUploadFonts; exports.BulkActions = _chunkYMQEM4AOjs.BulkActions; exports.DISCOUNT_REQUIREMENT_TYPES = DISCOUNT_REQUIREMENT_TYPES; exports.DISCOUNT_REQUIREMENT_TYPES_OBJECT = DISCOUNT_REQUIREMENT_TYPES_OBJECT; exports.EXECUTION_STATUS = _chunkYMQEM4AOjs.EXECUTION_STATUS; exports.ExistingDocumentResolver = _chunkYMQEM4AOjs.ExistingDocumentResolver; exports.FONT_STATUS = _chunkYMQEM4AOjs.FONT_STATUS; exports.FontReviewCard = _chunkYMQEM4AOjs.FontReviewCard_default; exports.FontScriptUploaderComponent = FontScriptUploaderComponent; exports.GenerateCollectionsPairsComponent = GenerateCollectionsPairsComponent; exports.HtmlDescription = HtmlDescription; exports.KeyValueInput = KeyValueInput; exports.KeyValueReferenceInput = KeyValueReferenceInput; exports.NestedObjectArraySelector = NestedObjectArraySelector; exports.PLAN_PHASE = _chunkYMQEM4AOjs.PLAN_PHASE; exports.PLAN_VERSION = _chunkYMQEM4AOjs.PLAN_VERSION; exports.PriceInput = _chunkYMQEM4AOjs.PriceInput_default; exports.PrimaryCollectionGeneratorTypeface = PrimaryCollectionGeneratorTypeface; exports.RECOMMENDATION = _chunkYMQEM4AOjs.RECOMMENDATION; exports.RegenerateSubfamiliesComponent = RegenerateSubfamiliesComponent; exports.SCRIPTS = SCRIPTS; exports.SCRIPTS_OBJECT = SCRIPTS_OBJECT; exports.SetOTF = SetOTF; exports.SingleUploaderTool = SingleUploaderTool; exports.StatusDisplay = StatusDisplay_default; exports.StyleCountInput = StyleCountInput; exports.UpdateScriptsComponent = UpdateScriptsComponent; exports.UploadButton = UploadButton_default; exports.UploadModal = _chunkYMQEM4AOjs.UploadModal; exports.UploadScriptsComponent = UploadScriptsComponent; exports.UploadStep1Settings = _chunkYMQEM4AOjs.UploadStep1Settings; exports.UploadStep2Review = _chunkYMQEM4AOjs.UploadStep2Review; exports.UploadStep3Execute = _chunkYMQEM4AOjs.UploadStep3Execute; exports.UploadStep3bInstances = _chunkYMQEM4AOjs.UploadStep3bInstances; exports.UploadSummary = _chunkYMQEM4AOjs.UploadSummary; exports.VariableInstanceReferencesInput = VariableInstanceReferencesInput; exports.addItalicToFontTitle = _chunkYMQEM4AOjs.addItalicToFontTitle; exports.buildUploadPlan = _chunkYMQEM4AOjs.buildUploadPlan; exports.createEmptyPlan = _chunkYMQEM4AOjs.createEmptyPlan; exports.createFontDecisions = _chunkYMQEM4AOjs.createFontDecisions; exports.createFontObject = _chunkYMQEM4AOjs.createFontObject; exports.createInitialExecutionState = _chunkYMQEM4AOjs.createInitialExecutionState; exports.createStylesField = createStylesField; exports.determineWeight = _chunkYMQEM4AOjs.determineWeight; exports.escapeCssFontName = _chunkYMQEM4AOjs.escapeCssFontName; exports.executeUploadPlan = _chunkYMQEM4AOjs.executeUploadPlan; exports.executionReducer = _chunkYMQEM4AOjs.executionReducer; exports.expandAbbreviations = _chunkYMQEM4AOjs.expandAbbreviations; exports.extractFontMetadata = _chunkYMQEM4AOjs.extractFontMetadata; exports.extractWeightFromFullName = _chunkYMQEM4AOjs.extractWeightFromFullName; exports.extractWeightName = _chunkYMQEM4AOjs.extractWeightName; exports.formatFontTitle = _chunkYMQEM4AOjs.formatFontTitle; exports.generateCssFile = _chunkYMQEM4AOjs.generateCssFile; exports.generateFontData = _chunkYMQEM4AOjs.generateFontData; exports.generateFontFile = generateFontFile; exports.generateStyleKeywords = _chunkYMQEM4AOjs.generateStyleKeywords; exports.generateSubset = generateSubset; exports.getAllFeatureTags = _chunkYMQEM4AOjs.getAllFeatureTags; exports.getCharacterSet = _chunkYMQEM4AOjs.getCharacterSet; exports.getEmptyFontKit = getEmptyFontKit; exports.getFamilyClass = _chunkYMQEM4AOjs.getFamilyClass; exports.getFontMetadata = _chunkYMQEM4AOjs.getFontMetadata; exports.getFontMetrics = _chunkYMQEM4AOjs.getFontMetrics; exports.getFsSelection = _chunkYMQEM4AOjs.getFsSelection; exports.getGlyphCount = _chunkYMQEM4AOjs.getGlyphCount; exports.getItalicAngle = _chunkYMQEM4AOjs.getItalicAngle; exports.getMacStyle = _chunkYMQEM4AOjs.getMacStyle; exports.getNameString = _chunkYMQEM4AOjs.getNameString; exports.getNamedInstances = _chunkYMQEM4AOjs.getNamedInstances; exports.getVariationAxes = _chunkYMQEM4AOjs.getVariationAxes; exports.getWeightClass = _chunkYMQEM4AOjs.getWeightClass; exports.logFontInfo = _chunkYMQEM4AOjs.logFontInfo; exports.openTypeField = openTypeField; exports.parseFont = _chunkYMQEM4AOjs.parseFont; exports.parseVariableFontInstances = _chunkYMQEM4AOjs.parseVariableFontInstances_default; exports.planReducer = _chunkYMQEM4AOjs.planReducer; exports.processFontFiles = _chunkYMQEM4AOjs.processFontFiles; exports.processItalicKeywords = _chunkYMQEM4AOjs.processItalicKeywords; exports.processSubfamilyName = _chunkYMQEM4AOjs.processSubfamilyName; exports.readFontFile = _chunkYMQEM4AOjs.readFontFile; exports.removeWeightNames = _chunkYMQEM4AOjs.removeWeightNames; exports.renameFontDocuments = renameFontDocuments; exports.resolveExistingFont = _chunkYMQEM4AOjs.resolveExistingFont; exports.reverseSpellingLookup = _chunkYMQEM4AOjs.reverseSpellingLookup; exports.sanitizeForSanityId = _chunkYMQEM4AOjs.sanitizeForSanityId; exports.sortFontObjects = _chunkYMQEM4AOjs.sortFontObjects; exports.styleCountField = styleCountField; exports.stylisticSetField = stylisticSetField; exports.updateFontPrices = updateFontPrices; exports.updateTypefaceDocument = _chunkYMQEM4AOjs.updateTypefaceDocument; exports.uploadFontFiles = uploadFontFiles; exports.useNestedObjects = useNestedObjects; exports.useSanityClient = useSanityClient;
|
package/dist/index.mjs
CHANGED
|
@@ -60,7 +60,7 @@ import {
|
|
|
60
60
|
sanitizeForSanityId,
|
|
61
61
|
sortFontObjects,
|
|
62
62
|
updateTypefaceDocument
|
|
63
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-FT7YTFZW.mjs";
|
|
64
64
|
|
|
65
65
|
// src/components/BatchUploadFonts.jsx
|
|
66
66
|
import React3, { useCallback, useState as useState2, useMemo as useMemo2, useRef, useEffect, lazy, Suspense } from "react";
|
|
@@ -636,7 +636,7 @@ var updateTypefaceSubfamilies = async (doc_id, stylesObject, newSubfamiliesArray
|
|
|
636
636
|
};
|
|
637
637
|
|
|
638
638
|
// src/components/BatchUploadFonts.jsx
|
|
639
|
-
var UploadModal2 = lazy(() => import("./UploadModal-
|
|
639
|
+
var UploadModal2 = lazy(() => import("./UploadModal-DDTVJ2MA.mjs"));
|
|
640
640
|
var ACCEPTED_EXTENSIONS = ["ttf", "otf", "woff", "woff2", "eot", "svg"];
|
|
641
641
|
var formatElapsed = (s) => {
|
|
642
642
|
const m = Math.floor(s / 60);
|
|
@@ -1021,7 +1021,7 @@ var BatchUploadFonts = () => {
|
|
|
1021
1021
|
style: { fontFamily: "monospace", minWidth: "2.5rem", flexShrink: 0 }
|
|
1022
1022
|
},
|
|
1023
1023
|
ext
|
|
1024
|
-
), /* @__PURE__ */ React3.createElement(Box2, { style: { flex: 1, minWidth: 0
|
|
1024
|
+
), /* @__PURE__ */ React3.createElement(Box2, { style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React3.createElement(Text3, { size: 1 }, file.name))), /* @__PURE__ */ React3.createElement(
|
|
1025
1025
|
Button2,
|
|
1026
1026
|
{
|
|
1027
1027
|
mode: "bleed",
|
|
@@ -1938,18 +1938,18 @@ var SingleUploaderTool = (props) => {
|
|
|
1938
1938
|
const formatUpper = format.toUpperCase();
|
|
1939
1939
|
const hasFile = !!((_b2 = (_a2 = fileInput == null ? void 0 : fileInput[format]) == null ? void 0 : _a2.asset) == null ? void 0 : _b2._ref);
|
|
1940
1940
|
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
|
|
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 } }, /* @__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
1942
|
};
|
|
1943
1943
|
const renderTopLevelAssetSection = (label, fieldName, assetRef, filename, onBuild) => {
|
|
1944
1944
|
const hasFile = !!assetRef;
|
|
1945
1945
|
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
|
|
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 } }, /* @__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
1947
|
};
|
|
1948
1948
|
const renderCssSection = () => {
|
|
1949
1949
|
var _a2, _b2;
|
|
1950
1950
|
const hasFile = !!((_b2 = (_a2 = fileInput == null ? void 0 : fileInput.css) == null ? void 0 : _a2.asset) == null ? void 0 : _b2._ref);
|
|
1951
1951
|
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
|
|
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 } }, /* @__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
1953
|
};
|
|
1954
1954
|
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
1955
|
return /* @__PURE__ */ React6.createElement(Stack5, { space: 2 }, /* @__PURE__ */ React6.createElement(
|
|
@@ -2811,21 +2811,36 @@ function KeyValueReferenceInput(props) {
|
|
|
2811
2811
|
const pickerLabel = referenceType || valueTitle.toLowerCase();
|
|
2812
2812
|
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
2813
|
var _a2;
|
|
2814
|
-
return /* @__PURE__ */ React12.createElement(
|
|
2814
|
+
return /* @__PURE__ */ React12.createElement(Flex7, { key: index, gap: 1, align: "center" }, /* @__PURE__ */ React12.createElement(Flex7, { direction: "column", style: { flexShrink: 0 } }, /* @__PURE__ */ React12.createElement(
|
|
2815
|
+
Button10,
|
|
2816
|
+
{
|
|
2817
|
+
mode: "bleed",
|
|
2818
|
+
icon: ArrowUpIcon2,
|
|
2819
|
+
padding: 1,
|
|
2820
|
+
fontSize: 0,
|
|
2821
|
+
onClick: () => handleMoveUp(index),
|
|
2822
|
+
disabled: index === 0,
|
|
2823
|
+
style: { cursor: index === 0 ? "default" : "pointer" }
|
|
2824
|
+
}
|
|
2825
|
+
), /* @__PURE__ */ React12.createElement(
|
|
2826
|
+
Button10,
|
|
2827
|
+
{
|
|
2828
|
+
mode: "bleed",
|
|
2829
|
+
icon: ArrowDownIcon2,
|
|
2830
|
+
padding: 1,
|
|
2831
|
+
fontSize: 0,
|
|
2832
|
+
onClick: () => handleMoveDown(index),
|
|
2833
|
+
disabled: index === pairs.length - 1,
|
|
2834
|
+
style: { cursor: index === pairs.length - 1 ? "default" : "pointer" }
|
|
2835
|
+
}
|
|
2836
|
+
)), /* @__PURE__ */ React12.createElement(Box4, { flex: 1 }, /* @__PURE__ */ React12.createElement(
|
|
2815
2837
|
TextInput3,
|
|
2816
2838
|
{
|
|
2817
2839
|
value: pair.key,
|
|
2818
2840
|
onChange: (e) => handlePairChange(index, "key", e.target.value),
|
|
2819
2841
|
placeholder: keyPlaceholder
|
|
2820
2842
|
}
|
|
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(
|
|
2843
|
+
)), /* @__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
2844
|
MenuButton2,
|
|
2830
2845
|
{
|
|
2831
2846
|
button: /* @__PURE__ */ React12.createElement(Button10, { icon: EllipsisHorizontalIcon, mode: "bleed", title: "Options" }),
|
|
@@ -2837,18 +2852,20 @@ function KeyValueReferenceInput(props) {
|
|
|
2837
2852
|
Box4,
|
|
2838
2853
|
{
|
|
2839
2854
|
padding: 2,
|
|
2840
|
-
style: {
|
|
2855
|
+
style: { border: "1px dashed #ccc", borderRadius: "4px", display: "flex", alignItems: "center", justifyContent: "center", cursor: "pointer" },
|
|
2841
2856
|
onClick: () => openReferenceSelector(index)
|
|
2842
2857
|
},
|
|
2843
2858
|
/* @__PURE__ */ React12.createElement(Text10, { muted: true, size: 2 }, "Click to select a ", pickerLabel)
|
|
2844
|
-
))
|
|
2845
|
-
|
|
2859
|
+
)), /* @__PURE__ */ React12.createElement(
|
|
2860
|
+
Button10,
|
|
2846
2861
|
{
|
|
2847
|
-
|
|
2862
|
+
mode: "bleed",
|
|
2863
|
+
tone: "critical",
|
|
2864
|
+
icon: TrashIcon4,
|
|
2865
|
+
padding: 2,
|
|
2848
2866
|
onClick: () => handleRemovePair(index),
|
|
2849
|
-
style: {
|
|
2850
|
-
}
|
|
2851
|
-
/* @__PURE__ */ React12.createElement(TrashIcon4, null)
|
|
2867
|
+
style: { flexShrink: 0, cursor: "pointer" }
|
|
2868
|
+
}
|
|
2852
2869
|
));
|
|
2853
2870
|
}))), /* @__PURE__ */ React12.createElement(Button10, { tone: "primary", mode: "ghost", onClick: handleAddPair, icon: AddIcon2, text: `Add ${keyTitle}` }), isDialogOpen && /* @__PURE__ */ React12.createElement(
|
|
2854
2871
|
Dialog,
|
|
@@ -5908,7 +5925,9 @@ function createStylesField({
|
|
|
5908
5925
|
subfamilyPreferredStyle = false,
|
|
5909
5926
|
subfamilyFontFilter = false,
|
|
5910
5927
|
subfamilyPreview = false,
|
|
5911
|
-
pairs = true
|
|
5928
|
+
pairs = true,
|
|
5929
|
+
generateCollections = false,
|
|
5930
|
+
generateFullFamilyCollection = false
|
|
5912
5931
|
} = {}) {
|
|
5913
5932
|
const subfamilyFields = [
|
|
5914
5933
|
{
|
|
@@ -6052,6 +6071,28 @@ function createStylesField({
|
|
|
6052
6071
|
type: "array",
|
|
6053
6072
|
of: [subfamilyItem]
|
|
6054
6073
|
},
|
|
6074
|
+
...field(generateCollections, {
|
|
6075
|
+
title: "Generate Collections and Pairs",
|
|
6076
|
+
name: "generateCollections",
|
|
6077
|
+
type: "string",
|
|
6078
|
+
description: "Generate Collections and Pairs from the typeface's fonts.",
|
|
6079
|
+
components: { input: GenerateCollectionsPairsComponent },
|
|
6080
|
+
hidden: ({ parent }) => {
|
|
6081
|
+
var _a;
|
|
6082
|
+
return !((_a = parent == null ? void 0 : parent.fonts) == null ? void 0 : _a.length);
|
|
6083
|
+
}
|
|
6084
|
+
}),
|
|
6085
|
+
...field(generateFullFamilyCollection, {
|
|
6086
|
+
title: "Generate Full Family Collection",
|
|
6087
|
+
name: "generateCollectionGroup",
|
|
6088
|
+
type: "string",
|
|
6089
|
+
description: "Generate a Collection that includes all styles from this typeface.",
|
|
6090
|
+
components: { input: PrimaryCollectionGeneratorTypeface },
|
|
6091
|
+
hidden: ({ parent }) => {
|
|
6092
|
+
var _a;
|
|
6093
|
+
return !((_a = parent == null ? void 0 : parent.fonts) == null ? void 0 : _a.length);
|
|
6094
|
+
}
|
|
6095
|
+
}),
|
|
6055
6096
|
{
|
|
6056
6097
|
title: "Collections",
|
|
6057
6098
|
name: "collections",
|
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.2",
|
|
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",
|
|
@@ -459,7 +459,7 @@ export const BatchUploadFonts = () => {
|
|
|
459
459
|
>
|
|
460
460
|
{ext}
|
|
461
461
|
</Text>
|
|
462
|
-
<Box style={{ flex: 1, minWidth: 0
|
|
462
|
+
<Box style={{ flex: 1, minWidth: 0 }}>
|
|
463
463
|
<Text size={1}>{file.name}</Text>
|
|
464
464
|
</Box>
|
|
465
465
|
</Flex>
|
|
@@ -148,72 +148,80 @@ export function KeyValueReferenceInput(props) {
|
|
|
148
148
|
<Box>
|
|
149
149
|
<Stack space={2}>
|
|
150
150
|
{pairs.map((pair, index) => (
|
|
151
|
-
<
|
|
151
|
+
<Flex key={index} gap={1} align="center">
|
|
152
152
|
{/* Reorder buttons */}
|
|
153
|
-
<
|
|
154
|
-
<
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
{/* Reference display or empty-state picker trigger */}
|
|
173
|
-
<Box flex={1} style={{ minHeight: '100%' }}>
|
|
174
|
-
{pair.value?._ref ? (
|
|
175
|
-
<Card className="referenceCard" radius={2} tone="primary" style={{ paddingLeft: '1rem', height: 'fit-content' }}>
|
|
176
|
-
<Flex align="center" justify="space-between">
|
|
177
|
-
<Text
|
|
178
|
-
size={2}
|
|
179
|
-
style={{ whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis', maxWidth: '90%' }}
|
|
180
|
-
>
|
|
181
|
-
{referenceData[pair.value._ref] || 'Loading...'}
|
|
182
|
-
</Text>
|
|
183
|
-
<MenuButton
|
|
184
|
-
button={<Button icon={EllipsisHorizontalIcon} mode="bleed" title="Options" />}
|
|
185
|
-
id={`ref-options-${index}`}
|
|
186
|
-
menu={
|
|
187
|
-
<Menu>
|
|
188
|
-
<MenuItem tone="critical" icon={TrashIcon} text="Remove" onClick={() => handlePairChange(index, 'value', null)} />
|
|
189
|
-
<MenuItem icon={SyncIcon} text="Replace" onClick={() => openReferenceSelector(index)} />
|
|
190
|
-
</Menu>
|
|
191
|
-
}
|
|
192
|
-
popover={{ portal: true, tone: 'default', placement: 'left' }}
|
|
193
|
-
/>
|
|
194
|
-
</Flex>
|
|
195
|
-
</Card>
|
|
196
|
-
) : (
|
|
197
|
-
<Box
|
|
198
|
-
padding={2}
|
|
199
|
-
style={{ minHeight: '100%', border: '1px dashed #ccc', borderRadius: '4px', display: 'flex', alignItems: 'center', justifyContent: 'center', cursor: 'pointer' }}
|
|
200
|
-
onClick={() => openReferenceSelector(index)}
|
|
201
|
-
>
|
|
202
|
-
<Text muted size={2}>Click to select a {pickerLabel}</Text>
|
|
203
|
-
</Box>
|
|
204
|
-
)}
|
|
205
|
-
</Box>
|
|
153
|
+
<Flex direction="column" style={{ flexShrink: 0 }}>
|
|
154
|
+
<Button
|
|
155
|
+
mode="bleed"
|
|
156
|
+
icon={ArrowUpIcon}
|
|
157
|
+
padding={1}
|
|
158
|
+
fontSize={0}
|
|
159
|
+
onClick={() => handleMoveUp(index)}
|
|
160
|
+
disabled={index === 0}
|
|
161
|
+
style={{ cursor: index === 0 ? 'default' : 'pointer' }}
|
|
162
|
+
/>
|
|
163
|
+
<Button
|
|
164
|
+
mode="bleed"
|
|
165
|
+
icon={ArrowDownIcon}
|
|
166
|
+
padding={1}
|
|
167
|
+
fontSize={0}
|
|
168
|
+
onClick={() => handleMoveDown(index)}
|
|
169
|
+
disabled={index === pairs.length - 1}
|
|
170
|
+
style={{ cursor: index === pairs.length - 1 ? 'default' : 'pointer' }}
|
|
171
|
+
/>
|
|
206
172
|
</Flex>
|
|
207
173
|
|
|
174
|
+
{/* Key input */}
|
|
175
|
+
<Box flex={1}>
|
|
176
|
+
<TextInput
|
|
177
|
+
value={pair.key}
|
|
178
|
+
onChange={(e) => handlePairChange(index, 'key', e.target.value)}
|
|
179
|
+
placeholder={keyPlaceholder}
|
|
180
|
+
/>
|
|
181
|
+
</Box>
|
|
182
|
+
|
|
183
|
+
{/* Reference display or empty-state picker trigger */}
|
|
184
|
+
<Box flex={1}>
|
|
185
|
+
{pair.value?._ref ? (
|
|
186
|
+
<Card radius={2} tone="primary" style={{ paddingLeft: '0.75rem', height: 'fit-content' }}>
|
|
187
|
+
<Flex align="center" justify="space-between">
|
|
188
|
+
<Text size={2} style={{ whiteSpace: 'nowrap' }}>
|
|
189
|
+
{referenceData[pair.value._ref] || 'Loading...'}
|
|
190
|
+
</Text>
|
|
191
|
+
<MenuButton
|
|
192
|
+
button={<Button icon={EllipsisHorizontalIcon} mode="bleed" title="Options" />}
|
|
193
|
+
id={`ref-options-${index}`}
|
|
194
|
+
menu={
|
|
195
|
+
<Menu>
|
|
196
|
+
<MenuItem tone="critical" icon={TrashIcon} text="Remove" onClick={() => handlePairChange(index, 'value', null)} />
|
|
197
|
+
<MenuItem icon={SyncIcon} text="Replace" onClick={() => openReferenceSelector(index)} />
|
|
198
|
+
</Menu>
|
|
199
|
+
}
|
|
200
|
+
popover={{ portal: true, tone: 'default', placement: 'left' }}
|
|
201
|
+
/>
|
|
202
|
+
</Flex>
|
|
203
|
+
</Card>
|
|
204
|
+
) : (
|
|
205
|
+
<Box
|
|
206
|
+
padding={2}
|
|
207
|
+
style={{ border: '1px dashed #ccc', borderRadius: '4px', display: 'flex', alignItems: 'center', justifyContent: 'center', cursor: 'pointer' }}
|
|
208
|
+
onClick={() => openReferenceSelector(index)}
|
|
209
|
+
>
|
|
210
|
+
<Text muted size={2}>Click to select a {pickerLabel}</Text>
|
|
211
|
+
</Box>
|
|
212
|
+
)}
|
|
213
|
+
</Box>
|
|
214
|
+
|
|
208
215
|
{/* Remove button */}
|
|
209
|
-
<
|
|
210
|
-
|
|
216
|
+
<Button
|
|
217
|
+
mode="bleed"
|
|
218
|
+
tone="critical"
|
|
219
|
+
icon={TrashIcon}
|
|
220
|
+
padding={2}
|
|
211
221
|
onClick={() => handleRemovePair(index)}
|
|
212
|
-
style={{
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
</button>
|
|
216
|
-
</Box>
|
|
222
|
+
style={{ flexShrink: 0, cursor: 'pointer' }}
|
|
223
|
+
/>
|
|
224
|
+
</Flex>
|
|
217
225
|
))}
|
|
218
226
|
</Stack>
|
|
219
227
|
</Box>
|
|
@@ -479,7 +479,7 @@ export const SingleUploaderTool = (props) => {
|
|
|
479
479
|
{formatUpper}
|
|
480
480
|
</Text>
|
|
481
481
|
{hasFile ? (
|
|
482
|
-
<Box style={{ flex: 1, minWidth: 0
|
|
482
|
+
<Box style={{ flex: 1, minWidth: 0 }}>
|
|
483
483
|
<a href={fileUrl} target="_blank" rel="noreferrer">{filenames?.[format] || 'File'}</a>
|
|
484
484
|
</Box>
|
|
485
485
|
) : (
|
|
@@ -520,7 +520,7 @@ export const SingleUploaderTool = (props) => {
|
|
|
520
520
|
{label}
|
|
521
521
|
</Text>
|
|
522
522
|
{hasFile ? (
|
|
523
|
-
<Box style={{ flex: 1, minWidth: 0
|
|
523
|
+
<Box style={{ flex: 1, minWidth: 0 }}>
|
|
524
524
|
<a href={fileUrl} target="_blank" rel="noreferrer">{filename || 'File'}</a>
|
|
525
525
|
</Box>
|
|
526
526
|
) : (
|
|
@@ -561,7 +561,7 @@ export const SingleUploaderTool = (props) => {
|
|
|
561
561
|
CSS
|
|
562
562
|
</Text>
|
|
563
563
|
{hasFile ? (
|
|
564
|
-
<Box style={{ flex: 1, minWidth: 0
|
|
564
|
+
<Box style={{ flex: 1, minWidth: 0 }}>
|
|
565
565
|
<a href={fileUrl} target="_blank" rel="noreferrer">{filenames?.css || 'File'}</a>
|
|
566
566
|
</Box>
|
|
567
567
|
) : (
|
|
@@ -235,7 +235,7 @@ export default function UploadStep1Settings({ settings, onStartProcessing }) {
|
|
|
235
235
|
>
|
|
236
236
|
{ext.toUpperCase()}
|
|
237
237
|
</Badge>
|
|
238
|
-
<Text size={1} style={{ flex: 1
|
|
238
|
+
<Text size={1} style={{ flex: 1 }}>
|
|
239
239
|
{file.name}
|
|
240
240
|
</Text>
|
|
241
241
|
<Button
|
|
@@ -181,7 +181,7 @@ export default function UploadStep3Execute({
|
|
|
181
181
|
return (
|
|
182
182
|
<Card key={entry.tempId} border radius={1} padding={2}>
|
|
183
183
|
<Flex align="center" gap={2}>
|
|
184
|
-
<Text size={1} style={{
|
|
184
|
+
<Text size={1} style={{ flex: 1 }}>
|
|
185
185
|
{entry.title}
|
|
186
186
|
</Text>
|
|
187
187
|
<Box style={{ width: 120, flexShrink: 0, textAlign: 'right' }}>
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { AdvancedRefArray } from '@liiift-studio/sanity-advanced-reference-array';
|
|
4
4
|
import { RegenerateSubfamiliesComponent } from '../components/RegenerateSubfamiliesComponent.jsx';
|
|
5
|
+
import { GenerateCollectionsPairsComponent } from '../components/GenerateCollectionsPairsComponent.jsx';
|
|
6
|
+
import { PrimaryCollectionGeneratorTypeface } from '../components/PrimaryCollectionGeneratorTypeface.jsx';
|
|
5
7
|
|
|
6
8
|
// Returns extra GROQ params scoped to the current typeface document
|
|
7
9
|
const typefaceParams = (doc) => ({ typefaceName: doc?.title || '' });
|
|
@@ -93,6 +95,8 @@ export function createStylesField({
|
|
|
93
95
|
subfamilyFontFilter = false,
|
|
94
96
|
subfamilyPreview = false,
|
|
95
97
|
pairs = true,
|
|
98
|
+
generateCollections = false,
|
|
99
|
+
generateFullFamilyCollection = false,
|
|
96
100
|
} = {}) {
|
|
97
101
|
|
|
98
102
|
const subfamilyFields = [
|
|
@@ -236,6 +240,22 @@ export function createStylesField({
|
|
|
236
240
|
type: 'array',
|
|
237
241
|
of: [subfamilyItem],
|
|
238
242
|
},
|
|
243
|
+
...field(generateCollections, {
|
|
244
|
+
title: 'Generate Collections and Pairs',
|
|
245
|
+
name: 'generateCollections',
|
|
246
|
+
type: 'string',
|
|
247
|
+
description: "Generate Collections and Pairs from the typeface's fonts.",
|
|
248
|
+
components: { input: GenerateCollectionsPairsComponent },
|
|
249
|
+
hidden: ({ parent }) => !parent?.fonts?.length,
|
|
250
|
+
}),
|
|
251
|
+
...field(generateFullFamilyCollection, {
|
|
252
|
+
title: 'Generate Full Family Collection',
|
|
253
|
+
name: 'generateCollectionGroup',
|
|
254
|
+
type: 'string',
|
|
255
|
+
description: 'Generate a Collection that includes all styles from this typeface.',
|
|
256
|
+
components: { input: PrimaryCollectionGeneratorTypeface },
|
|
257
|
+
hidden: ({ parent }) => !parent?.fonts?.length,
|
|
258
|
+
}),
|
|
239
259
|
{
|
|
240
260
|
title: 'Collections',
|
|
241
261
|
name: 'collections',
|