@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/dist/index.mjs
CHANGED
|
@@ -6265,6 +6265,530 @@ var styleCountField = {
|
|
|
6265
6265
|
},
|
|
6266
6266
|
readOnly: true
|
|
6267
6267
|
};
|
|
6268
|
+
|
|
6269
|
+
// src/schema/stylisticSetField.js
|
|
6270
|
+
import { StringIcon } from "@sanity/icons";
|
|
6271
|
+
var stylisticSetField = {
|
|
6272
|
+
title: "Stylistic Features Section",
|
|
6273
|
+
name: "stylisticSet",
|
|
6274
|
+
group: "stylisticSets",
|
|
6275
|
+
type: "object",
|
|
6276
|
+
fields: [
|
|
6277
|
+
{
|
|
6278
|
+
name: "featured",
|
|
6279
|
+
title: "Featured Stylistic Feature Words & Phrases",
|
|
6280
|
+
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.',
|
|
6281
|
+
type: "array",
|
|
6282
|
+
of: [
|
|
6283
|
+
{
|
|
6284
|
+
name: "featuredWord",
|
|
6285
|
+
title: "Words or Phrase",
|
|
6286
|
+
type: "object",
|
|
6287
|
+
icon: StringIcon,
|
|
6288
|
+
fields: [
|
|
6289
|
+
{
|
|
6290
|
+
type: "text",
|
|
6291
|
+
title: "Content",
|
|
6292
|
+
name: "content"
|
|
6293
|
+
},
|
|
6294
|
+
{
|
|
6295
|
+
type: "string",
|
|
6296
|
+
title: "Label",
|
|
6297
|
+
name: "label"
|
|
6298
|
+
},
|
|
6299
|
+
{
|
|
6300
|
+
title: "Stylistic Feature",
|
|
6301
|
+
name: "stylisticFeature",
|
|
6302
|
+
type: "string",
|
|
6303
|
+
// description: '[This will be autopopulated with the list of stylistic features when ready.]',
|
|
6304
|
+
options: {
|
|
6305
|
+
list: [
|
|
6306
|
+
{ title: "All Alternates", value: "'aalt' 1" },
|
|
6307
|
+
{ title: "All Caps", value: "'c2sc' 1" },
|
|
6308
|
+
{ title: "Alternate Annotation", value: "'nalt' 1" },
|
|
6309
|
+
{ title: "Alternative Fractions", value: "'afrc' 1" },
|
|
6310
|
+
{ title: "Capitals To Small Caps", value: "'c2sc' 1, 'smcp' 1" },
|
|
6311
|
+
{ title: "Capitals to Petite Caps", value: "'c2pc' 1" },
|
|
6312
|
+
{ title: "Case Sensitive Forms", value: "'case' 1" },
|
|
6313
|
+
{ title: "Contextual Alternates", value: "'calt' 1" },
|
|
6314
|
+
{ title: "Contextual Ligatures", value: "'clig' 1" },
|
|
6315
|
+
{ title: "Contextual Swash", value: "'cswh' 1" },
|
|
6316
|
+
{ title: "Denominator", value: "'dnom' 1" },
|
|
6317
|
+
{ title: "Discretionary Ligatures", value: "'dlig' 1" },
|
|
6318
|
+
{ title: "Fractions", value: "'frac' 1" },
|
|
6319
|
+
{ title: "Glyph Decomposition", value: "'ccmp' 1" },
|
|
6320
|
+
{ title: "Historical Forms", value: "'hist' 1" },
|
|
6321
|
+
{ title: "Historical Ligatures", value: "'hlig' 1" },
|
|
6322
|
+
{ title: "Initial Form", value: "'init' 1" },
|
|
6323
|
+
{ title: "Isolated Form", value: "'isol' 1" },
|
|
6324
|
+
{ title: "Justified Alternates", value: "'jalt' 1" },
|
|
6325
|
+
{ title: "Localized Forms", value: "'locl' 1" },
|
|
6326
|
+
{ title: "Mark Positioning", value: "'mark' 1" },
|
|
6327
|
+
{ title: "Mark Positioning via Subs", value: "'mset' 1" },
|
|
6328
|
+
{ title: "Mark to Mark Positioning", value: "'mkmk' 1" },
|
|
6329
|
+
{ title: "Mathematical Greek", value: "'mgrk' 1" },
|
|
6330
|
+
{ title: "Medial Form", value: "'medi' 1" },
|
|
6331
|
+
{ title: "Numerator", value: "'numr' 1" },
|
|
6332
|
+
{ title: "Ordinals", value: "'ordn' 1" },
|
|
6333
|
+
{ title: "Ornaments", value: "'ornm' 1" },
|
|
6334
|
+
{ title: "Petite Caps", value: "'pcap' 1" },
|
|
6335
|
+
{ title: "Proportional Lining", value: "'pnum' 1" },
|
|
6336
|
+
{ title: "Proportional Oldstyle", value: "'onum' 1" },
|
|
6337
|
+
{ title: "Required Ligatures", value: "'rlig' 1" },
|
|
6338
|
+
{ title: "Scientific Inferiors", value: "'sinf' 1" },
|
|
6339
|
+
{ title: "Slashed Zero", value: "'zero' 1" },
|
|
6340
|
+
{ title: "Small Caps", value: "'smcp' 1" },
|
|
6341
|
+
{ title: "Standard Ligatures", value: "'liga' 1" },
|
|
6342
|
+
{ title: "Stylistic Alternates", value: "'salt' 1" },
|
|
6343
|
+
{ title: "Subscript", value: "'subs' 1" },
|
|
6344
|
+
{ title: "Superscript", value: "'sups' 1" },
|
|
6345
|
+
{ title: "Swash", value: "'swsh' 1" },
|
|
6346
|
+
{ title: "Tabular Lining", value: "'tnum' 1" },
|
|
6347
|
+
{ title: "Tabular Oldstyle", value: "'onum' 1" },
|
|
6348
|
+
{ title: "Terminal Form", value: "'fina' 1" },
|
|
6349
|
+
{ title: "Titling Alternates", value: "'titl' 1" },
|
|
6350
|
+
{ title: "Unicase", value: "'unic' 1" },
|
|
6351
|
+
{ 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" },
|
|
6352
|
+
{ title: "Stylistic Set 1", value: "'ss01' 1" },
|
|
6353
|
+
{ title: "Stylistic Set 2", value: "'ss02' 1" },
|
|
6354
|
+
{ title: "Stylistic Set 3", value: "'ss03' 1" },
|
|
6355
|
+
{ title: "Stylistic Set 4", value: "'ss04' 1" },
|
|
6356
|
+
{ title: "Stylistic Set 5", value: "'ss05' 1" },
|
|
6357
|
+
{ title: "Stylistic Set 6", value: "'ss06' 1" },
|
|
6358
|
+
{ title: "Stylistic Set 7", value: "'ss07' 1" },
|
|
6359
|
+
{ title: "Stylistic Set 8", value: "'ss08' 1" },
|
|
6360
|
+
{ title: "Stylistic Set 9", value: "'ss09' 1" },
|
|
6361
|
+
{ title: "Stylistic Set 10", value: "'ss10' 1" },
|
|
6362
|
+
{ title: "Stylistic Set 11", value: "'ss11' 1" },
|
|
6363
|
+
{ title: "Stylistic Set 12", value: "'ss12' 1" },
|
|
6364
|
+
{ title: "Stylistic Set 13", value: "'ss13' 1" },
|
|
6365
|
+
{ title: "Stylistic Set 14", value: "'ss14' 1" },
|
|
6366
|
+
{ title: "Stylistic Set 15", value: "'ss15' 1" },
|
|
6367
|
+
{ title: "Stylistic Set 16", value: "'ss16' 1" },
|
|
6368
|
+
{ title: "Stylistic Set 17", value: "'ss17' 1" },
|
|
6369
|
+
{ title: "Stylistic Set 18", value: "'ss18' 1" },
|
|
6370
|
+
{ title: "Stylistic Set 19", value: "'ss19' 1" },
|
|
6371
|
+
{ title: "Stylistic Set 20", value: "'ss20' 1" }
|
|
6372
|
+
]
|
|
6373
|
+
}
|
|
6374
|
+
},
|
|
6375
|
+
{
|
|
6376
|
+
type: "string",
|
|
6377
|
+
title: "Specialty CSS Implementation (for multi OT feautes)",
|
|
6378
|
+
name: "specialtyCss",
|
|
6379
|
+
placeholder: "'c2sc' 1, 'ss02' 1"
|
|
6380
|
+
},
|
|
6381
|
+
{
|
|
6382
|
+
type: "boolean",
|
|
6383
|
+
title: "Disable Ligatures on default",
|
|
6384
|
+
name: "ligatures"
|
|
6385
|
+
},
|
|
6386
|
+
{
|
|
6387
|
+
type: "boolean",
|
|
6388
|
+
title: "Disable Contextual Alternates on default",
|
|
6389
|
+
name: "calt"
|
|
6390
|
+
},
|
|
6391
|
+
{
|
|
6392
|
+
type: "boolean",
|
|
6393
|
+
title: "Only Applies to Italics",
|
|
6394
|
+
name: "italics"
|
|
6395
|
+
},
|
|
6396
|
+
{
|
|
6397
|
+
title: "Font Size",
|
|
6398
|
+
name: "size",
|
|
6399
|
+
type: "string",
|
|
6400
|
+
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.',
|
|
6401
|
+
options: {
|
|
6402
|
+
list: [
|
|
6403
|
+
{ title: "XLarge", value: "xl", description: "Recommended for single glyphs." },
|
|
6404
|
+
{ title: "Large", value: "lg", description: "Recommended for 2\u20135 glyphs on one line, or 2 short lines of text." },
|
|
6405
|
+
{ title: "Medium", value: "md", description: "Recommended for 2\u20133 lines of text." },
|
|
6406
|
+
{ title: "Small", value: "sm", description: "Recommended for 3\u20134 lines of text." }
|
|
6407
|
+
],
|
|
6408
|
+
layout: "radio"
|
|
6409
|
+
// direction: "horizontal"
|
|
6410
|
+
}
|
|
6411
|
+
}
|
|
6412
|
+
],
|
|
6413
|
+
preview: {
|
|
6414
|
+
select: {
|
|
6415
|
+
title: "content",
|
|
6416
|
+
subtitle: "label"
|
|
6417
|
+
},
|
|
6418
|
+
prepare(selection) {
|
|
6419
|
+
const { title, subtitle } = selection;
|
|
6420
|
+
return {
|
|
6421
|
+
title,
|
|
6422
|
+
subtitle
|
|
6423
|
+
};
|
|
6424
|
+
}
|
|
6425
|
+
}
|
|
6426
|
+
}
|
|
6427
|
+
]
|
|
6428
|
+
},
|
|
6429
|
+
{
|
|
6430
|
+
name: "sets",
|
|
6431
|
+
title: "Full list of stylistic features & their corresponding glyphs",
|
|
6432
|
+
type: "array",
|
|
6433
|
+
of: [
|
|
6434
|
+
{
|
|
6435
|
+
name: "set",
|
|
6436
|
+
type: "object",
|
|
6437
|
+
title: "Stylistic Feature",
|
|
6438
|
+
icon: StringIcon,
|
|
6439
|
+
fields: [
|
|
6440
|
+
{
|
|
6441
|
+
name: "title",
|
|
6442
|
+
title: "Label for Stylistic Feature",
|
|
6443
|
+
description: 'e.g. "ss01", "Lining Numerals',
|
|
6444
|
+
type: "string"
|
|
6445
|
+
},
|
|
6446
|
+
{
|
|
6447
|
+
name: "content",
|
|
6448
|
+
title: "Corresponding glyphs",
|
|
6449
|
+
type: "text",
|
|
6450
|
+
description: "For stylistic features that apply to multiple of the same base character, recommended to create a new line for each base character."
|
|
6451
|
+
},
|
|
6452
|
+
{
|
|
6453
|
+
title: "Stylistic Feature",
|
|
6454
|
+
name: "stylisticFeature",
|
|
6455
|
+
type: "string",
|
|
6456
|
+
// description: '[This will be autopopulated with the list of stylistic features when ready.]',
|
|
6457
|
+
options: {
|
|
6458
|
+
list: [
|
|
6459
|
+
{ title: "All Alternates", value: "'aalt' 1" },
|
|
6460
|
+
{ title: "All Caps", value: "'c2sc' 1" },
|
|
6461
|
+
{ title: "Alternate Annotation", value: "'nalt' 1" },
|
|
6462
|
+
{ title: "Alternative Fractions", value: "'afrc' 1" },
|
|
6463
|
+
{ title: "Capitals To Small Caps", value: "'c2sc' 1, 'smcp' 1" },
|
|
6464
|
+
{ title: "Capitals to Petite Caps", value: "'c2pc' 1" },
|
|
6465
|
+
{ title: "Case Sensitive Forms", value: "'case' 1" },
|
|
6466
|
+
{ title: "Contextual Alternates", value: "'calt' 1" },
|
|
6467
|
+
{ title: "Contextual Ligatures", value: "'clig' 1" },
|
|
6468
|
+
{ title: "Contextual Swash", value: "'cswh' 1" },
|
|
6469
|
+
{ title: "Denominator", value: "'dnom' 1" },
|
|
6470
|
+
{ title: "Discretionary Ligatures", value: "'dlig' 1" },
|
|
6471
|
+
{ title: "Fractions", value: "'frac' 1" },
|
|
6472
|
+
{ title: "Glyph Decomposition", value: "'ccmp' 1" },
|
|
6473
|
+
{ title: "Historical Forms", value: "'hist' 1" },
|
|
6474
|
+
{ title: "Historical Ligatures", value: "'hlig' 1" },
|
|
6475
|
+
{ title: "Initial Form", value: "'init' 1" },
|
|
6476
|
+
{ title: "Isolated Form", value: "'isol' 1" },
|
|
6477
|
+
{ title: "Justified Alternates", value: "'jalt' 1" },
|
|
6478
|
+
{ title: "Localized Forms", value: "'locl' 1" },
|
|
6479
|
+
{ title: "Mark Positioning", value: "'mark' 1" },
|
|
6480
|
+
{ title: "Mark Positioning via Subs", value: "'mset' 1" },
|
|
6481
|
+
{ title: "Mark to Mark Positioning", value: "'mkmk' 1" },
|
|
6482
|
+
{ title: "Mathematical Greek", value: "'mgrk' 1" },
|
|
6483
|
+
{ title: "Medial Form", value: "'medi' 1" },
|
|
6484
|
+
{ title: "Numerator", value: "'numr' 1" },
|
|
6485
|
+
{ title: "Ordinals", value: "'ordn' 1" },
|
|
6486
|
+
{ title: "Ornaments", value: "'ornm' 1" },
|
|
6487
|
+
{ title: "Petite Caps", value: "'pcap' 1" },
|
|
6488
|
+
{ title: "Proportional Lining", value: "'pnum' 1" },
|
|
6489
|
+
{ title: "Proportional Oldstyle", value: "'onum' 1" },
|
|
6490
|
+
{ title: "Required Ligatures", value: "'rlig' 1" },
|
|
6491
|
+
{ title: "Scientific Inferiors", value: "'sinf' 1" },
|
|
6492
|
+
{ title: "Slashed Zero", value: "'zero' 1" },
|
|
6493
|
+
{ title: "Small Caps", value: "'smcp' 1" },
|
|
6494
|
+
{ title: "Standard Ligatures", value: "'liga' 1" },
|
|
6495
|
+
{ title: "Stylistic Alternates", value: "'salt' 1" },
|
|
6496
|
+
{ title: "Subscript", value: "'subs' 1" },
|
|
6497
|
+
{ title: "Superscript", value: "'sups' 1" },
|
|
6498
|
+
{ title: "Swash", value: "'swsh' 1" },
|
|
6499
|
+
{ title: "Tabular Lining", value: "'tnum' 1" },
|
|
6500
|
+
{ title: "Tabular Oldstyle", value: "'onum' 1" },
|
|
6501
|
+
{ title: "Terminal Form", value: "'fina' 1" },
|
|
6502
|
+
{ title: "Titling Alternates", value: "'titl' 1" },
|
|
6503
|
+
{ title: "Unicase", value: "'unic' 1" },
|
|
6504
|
+
{ 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" },
|
|
6505
|
+
{ title: "Stylistic Set 1", value: "'ss01' 1" },
|
|
6506
|
+
{ title: "Stylistic Set 2", value: "'ss02' 1" },
|
|
6507
|
+
{ title: "Stylistic Set 3", value: "'ss03' 1" },
|
|
6508
|
+
{ title: "Stylistic Set 4", value: "'ss04' 1" },
|
|
6509
|
+
{ title: "Stylistic Set 5", value: "'ss05' 1" },
|
|
6510
|
+
{ title: "Stylistic Set 6", value: "'ss06' 1" },
|
|
6511
|
+
{ title: "Stylistic Set 7", value: "'ss07' 1" },
|
|
6512
|
+
{ title: "Stylistic Set 8", value: "'ss08' 1" },
|
|
6513
|
+
{ title: "Stylistic Set 9", value: "'ss09' 1" },
|
|
6514
|
+
{ title: "Stylistic Set 10", value: "'ss10' 1" },
|
|
6515
|
+
{ title: "Stylistic Set 11", value: "'ss11' 1" },
|
|
6516
|
+
{ title: "Stylistic Set 12", value: "'ss12' 1" },
|
|
6517
|
+
{ title: "Stylistic Set 13", value: "'ss13' 1" },
|
|
6518
|
+
{ title: "Stylistic Set 14", value: "'ss14' 1" },
|
|
6519
|
+
{ title: "Stylistic Set 15", value: "'ss15' 1" },
|
|
6520
|
+
{ title: "Stylistic Set 16", value: "'ss16' 1" },
|
|
6521
|
+
{ title: "Stylistic Set 17", value: "'ss17' 1" },
|
|
6522
|
+
{ title: "Stylistic Set 18", value: "'ss18' 1" },
|
|
6523
|
+
{ title: "Stylistic Set 19", value: "'ss19' 1" },
|
|
6524
|
+
{ title: "Stylistic Set 20", value: "'ss20' 1" }
|
|
6525
|
+
]
|
|
6526
|
+
}
|
|
6527
|
+
},
|
|
6528
|
+
{
|
|
6529
|
+
type: "string",
|
|
6530
|
+
title: "Specialty CSS Implementation (for multi OT feautes)",
|
|
6531
|
+
name: "specialtyCss",
|
|
6532
|
+
placeholder: "'c2sc' 1, 'ss02' 1"
|
|
6533
|
+
},
|
|
6534
|
+
{
|
|
6535
|
+
type: "boolean",
|
|
6536
|
+
title: "Disable Ligatures on default",
|
|
6537
|
+
name: "ligatures"
|
|
6538
|
+
},
|
|
6539
|
+
{
|
|
6540
|
+
type: "boolean",
|
|
6541
|
+
title: "Disable Contextual Alternates on default",
|
|
6542
|
+
name: "calt"
|
|
6543
|
+
},
|
|
6544
|
+
{
|
|
6545
|
+
type: "boolean",
|
|
6546
|
+
title: "Only Applies to Italics",
|
|
6547
|
+
name: "italics"
|
|
6548
|
+
}
|
|
6549
|
+
],
|
|
6550
|
+
preview: {
|
|
6551
|
+
select: {
|
|
6552
|
+
title: "title",
|
|
6553
|
+
subtitle: "content"
|
|
6554
|
+
},
|
|
6555
|
+
prepare(selection) {
|
|
6556
|
+
const { title, subtitle } = selection;
|
|
6557
|
+
return {
|
|
6558
|
+
subtitle,
|
|
6559
|
+
title
|
|
6560
|
+
};
|
|
6561
|
+
}
|
|
6562
|
+
}
|
|
6563
|
+
}
|
|
6564
|
+
]
|
|
6565
|
+
}
|
|
6566
|
+
]
|
|
6567
|
+
};
|
|
6568
|
+
|
|
6569
|
+
// src/schema/stylesField.js
|
|
6570
|
+
import { AdvancedRefArray } from "sanity-advanced-reference-array";
|
|
6571
|
+
var fontsFilter = async ({ getClient, document, parent }) => {
|
|
6572
|
+
const client = getClient({ apiVersion: "2022-11-09" });
|
|
6573
|
+
const typefaceName = document.title;
|
|
6574
|
+
const fonts = await client.fetch('*[_type == "font" && lower(typefaceName) == lower($typefaceName)]', { typefaceName });
|
|
6575
|
+
const relatedItemsFiltered = fonts.map((f) => f._id).filter(Boolean);
|
|
6576
|
+
const existingItems = parent.map((f) => f._ref).filter(Boolean);
|
|
6577
|
+
return {
|
|
6578
|
+
filter: "!(_id in $existingItems) && (_id in $relatedItemsFiltered)",
|
|
6579
|
+
params: { existingItems, relatedItemsFiltered }
|
|
6580
|
+
};
|
|
6581
|
+
};
|
|
6582
|
+
var variableFontsFilter = async ({ getClient, document, parent }) => {
|
|
6583
|
+
const client = getClient({ apiVersion: "2022-11-09" });
|
|
6584
|
+
const typefaceName = document.title;
|
|
6585
|
+
const existingItems = parent.map((f) => f._ref).filter(Boolean);
|
|
6586
|
+
const fonts = await client.fetch('*[_type == "font" && typefaceName == $typefaceName && variableFont == true]', { typefaceName });
|
|
6587
|
+
const relatedItemsFiltered = fonts.map((f) => f._id).filter(Boolean);
|
|
6588
|
+
return {
|
|
6589
|
+
filter: "!(_id in $existingItems) && (_id in $relatedItemsFiltered)",
|
|
6590
|
+
params: { existingItems, relatedItemsFiltered }
|
|
6591
|
+
};
|
|
6592
|
+
};
|
|
6593
|
+
function createStylesField({
|
|
6594
|
+
hasFreeFlag = false,
|
|
6595
|
+
displayStylesHidden = false,
|
|
6596
|
+
hasSortHeaviestFirst = false,
|
|
6597
|
+
hasBuySectionColumns = false,
|
|
6598
|
+
hasFontSizeMultiplier = false,
|
|
6599
|
+
hasSerifFlag = false,
|
|
6600
|
+
hasRegenerateSubfamilies = false,
|
|
6601
|
+
hasSubfamilyFontSizeMultiplier = false,
|
|
6602
|
+
hasSubfamilyUseListOrder = false,
|
|
6603
|
+
hasSubfamilyPreferredStyle = false,
|
|
6604
|
+
hasSubfamilyFontFilter = false,
|
|
6605
|
+
hasSubfamilyPreview = false,
|
|
6606
|
+
pairsHidden = false
|
|
6607
|
+
} = {}) {
|
|
6608
|
+
const subfamilyFields = [
|
|
6609
|
+
{
|
|
6610
|
+
title: "Title",
|
|
6611
|
+
name: "title",
|
|
6612
|
+
type: "string"
|
|
6613
|
+
},
|
|
6614
|
+
...hasSubfamilyFontSizeMultiplier ? [{
|
|
6615
|
+
title: "Subfamily Font Size Multiplier",
|
|
6616
|
+
name: "fontSizeMultiplier",
|
|
6617
|
+
type: "number",
|
|
6618
|
+
initialValue: 1,
|
|
6619
|
+
description: "Adjust font size for this subfamily in the Family Overview (Design Space). Default is 1.0 (100%). Range: 0.5 to 2.0",
|
|
6620
|
+
validation: (Rule) => Rule.min(0.5).max(2).precision(2)
|
|
6621
|
+
}] : [],
|
|
6622
|
+
...hasSubfamilyUseListOrder ? [{
|
|
6623
|
+
title: "Use List Order",
|
|
6624
|
+
name: "useListOrder",
|
|
6625
|
+
type: "boolean",
|
|
6626
|
+
initialValue: false,
|
|
6627
|
+
description: "Display fonts in the manual order listed below, bypassing programmatic weight-based sorting in the Family Overview."
|
|
6628
|
+
}] : [],
|
|
6629
|
+
{
|
|
6630
|
+
title: "Fonts",
|
|
6631
|
+
name: "fonts",
|
|
6632
|
+
type: "array",
|
|
6633
|
+
components: { input: AdvancedRefArray },
|
|
6634
|
+
of: [{ type: "reference", weak: true, to: [{ type: "font" }] }],
|
|
6635
|
+
options: {
|
|
6636
|
+
sortable: true,
|
|
6637
|
+
...hasSubfamilyFontFilter ? { filter: fontsFilter } : {}
|
|
6638
|
+
}
|
|
6639
|
+
},
|
|
6640
|
+
...hasSubfamilyPreferredStyle ? [{
|
|
6641
|
+
title: "SubFamily Preferred Style",
|
|
6642
|
+
name: "preferredStyle",
|
|
6643
|
+
type: "reference",
|
|
6644
|
+
weak: true,
|
|
6645
|
+
to: [{ type: "font" }],
|
|
6646
|
+
options: {
|
|
6647
|
+
filter: async ({ getClient, document, parent }) => {
|
|
6648
|
+
const client = getClient({ apiVersion: "2022-11-09" });
|
|
6649
|
+
const typefaceName = document.title;
|
|
6650
|
+
const fonts = await client.fetch('*[_type == "font" && typefaceName == $typefaceName && variableFont == false]', { typefaceName });
|
|
6651
|
+
const relatedItemsFiltered = fonts.map((f) => f._id).filter(Boolean);
|
|
6652
|
+
const existingItems = parent.fonts.map((f) => f._ref).filter(Boolean);
|
|
6653
|
+
return {
|
|
6654
|
+
filter: "(_id in $existingItems) && (_id in $relatedItemsFiltered)",
|
|
6655
|
+
params: { existingItems, relatedItemsFiltered }
|
|
6656
|
+
};
|
|
6657
|
+
}
|
|
6658
|
+
}
|
|
6659
|
+
}] : []
|
|
6660
|
+
];
|
|
6661
|
+
const subfamilyItem = {
|
|
6662
|
+
type: "object",
|
|
6663
|
+
fields: subfamilyFields,
|
|
6664
|
+
...hasSubfamilyPreview ? {
|
|
6665
|
+
preview: {
|
|
6666
|
+
select: { title: "title", fonts: "fonts" },
|
|
6667
|
+
prepare(props) {
|
|
6668
|
+
const numFonts = Object.keys(props.fonts || {}).length;
|
|
6669
|
+
return { title: props.title, subtitle: `${numFonts} fonts` };
|
|
6670
|
+
}
|
|
6671
|
+
}
|
|
6672
|
+
} : {}
|
|
6673
|
+
};
|
|
6674
|
+
const fields = [
|
|
6675
|
+
...hasFreeFlag ? [{
|
|
6676
|
+
title: "Free Typeface",
|
|
6677
|
+
name: "free",
|
|
6678
|
+
type: "boolean",
|
|
6679
|
+
description: 'This typeface is free to download and use. This will alter the "Buy" button and checkout experience.',
|
|
6680
|
+
initialValue: false
|
|
6681
|
+
}] : [],
|
|
6682
|
+
{
|
|
6683
|
+
title: "Display All Styles",
|
|
6684
|
+
name: "displayStyles",
|
|
6685
|
+
type: "boolean",
|
|
6686
|
+
initialValue: true,
|
|
6687
|
+
hidden: displayStylesHidden,
|
|
6688
|
+
description: "Show all Font Styles below collections in Buy Section"
|
|
6689
|
+
},
|
|
6690
|
+
...hasSortHeaviestFirst ? [{
|
|
6691
|
+
title: "Sort Fonts Heaviest to Lightest",
|
|
6692
|
+
name: "sortHeaviestFirst",
|
|
6693
|
+
type: "boolean",
|
|
6694
|
+
initialValue: false,
|
|
6695
|
+
description: "Sort fonts by weight from heaviest (900) to lightest (100). Default is lightest to heaviest (industry standard)."
|
|
6696
|
+
}] : [],
|
|
6697
|
+
...hasBuySectionColumns ? [{
|
|
6698
|
+
title: "Multi Column Buy Section",
|
|
6699
|
+
name: "buySectionColumns",
|
|
6700
|
+
type: "boolean",
|
|
6701
|
+
initialValue: true,
|
|
6702
|
+
description: "Choose Single Column or Multi Column for the Buy Section, Default is Multi Column"
|
|
6703
|
+
}] : [],
|
|
6704
|
+
...hasFontSizeMultiplier ? [{
|
|
6705
|
+
title: "Style Grid Font Size Multiplier",
|
|
6706
|
+
name: "fontSizeMultiplier",
|
|
6707
|
+
type: "number",
|
|
6708
|
+
initialValue: 1,
|
|
6709
|
+
description: "Adjust font size in the buy section style grid. Default is 1.0 (100%). Range: 0.5 to 2.0",
|
|
6710
|
+
validation: (Rule) => Rule.min(0.5).max(2).precision(2)
|
|
6711
|
+
}] : [],
|
|
6712
|
+
...hasSerifFlag ? [{
|
|
6713
|
+
title: "Includes Serifs",
|
|
6714
|
+
name: "serif",
|
|
6715
|
+
type: "boolean",
|
|
6716
|
+
initialValue: false,
|
|
6717
|
+
description: "Check if this typeface includes serif letterforms. Used for typeface overview serif/sans filters. Frontend automatically treats non-serif typefaces as sans serif."
|
|
6718
|
+
}] : [],
|
|
6719
|
+
{
|
|
6720
|
+
title: "Fonts",
|
|
6721
|
+
name: "fonts",
|
|
6722
|
+
type: "array",
|
|
6723
|
+
components: { input: AdvancedRefArray },
|
|
6724
|
+
of: [{
|
|
6725
|
+
type: "reference",
|
|
6726
|
+
weak: true,
|
|
6727
|
+
to: [{ type: "font" }],
|
|
6728
|
+
options: { filter: fontsFilter }
|
|
6729
|
+
}],
|
|
6730
|
+
options: { sortable: true }
|
|
6731
|
+
},
|
|
6732
|
+
{
|
|
6733
|
+
title: "Variable Fonts",
|
|
6734
|
+
name: "variableFont",
|
|
6735
|
+
type: "array",
|
|
6736
|
+
components: { input: AdvancedRefArray },
|
|
6737
|
+
of: [{
|
|
6738
|
+
type: "reference",
|
|
6739
|
+
weak: true,
|
|
6740
|
+
to: [{ type: "font" }],
|
|
6741
|
+
options: { filter: variableFontsFilter }
|
|
6742
|
+
}],
|
|
6743
|
+
description: "Variable fonts are automatically included as a bonus when customers purchase all non-variable styles of this typeface.",
|
|
6744
|
+
options: { sortable: true }
|
|
6745
|
+
},
|
|
6746
|
+
...hasRegenerateSubfamilies ? [{
|
|
6747
|
+
title: "Regenerate Subfamilies",
|
|
6748
|
+
name: "regenerateSubfamilies",
|
|
6749
|
+
type: "string",
|
|
6750
|
+
hidden: ({ parent }) => {
|
|
6751
|
+
var _a, _b, _c, _d;
|
|
6752
|
+
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;
|
|
6753
|
+
},
|
|
6754
|
+
description: "Regenerates subfamily groups based on the fonts in this typeface.",
|
|
6755
|
+
components: { input: RegenerateSubfamiliesComponent }
|
|
6756
|
+
}] : [],
|
|
6757
|
+
{
|
|
6758
|
+
title: "Sub Families",
|
|
6759
|
+
name: "subfamilies",
|
|
6760
|
+
type: "array",
|
|
6761
|
+
of: [subfamilyItem]
|
|
6762
|
+
},
|
|
6763
|
+
{
|
|
6764
|
+
title: "Collections",
|
|
6765
|
+
name: "collections",
|
|
6766
|
+
type: "array",
|
|
6767
|
+
components: { input: AdvancedRefArray },
|
|
6768
|
+
of: [{ type: "reference", weak: true, to: [{ type: "collection" }] }],
|
|
6769
|
+
options: { sortable: true },
|
|
6770
|
+
validation: (Rule) => Rule.unique()
|
|
6771
|
+
},
|
|
6772
|
+
{
|
|
6773
|
+
title: "Pairs",
|
|
6774
|
+
name: "pairs",
|
|
6775
|
+
type: "array",
|
|
6776
|
+
components: { input: AdvancedRefArray },
|
|
6777
|
+
of: [{ type: "reference", weak: true, to: [{ type: "pair" }] }],
|
|
6778
|
+
options: { sortable: true },
|
|
6779
|
+
validation: (Rule) => Rule.unique(),
|
|
6780
|
+
hidden: pairsHidden
|
|
6781
|
+
}
|
|
6782
|
+
];
|
|
6783
|
+
return {
|
|
6784
|
+
title: "Styles",
|
|
6785
|
+
name: "styles",
|
|
6786
|
+
type: "object",
|
|
6787
|
+
group: "styles",
|
|
6788
|
+
fields,
|
|
6789
|
+
options: { collapsible: true }
|
|
6790
|
+
};
|
|
6791
|
+
}
|
|
6268
6792
|
export {
|
|
6269
6793
|
BatchUploadFonts,
|
|
6270
6794
|
FontScriptUploaderComponent,
|
|
@@ -6287,6 +6811,7 @@ export {
|
|
|
6287
6811
|
VariableInstanceReferencesInput,
|
|
6288
6812
|
addItalicToFontTitle,
|
|
6289
6813
|
createFontObject,
|
|
6814
|
+
createStylesField,
|
|
6290
6815
|
determineWeight,
|
|
6291
6816
|
expandAbbreviations,
|
|
6292
6817
|
extractFontMetadata,
|
|
@@ -6312,6 +6837,7 @@ export {
|
|
|
6312
6837
|
sanitizeForSanityId,
|
|
6313
6838
|
sortFontObjects,
|
|
6314
6839
|
styleCountField,
|
|
6840
|
+
stylisticSetField,
|
|
6315
6841
|
updateFontPrices,
|
|
6316
6842
|
updateTypefaceDocument,
|
|
6317
6843
|
uploadFontFiles,
|
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.6",
|
|
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",
|
|
@@ -59,7 +59,13 @@
|
|
|
59
59
|
"@sanity/icons": ">=3",
|
|
60
60
|
"@sanity/ui": ">=3",
|
|
61
61
|
"react": ">=18",
|
|
62
|
-
"sanity": ">=3"
|
|
62
|
+
"sanity": ">=3",
|
|
63
|
+
"sanity-advanced-reference-array": ">=1"
|
|
64
|
+
},
|
|
65
|
+
"peerDependenciesMeta": {
|
|
66
|
+
"sanity-advanced-reference-array": {
|
|
67
|
+
"optional": true
|
|
68
|
+
}
|
|
63
69
|
},
|
|
64
70
|
"devDependencies": {
|
|
65
71
|
"@sanity/icons": "^3",
|
package/src/index.js
CHANGED
|
@@ -56,6 +56,8 @@ export { sanitizeForSanityId } from './utils/sanitizeForSanityId.js';
|
|
|
56
56
|
// Schema field definitions
|
|
57
57
|
export { openTypeField } from './schema/openTypeField.js';
|
|
58
58
|
export { styleCountField } from './schema/styleCountField.js';
|
|
59
|
+
export { stylisticSetField } from './schema/stylisticSetField.js';
|
|
60
|
+
export { createStylesField } from './schema/stylesField.js';
|
|
59
61
|
|
|
60
62
|
// Keyword utilities
|
|
61
63
|
export {
|