sanity-plugin-internationalized-array

5.3.15.3.2
~

Modified (4 files)

Index: package/dist/index.js
===================================================================
--- package/dist/index.js
+++ package/dist/index.js
@@ -577,9 +577,9 @@
 */
 const internationalizedArrayLanguageFilter = (enclosingType, _member, selectedLanguageIds, parentValue, languages) => {
 	if (isInternationalizedArrayItemType(enclosingType.name)) {
 		let language = typeof parentValue?.language == "string" ? parentValue?.[LANGUAGE_FIELD_NAME] : typeof parentValue?._key == "string" ? parentValue?._key : null;
-		return !language || languages.find((l) => l.id === language) ? language ? selectedLanguageIds.includes(language) : !1 : !0;
+		return language && !languages.find((l) => l.id === language) ? !0 : language ? selectedLanguageIds.includes(language) : !1;
 	}
 	return !0;
 };
 /**
@@ -1101,9 +1101,9 @@
 	$[2] === parentValue ? t1 = $[3] : (t1 = parentValue?.map(_temp) ?? [], $[2] = parentValue, $[3] = t1);
 	let languageKeysInUse = t1, t2;
 	$[4] !== languages || $[5] !== onChange || $[6] !== value ? (t2 = (event) => {
 		let languageId = event?.currentTarget?.value;
-		!value || !languages?.length || !languages.find((l) => l.id === languageId) || onChange([set(languageId, [LANGUAGE_FIELD_NAME])]);
+		value && languages?.length && languages.find((l) => l.id === languageId) && onChange([set(languageId, [LANGUAGE_FIELD_NAME])]);
 	}, $[4] = languages, $[5] = onChange, $[6] = value, $[7] = t2) : t2 = $[7];
 	let handleKeyChange = t2, t3 = `Change "${value[LANGUAGE_FIELD_NAME]}"`, t4;
 	$[8] === t3 ? t4 = $[9] : (t4 = /* @__PURE__ */ jsx(Button, {
 		fontSize: 1,
Index: package/package.json
===================================================================
--- package/package.json
+++ package/package.json
@@ -1,7 +1,7 @@
 {
   "name": "sanity-plugin-internationalized-array",
-  "version": "5.3.1",
+  "version": "5.3.2",
   "description": "Store localized fields in an array to save on attributes",
   "keywords": [
     "sanity",
     "sanity-plugin"
@@ -27,37 +27,37 @@
     "./migrations": "./dist/migrations/index.js",
     "./package.json": "./package.json"
   },
   "dependencies": {
-    "@sanity/icons": "^5.2.1",
-    "@sanity/ui": "^4.0.7",
-    "@sanity/util": "^6.11.0",
+    "@sanity/icons": "^5.2.2",
+    "@sanity/ui": "^4.2.7",
+    "@sanity/util": "^6.16.0",
     "lodash-es": "^4.18.1"
   },
   "devDependencies": {
+    "@sanity/language-filter": "5.0.19",
     "@sanity/tsconfig": "^2.2.1",
     "@sanity/tsdown-config": "^0.27.1",
     "@testing-library/jest-dom": "^7.0.1",
     "@testing-library/react": "^16.3.3",
     "@types/lodash-es": "^4.17.12",
     "@types/node": "^24.13.3",
-    "@types/react": "^19.2.18",
-    "@types/react-dom": "^19.2.4",
+    "@types/react": "^19.3.0",
+    "@types/react-dom": "^19.3.0",
     "jsdom": "^29.1.1",
     "oxc-transform-react": "^0.147.0",
-    "react": "^19.2.8",
-    "react-dom": "^19.2.8",
-    "sanity": "^6.11.0",
+    "react": "^19.3.0",
+    "react-dom": "^19.3.0",
+    "sanity": "^6.16.0",
     "styled-components": "^6.5.3",
-    "tsdown": "^0.22.14",
-    "@sanity/language-filter": "5.0.18"
+    "tsdown": "^0.22.14"
   },
   "peerDependencies": {
+    "@sanity/assist": "^6.2.2",
+    "@sanity/language-filter": "^5.0.19",
     "react": "^19.2",
     "react-dom": "^19.2",
-    "sanity": "^5 || ^6.0.0-0",
-    "@sanity/assist": "^6.2.1",
-    "@sanity/language-filter": "^5.0.18"
+    "sanity": "^5 || ^6.0.0-0"
   },
   "peerDependenciesMeta": {
     "@sanity/assist": {
       "optional": true
File too large for inline diff
Index: package/dist/migrations/index.js.map
===================================================================
--- package/dist/migrations/index.js.map
+++ package/dist/migrations/index.js.map
@@ -1,1 +1,1 @@
-{"version":3,"file":"index.js","names":[],"sources":["../../migrations/migrateToLanguageField.ts"],"sourcesContent":["import {defineMigration, set} from 'sanity/migrate'\n\n/**\n * The property which will be used to store the language identifier from v5.\n */\nconst LANGUAGE_FIELD_NAME = 'language'\n/**\n * The prefix of the internationalized array type name.\n * Internationalized arrays contain objects with `_type` starting with this prefix\n * and ending with `Value` (e.g. `internationalizedArrayStringValue`).\n */\nconst INTERNATIONALIZED_PREFIX = 'internationalizedArray'\n/**\n * The suffix of the internationalized array value type name.\n */\nconst VALUE_SUFFIX = 'Value'\n\n/**\n * Creates a migration that automatically finds all internationalized array\n * item objects and moves language identifiers from `_key` to the dedicated\n * `language` field, generating new random `_key` values.\n *\n * Detection is automatic: the `object` handler is called for every object in\n * every matching document. If the object has a `_type` matching\n * `internationalizedArray*Value` and is missing the `language` field, it is\n * migrated.\n */\nexport function migrateToLanguageField(documentTypes: string[]) {\n  return defineMigration({\n    title: 'Migrate internationalized array from _key to language',\n    documentTypes,\n    migrate: {\n      object(node) {\n        const type = node['_type']\n        const language = node[LANGUAGE_FIELD_NAME]\n\n        if (\n          typeof type !== 'string' ||\n          !type.startsWith(INTERNATIONALIZED_PREFIX) ||\n          !type.endsWith(VALUE_SUFFIX)\n        ) {\n          return undefined\n        }\n\n        // Already migrated: has a language field.\n        if (language && typeof language === 'string') {\n          return undefined\n        }\n\n        // Needs migration: _key holds the language id.\n        const oldKey = node['_key']\n        if (typeof oldKey !== 'string' || oldKey.length === 0) {\n          return undefined\n        }\n\n        return set({\n          ...node,\n          _key: undefined,\n          [LANGUAGE_FIELD_NAME]: oldKey,\n        })\n      },\n    },\n  })\n}\n"],"mappings":";;;;AAKA,MAAM,sBAAsB;;;;;;;;;;;AAsB5B,SAAgB,uBAAuB,eAAyB;CAC9D,OAAO,gBAAgB;EACrB,OAAO;EACP;EACA,SAAS,EACP,OAAO,MAAM;GACX,IAAM,OAAO,KAAK,OACZ,WAAW,KAAK;GAWtB,IARE,OAAO,QAAS,YAChB,CAAC,KAAK,WAAW,wBAAwB,KACzC,CAAC,KAAK,SAAS,OAAY,KAMzB,YAAY,OAAO,YAAa,UAClC;GAIF,IAAM,SAAS,KAAK;GAChB,WAAO,UAAW,YAAY,OAAO,WAAW,GAIpD,OAAO,IAAI;IACT,GAAG;IACH,MAAM,KAAA;KACL,sBAAsB;GACzB,CAAC;EACH,EACF;CACF,CAAC;AACH"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["\"_type\"","\"_key\""],"sources":["../../migrations/migrateToLanguageField.ts"],"sourcesContent":["import {defineMigration, set} from 'sanity/migrate'\n\n/**\n * The property which will be used to store the language identifier from v5.\n */\nconst LANGUAGE_FIELD_NAME = 'language'\n/**\n * The prefix of the internationalized array type name.\n * Internationalized arrays contain objects with `_type` starting with this prefix\n * and ending with `Value` (e.g. `internationalizedArrayStringValue`).\n */\nconst INTERNATIONALIZED_PREFIX = 'internationalizedArray'\n/**\n * The suffix of the internationalized array value type name.\n */\nconst VALUE_SUFFIX = 'Value'\n\n/**\n * Creates a migration that automatically finds all internationalized array\n * item objects and moves language identifiers from `_key` to the dedicated\n * `language` field, generating new random `_key` values.\n *\n * Detection is automatic: the `object` handler is called for every object in\n * every matching document. If the object has a `_type` matching\n * `internationalizedArray*Value` and is missing the `language` field, it is\n * migrated.\n */\nexport function migrateToLanguageField(documentTypes: string[]) {\n  return defineMigration({\n    title: 'Migrate internationalized array from _key to language',\n    documentTypes,\n    migrate: {\n      object(node) {\n        const type = node['_type']\n        const language = node[LANGUAGE_FIELD_NAME]\n\n        if (\n          typeof type !== 'string' ||\n          !type.startsWith(INTERNATIONALIZED_PREFIX) ||\n          !type.endsWith(VALUE_SUFFIX)\n        ) {\n          return undefined\n        }\n\n        // Already migrated: has a language field.\n        if (language && typeof language === 'string') {\n          return undefined\n        }\n\n        // Needs migration: _key holds the language id.\n        const oldKey = node['_key']\n        if (typeof oldKey !== 'string' || oldKey.length === 0) {\n          return undefined\n        }\n\n        return set({\n          ...node,\n          _key: undefined,\n          [LANGUAGE_FIELD_NAME]: oldKey,\n        })\n      },\n    },\n  })\n}\n"],"mappings":";;;;AAKA,MAAM,sBAAsB;;;;;;;;;;;AAsB5B,SAAgB,uBAAuB,eAAyB;CAC9D,OAAO,gBAAgB;EACrB,OAAO;EACP;EACA,SAAS,EACP,OAAO,MAAM;GACX,IAAM,OAAO,KAAKA,OACZ,WAAW,KAAK;GAWtB,IARE,OAAO,QAAS,YAChB,CAAC,KAAK,WAAW,wBAAwB,KACzC,CAAC,KAAK,SAAS,OAAY,KAMzB,YAAY,OAAO,YAAa,UAClC;GAIF,IAAM,SAAS,KAAKC;GACpB,IAAI,OAAO,UAAW,YAAY,OAAO,WAAW,GAIpD,OAAO,IAAI;IACT,GAAG;IACH,MAAM,KAAA;KACL,sBAAsB;GACzB,CAAC;EACH,EACF;CACF,CAAC;AACH"}
\ No newline at end of file