@liiift-studio/sanity-font-manager 2.3.4 → 2.3.6
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 +49 -0
- package/dist/index.js +528 -0
- package/dist/index.mjs +526 -0
- package/package.json +8 -2
- package/src/index.js +2 -0
- package/src/schema/stylesField.js +250 -0
- package/src/schema/stylisticSetField.js +301 -0
package/README.md
CHANGED
|
@@ -235,6 +235,55 @@ Label-wrapped button that triggers a hidden file input.
|
|
|
235
235
|
|
|
236
236
|
---
|
|
237
237
|
|
|
238
|
+
## Schema field definitions
|
|
239
|
+
|
|
240
|
+
Pre-built Sanity schema field objects that can be spread directly into a typeface schema's `fields` array. Eliminates hundreds of lines of repeated field definitions across consumer studios.
|
|
241
|
+
|
|
242
|
+
### `openTypeField`
|
|
243
|
+
|
|
244
|
+
A complete `openType` object field wired to the `openType` tab group. Includes the `features` checkbox array (all standard OpenType feature keys) plus per-feature sub-objects with `title`, `feature`, and `customText` fields. Uses `SetOTF` internally for auto-detection.
|
|
245
|
+
|
|
246
|
+
```js
|
|
247
|
+
import { openTypeField } from '@liiift-studio/sanity-font-manager';
|
|
248
|
+
|
|
249
|
+
// In your typeface schema fields array:
|
|
250
|
+
openTypeField,
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
Requires the `openType` group to be declared in your schema's `groups` array:
|
|
254
|
+
```js
|
|
255
|
+
{ name: 'openType', title: 'Open Type' }
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
### `styleCountField`
|
|
259
|
+
|
|
260
|
+
A read-only `number` field in the `styles` group that displays the total count of static + variable font styles linked to the typeface. Uses `StyleCountInput` internally.
|
|
261
|
+
|
|
262
|
+
```js
|
|
263
|
+
import { styleCountField } from '@liiift-studio/sanity-font-manager';
|
|
264
|
+
|
|
265
|
+
// In your typeface schema fields array:
|
|
266
|
+
styleCountField,
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
### `stylisticSetField`
|
|
270
|
+
|
|
271
|
+
A complete `stylisticSet` object field for the `stylisticSets` group. Contains two sub-arrays: `featured` (highlighted words/phrases with per-character backtick syntax, stylistic feature picker, size, and CSS overrides) and `sets` (full catalogue of feature → glyph mappings). Both include the full OpenType feature dropdown (44 named features + all 20 stylistic sets).
|
|
272
|
+
|
|
273
|
+
```js
|
|
274
|
+
import { stylisticSetField } from '@liiift-studio/sanity-font-manager';
|
|
275
|
+
|
|
276
|
+
// In your typeface schema fields array:
|
|
277
|
+
stylisticSetField,
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
Requires the `stylisticSets` group to be declared in your schema's `groups` array:
|
|
281
|
+
```js
|
|
282
|
+
{ name: 'stylisticSets', title: 'Stylistic Sets' }
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
---
|
|
286
|
+
|
|
238
287
|
## Hook
|
|
239
288
|
|
|
240
289
|
### `useSanityClient`
|
package/dist/index.js
CHANGED
|
@@ -50,6 +50,7 @@ __export(index_exports, {
|
|
|
50
50
|
VariableInstanceReferencesInput: () => VariableInstanceReferencesInput,
|
|
51
51
|
addItalicToFontTitle: () => addItalicToFontTitle,
|
|
52
52
|
createFontObject: () => createFontObject,
|
|
53
|
+
createStylesField: () => createStylesField,
|
|
53
54
|
determineWeight: () => determineWeight,
|
|
54
55
|
expandAbbreviations: () => expandAbbreviations,
|
|
55
56
|
extractFontMetadata: () => extractFontMetadata,
|
|
@@ -75,6 +76,7 @@ __export(index_exports, {
|
|
|
75
76
|
sanitizeForSanityId: () => sanitizeForSanityId,
|
|
76
77
|
sortFontObjects: () => sortFontObjects,
|
|
77
78
|
styleCountField: () => styleCountField,
|
|
79
|
+
stylisticSetField: () => stylisticSetField,
|
|
78
80
|
updateFontPrices: () => updateFontPrices,
|
|
79
81
|
updateTypefaceDocument: () => updateTypefaceDocument,
|
|
80
82
|
uploadFontFiles: () => uploadFontFiles,
|
|
@@ -6349,6 +6351,530 @@ var styleCountField = {
|
|
|
6349
6351
|
},
|
|
6350
6352
|
readOnly: true
|
|
6351
6353
|
};
|
|
6354
|
+
|
|
6355
|
+
// src/schema/stylisticSetField.js
|
|
6356
|
+
var import_icons6 = require("@sanity/icons");
|
|
6357
|
+
var stylisticSetField = {
|
|
6358
|
+
title: "Stylistic Features Section",
|
|
6359
|
+
name: "stylisticSet",
|
|
6360
|
+
group: "stylisticSets",
|
|
6361
|
+
type: "object",
|
|
6362
|
+
fields: [
|
|
6363
|
+
{
|
|
6364
|
+
name: "featured",
|
|
6365
|
+
title: "Featured Stylistic Feature Words & Phrases",
|
|
6366
|
+
description: 'Write a single letter, word or several words. Wrap the portion of the word that you want to use the stylistic set in ` characters. For example, writing "L`if`t" will make the "if" apply a stylistic set.',
|
|
6367
|
+
type: "array",
|
|
6368
|
+
of: [
|
|
6369
|
+
{
|
|
6370
|
+
name: "featuredWord",
|
|
6371
|
+
title: "Words or Phrase",
|
|
6372
|
+
type: "object",
|
|
6373
|
+
icon: import_icons6.StringIcon,
|
|
6374
|
+
fields: [
|
|
6375
|
+
{
|
|
6376
|
+
type: "text",
|
|
6377
|
+
title: "Content",
|
|
6378
|
+
name: "content"
|
|
6379
|
+
},
|
|
6380
|
+
{
|
|
6381
|
+
type: "string",
|
|
6382
|
+
title: "Label",
|
|
6383
|
+
name: "label"
|
|
6384
|
+
},
|
|
6385
|
+
{
|
|
6386
|
+
title: "Stylistic Feature",
|
|
6387
|
+
name: "stylisticFeature",
|
|
6388
|
+
type: "string",
|
|
6389
|
+
// description: '[This will be autopopulated with the list of stylistic features when ready.]',
|
|
6390
|
+
options: {
|
|
6391
|
+
list: [
|
|
6392
|
+
{ title: "All Alternates", value: "'aalt' 1" },
|
|
6393
|
+
{ title: "All Caps", value: "'c2sc' 1" },
|
|
6394
|
+
{ title: "Alternate Annotation", value: "'nalt' 1" },
|
|
6395
|
+
{ title: "Alternative Fractions", value: "'afrc' 1" },
|
|
6396
|
+
{ title: "Capitals To Small Caps", value: "'c2sc' 1, 'smcp' 1" },
|
|
6397
|
+
{ title: "Capitals to Petite Caps", value: "'c2pc' 1" },
|
|
6398
|
+
{ title: "Case Sensitive Forms", value: "'case' 1" },
|
|
6399
|
+
{ title: "Contextual Alternates", value: "'calt' 1" },
|
|
6400
|
+
{ title: "Contextual Ligatures", value: "'clig' 1" },
|
|
6401
|
+
{ title: "Contextual Swash", value: "'cswh' 1" },
|
|
6402
|
+
{ title: "Denominator", value: "'dnom' 1" },
|
|
6403
|
+
{ title: "Discretionary Ligatures", value: "'dlig' 1" },
|
|
6404
|
+
{ title: "Fractions", value: "'frac' 1" },
|
|
6405
|
+
{ title: "Glyph Decomposition", value: "'ccmp' 1" },
|
|
6406
|
+
{ title: "Historical Forms", value: "'hist' 1" },
|
|
6407
|
+
{ title: "Historical Ligatures", value: "'hlig' 1" },
|
|
6408
|
+
{ title: "Initial Form", value: "'init' 1" },
|
|
6409
|
+
{ title: "Isolated Form", value: "'isol' 1" },
|
|
6410
|
+
{ title: "Justified Alternates", value: "'jalt' 1" },
|
|
6411
|
+
{ title: "Localized Forms", value: "'locl' 1" },
|
|
6412
|
+
{ title: "Mark Positioning", value: "'mark' 1" },
|
|
6413
|
+
{ title: "Mark Positioning via Subs", value: "'mset' 1" },
|
|
6414
|
+
{ title: "Mark to Mark Positioning", value: "'mkmk' 1" },
|
|
6415
|
+
{ title: "Mathematical Greek", value: "'mgrk' 1" },
|
|
6416
|
+
{ title: "Medial Form", value: "'medi' 1" },
|
|
6417
|
+
{ title: "Numerator", value: "'numr' 1" },
|
|
6418
|
+
{ title: "Ordinals", value: "'ordn' 1" },
|
|
6419
|
+
{ title: "Ornaments", value: "'ornm' 1" },
|
|
6420
|
+
{ title: "Petite Caps", value: "'pcap' 1" },
|
|
6421
|
+
{ title: "Proportional Lining", value: "'pnum' 1" },
|
|
6422
|
+
{ title: "Proportional Oldstyle", value: "'onum' 1" },
|
|
6423
|
+
{ title: "Required Ligatures", value: "'rlig' 1" },
|
|
6424
|
+
{ title: "Scientific Inferiors", value: "'sinf' 1" },
|
|
6425
|
+
{ title: "Slashed Zero", value: "'zero' 1" },
|
|
6426
|
+
{ title: "Small Caps", value: "'smcp' 1" },
|
|
6427
|
+
{ title: "Standard Ligatures", value: "'liga' 1" },
|
|
6428
|
+
{ title: "Stylistic Alternates", value: "'salt' 1" },
|
|
6429
|
+
{ title: "Subscript", value: "'subs' 1" },
|
|
6430
|
+
{ title: "Superscript", value: "'sups' 1" },
|
|
6431
|
+
{ title: "Swash", value: "'swsh' 1" },
|
|
6432
|
+
{ title: "Tabular Lining", value: "'tnum' 1" },
|
|
6433
|
+
{ title: "Tabular Oldstyle", value: "'onum' 1" },
|
|
6434
|
+
{ title: "Terminal Form", value: "'fina' 1" },
|
|
6435
|
+
{ title: "Titling Alternates", value: "'titl' 1" },
|
|
6436
|
+
{ title: "Unicase", value: "'unic' 1" },
|
|
6437
|
+
{ title: "All Stylistic Sets", value: "'ss01' 1, 'ss02' 1, 'ss03' 1, 'ss04' 1, 'ss05' 1, 'ss06' 1, 'ss07' 1, 'ss08' 1, 'ss09' 1, 'ss10' 1, 'ss11' 1, 'ss12' 1, 'ss13' 1, 'ss14' 1, 'ss15' 1, 'ss16' 1, 'ss17' 1, 'ss18' 1, 'ss19' 1, 'ss20' 1" },
|
|
6438
|
+
{ title: "Stylistic Set 1", value: "'ss01' 1" },
|
|
6439
|
+
{ title: "Stylistic Set 2", value: "'ss02' 1" },
|
|
6440
|
+
{ title: "Stylistic Set 3", value: "'ss03' 1" },
|
|
6441
|
+
{ title: "Stylistic Set 4", value: "'ss04' 1" },
|
|
6442
|
+
{ title: "Stylistic Set 5", value: "'ss05' 1" },
|
|
6443
|
+
{ title: "Stylistic Set 6", value: "'ss06' 1" },
|
|
6444
|
+
{ title: "Stylistic Set 7", value: "'ss07' 1" },
|
|
6445
|
+
{ title: "Stylistic Set 8", value: "'ss08' 1" },
|
|
6446
|
+
{ title: "Stylistic Set 9", value: "'ss09' 1" },
|
|
6447
|
+
{ title: "Stylistic Set 10", value: "'ss10' 1" },
|
|
6448
|
+
{ title: "Stylistic Set 11", value: "'ss11' 1" },
|
|
6449
|
+
{ title: "Stylistic Set 12", value: "'ss12' 1" },
|
|
6450
|
+
{ title: "Stylistic Set 13", value: "'ss13' 1" },
|
|
6451
|
+
{ title: "Stylistic Set 14", value: "'ss14' 1" },
|
|
6452
|
+
{ title: "Stylistic Set 15", value: "'ss15' 1" },
|
|
6453
|
+
{ title: "Stylistic Set 16", value: "'ss16' 1" },
|
|
6454
|
+
{ title: "Stylistic Set 17", value: "'ss17' 1" },
|
|
6455
|
+
{ title: "Stylistic Set 18", value: "'ss18' 1" },
|
|
6456
|
+
{ title: "Stylistic Set 19", value: "'ss19' 1" },
|
|
6457
|
+
{ title: "Stylistic Set 20", value: "'ss20' 1" }
|
|
6458
|
+
]
|
|
6459
|
+
}
|
|
6460
|
+
},
|
|
6461
|
+
{
|
|
6462
|
+
type: "string",
|
|
6463
|
+
title: "Specialty CSS Implementation (for multi OT feautes)",
|
|
6464
|
+
name: "specialtyCss",
|
|
6465
|
+
placeholder: "'c2sc' 1, 'ss02' 1"
|
|
6466
|
+
},
|
|
6467
|
+
{
|
|
6468
|
+
type: "boolean",
|
|
6469
|
+
title: "Disable Ligatures on default",
|
|
6470
|
+
name: "ligatures"
|
|
6471
|
+
},
|
|
6472
|
+
{
|
|
6473
|
+
type: "boolean",
|
|
6474
|
+
title: "Disable Contextual Alternates on default",
|
|
6475
|
+
name: "calt"
|
|
6476
|
+
},
|
|
6477
|
+
{
|
|
6478
|
+
type: "boolean",
|
|
6479
|
+
title: "Only Applies to Italics",
|
|
6480
|
+
name: "italics"
|
|
6481
|
+
},
|
|
6482
|
+
{
|
|
6483
|
+
title: "Font Size",
|
|
6484
|
+
name: "size",
|
|
6485
|
+
type: "string",
|
|
6486
|
+
description: 'Recommendation: Use "XLarge" for single glyphs; \nuse "Large" for 2\u20135 glyphs on one line, or 2 short lines of text; use "Medium" for 2\u20133 lines of text; use "Small" for 3\u20134 lines of text.',
|
|
6487
|
+
options: {
|
|
6488
|
+
list: [
|
|
6489
|
+
{ title: "XLarge", value: "xl", description: "Recommended for single glyphs." },
|
|
6490
|
+
{ title: "Large", value: "lg", description: "Recommended for 2\u20135 glyphs on one line, or 2 short lines of text." },
|
|
6491
|
+
{ title: "Medium", value: "md", description: "Recommended for 2\u20133 lines of text." },
|
|
6492
|
+
{ title: "Small", value: "sm", description: "Recommended for 3\u20134 lines of text." }
|
|
6493
|
+
],
|
|
6494
|
+
layout: "radio"
|
|
6495
|
+
// direction: "horizontal"
|
|
6496
|
+
}
|
|
6497
|
+
}
|
|
6498
|
+
],
|
|
6499
|
+
preview: {
|
|
6500
|
+
select: {
|
|
6501
|
+
title: "content",
|
|
6502
|
+
subtitle: "label"
|
|
6503
|
+
},
|
|
6504
|
+
prepare(selection) {
|
|
6505
|
+
const { title, subtitle } = selection;
|
|
6506
|
+
return {
|
|
6507
|
+
title,
|
|
6508
|
+
subtitle
|
|
6509
|
+
};
|
|
6510
|
+
}
|
|
6511
|
+
}
|
|
6512
|
+
}
|
|
6513
|
+
]
|
|
6514
|
+
},
|
|
6515
|
+
{
|
|
6516
|
+
name: "sets",
|
|
6517
|
+
title: "Full list of stylistic features & their corresponding glyphs",
|
|
6518
|
+
type: "array",
|
|
6519
|
+
of: [
|
|
6520
|
+
{
|
|
6521
|
+
name: "set",
|
|
6522
|
+
type: "object",
|
|
6523
|
+
title: "Stylistic Feature",
|
|
6524
|
+
icon: import_icons6.StringIcon,
|
|
6525
|
+
fields: [
|
|
6526
|
+
{
|
|
6527
|
+
name: "title",
|
|
6528
|
+
title: "Label for Stylistic Feature",
|
|
6529
|
+
description: 'e.g. "ss01", "Lining Numerals',
|
|
6530
|
+
type: "string"
|
|
6531
|
+
},
|
|
6532
|
+
{
|
|
6533
|
+
name: "content",
|
|
6534
|
+
title: "Corresponding glyphs",
|
|
6535
|
+
type: "text",
|
|
6536
|
+
description: "For stylistic features that apply to multiple of the same base character, recommended to create a new line for each base character."
|
|
6537
|
+
},
|
|
6538
|
+
{
|
|
6539
|
+
title: "Stylistic Feature",
|
|
6540
|
+
name: "stylisticFeature",
|
|
6541
|
+
type: "string",
|
|
6542
|
+
// description: '[This will be autopopulated with the list of stylistic features when ready.]',
|
|
6543
|
+
options: {
|
|
6544
|
+
list: [
|
|
6545
|
+
{ title: "All Alternates", value: "'aalt' 1" },
|
|
6546
|
+
{ title: "All Caps", value: "'c2sc' 1" },
|
|
6547
|
+
{ title: "Alternate Annotation", value: "'nalt' 1" },
|
|
6548
|
+
{ title: "Alternative Fractions", value: "'afrc' 1" },
|
|
6549
|
+
{ title: "Capitals To Small Caps", value: "'c2sc' 1, 'smcp' 1" },
|
|
6550
|
+
{ title: "Capitals to Petite Caps", value: "'c2pc' 1" },
|
|
6551
|
+
{ title: "Case Sensitive Forms", value: "'case' 1" },
|
|
6552
|
+
{ title: "Contextual Alternates", value: "'calt' 1" },
|
|
6553
|
+
{ title: "Contextual Ligatures", value: "'clig' 1" },
|
|
6554
|
+
{ title: "Contextual Swash", value: "'cswh' 1" },
|
|
6555
|
+
{ title: "Denominator", value: "'dnom' 1" },
|
|
6556
|
+
{ title: "Discretionary Ligatures", value: "'dlig' 1" },
|
|
6557
|
+
{ title: "Fractions", value: "'frac' 1" },
|
|
6558
|
+
{ title: "Glyph Decomposition", value: "'ccmp' 1" },
|
|
6559
|
+
{ title: "Historical Forms", value: "'hist' 1" },
|
|
6560
|
+
{ title: "Historical Ligatures", value: "'hlig' 1" },
|
|
6561
|
+
{ title: "Initial Form", value: "'init' 1" },
|
|
6562
|
+
{ title: "Isolated Form", value: "'isol' 1" },
|
|
6563
|
+
{ title: "Justified Alternates", value: "'jalt' 1" },
|
|
6564
|
+
{ title: "Localized Forms", value: "'locl' 1" },
|
|
6565
|
+
{ title: "Mark Positioning", value: "'mark' 1" },
|
|
6566
|
+
{ title: "Mark Positioning via Subs", value: "'mset' 1" },
|
|
6567
|
+
{ title: "Mark to Mark Positioning", value: "'mkmk' 1" },
|
|
6568
|
+
{ title: "Mathematical Greek", value: "'mgrk' 1" },
|
|
6569
|
+
{ title: "Medial Form", value: "'medi' 1" },
|
|
6570
|
+
{ title: "Numerator", value: "'numr' 1" },
|
|
6571
|
+
{ title: "Ordinals", value: "'ordn' 1" },
|
|
6572
|
+
{ title: "Ornaments", value: "'ornm' 1" },
|
|
6573
|
+
{ title: "Petite Caps", value: "'pcap' 1" },
|
|
6574
|
+
{ title: "Proportional Lining", value: "'pnum' 1" },
|
|
6575
|
+
{ title: "Proportional Oldstyle", value: "'onum' 1" },
|
|
6576
|
+
{ title: "Required Ligatures", value: "'rlig' 1" },
|
|
6577
|
+
{ title: "Scientific Inferiors", value: "'sinf' 1" },
|
|
6578
|
+
{ title: "Slashed Zero", value: "'zero' 1" },
|
|
6579
|
+
{ title: "Small Caps", value: "'smcp' 1" },
|
|
6580
|
+
{ title: "Standard Ligatures", value: "'liga' 1" },
|
|
6581
|
+
{ title: "Stylistic Alternates", value: "'salt' 1" },
|
|
6582
|
+
{ title: "Subscript", value: "'subs' 1" },
|
|
6583
|
+
{ title: "Superscript", value: "'sups' 1" },
|
|
6584
|
+
{ title: "Swash", value: "'swsh' 1" },
|
|
6585
|
+
{ title: "Tabular Lining", value: "'tnum' 1" },
|
|
6586
|
+
{ title: "Tabular Oldstyle", value: "'onum' 1" },
|
|
6587
|
+
{ title: "Terminal Form", value: "'fina' 1" },
|
|
6588
|
+
{ title: "Titling Alternates", value: "'titl' 1" },
|
|
6589
|
+
{ title: "Unicase", value: "'unic' 1" },
|
|
6590
|
+
{ title: "All Stylistic Sets", value: "'ss01' 1, 'ss02' 1, 'ss03' 1, 'ss04' 1, 'ss05' 1, 'ss06' 1, 'ss07' 1, 'ss08' 1, 'ss09' 1, 'ss10' 1, 'ss11' 1, 'ss12' 1, 'ss13' 1, 'ss14' 1, 'ss15' 1, 'ss16' 1, 'ss17' 1, 'ss18' 1, 'ss19' 1, 'ss20' 1" },
|
|
6591
|
+
{ title: "Stylistic Set 1", value: "'ss01' 1" },
|
|
6592
|
+
{ title: "Stylistic Set 2", value: "'ss02' 1" },
|
|
6593
|
+
{ title: "Stylistic Set 3", value: "'ss03' 1" },
|
|
6594
|
+
{ title: "Stylistic Set 4", value: "'ss04' 1" },
|
|
6595
|
+
{ title: "Stylistic Set 5", value: "'ss05' 1" },
|
|
6596
|
+
{ title: "Stylistic Set 6", value: "'ss06' 1" },
|
|
6597
|
+
{ title: "Stylistic Set 7", value: "'ss07' 1" },
|
|
6598
|
+
{ title: "Stylistic Set 8", value: "'ss08' 1" },
|
|
6599
|
+
{ title: "Stylistic Set 9", value: "'ss09' 1" },
|
|
6600
|
+
{ title: "Stylistic Set 10", value: "'ss10' 1" },
|
|
6601
|
+
{ title: "Stylistic Set 11", value: "'ss11' 1" },
|
|
6602
|
+
{ title: "Stylistic Set 12", value: "'ss12' 1" },
|
|
6603
|
+
{ title: "Stylistic Set 13", value: "'ss13' 1" },
|
|
6604
|
+
{ title: "Stylistic Set 14", value: "'ss14' 1" },
|
|
6605
|
+
{ title: "Stylistic Set 15", value: "'ss15' 1" },
|
|
6606
|
+
{ title: "Stylistic Set 16", value: "'ss16' 1" },
|
|
6607
|
+
{ title: "Stylistic Set 17", value: "'ss17' 1" },
|
|
6608
|
+
{ title: "Stylistic Set 18", value: "'ss18' 1" },
|
|
6609
|
+
{ title: "Stylistic Set 19", value: "'ss19' 1" },
|
|
6610
|
+
{ title: "Stylistic Set 20", value: "'ss20' 1" }
|
|
6611
|
+
]
|
|
6612
|
+
}
|
|
6613
|
+
},
|
|
6614
|
+
{
|
|
6615
|
+
type: "string",
|
|
6616
|
+
title: "Specialty CSS Implementation (for multi OT feautes)",
|
|
6617
|
+
name: "specialtyCss",
|
|
6618
|
+
placeholder: "'c2sc' 1, 'ss02' 1"
|
|
6619
|
+
},
|
|
6620
|
+
{
|
|
6621
|
+
type: "boolean",
|
|
6622
|
+
title: "Disable Ligatures on default",
|
|
6623
|
+
name: "ligatures"
|
|
6624
|
+
},
|
|
6625
|
+
{
|
|
6626
|
+
type: "boolean",
|
|
6627
|
+
title: "Disable Contextual Alternates on default",
|
|
6628
|
+
name: "calt"
|
|
6629
|
+
},
|
|
6630
|
+
{
|
|
6631
|
+
type: "boolean",
|
|
6632
|
+
title: "Only Applies to Italics",
|
|
6633
|
+
name: "italics"
|
|
6634
|
+
}
|
|
6635
|
+
],
|
|
6636
|
+
preview: {
|
|
6637
|
+
select: {
|
|
6638
|
+
title: "title",
|
|
6639
|
+
subtitle: "content"
|
|
6640
|
+
},
|
|
6641
|
+
prepare(selection) {
|
|
6642
|
+
const { title, subtitle } = selection;
|
|
6643
|
+
return {
|
|
6644
|
+
subtitle,
|
|
6645
|
+
title
|
|
6646
|
+
};
|
|
6647
|
+
}
|
|
6648
|
+
}
|
|
6649
|
+
}
|
|
6650
|
+
]
|
|
6651
|
+
}
|
|
6652
|
+
]
|
|
6653
|
+
};
|
|
6654
|
+
|
|
6655
|
+
// src/schema/stylesField.js
|
|
6656
|
+
var import_sanity_advanced_reference_array = require("sanity-advanced-reference-array");
|
|
6657
|
+
var fontsFilter = async ({ getClient, document, parent }) => {
|
|
6658
|
+
const client = getClient({ apiVersion: "2022-11-09" });
|
|
6659
|
+
const typefaceName = document.title;
|
|
6660
|
+
const fonts = await client.fetch('*[_type == "font" && lower(typefaceName) == lower($typefaceName)]', { typefaceName });
|
|
6661
|
+
const relatedItemsFiltered = fonts.map((f) => f._id).filter(Boolean);
|
|
6662
|
+
const existingItems = parent.map((f) => f._ref).filter(Boolean);
|
|
6663
|
+
return {
|
|
6664
|
+
filter: "!(_id in $existingItems) && (_id in $relatedItemsFiltered)",
|
|
6665
|
+
params: { existingItems, relatedItemsFiltered }
|
|
6666
|
+
};
|
|
6667
|
+
};
|
|
6668
|
+
var variableFontsFilter = async ({ getClient, document, parent }) => {
|
|
6669
|
+
const client = getClient({ apiVersion: "2022-11-09" });
|
|
6670
|
+
const typefaceName = document.title;
|
|
6671
|
+
const existingItems = parent.map((f) => f._ref).filter(Boolean);
|
|
6672
|
+
const fonts = await client.fetch('*[_type == "font" && typefaceName == $typefaceName && variableFont == true]', { typefaceName });
|
|
6673
|
+
const relatedItemsFiltered = fonts.map((f) => f._id).filter(Boolean);
|
|
6674
|
+
return {
|
|
6675
|
+
filter: "!(_id in $existingItems) && (_id in $relatedItemsFiltered)",
|
|
6676
|
+
params: { existingItems, relatedItemsFiltered }
|
|
6677
|
+
};
|
|
6678
|
+
};
|
|
6679
|
+
function createStylesField({
|
|
6680
|
+
hasFreeFlag = false,
|
|
6681
|
+
displayStylesHidden = false,
|
|
6682
|
+
hasSortHeaviestFirst = false,
|
|
6683
|
+
hasBuySectionColumns = false,
|
|
6684
|
+
hasFontSizeMultiplier = false,
|
|
6685
|
+
hasSerifFlag = false,
|
|
6686
|
+
hasRegenerateSubfamilies = false,
|
|
6687
|
+
hasSubfamilyFontSizeMultiplier = false,
|
|
6688
|
+
hasSubfamilyUseListOrder = false,
|
|
6689
|
+
hasSubfamilyPreferredStyle = false,
|
|
6690
|
+
hasSubfamilyFontFilter = false,
|
|
6691
|
+
hasSubfamilyPreview = false,
|
|
6692
|
+
pairsHidden = false
|
|
6693
|
+
} = {}) {
|
|
6694
|
+
const subfamilyFields = [
|
|
6695
|
+
{
|
|
6696
|
+
title: "Title",
|
|
6697
|
+
name: "title",
|
|
6698
|
+
type: "string"
|
|
6699
|
+
},
|
|
6700
|
+
...hasSubfamilyFontSizeMultiplier ? [{
|
|
6701
|
+
title: "Subfamily Font Size Multiplier",
|
|
6702
|
+
name: "fontSizeMultiplier",
|
|
6703
|
+
type: "number",
|
|
6704
|
+
initialValue: 1,
|
|
6705
|
+
description: "Adjust font size for this subfamily in the Family Overview (Design Space). Default is 1.0 (100%). Range: 0.5 to 2.0",
|
|
6706
|
+
validation: (Rule) => Rule.min(0.5).max(2).precision(2)
|
|
6707
|
+
}] : [],
|
|
6708
|
+
...hasSubfamilyUseListOrder ? [{
|
|
6709
|
+
title: "Use List Order",
|
|
6710
|
+
name: "useListOrder",
|
|
6711
|
+
type: "boolean",
|
|
6712
|
+
initialValue: false,
|
|
6713
|
+
description: "Display fonts in the manual order listed below, bypassing programmatic weight-based sorting in the Family Overview."
|
|
6714
|
+
}] : [],
|
|
6715
|
+
{
|
|
6716
|
+
title: "Fonts",
|
|
6717
|
+
name: "fonts",
|
|
6718
|
+
type: "array",
|
|
6719
|
+
components: { input: import_sanity_advanced_reference_array.AdvancedRefArray },
|
|
6720
|
+
of: [{ type: "reference", weak: true, to: [{ type: "font" }] }],
|
|
6721
|
+
options: {
|
|
6722
|
+
sortable: true,
|
|
6723
|
+
...hasSubfamilyFontFilter ? { filter: fontsFilter } : {}
|
|
6724
|
+
}
|
|
6725
|
+
},
|
|
6726
|
+
...hasSubfamilyPreferredStyle ? [{
|
|
6727
|
+
title: "SubFamily Preferred Style",
|
|
6728
|
+
name: "preferredStyle",
|
|
6729
|
+
type: "reference",
|
|
6730
|
+
weak: true,
|
|
6731
|
+
to: [{ type: "font" }],
|
|
6732
|
+
options: {
|
|
6733
|
+
filter: async ({ getClient, document, parent }) => {
|
|
6734
|
+
const client = getClient({ apiVersion: "2022-11-09" });
|
|
6735
|
+
const typefaceName = document.title;
|
|
6736
|
+
const fonts = await client.fetch('*[_type == "font" && typefaceName == $typefaceName && variableFont == false]', { typefaceName });
|
|
6737
|
+
const relatedItemsFiltered = fonts.map((f) => f._id).filter(Boolean);
|
|
6738
|
+
const existingItems = parent.fonts.map((f) => f._ref).filter(Boolean);
|
|
6739
|
+
return {
|
|
6740
|
+
filter: "(_id in $existingItems) && (_id in $relatedItemsFiltered)",
|
|
6741
|
+
params: { existingItems, relatedItemsFiltered }
|
|
6742
|
+
};
|
|
6743
|
+
}
|
|
6744
|
+
}
|
|
6745
|
+
}] : []
|
|
6746
|
+
];
|
|
6747
|
+
const subfamilyItem = {
|
|
6748
|
+
type: "object",
|
|
6749
|
+
fields: subfamilyFields,
|
|
6750
|
+
...hasSubfamilyPreview ? {
|
|
6751
|
+
preview: {
|
|
6752
|
+
select: { title: "title", fonts: "fonts" },
|
|
6753
|
+
prepare(props) {
|
|
6754
|
+
const numFonts = Object.keys(props.fonts || {}).length;
|
|
6755
|
+
return { title: props.title, subtitle: `${numFonts} fonts` };
|
|
6756
|
+
}
|
|
6757
|
+
}
|
|
6758
|
+
} : {}
|
|
6759
|
+
};
|
|
6760
|
+
const fields = [
|
|
6761
|
+
...hasFreeFlag ? [{
|
|
6762
|
+
title: "Free Typeface",
|
|
6763
|
+
name: "free",
|
|
6764
|
+
type: "boolean",
|
|
6765
|
+
description: 'This typeface is free to download and use. This will alter the "Buy" button and checkout experience.',
|
|
6766
|
+
initialValue: false
|
|
6767
|
+
}] : [],
|
|
6768
|
+
{
|
|
6769
|
+
title: "Display All Styles",
|
|
6770
|
+
name: "displayStyles",
|
|
6771
|
+
type: "boolean",
|
|
6772
|
+
initialValue: true,
|
|
6773
|
+
hidden: displayStylesHidden,
|
|
6774
|
+
description: "Show all Font Styles below collections in Buy Section"
|
|
6775
|
+
},
|
|
6776
|
+
...hasSortHeaviestFirst ? [{
|
|
6777
|
+
title: "Sort Fonts Heaviest to Lightest",
|
|
6778
|
+
name: "sortHeaviestFirst",
|
|
6779
|
+
type: "boolean",
|
|
6780
|
+
initialValue: false,
|
|
6781
|
+
description: "Sort fonts by weight from heaviest (900) to lightest (100). Default is lightest to heaviest (industry standard)."
|
|
6782
|
+
}] : [],
|
|
6783
|
+
...hasBuySectionColumns ? [{
|
|
6784
|
+
title: "Multi Column Buy Section",
|
|
6785
|
+
name: "buySectionColumns",
|
|
6786
|
+
type: "boolean",
|
|
6787
|
+
initialValue: true,
|
|
6788
|
+
description: "Choose Single Column or Multi Column for the Buy Section, Default is Multi Column"
|
|
6789
|
+
}] : [],
|
|
6790
|
+
...hasFontSizeMultiplier ? [{
|
|
6791
|
+
title: "Style Grid Font Size Multiplier",
|
|
6792
|
+
name: "fontSizeMultiplier",
|
|
6793
|
+
type: "number",
|
|
6794
|
+
initialValue: 1,
|
|
6795
|
+
description: "Adjust font size in the buy section style grid. Default is 1.0 (100%). Range: 0.5 to 2.0",
|
|
6796
|
+
validation: (Rule) => Rule.min(0.5).max(2).precision(2)
|
|
6797
|
+
}] : [],
|
|
6798
|
+
...hasSerifFlag ? [{
|
|
6799
|
+
title: "Includes Serifs",
|
|
6800
|
+
name: "serif",
|
|
6801
|
+
type: "boolean",
|
|
6802
|
+
initialValue: false,
|
|
6803
|
+
description: "Check if this typeface includes serif letterforms. Used for typeface overview serif/sans filters. Frontend automatically treats non-serif typefaces as sans serif."
|
|
6804
|
+
}] : [],
|
|
6805
|
+
{
|
|
6806
|
+
title: "Fonts",
|
|
6807
|
+
name: "fonts",
|
|
6808
|
+
type: "array",
|
|
6809
|
+
components: { input: import_sanity_advanced_reference_array.AdvancedRefArray },
|
|
6810
|
+
of: [{
|
|
6811
|
+
type: "reference",
|
|
6812
|
+
weak: true,
|
|
6813
|
+
to: [{ type: "font" }],
|
|
6814
|
+
options: { filter: fontsFilter }
|
|
6815
|
+
}],
|
|
6816
|
+
options: { sortable: true }
|
|
6817
|
+
},
|
|
6818
|
+
{
|
|
6819
|
+
title: "Variable Fonts",
|
|
6820
|
+
name: "variableFont",
|
|
6821
|
+
type: "array",
|
|
6822
|
+
components: { input: import_sanity_advanced_reference_array.AdvancedRefArray },
|
|
6823
|
+
of: [{
|
|
6824
|
+
type: "reference",
|
|
6825
|
+
weak: true,
|
|
6826
|
+
to: [{ type: "font" }],
|
|
6827
|
+
options: { filter: variableFontsFilter }
|
|
6828
|
+
}],
|
|
6829
|
+
description: "Variable fonts are automatically included as a bonus when customers purchase all non-variable styles of this typeface.",
|
|
6830
|
+
options: { sortable: true }
|
|
6831
|
+
},
|
|
6832
|
+
...hasRegenerateSubfamilies ? [{
|
|
6833
|
+
title: "Regenerate Subfamilies",
|
|
6834
|
+
name: "regenerateSubfamilies",
|
|
6835
|
+
type: "string",
|
|
6836
|
+
hidden: ({ parent }) => {
|
|
6837
|
+
var _a, _b, _c, _d;
|
|
6838
|
+
return ((_b = (_a = parent == null ? void 0 : parent.styles) == null ? void 0 : _a.subfamilies) == null ? void 0 : _b.length) === 0 || ((_d = (_c = parent == null ? void 0 : parent.styles) == null ? void 0 : _c.fonts) == null ? void 0 : _d.length) === 0;
|
|
6839
|
+
},
|
|
6840
|
+
description: "Regenerates subfamily groups based on the fonts in this typeface.",
|
|
6841
|
+
components: { input: RegenerateSubfamiliesComponent }
|
|
6842
|
+
}] : [],
|
|
6843
|
+
{
|
|
6844
|
+
title: "Sub Families",
|
|
6845
|
+
name: "subfamilies",
|
|
6846
|
+
type: "array",
|
|
6847
|
+
of: [subfamilyItem]
|
|
6848
|
+
},
|
|
6849
|
+
{
|
|
6850
|
+
title: "Collections",
|
|
6851
|
+
name: "collections",
|
|
6852
|
+
type: "array",
|
|
6853
|
+
components: { input: import_sanity_advanced_reference_array.AdvancedRefArray },
|
|
6854
|
+
of: [{ type: "reference", weak: true, to: [{ type: "collection" }] }],
|
|
6855
|
+
options: { sortable: true },
|
|
6856
|
+
validation: (Rule) => Rule.unique()
|
|
6857
|
+
},
|
|
6858
|
+
{
|
|
6859
|
+
title: "Pairs",
|
|
6860
|
+
name: "pairs",
|
|
6861
|
+
type: "array",
|
|
6862
|
+
components: { input: import_sanity_advanced_reference_array.AdvancedRefArray },
|
|
6863
|
+
of: [{ type: "reference", weak: true, to: [{ type: "pair" }] }],
|
|
6864
|
+
options: { sortable: true },
|
|
6865
|
+
validation: (Rule) => Rule.unique(),
|
|
6866
|
+
hidden: pairsHidden
|
|
6867
|
+
}
|
|
6868
|
+
];
|
|
6869
|
+
return {
|
|
6870
|
+
title: "Styles",
|
|
6871
|
+
name: "styles",
|
|
6872
|
+
type: "object",
|
|
6873
|
+
group: "styles",
|
|
6874
|
+
fields,
|
|
6875
|
+
options: { collapsible: true }
|
|
6876
|
+
};
|
|
6877
|
+
}
|
|
6352
6878
|
// Annotate the CommonJS export names for ESM import in node:
|
|
6353
6879
|
0 && (module.exports = {
|
|
6354
6880
|
BatchUploadFonts,
|
|
@@ -6372,6 +6898,7 @@ var styleCountField = {
|
|
|
6372
6898
|
VariableInstanceReferencesInput,
|
|
6373
6899
|
addItalicToFontTitle,
|
|
6374
6900
|
createFontObject,
|
|
6901
|
+
createStylesField,
|
|
6375
6902
|
determineWeight,
|
|
6376
6903
|
expandAbbreviations,
|
|
6377
6904
|
extractFontMetadata,
|
|
@@ -6397,6 +6924,7 @@ var styleCountField = {
|
|
|
6397
6924
|
sanitizeForSanityId,
|
|
6398
6925
|
sortFontObjects,
|
|
6399
6926
|
styleCountField,
|
|
6927
|
+
stylisticSetField,
|
|
6400
6928
|
updateFontPrices,
|
|
6401
6929
|
updateTypefaceDocument,
|
|
6402
6930
|
uploadFontFiles,
|