@liiift-studio/sanity-font-manager 2.3.15 → 2.3.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -6806,7 +6806,19 @@ var stylisticSetField = {
6806
6806
  };
6807
6807
 
6808
6808
  // src/schema/stylesField.js
6809
+ var import_react21 = __toESM(require("react"));
6809
6810
  var import_sanity_advanced_reference_array = require("@liiift-studio/sanity-advanced-reference-array");
6811
+ var typefaceParams = (doc) => ({ typefaceName: (doc == null ? void 0 : doc.title) || "" });
6812
+ var FontsRefArray = (props) => import_react21.default.createElement(import_sanity_advanced_reference_array.AdvancedRefArray, {
6813
+ ...props,
6814
+ filterGroq: "lower(typefaceName) == lower($typefaceName)",
6815
+ filterParams: typefaceParams
6816
+ });
6817
+ var VariableFontsRefArray = (props) => import_react21.default.createElement(import_sanity_advanced_reference_array.AdvancedRefArray, {
6818
+ ...props,
6819
+ filterGroq: "lower(typefaceName) == lower($typefaceName) && variableFont == true",
6820
+ filterParams: typefaceParams
6821
+ });
6810
6822
  var field = (condition, def) => condition ? [def] : [];
6811
6823
  var fontsFilter = async ({ getClient, document, parent }) => {
6812
6824
  const client = getClient({ apiVersion: "2022-11-09" });
@@ -6881,7 +6893,7 @@ function createStylesField({
6881
6893
  title: "Fonts",
6882
6894
  name: "fonts",
6883
6895
  type: "array",
6884
- components: { input: import_sanity_advanced_reference_array.AdvancedRefArray },
6896
+ components: { input: FontsRefArray },
6885
6897
  of: [{ type: "reference", weak: true, to: [{ type: "font" }] }],
6886
6898
  options: {
6887
6899
  sortable: true,
@@ -6958,7 +6970,7 @@ function createStylesField({
6958
6970
  title: "Fonts",
6959
6971
  name: "fonts",
6960
6972
  type: "array",
6961
- components: { input: import_sanity_advanced_reference_array.AdvancedRefArray },
6973
+ components: { input: FontsRefArray },
6962
6974
  of: [{
6963
6975
  type: "reference",
6964
6976
  weak: true,
@@ -6971,7 +6983,7 @@ function createStylesField({
6971
6983
  title: "Variable Fonts",
6972
6984
  name: "variableFont",
6973
6985
  type: "array",
6974
- components: { input: import_sanity_advanced_reference_array.AdvancedRefArray },
6986
+ components: { input: VariableFontsRefArray },
6975
6987
  of: [{
6976
6988
  type: "reference",
6977
6989
  weak: true,
package/dist/index.mjs CHANGED
@@ -6716,7 +6716,19 @@ var stylisticSetField = {
6716
6716
  };
6717
6717
 
6718
6718
  // src/schema/stylesField.js
6719
+ import React19 from "react";
6719
6720
  import { AdvancedRefArray } from "@liiift-studio/sanity-advanced-reference-array";
6721
+ var typefaceParams = (doc) => ({ typefaceName: (doc == null ? void 0 : doc.title) || "" });
6722
+ var FontsRefArray = (props) => React19.createElement(AdvancedRefArray, {
6723
+ ...props,
6724
+ filterGroq: "lower(typefaceName) == lower($typefaceName)",
6725
+ filterParams: typefaceParams
6726
+ });
6727
+ var VariableFontsRefArray = (props) => React19.createElement(AdvancedRefArray, {
6728
+ ...props,
6729
+ filterGroq: "lower(typefaceName) == lower($typefaceName) && variableFont == true",
6730
+ filterParams: typefaceParams
6731
+ });
6720
6732
  var field = (condition, def) => condition ? [def] : [];
6721
6733
  var fontsFilter = async ({ getClient, document, parent }) => {
6722
6734
  const client = getClient({ apiVersion: "2022-11-09" });
@@ -6791,7 +6803,7 @@ function createStylesField({
6791
6803
  title: "Fonts",
6792
6804
  name: "fonts",
6793
6805
  type: "array",
6794
- components: { input: AdvancedRefArray },
6806
+ components: { input: FontsRefArray },
6795
6807
  of: [{ type: "reference", weak: true, to: [{ type: "font" }] }],
6796
6808
  options: {
6797
6809
  sortable: true,
@@ -6868,7 +6880,7 @@ function createStylesField({
6868
6880
  title: "Fonts",
6869
6881
  name: "fonts",
6870
6882
  type: "array",
6871
- components: { input: AdvancedRefArray },
6883
+ components: { input: FontsRefArray },
6872
6884
  of: [{
6873
6885
  type: "reference",
6874
6886
  weak: true,
@@ -6881,7 +6893,7 @@ function createStylesField({
6881
6893
  title: "Variable Fonts",
6882
6894
  name: "variableFont",
6883
6895
  type: "array",
6884
- components: { input: AdvancedRefArray },
6896
+ components: { input: VariableFontsRefArray },
6885
6897
  of: [{
6886
6898
  type: "reference",
6887
6899
  weak: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@liiift-studio/sanity-font-manager",
3
- "version": "2.3.15",
3
+ "version": "2.3.17",
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",
@@ -27,7 +27,8 @@
27
27
  "import": "./dist/index.mjs",
28
28
  "require": "./dist/index.js",
29
29
  "default": "./dist/index.mjs"
30
- }
30
+ },
31
+ "./package.json": "./package.json"
31
32
  },
32
33
  "files": [
33
34
  "dist",
@@ -1,7 +1,25 @@
1
1
  // Sanity schema factory function for the Styles object field — call createStylesField(options) to generate the field definition for a typeface document
2
+ import React from 'react';
2
3
  import { AdvancedRefArray } from '@liiift-studio/sanity-advanced-reference-array';
3
4
  import { RegenerateSubfamiliesComponent } from '../components/RegenerateSubfamiliesComponent.jsx';
4
5
 
6
+ // Returns extra GROQ params scoped to the current typeface document
7
+ const typefaceParams = (doc) => ({ typefaceName: doc?.title || '' });
8
+
9
+ // AdvancedRefArray wrapper — limits search results to fonts belonging to this typeface
10
+ const FontsRefArray = (props) => React.createElement(AdvancedRefArray, {
11
+ ...props,
12
+ filterGroq: 'lower(typefaceName) == lower($typefaceName)',
13
+ filterParams: typefaceParams,
14
+ });
15
+
16
+ // AdvancedRefArray wrapper — limits search results to variable fonts belonging to this typeface
17
+ const VariableFontsRefArray = (props) => React.createElement(AdvancedRefArray, {
18
+ ...props,
19
+ filterGroq: 'lower(typefaceName) == lower($typefaceName) && variableFont == true',
20
+ filterParams: typefaceParams,
21
+ });
22
+
5
23
  // Conditionally includes a field definition in an array
6
24
  const field = (condition, def) => condition ? [def] : [];
7
25
 
@@ -102,7 +120,7 @@ export function createStylesField({
102
120
  title: 'Fonts',
103
121
  name: 'fonts',
104
122
  type: 'array',
105
- components: { input: AdvancedRefArray },
123
+ components: { input: FontsRefArray },
106
124
  of: [{ type: 'reference', weak: true, to: [{ type: 'font' }] }],
107
125
  options: {
108
126
  sortable: true,
@@ -181,7 +199,7 @@ export function createStylesField({
181
199
  title: 'Fonts',
182
200
  name: 'fonts',
183
201
  type: 'array',
184
- components: { input: AdvancedRefArray },
202
+ components: { input: FontsRefArray },
185
203
  of: [{
186
204
  type: 'reference',
187
205
  weak: true,
@@ -194,7 +212,7 @@ export function createStylesField({
194
212
  title: 'Variable Fonts',
195
213
  name: 'variableFont',
196
214
  type: 'array',
197
- components: { input: AdvancedRefArray },
215
+ components: { input: VariableFontsRefArray },
198
216
  of: [{
199
217
  type: 'reference',
200
218
  weak: true,