@liiift-studio/sanity-font-manager 2.3.8 → 2.3.9

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
@@ -6660,7 +6660,7 @@ var fontsFilter = async ({ getClient, document, parent }) => {
6660
6660
  const typefaceName = document.title;
6661
6661
  const fonts = await client.fetch('*[_type == "font" && lower(typefaceName) == lower($typefaceName)]', { typefaceName });
6662
6662
  const relatedItemsFiltered = fonts.map((f) => f._id).filter(Boolean);
6663
- const existingItems = parent.map((f) => f._ref).filter(Boolean);
6663
+ const existingItems = (parent || []).map((f) => f._ref).filter(Boolean);
6664
6664
  return {
6665
6665
  filter: "!(_id in $existingItems) && (_id in $relatedItemsFiltered)",
6666
6666
  params: { existingItems, relatedItemsFiltered }
@@ -6669,7 +6669,7 @@ var fontsFilter = async ({ getClient, document, parent }) => {
6669
6669
  var variableFontsFilter = async ({ getClient, document, parent }) => {
6670
6670
  const client = getClient({ apiVersion: "2022-11-09" });
6671
6671
  const typefaceName = document.title;
6672
- const existingItems = parent.map((f) => f._ref).filter(Boolean);
6672
+ const existingItems = (parent || []).map((f) => f._ref).filter(Boolean);
6673
6673
  const fonts = await client.fetch('*[_type == "font" && typefaceName == $typefaceName && variableFont == true]', { typefaceName });
6674
6674
  const relatedItemsFiltered = fonts.map((f) => f._id).filter(Boolean);
6675
6675
  return {
@@ -6682,7 +6682,7 @@ var subfamilyPreferredStyleFilter = async ({ getClient, document, parent }) => {
6682
6682
  const typefaceName = document.title;
6683
6683
  const fonts = await client.fetch('*[_type == "font" && typefaceName == $typefaceName && variableFont == false]', { typefaceName });
6684
6684
  const relatedItemsFiltered = fonts.map((f) => f._id).filter(Boolean);
6685
- const existingItems = parent.fonts.map((f) => f._ref).filter(Boolean);
6685
+ const existingItems = (parent.fonts || []).map((f) => f._ref).filter(Boolean);
6686
6686
  return {
6687
6687
  filter: "(_id in $existingItems) && (_id in $relatedItemsFiltered)",
6688
6688
  params: { existingItems, relatedItemsFiltered }
@@ -6751,7 +6751,7 @@ function createStylesField({
6751
6751
  preview: {
6752
6752
  select: { title: "title", fonts: "fonts" },
6753
6753
  prepare({ title, fonts }) {
6754
- return { title, subtitle: `${Object.keys(fonts || {}).length} fonts` };
6754
+ return { title, subtitle: `${(fonts || []).length} fonts` };
6755
6755
  }
6756
6756
  }
6757
6757
  } : {}
@@ -6833,8 +6833,8 @@ function createStylesField({
6833
6833
  name: "regenerateSubfamilies",
6834
6834
  type: "string",
6835
6835
  hidden: ({ parent }) => {
6836
- var _a, _b, _c, _d;
6837
- 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;
6836
+ var _a, _b;
6837
+ return !((_a = parent == null ? void 0 : parent.subfamilies) == null ? void 0 : _a.length) || !((_b = parent == null ? void 0 : parent.fonts) == null ? void 0 : _b.length);
6838
6838
  },
6839
6839
  description: "Regenerates subfamily groups based on the fonts in this typeface.",
6840
6840
  components: { input: RegenerateSubfamiliesComponent }
package/dist/index.mjs CHANGED
@@ -6574,7 +6574,7 @@ var fontsFilter = async ({ getClient, document, parent }) => {
6574
6574
  const typefaceName = document.title;
6575
6575
  const fonts = await client.fetch('*[_type == "font" && lower(typefaceName) == lower($typefaceName)]', { typefaceName });
6576
6576
  const relatedItemsFiltered = fonts.map((f) => f._id).filter(Boolean);
6577
- const existingItems = parent.map((f) => f._ref).filter(Boolean);
6577
+ const existingItems = (parent || []).map((f) => f._ref).filter(Boolean);
6578
6578
  return {
6579
6579
  filter: "!(_id in $existingItems) && (_id in $relatedItemsFiltered)",
6580
6580
  params: { existingItems, relatedItemsFiltered }
@@ -6583,7 +6583,7 @@ var fontsFilter = async ({ getClient, document, parent }) => {
6583
6583
  var variableFontsFilter = async ({ getClient, document, parent }) => {
6584
6584
  const client = getClient({ apiVersion: "2022-11-09" });
6585
6585
  const typefaceName = document.title;
6586
- const existingItems = parent.map((f) => f._ref).filter(Boolean);
6586
+ const existingItems = (parent || []).map((f) => f._ref).filter(Boolean);
6587
6587
  const fonts = await client.fetch('*[_type == "font" && typefaceName == $typefaceName && variableFont == true]', { typefaceName });
6588
6588
  const relatedItemsFiltered = fonts.map((f) => f._id).filter(Boolean);
6589
6589
  return {
@@ -6596,7 +6596,7 @@ var subfamilyPreferredStyleFilter = async ({ getClient, document, parent }) => {
6596
6596
  const typefaceName = document.title;
6597
6597
  const fonts = await client.fetch('*[_type == "font" && typefaceName == $typefaceName && variableFont == false]', { typefaceName });
6598
6598
  const relatedItemsFiltered = fonts.map((f) => f._id).filter(Boolean);
6599
- const existingItems = parent.fonts.map((f) => f._ref).filter(Boolean);
6599
+ const existingItems = (parent.fonts || []).map((f) => f._ref).filter(Boolean);
6600
6600
  return {
6601
6601
  filter: "(_id in $existingItems) && (_id in $relatedItemsFiltered)",
6602
6602
  params: { existingItems, relatedItemsFiltered }
@@ -6665,7 +6665,7 @@ function createStylesField({
6665
6665
  preview: {
6666
6666
  select: { title: "title", fonts: "fonts" },
6667
6667
  prepare({ title, fonts }) {
6668
- return { title, subtitle: `${Object.keys(fonts || {}).length} fonts` };
6668
+ return { title, subtitle: `${(fonts || []).length} fonts` };
6669
6669
  }
6670
6670
  }
6671
6671
  } : {}
@@ -6747,8 +6747,8 @@ function createStylesField({
6747
6747
  name: "regenerateSubfamilies",
6748
6748
  type: "string",
6749
6749
  hidden: ({ parent }) => {
6750
- var _a, _b, _c, _d;
6751
- 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;
6750
+ var _a, _b;
6751
+ return !((_a = parent == null ? void 0 : parent.subfamilies) == null ? void 0 : _a.length) || !((_b = parent == null ? void 0 : parent.fonts) == null ? void 0 : _b.length);
6752
6752
  },
6753
6753
  description: "Regenerates subfamily groups based on the fonts in this typeface.",
6754
6754
  components: { input: RegenerateSubfamiliesComponent }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@liiift-studio/sanity-font-manager",
3
- "version": "2.3.8",
3
+ "version": "2.3.9",
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",
@@ -11,7 +11,7 @@ const fontsFilter = async ({ getClient, document, parent }) => {
11
11
  const typefaceName = document.title;
12
12
  const fonts = await client.fetch('*[_type == "font" && lower(typefaceName) == lower($typefaceName)]', { typefaceName });
13
13
  const relatedItemsFiltered = fonts.map(f => f._id).filter(Boolean);
14
- const existingItems = parent.map(f => f._ref).filter(Boolean);
14
+ const existingItems = (parent || []).map(f => f._ref).filter(Boolean);
15
15
  return {
16
16
  filter: '!(_id in $existingItems) && (_id in $relatedItemsFiltered)',
17
17
  params: { existingItems, relatedItemsFiltered },
@@ -22,7 +22,7 @@ const fontsFilter = async ({ getClient, document, parent }) => {
22
22
  const variableFontsFilter = async ({ getClient, document, parent }) => {
23
23
  const client = getClient({ apiVersion: '2022-11-09' });
24
24
  const typefaceName = document.title;
25
- const existingItems = parent.map(f => f._ref).filter(Boolean);
25
+ const existingItems = (parent || []).map(f => f._ref).filter(Boolean);
26
26
  const fonts = await client.fetch('*[_type == "font" && typefaceName == $typefaceName && variableFont == true]', { typefaceName });
27
27
  const relatedItemsFiltered = fonts.map(f => f._id).filter(Boolean);
28
28
  return {
@@ -37,7 +37,7 @@ const subfamilyPreferredStyleFilter = async ({ getClient, document, parent }) =>
37
37
  const typefaceName = document.title;
38
38
  const fonts = await client.fetch('*[_type == "font" && typefaceName == $typefaceName && variableFont == false]', { typefaceName });
39
39
  const relatedItemsFiltered = fonts.map(f => f._id).filter(Boolean);
40
- const existingItems = parent.fonts.map(f => f._ref).filter(Boolean);
40
+ const existingItems = (parent.fonts || []).map(f => f._ref).filter(Boolean);
41
41
  return {
42
42
  filter: '(_id in $existingItems) && (_id in $relatedItemsFiltered)',
43
43
  params: { existingItems, relatedItemsFiltered },
@@ -126,7 +126,7 @@ export function createStylesField({
126
126
  preview: {
127
127
  select: { title: 'title', fonts: 'fonts' },
128
128
  prepare({ title, fonts }) {
129
- return { title, subtitle: `${Object.keys(fonts || {}).length} fonts` };
129
+ return { title, subtitle: `${(fonts || []).length} fonts` };
130
130
  },
131
131
  },
132
132
  } : {}),
@@ -208,7 +208,7 @@ export function createStylesField({
208
208
  title: 'Regenerate Subfamilies',
209
209
  name: 'regenerateSubfamilies',
210
210
  type: 'string',
211
- hidden: ({ parent }) => parent?.styles?.subfamilies?.length === 0 || parent?.styles?.fonts?.length === 0,
211
+ hidden: ({ parent }) => !parent?.subfamilies?.length || !parent?.fonts?.length,
212
212
  description: 'Regenerates subfamily groups based on the fonts in this typeface.',
213
213
  components: { input: RegenerateSubfamiliesComponent },
214
214
  }),