@liiift-studio/sanity-font-manager 2.3.2 → 2.3.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/README.md +33 -0
- package/dist/index.js +78 -0
- package/dist/index.mjs +168 -92
- package/package.json +1 -1
- package/src/components/SetOTF.jsx +87 -0
- package/src/components/StyleCountInput.jsx +16 -0
- package/src/index.js +2 -0
package/README.md
CHANGED
|
@@ -110,6 +110,39 @@ Updates and re-links existing script font variant references on font documents
|
|
|
110
110
|
|
|
111
111
|
Recalculates and patches the `subfamily` field on all fonts linked to a typeface, based on the typeface's defined subfamily groups — without re-uploading any files.
|
|
112
112
|
|
|
113
|
+
### `SetOTF`
|
|
114
|
+
|
|
115
|
+
Detects which configured OpenType feature keys are supported by the typeface's first linked font. Reads `opentypeFeatures.chars` from the font document (populated by `generateFontData`) and patches the `features` array on the field. Shows a feature count when features are detected, and clear error messages when font data is missing.
|
|
116
|
+
|
|
117
|
+
Wire it up on the `openType` object field in the typeface schema:
|
|
118
|
+
|
|
119
|
+
```jsx
|
|
120
|
+
import { SetOTF } from '@liiift-studio/sanity-font-manager';
|
|
121
|
+
|
|
122
|
+
{
|
|
123
|
+
name: 'openType',
|
|
124
|
+
type: 'object',
|
|
125
|
+
components: { input: SetOTF },
|
|
126
|
+
options: { collapsible: true },
|
|
127
|
+
fields: [ /* feature fields — each with a `feature` string e.g. 'liga', 'smcp' */ ],
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### `StyleCountInput`
|
|
132
|
+
|
|
133
|
+
Displays the total number of font styles (static + variable) linked to a typeface. Reads `styles.fonts` and `styles.variableFont` arrays from the form context. Useful as a read-only display field in the typeface schema.
|
|
134
|
+
|
|
135
|
+
```jsx
|
|
136
|
+
import { StyleCountInput } from '@liiift-studio/sanity-font-manager';
|
|
137
|
+
|
|
138
|
+
{
|
|
139
|
+
name: 'styleCount',
|
|
140
|
+
type: 'number',
|
|
141
|
+
readOnly: true,
|
|
142
|
+
components: { input: StyleCountInput },
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
113
146
|
### `KeyValueInput`
|
|
114
147
|
|
|
115
148
|
Generic ordered key-value editor where both keys and values are plain strings. Supports add, remove, and reorder (up/down arrows). Values are stored as an array of `{ key, value }` objects.
|
package/dist/index.js
CHANGED
|
@@ -40,8 +40,10 @@ __export(index_exports, {
|
|
|
40
40
|
RegenerateSubfamiliesComponent: () => RegenerateSubfamiliesComponent,
|
|
41
41
|
SCRIPTS: () => SCRIPTS,
|
|
42
42
|
SCRIPTS_OBJECT: () => SCRIPTS_OBJECT,
|
|
43
|
+
SetOTF: () => SetOTF,
|
|
43
44
|
SingleUploaderTool: () => SingleUploaderTool,
|
|
44
45
|
StatusDisplay: () => StatusDisplay_default,
|
|
46
|
+
StyleCountInput: () => StyleCountInput,
|
|
45
47
|
UpdateScriptsComponent: () => UpdateScriptsComponent,
|
|
46
48
|
UploadButton: () => UploadButton_default,
|
|
47
49
|
UploadScriptsComponent: () => UploadScriptsComponent,
|
|
@@ -4041,6 +4043,80 @@ var PrimaryCollectionGeneratorTypeface = () => {
|
|
|
4041
4043
|
)) : /* @__PURE__ */ import_react16.default.createElement(import_ui14.Flex, { align: "center", justify: "center", gap: 3, padding: 4 }, /* @__PURE__ */ import_react16.default.createElement(import_ui14.Spinner, null), /* @__PURE__ */ import_react16.default.createElement(import_ui14.Text, { muted: true, size: 1 }, status))));
|
|
4042
4044
|
};
|
|
4043
4045
|
|
|
4046
|
+
// src/components/SetOTF.jsx
|
|
4047
|
+
var import_react17 = require("react");
|
|
4048
|
+
var import_sanity13 = require("sanity");
|
|
4049
|
+
var import_ui15 = require("@sanity/ui");
|
|
4050
|
+
var SetOTF = (props) => {
|
|
4051
|
+
var _a, _b;
|
|
4052
|
+
const { onChange, value = {} } = props;
|
|
4053
|
+
const client = useSanityClient();
|
|
4054
|
+
const stylesObject = (0, import_sanity13.useFormValue)(["styles"]);
|
|
4055
|
+
const [message, setMessage] = (0, import_react17.useState)("");
|
|
4056
|
+
const detect = async () => {
|
|
4057
|
+
var _a2, _b2, _c;
|
|
4058
|
+
if (!((_a2 = stylesObject == null ? void 0 : stylesObject.fonts) == null ? void 0 : _a2.length)) {
|
|
4059
|
+
setMessage("Error: No fonts found in styles. Please add at least one font first.");
|
|
4060
|
+
setTimeout(() => setMessage(""), 5e3);
|
|
4061
|
+
return;
|
|
4062
|
+
}
|
|
4063
|
+
const fontRef = (_b2 = stylesObject.fonts[0]) == null ? void 0 : _b2._ref;
|
|
4064
|
+
if (!fontRef) {
|
|
4065
|
+
setMessage("Error: Invalid font reference in styles.");
|
|
4066
|
+
setTimeout(() => setMessage(""), 5e3);
|
|
4067
|
+
return;
|
|
4068
|
+
}
|
|
4069
|
+
try {
|
|
4070
|
+
const font = await client.fetch('*[_type == "font" && _id == $id][0]', { id: fontRef });
|
|
4071
|
+
if (!font) {
|
|
4072
|
+
setMessage("Error: Could not find the referenced font.");
|
|
4073
|
+
setTimeout(() => setMessage(""), 5e3);
|
|
4074
|
+
return;
|
|
4075
|
+
}
|
|
4076
|
+
if (!((_c = font.opentypeFeatures) == null ? void 0 : _c.chars)) {
|
|
4077
|
+
setMessage(`Error: No OpenType feature data found in "${font.title || "this font"}". Generate font data first.`);
|
|
4078
|
+
setTimeout(() => setMessage(""), 5e3);
|
|
4079
|
+
return;
|
|
4080
|
+
}
|
|
4081
|
+
const features = [];
|
|
4082
|
+
Object.keys(value).forEach((key) => {
|
|
4083
|
+
var _a3;
|
|
4084
|
+
if (key !== "features" && ((_a3 = value[key]) == null ? void 0 : _a3.feature)) {
|
|
4085
|
+
const requiredFeatures = value[key].feature.split(" ");
|
|
4086
|
+
const approved = requiredFeatures.every((v) => font.opentypeFeatures.chars.includes(v));
|
|
4087
|
+
if (approved) features.push(key);
|
|
4088
|
+
}
|
|
4089
|
+
});
|
|
4090
|
+
onChange((0, import_sanity13.set)({ ...value, features }));
|
|
4091
|
+
setMessage(`Features detected: ${features.length ? features.join(", ") : "none"}.`);
|
|
4092
|
+
setTimeout(() => setMessage(""), 5e3);
|
|
4093
|
+
} catch (err) {
|
|
4094
|
+
setMessage("Error detecting features. Check the console for details.");
|
|
4095
|
+
console.error("SetOTF detect error:", err);
|
|
4096
|
+
}
|
|
4097
|
+
};
|
|
4098
|
+
return /* @__PURE__ */ React.createElement(import_ui15.Stack, { className: "openType" }, ((_a = value == null ? void 0 : value.features) == null ? void 0 : _a.length) > 0 && /* @__PURE__ */ React.createElement(import_ui15.Text, { muted: true, size: 1, style: { marginBottom: "0.5rem" } }, "Number of features: ", value.features.length), !!((_b = stylesObject == null ? void 0 : stylesObject.fonts) == null ? void 0 : _b.length) && /* @__PURE__ */ React.createElement(
|
|
4099
|
+
import_ui15.Button,
|
|
4100
|
+
{
|
|
4101
|
+
text: "Detect OTF",
|
|
4102
|
+
mode: "ghost",
|
|
4103
|
+
onClick: detect,
|
|
4104
|
+
style: { borderRadius: "0 3px 0 0", marginBottom: "1rem" }
|
|
4105
|
+
}
|
|
4106
|
+
), !!message && /* @__PURE__ */ React.createElement(import_ui15.Text, { muted: true, size: 1 }, /* @__PURE__ */ React.createElement("br", null), message, /* @__PURE__ */ React.createElement("br", null), /* @__PURE__ */ React.createElement("br", null)), props.renderDefault(props));
|
|
4107
|
+
};
|
|
4108
|
+
|
|
4109
|
+
// src/components/StyleCountInput.jsx
|
|
4110
|
+
var import_react18 = __toESM(require("react"));
|
|
4111
|
+
var import_ui16 = require("@sanity/ui");
|
|
4112
|
+
var import_sanity14 = require("sanity");
|
|
4113
|
+
var StyleCountInput = (props) => {
|
|
4114
|
+
const styles = (0, import_sanity14.useFormValue)(["styles", "fonts"]) || [];
|
|
4115
|
+
const vfStyles = (0, import_sanity14.useFormValue)(["styles", "variableFont"]) || [];
|
|
4116
|
+
const count = styles.length + vfStyles.length;
|
|
4117
|
+
return /* @__PURE__ */ import_react18.default.createElement(import_ui16.Text, { size: 1 }, count);
|
|
4118
|
+
};
|
|
4119
|
+
|
|
4044
4120
|
// src/utils/getEmptyFontKit.js
|
|
4045
4121
|
var fontkit7 = __toESM(require("fontkit"));
|
|
4046
4122
|
var import_slugify4 = __toESM(require("slugify"));
|
|
@@ -4131,8 +4207,10 @@ var readFontFile2 = (file) => {
|
|
|
4131
4207
|
RegenerateSubfamiliesComponent,
|
|
4132
4208
|
SCRIPTS,
|
|
4133
4209
|
SCRIPTS_OBJECT,
|
|
4210
|
+
SetOTF,
|
|
4134
4211
|
SingleUploaderTool,
|
|
4135
4212
|
StatusDisplay,
|
|
4213
|
+
StyleCountInput,
|
|
4136
4214
|
UpdateScriptsComponent,
|
|
4137
4215
|
UploadButton,
|
|
4138
4216
|
UploadScriptsComponent,
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/components/BatchUploadFonts.jsx
|
|
2
|
-
import
|
|
2
|
+
import React5, { useCallback, useState as useState2, useMemo as useMemo2, useRef, useEffect } from "react";
|
|
3
3
|
import { Card, Box as Box2, Flex as Flex3, Grid, Text as Text4, Label, Switch, Button as Button2, Spinner, Tooltip, Stack as Stack2 } from "@sanity/ui";
|
|
4
4
|
import { ControlsIcon, InfoOutlineIcon, TrashIcon, UploadIcon, WarningOutlineIcon } from "@sanity/icons";
|
|
5
5
|
import { useFormValue as useFormValue2 } from "sanity";
|
|
@@ -1378,17 +1378,17 @@ var updateFontPrices = async ({
|
|
|
1378
1378
|
};
|
|
1379
1379
|
|
|
1380
1380
|
// src/components/StatusDisplay.jsx
|
|
1381
|
-
import
|
|
1381
|
+
import React2 from "react";
|
|
1382
1382
|
import { Flex, Text } from "@sanity/ui";
|
|
1383
1383
|
var StatusDisplay = ({ status, error, action }) => {
|
|
1384
|
-
return /* @__PURE__ */
|
|
1384
|
+
return /* @__PURE__ */ React2.createElement(Flex, { paddingTop: 1, paddingBottom: 3, align: "center", justify: "space-between" }, /* @__PURE__ */ React2.createElement(Flex, { align: "center", gap: 2 }, /* @__PURE__ */ React2.createElement(Text, { size: 1 }, "Status:"), /* @__PURE__ */ React2.createElement(Text, { size: 1, style: { color: error ? "red" : "green" } }, status)), action && action);
|
|
1385
1385
|
};
|
|
1386
1386
|
var StatusDisplay_default = StatusDisplay;
|
|
1387
1387
|
|
|
1388
1388
|
// src/components/PriceInput.jsx
|
|
1389
|
-
import
|
|
1389
|
+
import React3 from "react";
|
|
1390
1390
|
import { Flex as Flex2, Text as Text2 } from "@sanity/ui";
|
|
1391
|
-
var PriceInput = ({ inputPrice, handleInputChange }) => /* @__PURE__ */
|
|
1391
|
+
var PriceInput = ({ inputPrice, handleInputChange }) => /* @__PURE__ */ React3.createElement(Flex2, { align: "center", gap: 2 }, /* @__PURE__ */ React3.createElement(Text2, { size: 1, muted: true }, "Price:"), /* @__PURE__ */ React3.createElement(Text2, { size: 1, muted: true }, "$"), /* @__PURE__ */ React3.createElement(
|
|
1392
1392
|
"input",
|
|
1393
1393
|
{
|
|
1394
1394
|
value: inputPrice,
|
|
@@ -1396,11 +1396,11 @@ var PriceInput = ({ inputPrice, handleInputChange }) => /* @__PURE__ */ React2.c
|
|
|
1396
1396
|
type: "number",
|
|
1397
1397
|
style: { textAlign: "end", padding: "5px", maxWidth: "75px" }
|
|
1398
1398
|
}
|
|
1399
|
-
), /* @__PURE__ */
|
|
1399
|
+
), /* @__PURE__ */ React3.createElement(Text2, { size: 1, muted: true }, "per style"));
|
|
1400
1400
|
var PriceInput_default = PriceInput;
|
|
1401
1401
|
|
|
1402
1402
|
// src/components/RegenerateSubfamiliesComponent.jsx
|
|
1403
|
-
import
|
|
1403
|
+
import React4, { useState } from "react";
|
|
1404
1404
|
import { nanoid as nanoid5 } from "nanoid";
|
|
1405
1405
|
import { Button, Text as Text3, Stack, Box } from "@sanity/ui";
|
|
1406
1406
|
import { useFormValue } from "sanity";
|
|
@@ -1416,7 +1416,7 @@ var RegenerateSubfamiliesComponent = () => {
|
|
|
1416
1416
|
const handleClick = () => {
|
|
1417
1417
|
regenerateSubfamilies({ title, stylesObject, slug, doc_id, client, setStatus, setReady, setError });
|
|
1418
1418
|
};
|
|
1419
|
-
return /* @__PURE__ */
|
|
1419
|
+
return /* @__PURE__ */ React4.createElement(React4.Fragment, null, status && /* @__PURE__ */ React4.createElement(Box, { padding: 3, style: { borderRadius: "4px", marginBottom: "10px" } }, /* @__PURE__ */ React4.createElement(Text3, { size: 1, style: { color: error ? "red" : "green" } }, status)), /* @__PURE__ */ React4.createElement(Button, { mode: "ghost", tone: "primary", width: "fill", padding: 3, onClick: handleClick, disabled: !ready }, /* @__PURE__ */ React4.createElement(Stack, { space: 2 }, /* @__PURE__ */ React4.createElement(Text3, { align: "center" }, "Regenerate Subfamilies"))));
|
|
1420
1420
|
};
|
|
1421
1421
|
var regenerateSubfamilies = async ({ title, stylesObject, slug, doc_id, client, setStatus, setReady, setError }) => {
|
|
1422
1422
|
try {
|
|
@@ -1818,17 +1818,17 @@ var BatchUploadFonts = () => {
|
|
|
1818
1818
|
setError(false);
|
|
1819
1819
|
setStatus("ready");
|
|
1820
1820
|
};
|
|
1821
|
-
const renderTooltipLabel = (label, description) => /* @__PURE__ */
|
|
1821
|
+
const renderTooltipLabel = (label, description) => /* @__PURE__ */ React5.createElement(
|
|
1822
1822
|
Tooltip,
|
|
1823
1823
|
{
|
|
1824
|
-
content: /* @__PURE__ */
|
|
1824
|
+
content: /* @__PURE__ */ React5.createElement(Box2, { padding: 2, style: { maxWidth: 260 } }, /* @__PURE__ */ React5.createElement(Text4, { size: 1, style: { lineHeight: 1.6 } }, description)),
|
|
1825
1825
|
placement: "top",
|
|
1826
1826
|
portal: true
|
|
1827
1827
|
},
|
|
1828
|
-
/* @__PURE__ */
|
|
1828
|
+
/* @__PURE__ */ React5.createElement(Flex3, { align: "center", gap: 1, style: { cursor: "default" } }, /* @__PURE__ */ React5.createElement(Label, null, label), /* @__PURE__ */ React5.createElement(InfoOutlineIcon, { style: { opacity: 0.5, display: "block" } }))
|
|
1829
1829
|
);
|
|
1830
|
-
const renderProcessing = () => /* @__PURE__ */
|
|
1831
|
-
const renderDropZone = () => /* @__PURE__ */
|
|
1830
|
+
const renderProcessing = () => /* @__PURE__ */ React5.createElement(Stack2, { space: 3, paddingY: 2 }, /* @__PURE__ */ React5.createElement(Flex3, { align: "center", gap: 3 }, /* @__PURE__ */ React5.createElement(Spinner, null), /* @__PURE__ */ React5.createElement(Text4, { size: 1, muted: true }, status)), /* @__PURE__ */ React5.createElement(Card, { tone: "caution", border: true, radius: 2, padding: 2 }, /* @__PURE__ */ React5.createElement(Flex3, { align: "center", justify: "space-between", gap: 2 }, /* @__PURE__ */ React5.createElement(Flex3, { align: "center", gap: 2 }, /* @__PURE__ */ React5.createElement(WarningOutlineIcon, { style: { flexShrink: 0 } }), /* @__PURE__ */ React5.createElement(Text4, { size: 1, weight: "semibold" }, "Do not close or reload this tab")), /* @__PURE__ */ React5.createElement(Text4, { size: 1, muted: true, style: { flexShrink: 0 } }, formatElapsed(elapsedSeconds)))));
|
|
1831
|
+
const renderDropZone = () => /* @__PURE__ */ React5.createElement(
|
|
1832
1832
|
Box2,
|
|
1833
1833
|
{
|
|
1834
1834
|
onDragEnter: handleDragEnter,
|
|
@@ -1845,7 +1845,7 @@ var BatchUploadFonts = () => {
|
|
|
1845
1845
|
cursor: "default"
|
|
1846
1846
|
}
|
|
1847
1847
|
},
|
|
1848
|
-
/* @__PURE__ */
|
|
1848
|
+
/* @__PURE__ */ React5.createElement(
|
|
1849
1849
|
"input",
|
|
1850
1850
|
{
|
|
1851
1851
|
ref: fileInputRef,
|
|
@@ -1856,7 +1856,7 @@ var BatchUploadFonts = () => {
|
|
|
1856
1856
|
onChange: handleFileSelect
|
|
1857
1857
|
}
|
|
1858
1858
|
),
|
|
1859
|
-
/* @__PURE__ */
|
|
1859
|
+
/* @__PURE__ */ React5.createElement(Stack2, { space: 3 }, /* @__PURE__ */ React5.createElement(Text4, { size: 1, muted: true }, isDragging ? "Release to add files" : "Drop font files here"), /* @__PURE__ */ React5.createElement(Flex3, { justify: "center" }, /* @__PURE__ */ React5.createElement(
|
|
1860
1860
|
Button2,
|
|
1861
1861
|
{
|
|
1862
1862
|
mode: "ghost",
|
|
@@ -1873,7 +1873,7 @@ var BatchUploadFonts = () => {
|
|
|
1873
1873
|
);
|
|
1874
1874
|
const renderFileList = () => {
|
|
1875
1875
|
const sorted = sortFilesByType(pendingFiles);
|
|
1876
|
-
return /* @__PURE__ */
|
|
1876
|
+
return /* @__PURE__ */ React5.createElement(Stack2, { space: 2 }, /* @__PURE__ */ React5.createElement(Flex3, { align: "center", justify: "space-between" }, /* @__PURE__ */ React5.createElement(Text4, { size: 1, muted: true }, pendingFiles.length, " file", pendingFiles.length === 1 ? "" : "s", " selected"), /* @__PURE__ */ React5.createElement(
|
|
1877
1877
|
Button2,
|
|
1878
1878
|
{
|
|
1879
1879
|
mode: "bleed",
|
|
@@ -1883,16 +1883,16 @@ var BatchUploadFonts = () => {
|
|
|
1883
1883
|
text: "Clear all",
|
|
1884
1884
|
onClick: () => setPendingFiles([])
|
|
1885
1885
|
}
|
|
1886
|
-
)), /* @__PURE__ */
|
|
1886
|
+
)), /* @__PURE__ */ React5.createElement(Box2, { style: { maxHeight: "260px", overflowY: "auto", display: "flex", flexDirection: "column", gap: "4px" } }, sorted.map((file, i) => {
|
|
1887
1887
|
const ext = file.name.split(".").pop().toUpperCase();
|
|
1888
|
-
return /* @__PURE__ */
|
|
1888
|
+
return /* @__PURE__ */ React5.createElement(Card, { key: `${file.name}-${file.size}-${i}`, border: true, radius: 1, paddingX: 2, paddingY: 2 }, /* @__PURE__ */ React5.createElement(Flex3, { justify: "space-between", align: "center", gap: 2 }, /* @__PURE__ */ React5.createElement(Flex3, { gap: 3, align: "center", style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React5.createElement(
|
|
1889
1889
|
Text4,
|
|
1890
1890
|
{
|
|
1891
1891
|
size: 0,
|
|
1892
1892
|
style: { fontFamily: "monospace", minWidth: "2.5rem", flexShrink: 0 }
|
|
1893
1893
|
},
|
|
1894
1894
|
ext
|
|
1895
|
-
), /* @__PURE__ */
|
|
1895
|
+
), /* @__PURE__ */ React5.createElement(Box2, { style: { flex: 1, minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, /* @__PURE__ */ React5.createElement(Text4, { size: 1 }, file.name))), /* @__PURE__ */ React5.createElement(
|
|
1896
1896
|
Button2,
|
|
1897
1897
|
{
|
|
1898
1898
|
mode: "bleed",
|
|
@@ -1902,7 +1902,7 @@ var BatchUploadFonts = () => {
|
|
|
1902
1902
|
onClick: () => handleRemoveFile(file)
|
|
1903
1903
|
}
|
|
1904
1904
|
)));
|
|
1905
|
-
})), /* @__PURE__ */
|
|
1905
|
+
})), /* @__PURE__ */ React5.createElement(
|
|
1906
1906
|
Box2,
|
|
1907
1907
|
{
|
|
1908
1908
|
onDragEnter: handleDragEnter,
|
|
@@ -1918,7 +1918,7 @@ var BatchUploadFonts = () => {
|
|
|
1918
1918
|
transition: "border-color 0.12s, background 0.12s"
|
|
1919
1919
|
}
|
|
1920
1920
|
},
|
|
1921
|
-
/* @__PURE__ */
|
|
1921
|
+
/* @__PURE__ */ React5.createElement(
|
|
1922
1922
|
"input",
|
|
1923
1923
|
{
|
|
1924
1924
|
ref: fileInputRef,
|
|
@@ -1929,7 +1929,7 @@ var BatchUploadFonts = () => {
|
|
|
1929
1929
|
onChange: handleFileSelect
|
|
1930
1930
|
}
|
|
1931
1931
|
),
|
|
1932
|
-
/* @__PURE__ */
|
|
1932
|
+
/* @__PURE__ */ React5.createElement(Flex3, { align: "center", justify: "center", gap: 2 }, /* @__PURE__ */ React5.createElement(Text4, { size: 1, muted: true }, isDragging ? "Release to add" : "Drop more files or"), /* @__PURE__ */ React5.createElement(
|
|
1933
1933
|
Button2,
|
|
1934
1934
|
{
|
|
1935
1935
|
mode: "bleed",
|
|
@@ -1943,7 +1943,7 @@ var BatchUploadFonts = () => {
|
|
|
1943
1943
|
}
|
|
1944
1944
|
}
|
|
1945
1945
|
))
|
|
1946
|
-
), /* @__PURE__ */
|
|
1946
|
+
), /* @__PURE__ */ React5.createElement(
|
|
1947
1947
|
Button2,
|
|
1948
1948
|
{
|
|
1949
1949
|
mode: "ghost",
|
|
@@ -1955,12 +1955,12 @@ var BatchUploadFonts = () => {
|
|
|
1955
1955
|
}
|
|
1956
1956
|
));
|
|
1957
1957
|
};
|
|
1958
|
-
return /* @__PURE__ */
|
|
1958
|
+
return /* @__PURE__ */ React5.createElement(React5.Fragment, null, title && title !== "" && slug && slug !== "" && /* @__PURE__ */ React5.createElement(React5.Fragment, null, /* @__PURE__ */ React5.createElement(
|
|
1959
1959
|
StatusDisplay_default,
|
|
1960
1960
|
{
|
|
1961
1961
|
status,
|
|
1962
1962
|
error,
|
|
1963
|
-
action: /* @__PURE__ */
|
|
1963
|
+
action: /* @__PURE__ */ React5.createElement(
|
|
1964
1964
|
Button2,
|
|
1965
1965
|
{
|
|
1966
1966
|
mode: showUtilities ? "default" : "ghost",
|
|
@@ -1973,7 +1973,7 @@ var BatchUploadFonts = () => {
|
|
|
1973
1973
|
}
|
|
1974
1974
|
)
|
|
1975
1975
|
}
|
|
1976
|
-
), /* @__PURE__ */
|
|
1976
|
+
), /* @__PURE__ */ React5.createElement(Card, { border: true, padding: 2, shadow: 1, radius: 2 }, showUtilities ? /* @__PURE__ */ React5.createElement(Stack2, { space: 4, marginTop: 2 }, /* @__PURE__ */ React5.createElement(Stack2, { space: 2 }, /* @__PURE__ */ React5.createElement(Text4, { size: 1, weight: "semibold", style: { lineHeight: 1.6 } }, "Regenerate Subfamilies"), /* @__PURE__ */ React5.createElement(RegenerateSubfamiliesComponent, null)), /* @__PURE__ */ React5.createElement(Stack2, { space: 3 }, /* @__PURE__ */ React5.createElement(Text4, { size: 1, weight: "semibold", style: { lineHeight: 1.6 } }, "Rename Fonts (name table, Full Name)"), /* @__PURE__ */ React5.createElement(Flex3, { align: "center", gap: 2 }, /* @__PURE__ */ React5.createElement(
|
|
1977
1977
|
Switch,
|
|
1978
1978
|
{
|
|
1979
1979
|
checked: preserveShortenedNames,
|
|
@@ -1982,7 +1982,7 @@ var BatchUploadFonts = () => {
|
|
|
1982
1982
|
), renderTooltipLabel(
|
|
1983
1983
|
"Preserve shortened names",
|
|
1984
1984
|
'Abbreviations in font names are kept as-is (e.g. "XNarrow" stays "XNarrow", "Bd" stays "Bd").'
|
|
1985
|
-
)), ready === "rename" ? renderProcessing() : /* @__PURE__ */
|
|
1985
|
+
)), ready === "rename" ? renderProcessing() : /* @__PURE__ */ React5.createElement(Button2, { mode: "ghost", tone: "primary", text: "Rename Existing Fonts", style: { width: "100%" }, onClick: handleRenameExistingFonts, disabled: ready !== true })), /* @__PURE__ */ React5.createElement(Stack2, { space: 3 }, /* @__PURE__ */ React5.createElement(Text4, { size: 1, weight: "semibold", style: { lineHeight: 1.6 } }, "Update Font Prices"), ready === "price" ? renderProcessing() : /* @__PURE__ */ React5.createElement(Stack2, { space: 2 }, /* @__PURE__ */ React5.createElement(PriceInput_default, { inputPrice, handleInputChange }), /* @__PURE__ */ React5.createElement(Button2, { mode: "ghost", tone: "primary", text: "Update All Font Prices", style: { width: "100%" }, onClick: handleChangeFontPrice, disabled: ready !== true }))), /* @__PURE__ */ React5.createElement(Stack2, { space: 3 }, /* @__PURE__ */ React5.createElement(Text4, { size: 1, weight: "semibold", style: { lineHeight: 1.6 } }, "Regenerate CSS"), /* @__PURE__ */ React5.createElement(Text4, { 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__ */ React5.createElement(Button2, { mode: "ghost", tone: "primary", text: "Regenerate CSS Files", style: { width: "100%" }, onClick: handleRegenerateCssFiles, disabled: ready !== true }))) : ready ? /* @__PURE__ */ React5.createElement(React5.Fragment, null, /* @__PURE__ */ React5.createElement(Grid, { columns: [2], gap: 4, marginTop: 1, marginBottom: 1 }, /* @__PURE__ */ React5.createElement(Box2, null, /* @__PURE__ */ React5.createElement(PriceInput_default, { inputPrice, handleInputChange })), /* @__PURE__ */ React5.createElement(Stack2, { space: 3 }, /* @__PURE__ */ React5.createElement(Flex3, { align: "center", gap: 2 }, /* @__PURE__ */ React5.createElement(
|
|
1986
1986
|
Switch,
|
|
1987
1987
|
{
|
|
1988
1988
|
checked: preserveShortenedNames,
|
|
@@ -1991,7 +1991,7 @@ var BatchUploadFonts = () => {
|
|
|
1991
1991
|
), renderTooltipLabel(
|
|
1992
1992
|
"Preserve shortened names",
|
|
1993
1993
|
'Abbreviations in font names are kept as-is (e.g. "XNarrow" stays "XNarrow", "Bd" stays "Bd").'
|
|
1994
|
-
)), /* @__PURE__ */
|
|
1994
|
+
)), /* @__PURE__ */ React5.createElement(Flex3, { align: "center", gap: 2 }, /* @__PURE__ */ React5.createElement(
|
|
1995
1995
|
Switch,
|
|
1996
1996
|
{
|
|
1997
1997
|
checked: preserveFileNames,
|
|
@@ -2000,11 +2000,11 @@ var BatchUploadFonts = () => {
|
|
|
2000
2000
|
), renderTooltipLabel(
|
|
2001
2001
|
"Preserve file names",
|
|
2002
2002
|
"Original filename capitalisation is used for asset naming instead of the normalised font title."
|
|
2003
|
-
)))), /* @__PURE__ */
|
|
2003
|
+
)))), /* @__PURE__ */ React5.createElement(Box2, { marginTop: 3 }, pendingFiles.length === 0 ? renderDropZone() : renderFileList())) : renderProcessing())));
|
|
2004
2004
|
};
|
|
2005
2005
|
|
|
2006
2006
|
// src/components/GenerateCollectionsPairsComponent.jsx
|
|
2007
|
-
import
|
|
2007
|
+
import React6, { useCallback as useCallback2, useState as useState3 } from "react";
|
|
2008
2008
|
import { Stack as Stack3, Grid as Grid2, Flex as Flex4, Text as Text5, Button as Button3, Card as Card2, Spinner as Spinner2 } from "@sanity/ui";
|
|
2009
2009
|
import { useFormValue as useFormValue3 } from "sanity";
|
|
2010
2010
|
import slugify2 from "slugify";
|
|
@@ -2184,7 +2184,7 @@ var GenerateCollectionsPairsComponent = () => {
|
|
|
2184
2184
|
setReady(true);
|
|
2185
2185
|
}, [doc_id, title, slug, stylesObject, pairPrice, client, createSanityPair]);
|
|
2186
2186
|
if (!title || !slug) return null;
|
|
2187
|
-
return /* @__PURE__ */
|
|
2187
|
+
return /* @__PURE__ */ React6.createElement(Stack3, { space: 2 }, /* @__PURE__ */ React6.createElement(StatusDisplay_default, { status, error: false }), /* @__PURE__ */ React6.createElement(Card2, { border: true, padding: 2, shadow: 1, radius: 2 }, ready ? /* @__PURE__ */ React6.createElement(Stack3, { space: 3 }, /* @__PURE__ */ React6.createElement(Grid2, { columns: [2], gap: 4, marginTop: 1, marginBottom: 1 }, /* @__PURE__ */ React6.createElement(Stack3, { space: 2 }, /* @__PURE__ */ React6.createElement(Text5, { size: 1, muted: true }, "Collection price / font"), /* @__PURE__ */ React6.createElement(Flex4, { align: "center", gap: 2 }, /* @__PURE__ */ React6.createElement(Text5, { size: 1, muted: true }, "$"), /* @__PURE__ */ React6.createElement(
|
|
2188
2188
|
"input",
|
|
2189
2189
|
{
|
|
2190
2190
|
value: collectionPrice,
|
|
@@ -2192,7 +2192,7 @@ var GenerateCollectionsPairsComponent = () => {
|
|
|
2192
2192
|
type: "number",
|
|
2193
2193
|
style: { textAlign: "end", padding: "5px", maxWidth: "75px" }
|
|
2194
2194
|
}
|
|
2195
|
-
))), /* @__PURE__ */
|
|
2195
|
+
))), /* @__PURE__ */ React6.createElement(Stack3, { space: 2 }, /* @__PURE__ */ React6.createElement(Text5, { size: 1, muted: true }, "Pair price"), /* @__PURE__ */ React6.createElement(Flex4, { align: "center", gap: 2 }, /* @__PURE__ */ React6.createElement(Text5, { size: 1, muted: true }, "$"), /* @__PURE__ */ React6.createElement(
|
|
2196
2196
|
"input",
|
|
2197
2197
|
{
|
|
2198
2198
|
value: pairPrice,
|
|
@@ -2200,11 +2200,11 @@ var GenerateCollectionsPairsComponent = () => {
|
|
|
2200
2200
|
type: "number",
|
|
2201
2201
|
style: { textAlign: "end", padding: "5px", maxWidth: "75px" }
|
|
2202
2202
|
}
|
|
2203
|
-
)))), /* @__PURE__ */
|
|
2203
|
+
)))), /* @__PURE__ */ React6.createElement(Button3, { mode: "ghost", tone: "primary", text: "Generate Collections", style: { width: "100%" }, onClick: handleGenerateCollections }), /* @__PURE__ */ React6.createElement(Button3, { mode: "ghost", tone: "primary", text: "Generate Pairs", style: { width: "100%" }, onClick: handleGeneratePairs })) : /* @__PURE__ */ React6.createElement(Flex4, { align: "center", justify: "center", gap: 3, padding: 4 }, /* @__PURE__ */ React6.createElement(Spinner2, null), /* @__PURE__ */ React6.createElement(Text5, { muted: true, size: 1 }, status))));
|
|
2204
2204
|
};
|
|
2205
2205
|
|
|
2206
2206
|
// src/components/UpdateScriptsComponent.jsx
|
|
2207
|
-
import
|
|
2207
|
+
import React7, { useState as useState4, useCallback as useCallback3, useRef as useRef2, useEffect as useEffect2 } from "react";
|
|
2208
2208
|
import { Stack as Stack4, Text as Text6, Button as Button4 } from "@sanity/ui";
|
|
2209
2209
|
import { useFormValue as useFormValue4, set } from "sanity";
|
|
2210
2210
|
var UpdateScriptsComponent = (props) => {
|
|
@@ -2247,7 +2247,7 @@ var UpdateScriptsComponent = (props) => {
|
|
|
2247
2247
|
if (isReadyRef.current) onChange(set(newScripts));
|
|
2248
2248
|
setMessage("Scripts updated");
|
|
2249
2249
|
}, [onChange, fonts, client]);
|
|
2250
|
-
return /* @__PURE__ */
|
|
2250
|
+
return /* @__PURE__ */ React7.createElement(Stack4, { space: 3 }, /* @__PURE__ */ React7.createElement(
|
|
2251
2251
|
Button4,
|
|
2252
2252
|
{
|
|
2253
2253
|
mode: "ghost",
|
|
@@ -2256,11 +2256,11 @@ var UpdateScriptsComponent = (props) => {
|
|
|
2256
2256
|
text: "Update Scripts from Font Files",
|
|
2257
2257
|
onClick: updateFromFonts
|
|
2258
2258
|
}
|
|
2259
|
-
), message && /* @__PURE__ */
|
|
2259
|
+
), message && /* @__PURE__ */ React7.createElement(Text6, { size: 1, style: { color: "green" } }, message), props.renderDefault(props));
|
|
2260
2260
|
};
|
|
2261
2261
|
|
|
2262
2262
|
// src/components/SingleUploaderTool.jsx
|
|
2263
|
-
import
|
|
2263
|
+
import React8, { useState as useState5, useEffect as useEffect3, useCallback as useCallback4, useMemo as useMemo3 } from "react";
|
|
2264
2264
|
import { Button as Button5, Grid as Grid3, Stack as Stack5, Flex as Flex5, Box as Box3, Text as Text7, Card as Card3 } from "@sanity/ui";
|
|
2265
2265
|
import { TrashIcon as TrashIcon2, ControlsIcon as ControlsIcon2 } from "@sanity/icons";
|
|
2266
2266
|
import { useFormValue as useFormValue5, set as set2, unset } from "sanity";
|
|
@@ -2804,26 +2804,26 @@ var SingleUploaderTool = (props) => {
|
|
|
2804
2804
|
const formatUpper = format.toUpperCase();
|
|
2805
2805
|
const hasFile = !!((_b2 = (_a2 = fileInput == null ? void 0 : fileInput[format]) == null ? void 0 : _a2.asset) == null ? void 0 : _b2._ref);
|
|
2806
2806
|
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;
|
|
2807
|
-
return /* @__PURE__ */
|
|
2807
|
+
return /* @__PURE__ */ React8.createElement(Card3, { border: true, radius: 1, paddingX: 2, paddingY: 3 }, /* @__PURE__ */ React8.createElement(Flex5, { justify: "space-between", align: "center", gap: 2 }, /* @__PURE__ */ React8.createElement(Flex5, { gap: 3, align: "center", style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React8.createElement(Text7, { size: 0, style: { fontFamily: "monospace", minWidth: "2.5rem", flexShrink: 0, opacity: hasFile ? 1 : 0.5 } }, formatUpper), hasFile ? /* @__PURE__ */ React8.createElement(Box3, { style: { flex: 1, minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, /* @__PURE__ */ React8.createElement("a", { href: fileUrl, target: "_blank", rel: "noreferrer" }, (filenames == null ? void 0 : filenames[format]) || "File")) : /* @__PURE__ */ React8.createElement(Text7, { size: 1, muted: true }, "\u2014")), status === "ready" && /* @__PURE__ */ React8.createElement(Flex5, { gap: 1, align: "center", style: { flexShrink: 0 } }, buildSource && (fileInput == null ? void 0 : fileInput[buildSource]) && /* @__PURE__ */ React8.createElement(Button5, { mode: "ghost", tone: "primary", fontSize: 1, padding: 2, onClick: () => handleGenerateFontFile(format, fileInput[buildSource]), text: "Build" }), /* @__PURE__ */ React8.createElement(Button5, { as: "label", mode: "ghost", tone: "primary", fontSize: 1, padding: 2, style: { cursor: "pointer" } }, /* @__PURE__ */ React8.createElement(Text7, { size: 1 }, "Upload"), /* @__PURE__ */ React8.createElement("input", { ref, type: "file", hidden: true, onChange: (e) => handleUpload(e, format) })), hasFile && /* @__PURE__ */ React8.createElement(Button5, { mode: "bleed", tone: "critical", icon: TrashIcon2, padding: 2, onClick: () => handleDelete(format) }))));
|
|
2808
2808
|
};
|
|
2809
2809
|
const renderTopLevelAssetSection = (label, fieldName, assetRef, filename, onBuild) => {
|
|
2810
2810
|
const hasFile = !!assetRef;
|
|
2811
2811
|
const fileUrl = hasFile ? `https://cdn.sanity.io/files/${process.env.SANITY_STUDIO_PROJECT_ID}/${process.env.SANITY_STUDIO_DATASET}/${assetRef.replace("file-", "").replace("-", ".")}` : null;
|
|
2812
|
-
return /* @__PURE__ */
|
|
2812
|
+
return /* @__PURE__ */ React8.createElement(Card3, { border: true, radius: 1, paddingX: 2, paddingY: 3 }, /* @__PURE__ */ React8.createElement(Flex5, { justify: "space-between", align: "center", gap: 2 }, /* @__PURE__ */ React8.createElement(Flex5, { gap: 3, align: "center", style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React8.createElement(Text7, { size: 0, style: { fontFamily: "monospace", minWidth: "2.5rem", flexShrink: 0, opacity: hasFile ? 1 : 0.5 } }, label), hasFile ? /* @__PURE__ */ React8.createElement(Box3, { style: { flex: 1, minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, /* @__PURE__ */ React8.createElement("a", { href: fileUrl, target: "_blank", rel: "noreferrer" }, filename || "File")) : /* @__PURE__ */ React8.createElement(Text7, { size: 1, muted: true }, "\u2014")), status === "ready" && /* @__PURE__ */ React8.createElement(Flex5, { gap: 1, align: "center", style: { flexShrink: 0 } }, onBuild && (fileInput == null ? void 0 : fileInput.woff2) && /* @__PURE__ */ React8.createElement(Button5, { mode: "ghost", tone: "primary", fontSize: 1, padding: 2, onClick: onBuild, text: "Build" }), /* @__PURE__ */ React8.createElement(Button5, { as: "label", mode: "ghost", tone: "primary", fontSize: 1, padding: 2, style: { cursor: "pointer" } }, /* @__PURE__ */ React8.createElement(Text7, { size: 1 }, "Upload"), /* @__PURE__ */ React8.createElement("input", { type: "file", hidden: true, onChange: (e) => handleUploadTopLevelFile(e, fieldName) })), hasFile && /* @__PURE__ */ React8.createElement(Button5, { mode: "bleed", tone: "critical", icon: TrashIcon2, padding: 2, onClick: () => handleDeleteTopLevel(fieldName) }))));
|
|
2813
2813
|
};
|
|
2814
2814
|
const renderCssSection = () => {
|
|
2815
2815
|
var _a2, _b2;
|
|
2816
2816
|
const hasFile = !!((_b2 = (_a2 = fileInput == null ? void 0 : fileInput.css) == null ? void 0 : _a2.asset) == null ? void 0 : _b2._ref);
|
|
2817
2817
|
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;
|
|
2818
|
-
return /* @__PURE__ */
|
|
2818
|
+
return /* @__PURE__ */ React8.createElement(Card3, { border: true, radius: 1, paddingX: 2, paddingY: 3 }, /* @__PURE__ */ React8.createElement(Flex5, { justify: "space-between", align: "center", gap: 2 }, /* @__PURE__ */ React8.createElement(Flex5, { gap: 3, align: "center", style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React8.createElement(Text7, { size: 0, style: { fontFamily: "monospace", minWidth: "2.5rem", flexShrink: 0, opacity: hasFile ? 1 : 0.5 } }, "CSS"), hasFile ? /* @__PURE__ */ React8.createElement(Box3, { style: { flex: 1, minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, /* @__PURE__ */ React8.createElement("a", { href: fileUrl, target: "_blank", rel: "noreferrer" }, (filenames == null ? void 0 : filenames.css) || "File")) : /* @__PURE__ */ React8.createElement(Text7, { size: 1, muted: true }, "\u2014")), status === "ready" && /* @__PURE__ */ React8.createElement(Flex5, { gap: 1, align: "center", style: { flexShrink: 0 } }, (fileInput == null ? void 0 : fileInput.woff2) && /* @__PURE__ */ React8.createElement(Button5, { mode: "ghost", tone: "primary", fontSize: 1, padding: 2, onClick: () => handleGenerateCssFile(), text: "Build" }), hasFile && /* @__PURE__ */ React8.createElement(Button5, { mode: "bleed", tone: "critical", icon: TrashIcon2, padding: 2, onClick: () => handleDelete("css") }))));
|
|
2819
2819
|
};
|
|
2820
|
-
const renderDataSection = () => /* @__PURE__ */
|
|
2821
|
-
return /* @__PURE__ */
|
|
2820
|
+
const renderDataSection = () => /* @__PURE__ */ React8.createElement(Card3, { border: true, radius: 1, paddingX: 2, paddingY: 3 }, /* @__PURE__ */ React8.createElement(Flex5, { justify: "space-between", align: "center", gap: 2 }, /* @__PURE__ */ React8.createElement(Flex5, { gap: 3, align: "center", style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React8.createElement(Text7, { 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__ */ React8.createElement(Text7, { size: 1 }, "v", doc_metaData.version, " ", /* @__PURE__ */ React8.createElement(Text7, { as: "span", size: 1, muted: true }, "(", doc_metaData.genDate, ")")) : /* @__PURE__ */ React8.createElement(Text7, { size: 1, muted: true }, "\u2014")), status === "ready" && (fileInput == null ? void 0 : fileInput.ttf) && /* @__PURE__ */ React8.createElement(Flex5, { gap: 1, align: "center", style: { flexShrink: 0 } }, /* @__PURE__ */ React8.createElement(Button5, { mode: "ghost", tone: "primary", fontSize: 1, padding: 2, onClick: () => handleGenerateFontData(), text: "Build" }))));
|
|
2821
|
+
return /* @__PURE__ */ React8.createElement(Stack5, { space: 2 }, /* @__PURE__ */ React8.createElement(
|
|
2822
2822
|
StatusDisplay_default,
|
|
2823
2823
|
{
|
|
2824
2824
|
status,
|
|
2825
2825
|
error,
|
|
2826
|
-
action: /* @__PURE__ */
|
|
2826
|
+
action: /* @__PURE__ */ React8.createElement(
|
|
2827
2827
|
Button5,
|
|
2828
2828
|
{
|
|
2829
2829
|
mode: "bleed",
|
|
@@ -2835,7 +2835,7 @@ var SingleUploaderTool = (props) => {
|
|
|
2835
2835
|
}
|
|
2836
2836
|
)
|
|
2837
2837
|
}
|
|
2838
|
-
), renderFontSection("ttf"), status === "ready" && (fileInput == null ? void 0 : fileInput.ttf) && /* @__PURE__ */
|
|
2838
|
+
), renderFontSection("ttf"), status === "ready" && (fileInput == null ? void 0 : fileInput.ttf) && /* @__PURE__ */ React8.createElement(Grid3, { columns: [1, 2], gap: 2 }, /* @__PURE__ */ React8.createElement(
|
|
2839
2839
|
Button5,
|
|
2840
2840
|
{
|
|
2841
2841
|
mode: "ghost",
|
|
@@ -2844,7 +2844,7 @@ var SingleUploaderTool = (props) => {
|
|
|
2844
2844
|
text: "Rebuild All from TTF",
|
|
2845
2845
|
style: { width: "100%" }
|
|
2846
2846
|
}
|
|
2847
|
-
), /* @__PURE__ */
|
|
2847
|
+
), /* @__PURE__ */ React8.createElement(
|
|
2848
2848
|
Button5,
|
|
2849
2849
|
{
|
|
2850
2850
|
mode: "ghost",
|
|
@@ -2864,11 +2864,11 @@ var SingleUploaderTool = (props) => {
|
|
|
2864
2864
|
text: "Build Missing",
|
|
2865
2865
|
style: { width: "100%" }
|
|
2866
2866
|
}
|
|
2867
|
-
)), renderFontSection("otf", "woff"), renderFontSection("woff", "ttf"), renderFontSection("woff2", "ttf"), showAdvanced && renderTopLevelAssetSection("WEB", "woff2_web", (_b = (_a = fileInput == null ? void 0 : fileInput.woff2_web) == null ? void 0 : _a.asset) == null ? void 0 : _b._ref, filenames == null ? void 0 : filenames.woff2_web, handleGenerateSubsetAndWeb), showAdvanced && renderTopLevelAssetSection("SUBSET", "woff2_subset", (_d = (_c = fileInput == null ? void 0 : fileInput.woff2_subset) == null ? void 0 : _c.asset) == null ? void 0 : _d._ref, filenames == null ? void 0 : filenames.woff2_subset, handleGenerateSubsetAndWeb), showAdvanced && renderFontSection("eot", "ttf"), showAdvanced && renderFontSection("svg", "ttf"), renderCssSection(), showAdvanced && renderDataSection(), status === "ready" && ((fileInput == null ? void 0 : fileInput.ttf) || (fileInput == null ? void 0 : fileInput.otf) || (fileInput == null ? void 0 : fileInput.woff) || (fileInput == null ? void 0 : fileInput.woff2)) && /* @__PURE__ */
|
|
2867
|
+
)), renderFontSection("otf", "woff"), renderFontSection("woff", "ttf"), renderFontSection("woff2", "ttf"), showAdvanced && renderTopLevelAssetSection("WEB", "woff2_web", (_b = (_a = fileInput == null ? void 0 : fileInput.woff2_web) == null ? void 0 : _a.asset) == null ? void 0 : _b._ref, filenames == null ? void 0 : filenames.woff2_web, handleGenerateSubsetAndWeb), showAdvanced && renderTopLevelAssetSection("SUBSET", "woff2_subset", (_d = (_c = fileInput == null ? void 0 : fileInput.woff2_subset) == null ? void 0 : _c.asset) == null ? void 0 : _d._ref, filenames == null ? void 0 : filenames.woff2_subset, handleGenerateSubsetAndWeb), showAdvanced && renderFontSection("eot", "ttf"), showAdvanced && renderFontSection("svg", "ttf"), renderCssSection(), showAdvanced && renderDataSection(), status === "ready" && ((fileInput == null ? void 0 : fileInput.ttf) || (fileInput == null ? void 0 : fileInput.otf) || (fileInput == null ? void 0 : fileInput.woff) || (fileInput == null ? void 0 : fileInput.woff2)) && /* @__PURE__ */ React8.createElement(Button5, { mode: "ghost", tone: "critical", onClick: () => handleDeleteAll(), text: "Delete All", style: { width: "100%" } }));
|
|
2868
2868
|
};
|
|
2869
2869
|
|
|
2870
2870
|
// src/components/UploadScriptsComponent.jsx
|
|
2871
|
-
import
|
|
2871
|
+
import React10, { useCallback as useCallback5, useEffect as useEffect4, useMemo as useMemo4, useState as useState6 } from "react";
|
|
2872
2872
|
import { Button as Button6, Flex as Flex6, Grid as Grid4, Stack as Stack6, Text as Text8, TextInput, MenuButton, Menu, MenuItem, Select } from "@sanity/ui";
|
|
2873
2873
|
import * as fontkit6 from "fontkit";
|
|
2874
2874
|
import slugify3 from "slugify";
|
|
@@ -2876,7 +2876,7 @@ import { useFormValue as useFormValue6 } from "sanity";
|
|
|
2876
2876
|
import { nanoid as nanoid7 } from "nanoid";
|
|
2877
2877
|
|
|
2878
2878
|
// src/utils/utils.js
|
|
2879
|
-
import
|
|
2879
|
+
import React9 from "react";
|
|
2880
2880
|
var HtmlDescription = ({ children }) => {
|
|
2881
2881
|
return children || "";
|
|
2882
2882
|
};
|
|
@@ -2890,8 +2890,8 @@ var UploadScriptsComponent = (props) => {
|
|
|
2890
2890
|
const { elementProps: { ref } } = props;
|
|
2891
2891
|
const client = useSanityClient();
|
|
2892
2892
|
const [selectedScript, setSelectedScript] = useState6("");
|
|
2893
|
-
const [status, setStatus] =
|
|
2894
|
-
const [ready, setReady] =
|
|
2893
|
+
const [status, setStatus] = React10.useState("");
|
|
2894
|
+
const [ready, setReady] = React10.useState(true);
|
|
2895
2895
|
let doc_id = useFormValue6(["_id"]);
|
|
2896
2896
|
const title = useFormValue6(["title"]);
|
|
2897
2897
|
const slug = useFormValue6(["slug"]);
|
|
@@ -3213,26 +3213,26 @@ var UploadScriptsComponent = (props) => {
|
|
|
3213
3213
|
}
|
|
3214
3214
|
setReady(true);
|
|
3215
3215
|
}, [title, slug, doc_id]);
|
|
3216
|
-
return /* @__PURE__ */
|
|
3216
|
+
return /* @__PURE__ */ React10.createElement(Stack6, null, !ready && /* @__PURE__ */ React10.createElement(Text8, null, /* @__PURE__ */ React10.createElement("br", null), status, /* @__PURE__ */ React10.createElement("br", null), /* @__PURE__ */ React10.createElement("br", null)), ready && /* @__PURE__ */ React10.createElement(Stack6, null, /* @__PURE__ */ React10.createElement(Grid4, { columns: !!(selectedScript && selectedScript !== "") ? 2 : 1, gap: 2 }, /* @__PURE__ */ React10.createElement(
|
|
3217
3217
|
Select,
|
|
3218
3218
|
{
|
|
3219
3219
|
id: "menu-button-example",
|
|
3220
3220
|
onChange: (e) => setSelectedScript(e.target.value)
|
|
3221
3221
|
},
|
|
3222
|
-
/* @__PURE__ */
|
|
3222
|
+
/* @__PURE__ */ React10.createElement("option", { key: "script-none", value: "" }, " "),
|
|
3223
3223
|
SCRIPTS.map(
|
|
3224
3224
|
(script, i) => {
|
|
3225
3225
|
var _a;
|
|
3226
|
-
return /* @__PURE__ */
|
|
3226
|
+
return /* @__PURE__ */ React10.createElement("option", { key: "script-" + i, value: script }, ((_a = script[0]) == null ? void 0 : _a.toUpperCase()) + script.slice(1));
|
|
3227
3227
|
}
|
|
3228
3228
|
)
|
|
3229
|
-
), !!(selectedScript && selectedScript !== "") && /* @__PURE__ */
|
|
3229
|
+
), !!(selectedScript && selectedScript !== "") && /* @__PURE__ */ React10.createElement(React10.Fragment, null, /* @__PURE__ */ React10.createElement("label", { htmlFor: "upload-scripts-file" }, /* @__PURE__ */ React10.createElement(
|
|
3230
3230
|
Button6,
|
|
3231
3231
|
{
|
|
3232
3232
|
style: { pointerEvents: "none" },
|
|
3233
3233
|
text: "Upload (ttf/otf/woff/woff2/etc..)"
|
|
3234
3234
|
}
|
|
3235
|
-
)), /* @__PURE__ */
|
|
3235
|
+
)), /* @__PURE__ */ React10.createElement(
|
|
3236
3236
|
"input",
|
|
3237
3237
|
{
|
|
3238
3238
|
ref,
|
|
@@ -3247,7 +3247,7 @@ var UploadScriptsComponent = (props) => {
|
|
|
3247
3247
|
};
|
|
3248
3248
|
|
|
3249
3249
|
// src/components/FontScriptUploaderComponent.jsx
|
|
3250
|
-
import
|
|
3250
|
+
import React11, { useState as useState7, useEffect as useEffect5, useCallback as useCallback6 } from "react";
|
|
3251
3251
|
import { Stack as Stack7, Flex as Flex7, Text as Text9, Button as Button7 } from "@sanity/ui";
|
|
3252
3252
|
import { useFormValue as useFormValue7, set as set3, unset as unset2 } from "sanity";
|
|
3253
3253
|
var FontScriptUploaderComponent = (props) => {
|
|
@@ -3456,17 +3456,17 @@ var FontScriptUploaderComponent = (props) => {
|
|
|
3456
3456
|
}
|
|
3457
3457
|
}
|
|
3458
3458
|
}, [scriptFileInput]);
|
|
3459
|
-
return /* @__PURE__ */
|
|
3459
|
+
return /* @__PURE__ */ React11.createElement(Stack7, { space: 4 }, SCRIPTS && scriptFileInput && SCRIPTS.map((language, i) => {
|
|
3460
3460
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$, _aa, _ba, _ca, _da, _ea, _fa, _ga, _ha, _ia, _ja, _ka, _la, _ma, _na, _oa, _pa, _qa, _ra, _sa, _ta, _ua, _va, _wa, _xa, _ya, _za, _Aa, _Ba, _Ca, _Da, _Ea, _Fa, _Ga;
|
|
3461
|
-
return /* @__PURE__ */ React10.createElement(Stack7, { space: 2, key: "language-" + i, style: { borderBottom: "1px solid var(--card-border-color)", paddingBottom: 8 } }, /* @__PURE__ */ React10.createElement(Flex7, { gap: 2 }, /* @__PURE__ */ React10.createElement(Text9, { weight: "semibold" }, ((_a = language[0]) == null ? void 0 : _a.toUpperCase()) + language.slice(1)), message && message[language] && message[language] !== "" && /* @__PURE__ */ React10.createElement(Text9, { style: { color: "green" } }, message[language])), expanded[language] && /* @__PURE__ */ React10.createElement(Stack7, { space: 2 }, /* @__PURE__ */ React10.createElement(Flex7, { justify: "space-between", align: "center" }, /* @__PURE__ */ React10.createElement(Text9, null, "TTF:\xA0", !((_d = (_c = (_b = scriptFileInput[language]) == null ? void 0 : _b.ttf) == null ? void 0 : _c.asset) == null ? void 0 : _d._ref) ? ((_e = filenames[language]) == null ? void 0 : _e.ttf) ? /* @__PURE__ */ React10.createElement("b", null, filenames[language].ttf) : /* @__PURE__ */ React10.createElement("b", null, "Empty") : /* @__PURE__ */ React10.createElement("a", { href: `https://cdn.sanity.io/files/${process.env.SANITY_STUDIO_PROJECT_ID}/${process.env.SANITY_STUDIO_DATASET}/${(_h = (_g = (_f = scriptFileInput[language]) == null ? void 0 : _f.ttf) == null ? void 0 : _g.asset) == null ? void 0 : _h._ref.replace("file-", "").replace("-", ".")}`, target: "_blank" }, ((_i = filenames[language]) == null ? void 0 : _i.ttf) ? /* @__PURE__ */ React10.createElement("b", null, filenames[language].ttf) : /* @__PURE__ */ React10.createElement("b", null, "File"))), status === "ready" && /* @__PURE__ */ React10.createElement(Flex7, { gap: 1 }, /* @__PURE__ */ React10.createElement("label", null, /* @__PURE__ */ React10.createElement(Button7, { as: "span", mode: "ghost" }, "Upload"), /* @__PURE__ */ React10.createElement("input", { ref, type: "file", style: { display: "none" }, onChange: (event) => handleUpload(event, language, "ttf") })), ((_j = value[language]) == null ? void 0 : _j.ttf) && /* @__PURE__ */ React10.createElement(Button7, { mode: "ghost", tone: "critical", onClick: () => handleDelete("ttf", language) }, "\xD7"))), status === "ready" && ((_k = value[language]) == null ? void 0 : _k.ttf) && /* @__PURE__ */ React10.createElement(Button7, { mode: "default", onClick: () => handleGenerateFontFile("all", value[language].ttf, language) }, "Regenerate Files from TTF"), /* @__PURE__ */ React10.createElement(Flex7, { justify: "space-between", align: "center" }, /* @__PURE__ */ React10.createElement(Text9, null, "OTF:\xA0", !((_n = (_m = (_l = scriptFileInput[language]) == null ? void 0 : _l.otf) == null ? void 0 : _m.asset) == null ? void 0 : _n._ref) ? ((_o = filenames[language]) == null ? void 0 : _o.otf) ? /* @__PURE__ */ React10.createElement("b", null, (_p = filenames[language]) == null ? void 0 : _p.otf) : /* @__PURE__ */ React10.createElement("b", null, "Empty") : /* @__PURE__ */ React10.createElement("a", { href: `https://cdn.sanity.io/files/${process.env.SANITY_STUDIO_PROJECT_ID}/${process.env.SANITY_STUDIO_DATASET}/${(_s = (_r = (_q = scriptFileInput[language]) == null ? void 0 : _q.otf) == null ? void 0 : _r.asset) == null ? void 0 : _s._ref.replace("file-", "").replace("-", ".")}`, target: "_blank" }, ((_t = filenames[language]) == null ? void 0 : _t.otf) ? /* @__PURE__ */ React10.createElement("b", null, (_u = filenames[language]) == null ? void 0 : _u.otf) : /* @__PURE__ */ React10.createElement("b", null, "File"))), status === "ready" && /* @__PURE__ */ React10.createElement(Flex7, { gap: 1 }, ((_v = value[language]) == null ? void 0 : _v.woff) && /* @__PURE__ */ React10.createElement(Button7, { mode: "default", onClick: () => handleGenerateFontFile("otf", value[language].woff, language) }, "Build"), /* @__PURE__ */ React10.createElement("label", null, /* @__PURE__ */ React10.createElement(Button7, { as: "span", mode: "ghost" }, "Upload"), /* @__PURE__ */ React10.createElement("input", { ref, type: "file", style: { display: "none" }, onChange: async (event) => handleUpload(event, language, "otf") })), ((_w = value[language]) == null ? void 0 : _w.otf) && /* @__PURE__ */ React10.createElement(Button7, { mode: "ghost", tone: "critical", onClick: () => handleDelete("otf", language) }, "\xD7"))), /* @__PURE__ */ React10.createElement(Flex7, { justify: "space-between", align: "center" }, /* @__PURE__ */ React10.createElement(Text9, null, "WOFF:\xA0", !((_z = (_y = (_x = scriptFileInput[language]) == null ? void 0 : _x.woff) == null ? void 0 : _y.asset) == null ? void 0 : _z._ref) ? ((_A = filenames[language]) == null ? void 0 : _A.woff) ? /* @__PURE__ */ React10.createElement("b", null, (_B = filenames[language]) == null ? void 0 : _B.woff) : /* @__PURE__ */ React10.createElement("b", null, "Empty") : /* @__PURE__ */ React10.createElement("a", { href: `https://cdn.sanity.io/files/${process.env.SANITY_STUDIO_PROJECT_ID}/${process.env.SANITY_STUDIO_DATASET}/${(_E = (_D = (_C = scriptFileInput[language]) == null ? void 0 : _C.woff) == null ? void 0 : _D.asset) == null ? void 0 : _E._ref.replace("file-", "").replace("-", ".")}`, target: "_blank" }, ((_F = filenames[language]) == null ? void 0 : _F.woff) ? /* @__PURE__ */ React10.createElement("b", null, (_G = filenames[language]) == null ? void 0 : _G.woff) : /* @__PURE__ */ React10.createElement("b", null, "File"))), status === "ready" && /* @__PURE__ */ React10.createElement(Flex7, { gap: 1 }, ((_H = value[language]) == null ? void 0 : _H.ttf) && /* @__PURE__ */ React10.createElement(Button7, { mode: "default", onClick: () => handleGenerateFontFile("woff", value[language].ttf, language) }, "Build"), /* @__PURE__ */ React10.createElement("label", null, /* @__PURE__ */ React10.createElement(Button7, { as: "span", mode: "ghost" }, "Upload"), /* @__PURE__ */ React10.createElement("input", { ref, type: "file", style: { display: "none" }, onChange: async (event) => handleUpload(event, language, "woff") })), ((_I = value[language]) == null ? void 0 : _I.woff) && /* @__PURE__ */ React10.createElement(Button7, { mode: "ghost", tone: "critical", onClick: () => handleDelete("woff", language) }, "\xD7"))), /* @__PURE__ */ React10.createElement(Flex7, { justify: "space-between", align: "center" }, /* @__PURE__ */ React10.createElement(Text9, null, "WOFF2:\xA0", !((_L = (_K = (_J = scriptFileInput[language]) == null ? void 0 : _J.woff2) == null ? void 0 : _K.asset) == null ? void 0 : _L._ref) ? ((_M = filenames[language]) == null ? void 0 : _M.woff2) ? /* @__PURE__ */ React10.createElement("b", null, (_N = filenames[language]) == null ? void 0 : _N.woff2) : /* @__PURE__ */ React10.createElement("b", null, "Empty") : /* @__PURE__ */ React10.createElement("a", { href: `https://cdn.sanity.io/files/${process.env.SANITY_STUDIO_PROJECT_ID}/${process.env.SANITY_STUDIO_DATASET}/${(_Q = (_P = (_O = scriptFileInput[language]) == null ? void 0 : _O.woff2) == null ? void 0 : _P.asset) == null ? void 0 : _Q._ref.replace("file-", "").replace("-", ".")}`, target: "_blank" }, ((_R = filenames[language]) == null ? void 0 : _R.woff2) ? /* @__PURE__ */ React10.createElement("b", null, (_S = filenames[language]) == null ? void 0 : _S.woff2) : /* @__PURE__ */ React10.createElement("b", null, "File"))), status === "ready" && /* @__PURE__ */ React10.createElement(Flex7, { gap: 1 }, ((_T = value[language]) == null ? void 0 : _T.ttf) && /* @__PURE__ */ React10.createElement(Button7, { mode: "default", onClick: () => handleGenerateFontFile("woff2", value[language].ttf, language) }, "Build"), /* @__PURE__ */ React10.createElement("label", null, /* @__PURE__ */ React10.createElement(Button7, { as: "span", mode: "ghost" }, "Upload"), /* @__PURE__ */ React10.createElement("input", { ref, type: "file", style: { display: "none" }, onChange: async (event) => handleUpload(event, language, "woff2") })), ((_U = value[language]) == null ? void 0 : _U.woff2) && /* @__PURE__ */ React10.createElement(Button7, { mode: "ghost", tone: "critical", onClick: () => handleDelete("woff2", language) }, "\xD7"))), /* @__PURE__ */ React10.createElement(Flex7, { justify: "space-between", align: "center" }, /* @__PURE__ */ React10.createElement(Text9, null, "EOT:\xA0", !((_X = (_W = (_V = scriptFileInput[language]) == null ? void 0 : _V.eot) == null ? void 0 : _W.asset) == null ? void 0 : _X._ref) ? ((_Y = filenames[language]) == null ? void 0 : _Y.eot) ? /* @__PURE__ */ React10.createElement("b", null, (_Z = filenames[language]) == null ? void 0 : _Z.eot) : /* @__PURE__ */ React10.createElement("b", null, "Empty") : /* @__PURE__ */ React10.createElement("a", { href: `https://cdn.sanity.io/files/${process.env.SANITY_STUDIO_PROJECT_ID}/${process.env.SANITY_STUDIO_DATASET}/${(_aa = (_$ = (__ = scriptFileInput[language]) == null ? void 0 : __.eot) == null ? void 0 : _$.asset) == null ? void 0 : _aa._ref.replace("file-", "").replace("-", ".")}`, target: "_blank" }, ((_ba = filenames[language]) == null ? void 0 : _ba.eot) ? /* @__PURE__ */ React10.createElement("b", null, (_ca = filenames[language]) == null ? void 0 : _ca.eot) : /* @__PURE__ */ React10.createElement("b", null, "File"))), status === "ready" && /* @__PURE__ */ React10.createElement(Flex7, { gap: 1 }, ((_da = value[language]) == null ? void 0 : _da.ttf) && /* @__PURE__ */ React10.createElement(Button7, { mode: "default", onClick: () => handleGenerateFontFile("eot", value[language].ttf, language) }, "Build"), /* @__PURE__ */ React10.createElement("label", null, /* @__PURE__ */ React10.createElement(Button7, { as: "span", mode: "ghost" }, "Upload"), /* @__PURE__ */ React10.createElement("input", { ref, type: "file", style: { display: "none" }, onChange: async (event) => handleUpload(event, language, "eot") })), ((_ea = value[language]) == null ? void 0 : _ea.eot) && /* @__PURE__ */ React10.createElement(Button7, { mode: "ghost", tone: "critical", onClick: () => handleDelete("eot", language) }, "\xD7"))), /* @__PURE__ */ React10.createElement(Flex7, { justify: "space-between", align: "center" }, /* @__PURE__ */ React10.createElement(Text9, null, "SVG:\xA0", !((_ha = (_ga = (_fa = scriptFileInput[language]) == null ? void 0 : _fa.svg) == null ? void 0 : _ga.asset) == null ? void 0 : _ha._ref) ? ((_ia = filenames[language]) == null ? void 0 : _ia.svg) ? /* @__PURE__ */ React10.createElement("b", null, (_ja = filenames[language]) == null ? void 0 : _ja.svg) : /* @__PURE__ */ React10.createElement("b", null, "Empty") : /* @__PURE__ */ React10.createElement("a", { href: `https://cdn.sanity.io/files/${process.env.SANITY_STUDIO_PROJECT_ID}/${process.env.SANITY_STUDIO_DATASET}/${(_ma = (_la = (_ka = scriptFileInput[language]) == null ? void 0 : _ka.svg) == null ? void 0 : _la.asset) == null ? void 0 : _ma._ref.replace("file-", "").replace("-", ".")}`, target: "_blank" }, ((_na = filenames[language]) == null ? void 0 : _na.svg) ? /* @__PURE__ */ React10.createElement("b", null, (_oa = filenames[language]) == null ? void 0 : _oa.svg) : /* @__PURE__ */ React10.createElement("b", null, "File"))), status === "ready" && /* @__PURE__ */ React10.createElement(Flex7, { gap: 1 }, ((_pa = value[language]) == null ? void 0 : _pa.ttf) && /* @__PURE__ */ React10.createElement(Button7, { mode: "default", onClick: () => handleGenerateFontFile("svg", value[language].ttf, language) }, "Build"), /* @__PURE__ */ React10.createElement("label", null, /* @__PURE__ */ React10.createElement(Button7, { as: "span", mode: "ghost" }, "Upload"), /* @__PURE__ */ React10.createElement("input", { ref, type: "file", style: { display: "none" }, onChange: async (event) => handleUpload(event, language, "svg") })), ((_qa = value[language]) == null ? void 0 : _qa.svg) && /* @__PURE__ */ React10.createElement(Button7, { mode: "ghost", tone: "critical", onClick: () => handleDelete("svg", language) }, "\xD7"))), /* @__PURE__ */ React10.createElement(Flex7, { justify: "space-between", align: "center" }, /* @__PURE__ */ React10.createElement(Text9, null, "CSS:\xA0", !((_ta = (_sa = (_ra = scriptFileInput[language]) == null ? void 0 : _ra.css) == null ? void 0 : _sa.asset) == null ? void 0 : _ta._ref) ? ((_ua = filenames[language]) == null ? void 0 : _ua.css) ? /* @__PURE__ */ React10.createElement("b", null, (_va = filenames[language]) == null ? void 0 : _va.css) : /* @__PURE__ */ React10.createElement("b", null, "Empty") : /* @__PURE__ */ React10.createElement("a", { href: `https://cdn.sanity.io/files/${process.env.SANITY_STUDIO_PROJECT_ID}/${process.env.SANITY_STUDIO_DATASET}/${(_ya = (_xa = (_wa = scriptFileInput[language]) == null ? void 0 : _wa.css) == null ? void 0 : _xa.asset) == null ? void 0 : _ya._ref.replace("file-", "").replace("-", ".")}`, target: "_blank" }, ((_za = filenames[language]) == null ? void 0 : _za.css) ? /* @__PURE__ */ React10.createElement("b", null, (_Aa = filenames[language]) == null ? void 0 : _Aa.css) : /* @__PURE__ */ React10.createElement("b", null, "File"))), status === "ready" && /* @__PURE__ */ React10.createElement(Flex7, { gap: 1 }, ((_Ba = value[language]) == null ? void 0 : _Ba.woff2) && /* @__PURE__ */ React10.createElement(Button7, { mode: "default", onClick: () => handleGenerateCssFile(language) }, "Build"), ((_Ca = value[language]) == null ? void 0 : _Ca.css) && /* @__PURE__ */ React10.createElement(Button7, { mode: "ghost", tone: "critical", onClick: () => handleDelete("css", language) }, "\xD7"))), status === "ready" && (((_Da = value[language]) == null ? void 0 : _Da.ttf) || ((_Ea = value[language]) == null ? void 0 : _Ea.otf) || ((_Fa = value[language]) == null ? void 0 : _Fa.woff) || ((_Ga = value[language]) == null ? void 0 : _Ga.woff2)) && /* @__PURE__ */ React10.createElement(Button7, { mode: "ghost", tone: "critical", onClick: () => handleDeleteAll(language), style: { width: "100%" } }, "Delete All")));
|
|
3461
|
+
return /* @__PURE__ */ React11.createElement(Stack7, { space: 2, key: "language-" + i, style: { borderBottom: "1px solid var(--card-border-color)", paddingBottom: 8 } }, /* @__PURE__ */ React11.createElement(Flex7, { gap: 2 }, /* @__PURE__ */ React11.createElement(Text9, { weight: "semibold" }, ((_a = language[0]) == null ? void 0 : _a.toUpperCase()) + language.slice(1)), message && message[language] && message[language] !== "" && /* @__PURE__ */ React11.createElement(Text9, { style: { color: "green" } }, message[language])), expanded[language] && /* @__PURE__ */ React11.createElement(Stack7, { space: 2 }, /* @__PURE__ */ React11.createElement(Flex7, { justify: "space-between", align: "center" }, /* @__PURE__ */ React11.createElement(Text9, null, "TTF:\xA0", !((_d = (_c = (_b = scriptFileInput[language]) == null ? void 0 : _b.ttf) == null ? void 0 : _c.asset) == null ? void 0 : _d._ref) ? ((_e = filenames[language]) == null ? void 0 : _e.ttf) ? /* @__PURE__ */ React11.createElement("b", null, filenames[language].ttf) : /* @__PURE__ */ React11.createElement("b", null, "Empty") : /* @__PURE__ */ React11.createElement("a", { href: `https://cdn.sanity.io/files/${process.env.SANITY_STUDIO_PROJECT_ID}/${process.env.SANITY_STUDIO_DATASET}/${(_h = (_g = (_f = scriptFileInput[language]) == null ? void 0 : _f.ttf) == null ? void 0 : _g.asset) == null ? void 0 : _h._ref.replace("file-", "").replace("-", ".")}`, target: "_blank" }, ((_i = filenames[language]) == null ? void 0 : _i.ttf) ? /* @__PURE__ */ React11.createElement("b", null, filenames[language].ttf) : /* @__PURE__ */ React11.createElement("b", null, "File"))), status === "ready" && /* @__PURE__ */ React11.createElement(Flex7, { gap: 1 }, /* @__PURE__ */ React11.createElement("label", null, /* @__PURE__ */ React11.createElement(Button7, { as: "span", mode: "ghost" }, "Upload"), /* @__PURE__ */ React11.createElement("input", { ref, type: "file", style: { display: "none" }, onChange: (event) => handleUpload(event, language, "ttf") })), ((_j = value[language]) == null ? void 0 : _j.ttf) && /* @__PURE__ */ React11.createElement(Button7, { mode: "ghost", tone: "critical", onClick: () => handleDelete("ttf", language) }, "\xD7"))), status === "ready" && ((_k = value[language]) == null ? void 0 : _k.ttf) && /* @__PURE__ */ React11.createElement(Button7, { mode: "default", onClick: () => handleGenerateFontFile("all", value[language].ttf, language) }, "Regenerate Files from TTF"), /* @__PURE__ */ React11.createElement(Flex7, { justify: "space-between", align: "center" }, /* @__PURE__ */ React11.createElement(Text9, null, "OTF:\xA0", !((_n = (_m = (_l = scriptFileInput[language]) == null ? void 0 : _l.otf) == null ? void 0 : _m.asset) == null ? void 0 : _n._ref) ? ((_o = filenames[language]) == null ? void 0 : _o.otf) ? /* @__PURE__ */ React11.createElement("b", null, (_p = filenames[language]) == null ? void 0 : _p.otf) : /* @__PURE__ */ React11.createElement("b", null, "Empty") : /* @__PURE__ */ React11.createElement("a", { href: `https://cdn.sanity.io/files/${process.env.SANITY_STUDIO_PROJECT_ID}/${process.env.SANITY_STUDIO_DATASET}/${(_s = (_r = (_q = scriptFileInput[language]) == null ? void 0 : _q.otf) == null ? void 0 : _r.asset) == null ? void 0 : _s._ref.replace("file-", "").replace("-", ".")}`, target: "_blank" }, ((_t = filenames[language]) == null ? void 0 : _t.otf) ? /* @__PURE__ */ React11.createElement("b", null, (_u = filenames[language]) == null ? void 0 : _u.otf) : /* @__PURE__ */ React11.createElement("b", null, "File"))), status === "ready" && /* @__PURE__ */ React11.createElement(Flex7, { gap: 1 }, ((_v = value[language]) == null ? void 0 : _v.woff) && /* @__PURE__ */ React11.createElement(Button7, { mode: "default", onClick: () => handleGenerateFontFile("otf", value[language].woff, language) }, "Build"), /* @__PURE__ */ React11.createElement("label", null, /* @__PURE__ */ React11.createElement(Button7, { as: "span", mode: "ghost" }, "Upload"), /* @__PURE__ */ React11.createElement("input", { ref, type: "file", style: { display: "none" }, onChange: async (event) => handleUpload(event, language, "otf") })), ((_w = value[language]) == null ? void 0 : _w.otf) && /* @__PURE__ */ React11.createElement(Button7, { mode: "ghost", tone: "critical", onClick: () => handleDelete("otf", language) }, "\xD7"))), /* @__PURE__ */ React11.createElement(Flex7, { justify: "space-between", align: "center" }, /* @__PURE__ */ React11.createElement(Text9, null, "WOFF:\xA0", !((_z = (_y = (_x = scriptFileInput[language]) == null ? void 0 : _x.woff) == null ? void 0 : _y.asset) == null ? void 0 : _z._ref) ? ((_A = filenames[language]) == null ? void 0 : _A.woff) ? /* @__PURE__ */ React11.createElement("b", null, (_B = filenames[language]) == null ? void 0 : _B.woff) : /* @__PURE__ */ React11.createElement("b", null, "Empty") : /* @__PURE__ */ React11.createElement("a", { href: `https://cdn.sanity.io/files/${process.env.SANITY_STUDIO_PROJECT_ID}/${process.env.SANITY_STUDIO_DATASET}/${(_E = (_D = (_C = scriptFileInput[language]) == null ? void 0 : _C.woff) == null ? void 0 : _D.asset) == null ? void 0 : _E._ref.replace("file-", "").replace("-", ".")}`, target: "_blank" }, ((_F = filenames[language]) == null ? void 0 : _F.woff) ? /* @__PURE__ */ React11.createElement("b", null, (_G = filenames[language]) == null ? void 0 : _G.woff) : /* @__PURE__ */ React11.createElement("b", null, "File"))), status === "ready" && /* @__PURE__ */ React11.createElement(Flex7, { gap: 1 }, ((_H = value[language]) == null ? void 0 : _H.ttf) && /* @__PURE__ */ React11.createElement(Button7, { mode: "default", onClick: () => handleGenerateFontFile("woff", value[language].ttf, language) }, "Build"), /* @__PURE__ */ React11.createElement("label", null, /* @__PURE__ */ React11.createElement(Button7, { as: "span", mode: "ghost" }, "Upload"), /* @__PURE__ */ React11.createElement("input", { ref, type: "file", style: { display: "none" }, onChange: async (event) => handleUpload(event, language, "woff") })), ((_I = value[language]) == null ? void 0 : _I.woff) && /* @__PURE__ */ React11.createElement(Button7, { mode: "ghost", tone: "critical", onClick: () => handleDelete("woff", language) }, "\xD7"))), /* @__PURE__ */ React11.createElement(Flex7, { justify: "space-between", align: "center" }, /* @__PURE__ */ React11.createElement(Text9, null, "WOFF2:\xA0", !((_L = (_K = (_J = scriptFileInput[language]) == null ? void 0 : _J.woff2) == null ? void 0 : _K.asset) == null ? void 0 : _L._ref) ? ((_M = filenames[language]) == null ? void 0 : _M.woff2) ? /* @__PURE__ */ React11.createElement("b", null, (_N = filenames[language]) == null ? void 0 : _N.woff2) : /* @__PURE__ */ React11.createElement("b", null, "Empty") : /* @__PURE__ */ React11.createElement("a", { href: `https://cdn.sanity.io/files/${process.env.SANITY_STUDIO_PROJECT_ID}/${process.env.SANITY_STUDIO_DATASET}/${(_Q = (_P = (_O = scriptFileInput[language]) == null ? void 0 : _O.woff2) == null ? void 0 : _P.asset) == null ? void 0 : _Q._ref.replace("file-", "").replace("-", ".")}`, target: "_blank" }, ((_R = filenames[language]) == null ? void 0 : _R.woff2) ? /* @__PURE__ */ React11.createElement("b", null, (_S = filenames[language]) == null ? void 0 : _S.woff2) : /* @__PURE__ */ React11.createElement("b", null, "File"))), status === "ready" && /* @__PURE__ */ React11.createElement(Flex7, { gap: 1 }, ((_T = value[language]) == null ? void 0 : _T.ttf) && /* @__PURE__ */ React11.createElement(Button7, { mode: "default", onClick: () => handleGenerateFontFile("woff2", value[language].ttf, language) }, "Build"), /* @__PURE__ */ React11.createElement("label", null, /* @__PURE__ */ React11.createElement(Button7, { as: "span", mode: "ghost" }, "Upload"), /* @__PURE__ */ React11.createElement("input", { ref, type: "file", style: { display: "none" }, onChange: async (event) => handleUpload(event, language, "woff2") })), ((_U = value[language]) == null ? void 0 : _U.woff2) && /* @__PURE__ */ React11.createElement(Button7, { mode: "ghost", tone: "critical", onClick: () => handleDelete("woff2", language) }, "\xD7"))), /* @__PURE__ */ React11.createElement(Flex7, { justify: "space-between", align: "center" }, /* @__PURE__ */ React11.createElement(Text9, null, "EOT:\xA0", !((_X = (_W = (_V = scriptFileInput[language]) == null ? void 0 : _V.eot) == null ? void 0 : _W.asset) == null ? void 0 : _X._ref) ? ((_Y = filenames[language]) == null ? void 0 : _Y.eot) ? /* @__PURE__ */ React11.createElement("b", null, (_Z = filenames[language]) == null ? void 0 : _Z.eot) : /* @__PURE__ */ React11.createElement("b", null, "Empty") : /* @__PURE__ */ React11.createElement("a", { href: `https://cdn.sanity.io/files/${process.env.SANITY_STUDIO_PROJECT_ID}/${process.env.SANITY_STUDIO_DATASET}/${(_aa = (_$ = (__ = scriptFileInput[language]) == null ? void 0 : __.eot) == null ? void 0 : _$.asset) == null ? void 0 : _aa._ref.replace("file-", "").replace("-", ".")}`, target: "_blank" }, ((_ba = filenames[language]) == null ? void 0 : _ba.eot) ? /* @__PURE__ */ React11.createElement("b", null, (_ca = filenames[language]) == null ? void 0 : _ca.eot) : /* @__PURE__ */ React11.createElement("b", null, "File"))), status === "ready" && /* @__PURE__ */ React11.createElement(Flex7, { gap: 1 }, ((_da = value[language]) == null ? void 0 : _da.ttf) && /* @__PURE__ */ React11.createElement(Button7, { mode: "default", onClick: () => handleGenerateFontFile("eot", value[language].ttf, language) }, "Build"), /* @__PURE__ */ React11.createElement("label", null, /* @__PURE__ */ React11.createElement(Button7, { as: "span", mode: "ghost" }, "Upload"), /* @__PURE__ */ React11.createElement("input", { ref, type: "file", style: { display: "none" }, onChange: async (event) => handleUpload(event, language, "eot") })), ((_ea = value[language]) == null ? void 0 : _ea.eot) && /* @__PURE__ */ React11.createElement(Button7, { mode: "ghost", tone: "critical", onClick: () => handleDelete("eot", language) }, "\xD7"))), /* @__PURE__ */ React11.createElement(Flex7, { justify: "space-between", align: "center" }, /* @__PURE__ */ React11.createElement(Text9, null, "SVG:\xA0", !((_ha = (_ga = (_fa = scriptFileInput[language]) == null ? void 0 : _fa.svg) == null ? void 0 : _ga.asset) == null ? void 0 : _ha._ref) ? ((_ia = filenames[language]) == null ? void 0 : _ia.svg) ? /* @__PURE__ */ React11.createElement("b", null, (_ja = filenames[language]) == null ? void 0 : _ja.svg) : /* @__PURE__ */ React11.createElement("b", null, "Empty") : /* @__PURE__ */ React11.createElement("a", { href: `https://cdn.sanity.io/files/${process.env.SANITY_STUDIO_PROJECT_ID}/${process.env.SANITY_STUDIO_DATASET}/${(_ma = (_la = (_ka = scriptFileInput[language]) == null ? void 0 : _ka.svg) == null ? void 0 : _la.asset) == null ? void 0 : _ma._ref.replace("file-", "").replace("-", ".")}`, target: "_blank" }, ((_na = filenames[language]) == null ? void 0 : _na.svg) ? /* @__PURE__ */ React11.createElement("b", null, (_oa = filenames[language]) == null ? void 0 : _oa.svg) : /* @__PURE__ */ React11.createElement("b", null, "File"))), status === "ready" && /* @__PURE__ */ React11.createElement(Flex7, { gap: 1 }, ((_pa = value[language]) == null ? void 0 : _pa.ttf) && /* @__PURE__ */ React11.createElement(Button7, { mode: "default", onClick: () => handleGenerateFontFile("svg", value[language].ttf, language) }, "Build"), /* @__PURE__ */ React11.createElement("label", null, /* @__PURE__ */ React11.createElement(Button7, { as: "span", mode: "ghost" }, "Upload"), /* @__PURE__ */ React11.createElement("input", { ref, type: "file", style: { display: "none" }, onChange: async (event) => handleUpload(event, language, "svg") })), ((_qa = value[language]) == null ? void 0 : _qa.svg) && /* @__PURE__ */ React11.createElement(Button7, { mode: "ghost", tone: "critical", onClick: () => handleDelete("svg", language) }, "\xD7"))), /* @__PURE__ */ React11.createElement(Flex7, { justify: "space-between", align: "center" }, /* @__PURE__ */ React11.createElement(Text9, null, "CSS:\xA0", !((_ta = (_sa = (_ra = scriptFileInput[language]) == null ? void 0 : _ra.css) == null ? void 0 : _sa.asset) == null ? void 0 : _ta._ref) ? ((_ua = filenames[language]) == null ? void 0 : _ua.css) ? /* @__PURE__ */ React11.createElement("b", null, (_va = filenames[language]) == null ? void 0 : _va.css) : /* @__PURE__ */ React11.createElement("b", null, "Empty") : /* @__PURE__ */ React11.createElement("a", { href: `https://cdn.sanity.io/files/${process.env.SANITY_STUDIO_PROJECT_ID}/${process.env.SANITY_STUDIO_DATASET}/${(_ya = (_xa = (_wa = scriptFileInput[language]) == null ? void 0 : _wa.css) == null ? void 0 : _xa.asset) == null ? void 0 : _ya._ref.replace("file-", "").replace("-", ".")}`, target: "_blank" }, ((_za = filenames[language]) == null ? void 0 : _za.css) ? /* @__PURE__ */ React11.createElement("b", null, (_Aa = filenames[language]) == null ? void 0 : _Aa.css) : /* @__PURE__ */ React11.createElement("b", null, "File"))), status === "ready" && /* @__PURE__ */ React11.createElement(Flex7, { gap: 1 }, ((_Ba = value[language]) == null ? void 0 : _Ba.woff2) && /* @__PURE__ */ React11.createElement(Button7, { mode: "default", onClick: () => handleGenerateCssFile(language) }, "Build"), ((_Ca = value[language]) == null ? void 0 : _Ca.css) && /* @__PURE__ */ React11.createElement(Button7, { mode: "ghost", tone: "critical", onClick: () => handleDelete("css", language) }, "\xD7"))), status === "ready" && (((_Da = value[language]) == null ? void 0 : _Da.ttf) || ((_Ea = value[language]) == null ? void 0 : _Ea.otf) || ((_Fa = value[language]) == null ? void 0 : _Fa.woff) || ((_Ga = value[language]) == null ? void 0 : _Ga.woff2)) && /* @__PURE__ */ React11.createElement(Button7, { mode: "ghost", tone: "critical", onClick: () => handleDeleteAll(language), style: { width: "100%" } }, "Delete All")));
|
|
3462
3462
|
}));
|
|
3463
3463
|
};
|
|
3464
3464
|
|
|
3465
3465
|
// src/components/UploadButton.jsx
|
|
3466
|
-
import
|
|
3466
|
+
import React12, { forwardRef } from "react";
|
|
3467
3467
|
import { Button as Button8, Text as Text10 } from "@sanity/ui";
|
|
3468
3468
|
var UploadButton = forwardRef(({ handleUpload }, ref) => {
|
|
3469
|
-
return /* @__PURE__ */
|
|
3469
|
+
return /* @__PURE__ */ React12.createElement(
|
|
3470
3470
|
Button8,
|
|
3471
3471
|
{
|
|
3472
3472
|
mode: "ghost",
|
|
@@ -3475,8 +3475,8 @@ var UploadButton = forwardRef(({ handleUpload }, ref) => {
|
|
|
3475
3475
|
padding: 3,
|
|
3476
3476
|
style: { position: "relative" }
|
|
3477
3477
|
},
|
|
3478
|
-
/* @__PURE__ */
|
|
3479
|
-
/* @__PURE__ */
|
|
3478
|
+
/* @__PURE__ */ React12.createElement(Text10, { align: "center" }, "Upload (ttf/otf/woff/woff2/etc...)"),
|
|
3479
|
+
/* @__PURE__ */ React12.createElement(
|
|
3480
3480
|
"input",
|
|
3481
3481
|
{
|
|
3482
3482
|
ref,
|
|
@@ -3500,7 +3500,7 @@ UploadButton.displayName = "UploadButton";
|
|
|
3500
3500
|
var UploadButton_default = UploadButton;
|
|
3501
3501
|
|
|
3502
3502
|
// src/components/KeyValueInput.jsx
|
|
3503
|
-
import
|
|
3503
|
+
import React13, { useState as useState8, useCallback as useCallback7 } from "react";
|
|
3504
3504
|
import { Button as Button9, Grid as Grid5, Stack as Stack8, TextInput as TextInput2 } from "@sanity/ui";
|
|
3505
3505
|
import { AddIcon, ArrowDownIcon, ArrowUpIcon, TrashIcon as TrashIcon3 } from "@sanity/icons";
|
|
3506
3506
|
import { set as set4 } from "sanity";
|
|
@@ -3536,33 +3536,33 @@ function KeyValueInput({ value = [], onChange }) {
|
|
|
3536
3536
|
setPairs(updatedPairs);
|
|
3537
3537
|
onChange(set4(updatedPairs));
|
|
3538
3538
|
}, [pairs, onChange]);
|
|
3539
|
-
return /* @__PURE__ */
|
|
3539
|
+
return /* @__PURE__ */ React13.createElement(Stack8, { space: 3 }, pairs.map((pair, index) => /* @__PURE__ */ React13.createElement(Grid5, { className: "manualButtonWrap", columns: [2], key: index, gap: 0, style: { position: "relative" } }, /* @__PURE__ */ React13.createElement("div", { style: { position: "absolute", height: "100%", top: "0", left: "-10px", width: "min-content", transform: "translate(-100%, 0%)" } }, /* @__PURE__ */ React13.createElement("button", { className: "manualButton manualButtonUp", style: { fontSize: "15px", height: "50%" }, onClick: () => handleMoveUp(index) }, /* @__PURE__ */ React13.createElement(ArrowUpIcon, null)), /* @__PURE__ */ React13.createElement("button", { className: "manualButton manualButtonDown", style: { fontSize: "15px", height: "50%" }, onClick: () => handleMoveDown(index) }, /* @__PURE__ */ React13.createElement(ArrowDownIcon, null))), /* @__PURE__ */ React13.createElement(
|
|
3540
3540
|
TextInput2,
|
|
3541
3541
|
{
|
|
3542
3542
|
value: pair.key,
|
|
3543
3543
|
onChange: (e) => handlePairChange(index, "key", e.target.value),
|
|
3544
3544
|
placeholder: "Key"
|
|
3545
3545
|
}
|
|
3546
|
-
), /* @__PURE__ */
|
|
3546
|
+
), /* @__PURE__ */ React13.createElement("div", { style: { marginLeft: "-1px" } }, /* @__PURE__ */ React13.createElement(
|
|
3547
3547
|
TextInput2,
|
|
3548
3548
|
{
|
|
3549
3549
|
value: pair.value,
|
|
3550
3550
|
onChange: (e) => handlePairChange(index, "value", e.target.value),
|
|
3551
3551
|
placeholder: "Value"
|
|
3552
3552
|
}
|
|
3553
|
-
)), /* @__PURE__ */
|
|
3553
|
+
)), /* @__PURE__ */ React13.createElement(
|
|
3554
3554
|
"button",
|
|
3555
3555
|
{
|
|
3556
3556
|
className: "manualButton",
|
|
3557
3557
|
onClick: () => handleRemovePair(index),
|
|
3558
3558
|
style: { position: "absolute", top: "0", right: "-10px", transform: "translate(100%, 0%)" }
|
|
3559
3559
|
},
|
|
3560
|
-
/* @__PURE__ */
|
|
3561
|
-
))), /* @__PURE__ */
|
|
3560
|
+
/* @__PURE__ */ React13.createElement(TrashIcon3, null)
|
|
3561
|
+
))), /* @__PURE__ */ React13.createElement(Button9, { tone: "primary", onClick: handleAddPair, icon: AddIcon, text: "Add Row" }));
|
|
3562
3562
|
}
|
|
3563
3563
|
|
|
3564
3564
|
// src/components/KeyValueReferenceInput.jsx
|
|
3565
|
-
import
|
|
3565
|
+
import React14, { useState as useState9, useCallback as useCallback8, useEffect as useEffect6 } from "react";
|
|
3566
3566
|
import { Button as Button10, Stack as Stack9, TextInput as TextInput3, Box as Box4, Card as Card4, Flex as Flex8, Text as Text11, Dialog, Menu as Menu2, MenuButton as MenuButton2, MenuItem as MenuItem2, Autocomplete } from "@sanity/ui";
|
|
3567
3567
|
import { AddIcon as AddIcon2, ArrowDownIcon as ArrowDownIcon2, ArrowUpIcon as ArrowUpIcon2, TrashIcon as TrashIcon4, SyncIcon, EllipsisHorizontalIcon } from "@sanity/icons";
|
|
3568
3568
|
import { set as set5, useFormValue as useFormValue8 } from "sanity";
|
|
@@ -3673,48 +3673,48 @@ function KeyValueReferenceInput(props) {
|
|
|
3673
3673
|
const valueTitle = (valueField == null ? void 0 : valueField.title) || "Value";
|
|
3674
3674
|
const keyPlaceholder = (keyField == null ? void 0 : keyField.placeholder) || "Enter key";
|
|
3675
3675
|
const pickerLabel = referenceType || valueTitle.toLowerCase();
|
|
3676
|
-
return /* @__PURE__ */
|
|
3676
|
+
return /* @__PURE__ */ React14.createElement(Stack9, { space: 3 }, topActions && /* @__PURE__ */ React14.createElement(Box4, { paddingBottom: 2 }, topActions), /* @__PURE__ */ React14.createElement(Box4, null, /* @__PURE__ */ React14.createElement(Stack9, { space: 2 }, pairs.map((pair, index) => {
|
|
3677
3677
|
var _a2;
|
|
3678
|
-
return /* @__PURE__ */
|
|
3678
|
+
return /* @__PURE__ */ React14.createElement(Box4, { key: index, style: { position: "relative" } }, /* @__PURE__ */ React14.createElement("div", { style: { position: "absolute", height: "100%", top: "0", left: "-5px", width: "min-content", transform: "translate(-100%, 0%)" } }, /* @__PURE__ */ React14.createElement("button", { className: "manualButton manualButtonUp", style: { fontSize: "15px", height: "50%" }, onClick: () => handleMoveUp(index) }, /* @__PURE__ */ React14.createElement(ArrowUpIcon2, null)), /* @__PURE__ */ React14.createElement("button", { className: "manualButton manualButtonDown", style: { fontSize: "15px", height: "50%" }, onClick: () => handleMoveDown(index) }, /* @__PURE__ */ React14.createElement(ArrowDownIcon2, null))), /* @__PURE__ */ React14.createElement(Flex8, { gap: 2, align: "flex-start" }, /* @__PURE__ */ React14.createElement(Box4, { flex: 1 }, /* @__PURE__ */ React14.createElement(
|
|
3679
3679
|
TextInput3,
|
|
3680
3680
|
{
|
|
3681
3681
|
value: pair.key,
|
|
3682
3682
|
onChange: (e) => handlePairChange(index, "key", e.target.value),
|
|
3683
3683
|
placeholder: keyPlaceholder
|
|
3684
3684
|
}
|
|
3685
|
-
)), /* @__PURE__ */
|
|
3685
|
+
)), /* @__PURE__ */ React14.createElement(Box4, { flex: 1, style: { minHeight: "100%" } }, ((_a2 = pair.value) == null ? void 0 : _a2._ref) ? /* @__PURE__ */ React14.createElement(Card4, { className: "referenceCard", radius: 2, tone: "primary", style: { paddingLeft: "1rem", height: "fit-content" } }, /* @__PURE__ */ React14.createElement(Flex8, { align: "center", justify: "space-between" }, /* @__PURE__ */ React14.createElement(
|
|
3686
3686
|
Text11,
|
|
3687
3687
|
{
|
|
3688
3688
|
size: 2,
|
|
3689
3689
|
style: { whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis", maxWidth: "90%" }
|
|
3690
3690
|
},
|
|
3691
3691
|
referenceData[pair.value._ref] || "Loading..."
|
|
3692
|
-
), /* @__PURE__ */
|
|
3692
|
+
), /* @__PURE__ */ React14.createElement(
|
|
3693
3693
|
MenuButton2,
|
|
3694
3694
|
{
|
|
3695
|
-
button: /* @__PURE__ */
|
|
3695
|
+
button: /* @__PURE__ */ React14.createElement(Button10, { icon: EllipsisHorizontalIcon, mode: "bleed", title: "Options" }),
|
|
3696
3696
|
id: `ref-options-${index}`,
|
|
3697
|
-
menu: /* @__PURE__ */
|
|
3697
|
+
menu: /* @__PURE__ */ React14.createElement(Menu2, null, /* @__PURE__ */ React14.createElement(MenuItem2, { tone: "critical", icon: TrashIcon4, text: "Remove", onClick: () => handlePairChange(index, "value", null) }), /* @__PURE__ */ React14.createElement(MenuItem2, { icon: SyncIcon, text: "Replace", onClick: () => openReferenceSelector(index) })),
|
|
3698
3698
|
popover: { portal: true, tone: "default", placement: "left" }
|
|
3699
3699
|
}
|
|
3700
|
-
))) : /* @__PURE__ */
|
|
3700
|
+
))) : /* @__PURE__ */ React14.createElement(
|
|
3701
3701
|
Box4,
|
|
3702
3702
|
{
|
|
3703
3703
|
padding: 2,
|
|
3704
3704
|
style: { minHeight: "100%", border: "1px dashed #ccc", borderRadius: "4px", display: "flex", alignItems: "center", justifyContent: "center", cursor: "pointer" },
|
|
3705
3705
|
onClick: () => openReferenceSelector(index)
|
|
3706
3706
|
},
|
|
3707
|
-
/* @__PURE__ */
|
|
3708
|
-
))), /* @__PURE__ */
|
|
3707
|
+
/* @__PURE__ */ React14.createElement(Text11, { muted: true, size: 2 }, "Click to select a ", pickerLabel)
|
|
3708
|
+
))), /* @__PURE__ */ React14.createElement(
|
|
3709
3709
|
"button",
|
|
3710
3710
|
{
|
|
3711
3711
|
className: "manualButton",
|
|
3712
3712
|
onClick: () => handleRemovePair(index),
|
|
3713
3713
|
style: { position: "absolute", top: "0", right: "-7px", transform: "translate(100%, 0%)" }
|
|
3714
3714
|
},
|
|
3715
|
-
/* @__PURE__ */
|
|
3715
|
+
/* @__PURE__ */ React14.createElement(TrashIcon4, null)
|
|
3716
3716
|
));
|
|
3717
|
-
}))), /* @__PURE__ */
|
|
3717
|
+
}))), /* @__PURE__ */ React14.createElement(Button10, { tone: "primary", mode: "ghost", onClick: handleAddPair, icon: AddIcon2, text: `Add ${keyTitle}` }), isDialogOpen && /* @__PURE__ */ React14.createElement(
|
|
3718
3718
|
Dialog,
|
|
3719
3719
|
{
|
|
3720
3720
|
header: `Select a ${pickerLabel}`,
|
|
@@ -3722,13 +3722,13 @@ function KeyValueReferenceInput(props) {
|
|
|
3722
3722
|
onClose: closeDialog,
|
|
3723
3723
|
width: 1
|
|
3724
3724
|
},
|
|
3725
|
-
/* @__PURE__ */
|
|
3725
|
+
/* @__PURE__ */ React14.createElement(Box4, { padding: 4 }, /* @__PURE__ */ React14.createElement(
|
|
3726
3726
|
Autocomplete,
|
|
3727
3727
|
{
|
|
3728
3728
|
id: "reference-autocomplete",
|
|
3729
3729
|
options: referenceOptions,
|
|
3730
3730
|
placeholder: `Search ${pickerLabel}s...`,
|
|
3731
|
-
renderOption: (option) => /* @__PURE__ */
|
|
3731
|
+
renderOption: (option) => /* @__PURE__ */ React14.createElement(Card4, { key: option.value, padding: 3, radius: 2, tone: "default", style: { cursor: "pointer" } }, /* @__PURE__ */ React14.createElement(Text11, { size: 2 }, option.title)),
|
|
3732
3732
|
renderValue: (val) => {
|
|
3733
3733
|
var _a2;
|
|
3734
3734
|
return ((_a2 = referenceOptions.find((o) => o.value === val)) == null ? void 0 : _a2.title) || "";
|
|
@@ -3745,7 +3745,7 @@ function KeyValueReferenceInput(props) {
|
|
|
3745
3745
|
}
|
|
3746
3746
|
|
|
3747
3747
|
// src/components/VariableInstanceReferencesInput.jsx
|
|
3748
|
-
import
|
|
3748
|
+
import React15, { useState as useState10, useCallback as useCallback9 } from "react";
|
|
3749
3749
|
import { Button as Button11, Flex as Flex9, Dialog as Dialog2, Box as Box5, Stack as Stack10, Text as Text12 } from "@sanity/ui";
|
|
3750
3750
|
import { SyncIcon as SyncIcon2, DocumentTextIcon } from "@sanity/icons";
|
|
3751
3751
|
import { set as set6, useFormValue as useFormValue9 } from "sanity";
|
|
@@ -3842,7 +3842,7 @@ function VariableInstanceReferencesInput(props) {
|
|
|
3842
3842
|
setPendingAction(null);
|
|
3843
3843
|
}, []);
|
|
3844
3844
|
const showAutofill = !!((formDocument == null ? void 0 : formDocument.variableFont) && (formDocument == null ? void 0 : formDocument.variableInstances));
|
|
3845
|
-
const topActions = showAutofill ? /* @__PURE__ */
|
|
3845
|
+
const topActions = showAutofill ? /* @__PURE__ */ React15.createElement(Flex9, { gap: 2 }, /* @__PURE__ */ React15.createElement(
|
|
3846
3846
|
Button11,
|
|
3847
3847
|
{
|
|
3848
3848
|
tone: "primary",
|
|
@@ -3853,7 +3853,7 @@ function VariableInstanceReferencesInput(props) {
|
|
|
3853
3853
|
disabled: isAutofilling,
|
|
3854
3854
|
loading: isAutofilling
|
|
3855
3855
|
}
|
|
3856
|
-
), /* @__PURE__ */
|
|
3856
|
+
), /* @__PURE__ */ React15.createElement(
|
|
3857
3857
|
Button11,
|
|
3858
3858
|
{
|
|
3859
3859
|
tone: "default",
|
|
@@ -3865,7 +3865,7 @@ function VariableInstanceReferencesInput(props) {
|
|
|
3865
3865
|
loading: isAutofilling
|
|
3866
3866
|
}
|
|
3867
3867
|
)) : null;
|
|
3868
|
-
return /* @__PURE__ */
|
|
3868
|
+
return /* @__PURE__ */ React15.createElement(React15.Fragment, null, /* @__PURE__ */ React15.createElement(
|
|
3869
3869
|
KeyValueReferenceInput,
|
|
3870
3870
|
{
|
|
3871
3871
|
...props,
|
|
@@ -3873,7 +3873,7 @@ function VariableInstanceReferencesInput(props) {
|
|
|
3873
3873
|
fetchReferences,
|
|
3874
3874
|
topActions
|
|
3875
3875
|
}
|
|
3876
|
-
), showConfirmDialog && /* @__PURE__ */
|
|
3876
|
+
), showConfirmDialog && /* @__PURE__ */ React15.createElement(
|
|
3877
3877
|
Dialog2,
|
|
3878
3878
|
{
|
|
3879
3879
|
header: "Existing entries found",
|
|
@@ -3881,12 +3881,12 @@ function VariableInstanceReferencesInput(props) {
|
|
|
3881
3881
|
onClose: handleConfirmCancel,
|
|
3882
3882
|
width: 1
|
|
3883
3883
|
},
|
|
3884
|
-
/* @__PURE__ */
|
|
3884
|
+
/* @__PURE__ */ React15.createElement(Box5, { padding: 4 }, /* @__PURE__ */ React15.createElement(Stack10, { space: 4 }, /* @__PURE__ */ React15.createElement(Text12, null, "You already have ", value.length, " ", value.length === 1 ? "entry" : "entries", ". How would you like to proceed?"), /* @__PURE__ */ React15.createElement(Flex9, { gap: 2, justify: "flex-end" }, /* @__PURE__ */ React15.createElement(Button11, { text: "Cancel", mode: "ghost", onClick: handleConfirmCancel }), /* @__PURE__ */ React15.createElement(Button11, { text: "Merge (Add New)", tone: "primary", mode: "ghost", onClick: () => handleConfirmChoice("merge") }), /* @__PURE__ */ React15.createElement(Button11, { text: "Replace All", tone: "critical", onClick: () => handleConfirmChoice("replace") }))))
|
|
3885
3885
|
));
|
|
3886
3886
|
}
|
|
3887
3887
|
|
|
3888
3888
|
// src/components/PrimaryCollectionGeneratorTypeface.jsx
|
|
3889
|
-
import
|
|
3889
|
+
import React16, { useCallback as useCallback10, useState as useState11 } from "react";
|
|
3890
3890
|
import { Stack as Stack11, Flex as Flex10, Text as Text13, Button as Button12, Card as Card5, Spinner as Spinner3 } from "@sanity/ui";
|
|
3891
3891
|
import { useFormValue as useFormValue10 } from "sanity";
|
|
3892
3892
|
import { nanoid as nanoid10 } from "nanoid";
|
|
@@ -3941,7 +3941,7 @@ var PrimaryCollectionGeneratorTypeface = () => {
|
|
|
3941
3941
|
setReady(true);
|
|
3942
3942
|
}, [docId, fonts, price, preferredStyle, styles, title, client]);
|
|
3943
3943
|
if (!title || !fonts) return null;
|
|
3944
|
-
return /* @__PURE__ */
|
|
3944
|
+
return /* @__PURE__ */ React16.createElement(Stack11, { space: 2 }, /* @__PURE__ */ React16.createElement(StatusDisplay_default, { status, error: false }), /* @__PURE__ */ React16.createElement(Card5, { border: true, padding: 2, shadow: 1, radius: 2 }, ready ? /* @__PURE__ */ React16.createElement(Stack11, { space: 3 }, /* @__PURE__ */ React16.createElement(Flex10, { align: "center", gap: 2, marginTop: 1, marginBottom: 1 }, /* @__PURE__ */ React16.createElement(Text13, { size: 1, muted: true }, "Price"), /* @__PURE__ */ React16.createElement(Text13, { size: 1, muted: true }, "$"), /* @__PURE__ */ React16.createElement(
|
|
3945
3945
|
"input",
|
|
3946
3946
|
{
|
|
3947
3947
|
value: price,
|
|
@@ -3949,7 +3949,7 @@ var PrimaryCollectionGeneratorTypeface = () => {
|
|
|
3949
3949
|
type: "number",
|
|
3950
3950
|
style: { textAlign: "end", padding: "5px", maxWidth: "75px" }
|
|
3951
3951
|
}
|
|
3952
|
-
), /* @__PURE__ */
|
|
3952
|
+
), /* @__PURE__ */ React16.createElement(Text13, { size: 1, muted: true }, "per full family")), /* @__PURE__ */ React16.createElement(
|
|
3953
3953
|
Button12,
|
|
3954
3954
|
{
|
|
3955
3955
|
mode: "ghost",
|
|
@@ -3958,7 +3958,81 @@ var PrimaryCollectionGeneratorTypeface = () => {
|
|
|
3958
3958
|
onClick: generateCollection,
|
|
3959
3959
|
text: "Generate Full Family Collection"
|
|
3960
3960
|
}
|
|
3961
|
-
)) : /* @__PURE__ */
|
|
3961
|
+
)) : /* @__PURE__ */ React16.createElement(Flex10, { align: "center", justify: "center", gap: 3, padding: 4 }, /* @__PURE__ */ React16.createElement(Spinner3, null), /* @__PURE__ */ React16.createElement(Text13, { muted: true, size: 1 }, status))));
|
|
3962
|
+
};
|
|
3963
|
+
|
|
3964
|
+
// src/components/SetOTF.jsx
|
|
3965
|
+
import { useState as useState12 } from "react";
|
|
3966
|
+
import { set as set7, useFormValue as useFormValue11 } from "sanity";
|
|
3967
|
+
import { Stack as Stack12, Button as Button13, Text as Text14 } from "@sanity/ui";
|
|
3968
|
+
var SetOTF = (props) => {
|
|
3969
|
+
var _a, _b;
|
|
3970
|
+
const { onChange, value = {} } = props;
|
|
3971
|
+
const client = useSanityClient();
|
|
3972
|
+
const stylesObject = useFormValue11(["styles"]);
|
|
3973
|
+
const [message, setMessage] = useState12("");
|
|
3974
|
+
const detect = async () => {
|
|
3975
|
+
var _a2, _b2, _c;
|
|
3976
|
+
if (!((_a2 = stylesObject == null ? void 0 : stylesObject.fonts) == null ? void 0 : _a2.length)) {
|
|
3977
|
+
setMessage("Error: No fonts found in styles. Please add at least one font first.");
|
|
3978
|
+
setTimeout(() => setMessage(""), 5e3);
|
|
3979
|
+
return;
|
|
3980
|
+
}
|
|
3981
|
+
const fontRef = (_b2 = stylesObject.fonts[0]) == null ? void 0 : _b2._ref;
|
|
3982
|
+
if (!fontRef) {
|
|
3983
|
+
setMessage("Error: Invalid font reference in styles.");
|
|
3984
|
+
setTimeout(() => setMessage(""), 5e3);
|
|
3985
|
+
return;
|
|
3986
|
+
}
|
|
3987
|
+
try {
|
|
3988
|
+
const font = await client.fetch('*[_type == "font" && _id == $id][0]', { id: fontRef });
|
|
3989
|
+
if (!font) {
|
|
3990
|
+
setMessage("Error: Could not find the referenced font.");
|
|
3991
|
+
setTimeout(() => setMessage(""), 5e3);
|
|
3992
|
+
return;
|
|
3993
|
+
}
|
|
3994
|
+
if (!((_c = font.opentypeFeatures) == null ? void 0 : _c.chars)) {
|
|
3995
|
+
setMessage(`Error: No OpenType feature data found in "${font.title || "this font"}". Generate font data first.`);
|
|
3996
|
+
setTimeout(() => setMessage(""), 5e3);
|
|
3997
|
+
return;
|
|
3998
|
+
}
|
|
3999
|
+
const features = [];
|
|
4000
|
+
Object.keys(value).forEach((key) => {
|
|
4001
|
+
var _a3;
|
|
4002
|
+
if (key !== "features" && ((_a3 = value[key]) == null ? void 0 : _a3.feature)) {
|
|
4003
|
+
const requiredFeatures = value[key].feature.split(" ");
|
|
4004
|
+
const approved = requiredFeatures.every((v) => font.opentypeFeatures.chars.includes(v));
|
|
4005
|
+
if (approved) features.push(key);
|
|
4006
|
+
}
|
|
4007
|
+
});
|
|
4008
|
+
onChange(set7({ ...value, features }));
|
|
4009
|
+
setMessage(`Features detected: ${features.length ? features.join(", ") : "none"}.`);
|
|
4010
|
+
setTimeout(() => setMessage(""), 5e3);
|
|
4011
|
+
} catch (err) {
|
|
4012
|
+
setMessage("Error detecting features. Check the console for details.");
|
|
4013
|
+
console.error("SetOTF detect error:", err);
|
|
4014
|
+
}
|
|
4015
|
+
};
|
|
4016
|
+
return /* @__PURE__ */ React.createElement(Stack12, { className: "openType" }, ((_a = value == null ? void 0 : value.features) == null ? void 0 : _a.length) > 0 && /* @__PURE__ */ React.createElement(Text14, { muted: true, size: 1, style: { marginBottom: "0.5rem" } }, "Number of features: ", value.features.length), !!((_b = stylesObject == null ? void 0 : stylesObject.fonts) == null ? void 0 : _b.length) && /* @__PURE__ */ React.createElement(
|
|
4017
|
+
Button13,
|
|
4018
|
+
{
|
|
4019
|
+
text: "Detect OTF",
|
|
4020
|
+
mode: "ghost",
|
|
4021
|
+
onClick: detect,
|
|
4022
|
+
style: { borderRadius: "0 3px 0 0", marginBottom: "1rem" }
|
|
4023
|
+
}
|
|
4024
|
+
), !!message && /* @__PURE__ */ React.createElement(Text14, { muted: true, size: 1 }, /* @__PURE__ */ React.createElement("br", null), message, /* @__PURE__ */ React.createElement("br", null), /* @__PURE__ */ React.createElement("br", null)), props.renderDefault(props));
|
|
4025
|
+
};
|
|
4026
|
+
|
|
4027
|
+
// src/components/StyleCountInput.jsx
|
|
4028
|
+
import React17 from "react";
|
|
4029
|
+
import { Text as Text15 } from "@sanity/ui";
|
|
4030
|
+
import { useFormValue as useFormValue12 } from "sanity";
|
|
4031
|
+
var StyleCountInput = (props) => {
|
|
4032
|
+
const styles = useFormValue12(["styles", "fonts"]) || [];
|
|
4033
|
+
const vfStyles = useFormValue12(["styles", "variableFont"]) || [];
|
|
4034
|
+
const count = styles.length + vfStyles.length;
|
|
4035
|
+
return /* @__PURE__ */ React17.createElement(Text15, { size: 1 }, count);
|
|
3962
4036
|
};
|
|
3963
4037
|
|
|
3964
4038
|
// src/utils/getEmptyFontKit.js
|
|
@@ -4050,8 +4124,10 @@ export {
|
|
|
4050
4124
|
RegenerateSubfamiliesComponent,
|
|
4051
4125
|
SCRIPTS,
|
|
4052
4126
|
SCRIPTS_OBJECT,
|
|
4127
|
+
SetOTF,
|
|
4053
4128
|
SingleUploaderTool,
|
|
4054
4129
|
StatusDisplay_default as StatusDisplay,
|
|
4130
|
+
StyleCountInput,
|
|
4055
4131
|
UpdateScriptsComponent,
|
|
4056
4132
|
UploadButton_default as UploadButton,
|
|
4057
4133
|
UploadScriptsComponent,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@liiift-studio/sanity-font-manager",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.3",
|
|
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",
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
// Detects and sets active OpenType features on a typeface document from the first linked font's metadata
|
|
2
|
+
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { set, useFormValue } from 'sanity';
|
|
5
|
+
import { Stack, Button, Text } from '@sanity/ui';
|
|
6
|
+
import { useSanityClient } from '../hooks/useSanityClient';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Reads the first linked font's opentypeFeatures data and checks which configured
|
|
10
|
+
* feature keys are supported. Patches the field with the detected features array.
|
|
11
|
+
*/
|
|
12
|
+
export const SetOTF = (props) => {
|
|
13
|
+
const { onChange, value = {} } = props;
|
|
14
|
+
const client = useSanityClient();
|
|
15
|
+
const stylesObject = useFormValue(['styles']);
|
|
16
|
+
const [message, setMessage] = useState('');
|
|
17
|
+
|
|
18
|
+
/** Fetches the first font document and matches its OpenType features against the configured keys. */
|
|
19
|
+
const detect = async () => {
|
|
20
|
+
if (!stylesObject?.fonts?.length) {
|
|
21
|
+
setMessage('Error: No fonts found in styles. Please add at least one font first.');
|
|
22
|
+
setTimeout(() => setMessage(''), 5000);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const fontRef = stylesObject.fonts[0]?._ref;
|
|
27
|
+
if (!fontRef) {
|
|
28
|
+
setMessage('Error: Invalid font reference in styles.');
|
|
29
|
+
setTimeout(() => setMessage(''), 5000);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
try {
|
|
34
|
+
const font = await client.fetch('*[_type == "font" && _id == $id][0]', { id: fontRef });
|
|
35
|
+
|
|
36
|
+
if (!font) {
|
|
37
|
+
setMessage('Error: Could not find the referenced font.');
|
|
38
|
+
setTimeout(() => setMessage(''), 5000);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (!font.opentypeFeatures?.chars) {
|
|
43
|
+
setMessage(`Error: No OpenType feature data found in "${font.title || 'this font'}". Generate font data first.`);
|
|
44
|
+
setTimeout(() => setMessage(''), 5000);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const features = [];
|
|
49
|
+
Object.keys(value).forEach(key => {
|
|
50
|
+
if (key !== 'features' && value[key]?.feature) {
|
|
51
|
+
const requiredFeatures = value[key].feature.split(' ');
|
|
52
|
+
const approved = requiredFeatures.every(v => font.opentypeFeatures.chars.includes(v));
|
|
53
|
+
if (approved) features.push(key);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
onChange(set({ ...value, features }));
|
|
58
|
+
setMessage(`Features detected: ${features.length ? features.join(', ') : 'none'}.`);
|
|
59
|
+
setTimeout(() => setMessage(''), 5000);
|
|
60
|
+
} catch (err) {
|
|
61
|
+
setMessage('Error detecting features. Check the console for details.');
|
|
62
|
+
console.error('SetOTF detect error:', err);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
return (
|
|
67
|
+
<Stack className="openType">
|
|
68
|
+
{value?.features?.length > 0 && (
|
|
69
|
+
<Text muted size={1} style={{ marginBottom: '0.5rem' }}>
|
|
70
|
+
Number of features: {value.features.length}
|
|
71
|
+
</Text>
|
|
72
|
+
)}
|
|
73
|
+
{!!stylesObject?.fonts?.length && (
|
|
74
|
+
<Button
|
|
75
|
+
text="Detect OTF"
|
|
76
|
+
mode="ghost"
|
|
77
|
+
onClick={detect}
|
|
78
|
+
style={{ borderRadius: '0 3px 0 0', marginBottom: '1rem' }}
|
|
79
|
+
/>
|
|
80
|
+
)}
|
|
81
|
+
{!!message && (
|
|
82
|
+
<Text muted size={1}><br />{message}<br /><br /></Text>
|
|
83
|
+
)}
|
|
84
|
+
{props.renderDefault(props)}
|
|
85
|
+
</Stack>
|
|
86
|
+
);
|
|
87
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Displays the total count of static and variable font styles linked to a typeface document
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { Text } from '@sanity/ui';
|
|
5
|
+
import { useFormValue } from 'sanity';
|
|
6
|
+
|
|
7
|
+
/** Reads styles.fonts and styles.variableFont arrays and displays the combined count. */
|
|
8
|
+
export const StyleCountInput = (props) => {
|
|
9
|
+
const styles = useFormValue(['styles', 'fonts']) || [];
|
|
10
|
+
const vfStyles = useFormValue(['styles', 'variableFont']) || [];
|
|
11
|
+
const count = styles.length + vfStyles.length;
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<Text size={1}>{count}</Text>
|
|
15
|
+
);
|
|
16
|
+
};
|
package/src/index.js
CHANGED
|
@@ -15,6 +15,8 @@ export { KeyValueInput } from './components/KeyValueInput.jsx';
|
|
|
15
15
|
export { KeyValueReferenceInput } from './components/KeyValueReferenceInput.jsx';
|
|
16
16
|
export { VariableInstanceReferencesInput } from './components/VariableInstanceReferencesInput.jsx';
|
|
17
17
|
export { PrimaryCollectionGeneratorTypeface } from './components/PrimaryCollectionGeneratorTypeface.jsx';
|
|
18
|
+
export { SetOTF } from './components/SetOTF.jsx';
|
|
19
|
+
export { StyleCountInput } from './components/StyleCountInput.jsx';
|
|
18
20
|
|
|
19
21
|
// Hooks
|
|
20
22
|
export { useSanityClient } from './hooks/useSanityClient.js';
|