@sanity/document-internationalization 4.1.1 → 5.0.1

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.
Files changed (52) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +44 -36
  3. package/dist/_chunks-es/{resources.mjs → resources.js} +1 -1
  4. package/dist/{_chunks-cjs → _chunks-es}/resources.js.map +1 -1
  5. package/dist/index.d.ts +112 -88
  6. package/dist/index.d.ts.map +1 -0
  7. package/dist/index.js +1075 -1337
  8. package/dist/index.js.map +1 -1
  9. package/package.json +35 -69
  10. package/dist/_chunks-cjs/resources.js +0 -8
  11. package/dist/_chunks-es/resources.mjs.map +0 -1
  12. package/dist/_legacy/resources.esm.js +0 -9
  13. package/dist/_legacy/resources.esm.js.map +0 -1
  14. package/dist/index.d.mts +0 -108
  15. package/dist/index.esm.js +0 -1625
  16. package/dist/index.esm.js.map +0 -1
  17. package/dist/index.mjs +0 -1625
  18. package/dist/index.mjs.map +0 -1
  19. package/sanity.json +0 -8
  20. package/src/actions/DeleteMetadataAction.tsx +0 -93
  21. package/src/actions/DeleteTranslationAction.tsx +0 -102
  22. package/src/actions/DuplicateWithTranslationsAction.tsx +0 -251
  23. package/src/badges/index.tsx +0 -27
  24. package/src/components/BulkPublish/DocumentCheck.tsx +0 -90
  25. package/src/components/BulkPublish/Info.tsx +0 -28
  26. package/src/components/BulkPublish/InfoIcon.tsx +0 -34
  27. package/src/components/BulkPublish/index.tsx +0 -181
  28. package/src/components/ConstrainedBox.tsx +0 -6
  29. package/src/components/DeleteTranslationDialog/DocumentPreview.tsx +0 -19
  30. package/src/components/DeleteTranslationDialog/index.tsx +0 -111
  31. package/src/components/DeleteTranslationDialog/separateReferences.ts +0 -23
  32. package/src/components/DeleteTranslationFooter.tsx +0 -28
  33. package/src/components/DocumentInternationalizationContext.tsx +0 -47
  34. package/src/components/DocumentInternationalizationMenu.tsx +0 -235
  35. package/src/components/LanguageManage.tsx +0 -108
  36. package/src/components/LanguageOption.tsx +0 -259
  37. package/src/components/LanguagePatch.tsx +0 -67
  38. package/src/components/OptimisticallyStrengthen/ReferencePatcher.tsx +0 -50
  39. package/src/components/OptimisticallyStrengthen/index.tsx +0 -34
  40. package/src/components/Warning.tsx +0 -18
  41. package/src/constants.ts +0 -16
  42. package/src/hooks/useLanguageMetadata.tsx +0 -26
  43. package/src/hooks/useOpenInNewPane.tsx +0 -33
  44. package/src/i18n/index.ts +0 -21
  45. package/src/i18n/resources.ts +0 -7
  46. package/src/index.ts +0 -6
  47. package/src/plugin.tsx +0 -239
  48. package/src/schema/translation/metadata.ts +0 -68
  49. package/src/types.ts +0 -97
  50. package/src/utils/createReference.ts +0 -20
  51. package/src/utils/excludePaths.ts +0 -123
  52. package/v2-incompatible.js +0 -11
package/package.json CHANGED
@@ -1,98 +1,64 @@
1
1
  {
2
2
  "name": "@sanity/document-internationalization",
3
- "version": "4.1.1",
3
+ "version": "5.0.1",
4
4
  "description": "Create unique translations of a document based on its language, joined by a shared reference document.",
5
5
  "keywords": [
6
6
  "sanity",
7
7
  "sanity-plugin"
8
8
  ],
9
- "homepage": "https://github.com/sanity-io/document-internationalization#readme",
9
+ "homepage": "https://github.com/sanity-io/plugins/tree/main/plugins/@sanity/document-internationalization#readme",
10
10
  "bugs": {
11
- "url": "https://github.com/sanity-io/document-internationalization/issues"
12
- },
13
- "repository": {
14
- "type": "git",
15
- "url": "git@github.com:sanity-io/document-internationalization.git"
11
+ "url": "https://github.com/sanity-io/plugins/issues"
16
12
  },
17
13
  "license": "MIT",
18
14
  "author": "Sanity.io <hello@sanity.io>",
19
- "sideEffects": false,
20
- "exports": {
21
- ".": {
22
- "source": "./src/index.ts",
23
- "import": "./dist/index.mjs",
24
- "require": "./dist/index.js",
25
- "default": "./dist/index.js"
26
- },
27
- "./package.json": "./package.json"
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+ssh://git@github.com/sanity-io/plugins.git",
18
+ "directory": "plugins/@sanity/document-internationalization"
28
19
  },
29
- "main": "./dist/index.js",
30
- "module": "./dist/index.esm.js",
31
- "source": "./src/index.ts",
32
- "types": "./dist/index.d.ts",
33
20
  "files": [
34
- "dist",
35
- "sanity.json",
36
- "src",
37
- "v2-incompatible.js"
21
+ "dist"
38
22
  ],
39
- "scripts": {
40
- "build": "run-s clean && pkg-utils build --strict && pkg-utils --strict",
41
- "clean": "rimraf dist",
42
- "format": "prettier --write --cache --ignore-unknown .",
43
- "link-watch": "plugin-kit link-watch",
44
- "lint": "eslint .",
45
- "prepare": "husky install",
46
- "prepublishOnly": "run-s build",
47
- "watch": "pkg-utils watch --strict"
23
+ "type": "module",
24
+ "types": "./dist/index.d.ts",
25
+ "exports": {
26
+ ".": "./dist/index.js",
27
+ "./package.json": "./package.json"
48
28
  },
49
29
  "dependencies": {
50
30
  "@sanity/icons": "^3.7.4",
51
- "@sanity/incompatible-plugin": "^1.0.5",
52
31
  "@sanity/mutator": "^5.0.1",
53
32
  "@sanity/ui": "^3.1.11",
54
33
  "@sanity/uuid": "^3.0.2",
55
- "sanity-plugin-internationalized-array": "^3.2.1",
34
+ "rxjs": "^7.8.1",
56
35
  "sanity-plugin-utils": "^1.7.0"
57
36
  },
58
37
  "devDependencies": {
59
- "@commitlint/cli": "^19.2.1",
60
- "@commitlint/config-conventional": "^19.1.0",
61
- "@sanity/pkg-utils": "6.1.0",
62
- "@sanity/plugin-kit": "^3.1.10",
63
- "@sanity/semantic-release-preset": "^4.1.7",
64
- "@types/react": "^19.2.7",
65
- "@typescript-eslint/eslint-plugin": "^7.6.0",
66
- "@typescript-eslint/parser": "^7.6.0",
67
- "eslint": "^8.57.0",
68
- "eslint-config-prettier": "^9.1.0",
69
- "eslint-config-sanity": "^7.1.2",
70
- "eslint-plugin-prettier": "^5.1.3",
71
- "eslint-plugin-react": "^7.34.1",
72
- "eslint-plugin-react-hooks": "^4.6.0",
73
- "eslint-plugin-simple-import-sort": "^12.0.0",
74
- "husky": "^8.0.3",
75
- "lint-staged": "^15.0.2",
76
- "npm-run-all2": "^5.0.0",
77
- "prettier": "^3.2.5",
78
- "prettier-plugin-packagejson": "^2.4.14",
79
- "react": "^19.2.3",
80
- "react-dom": "^19.2.3",
81
- "react-is": "^19.2.3",
82
- "rimraf": "^4.4.1",
83
- "sanity": "^4.0.0",
84
- "semantic-release": "^23.0.7",
85
- "typescript": "5.4.2"
38
+ "@sanity/pkg-utils": "^10.4.4",
39
+ "@testing-library/jest-dom": "^6.9.1",
40
+ "@testing-library/react": "^16.3.2",
41
+ "@types/react": "^19.2.13",
42
+ "@types/react-dom": "^19.2.3",
43
+ "babel-plugin-react-compiler": "^1.0.0",
44
+ "jsdom": "^28.0.0",
45
+ "react": "^19.2.4",
46
+ "react-dom": "^19.2.4",
47
+ "sanity": "^5.8.1",
48
+ "@repo/package.config": "0.0.0",
49
+ "sanity-plugin-internationalized-array": "^4.0.2",
50
+ "@repo/tsconfig": "0.0.0"
86
51
  },
87
52
  "peerDependencies": {
88
- "react": "^18 || ^19",
89
- "sanity": "^3.40.0 || ^4.0.0-0 || ^5",
90
- "styled-components": "^6.1"
53
+ "react": "^19.2",
54
+ "react-dom": "^19.2",
55
+ "sanity": "^5",
56
+ "sanity-plugin-internationalized-array": "^4.0.2"
91
57
  },
92
58
  "engines": {
93
- "node": ">=14"
59
+ "node": ">=20.19 <22 || >=22.12"
94
60
  },
95
- "publishConfig": {
96
- "access": "public"
61
+ "scripts": {
62
+ "build": "pkg build --strict --check --clean"
97
63
  }
98
- }
64
+ }
@@ -1,8 +0,0 @@
1
- "use strict";
2
- var resources = {
3
- "action.duplicate.label": "Duplicate with translations",
4
- "action.duplicate.disabled.missing-metadata": "The document cannot be duplicated because the metadata document is missing",
5
- "action.duplicate.disabled.multiple-metadata": "The document cannot be duplicated because there are multiple metadata documents"
6
- };
7
- exports.default = resources;
8
- //# sourceMappingURL=resources.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resources.mjs","sources":["../../src/i18n/resources.ts"],"sourcesContent":["export default {\n 'action.duplicate.label': 'Duplicate with translations',\n 'action.duplicate.disabled.missing-metadata':\n 'The document cannot be duplicated because the metadata document is missing',\n 'action.duplicate.disabled.multiple-metadata':\n 'The document cannot be duplicated because there are multiple metadata documents',\n}\n"],"names":[],"mappings":"AAAA,IAAA,YAAe;AAAA,EACb,0BAA0B;AAAA,EAC1B,8CACE;AAAA,EACF,+CACE;AACJ;"}
@@ -1,9 +0,0 @@
1
- var resources = {
2
- "action.duplicate.label": "Duplicate with translations",
3
- "action.duplicate.disabled.missing-metadata": "The document cannot be duplicated because the metadata document is missing",
4
- "action.duplicate.disabled.multiple-metadata": "The document cannot be duplicated because there are multiple metadata documents"
5
- };
6
- export {
7
- resources as default
8
- };
9
- //# sourceMappingURL=resources.esm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resources.esm.js","sources":["../../src/i18n/resources.ts"],"sourcesContent":["export default {\n 'action.duplicate.label': 'Duplicate with translations',\n 'action.duplicate.disabled.missing-metadata':\n 'The document cannot be duplicated because the metadata document is missing',\n 'action.duplicate.disabled.multiple-metadata':\n 'The document cannot be duplicated because there are multiple metadata documents',\n}\n"],"names":[],"mappings":"AAAA,IAAA,YAAe;AAAA,EACb,0BAA0B;AAAA,EAC1B,8CACE;AAAA,EACF,+CACE;AACJ;"}
package/dist/index.d.mts DELETED
@@ -1,108 +0,0 @@
1
- /// <reference types="react" />
2
-
3
- import {DocumentActionComponent} from 'sanity'
4
- import type {FieldDefinition} from 'sanity'
5
- import {JSX} from 'react'
6
- import type {KeyedObject} from 'sanity'
7
- import type {ObjectSchemaType} from 'sanity'
8
- import {Plugin as Plugin_2} from 'sanity'
9
- import type {Reference} from 'sanity'
10
- import type {SanityClient} from 'sanity'
11
- import type {SanityDocument} from 'sanity'
12
- import type {SanityDocumentLike} from 'sanity'
13
-
14
- export declare const DeleteTranslationAction: DocumentActionComponent
15
-
16
- export declare const documentInternationalization: Plugin_2<PluginConfig>
17
-
18
- export declare function DocumentInternationalizationMenu(
19
- props: DocumentInternationalizationMenuProps
20
- ): JSX.Element | null
21
-
22
- export declare type DocumentInternationalizationMenuProps = {
23
- schemaType: ObjectSchemaType
24
- documentId: string
25
- }
26
-
27
- export declare interface DocumentInternationalizationSchemaOpts {
28
- documentInternationalization?: {
29
- /** Set to true to disable duplication of this field or type */
30
- exclude?: boolean
31
- }
32
- }
33
-
34
- export declare const DuplicateWithTranslationsAction: DocumentActionComponent
35
-
36
- export declare type Language = {
37
- id: Intl.UnicodeBCP47LocaleIdentifier
38
- title: string
39
- }
40
-
41
- export declare type Metadata = {
42
- _id: string
43
- _createdAt: string
44
- translations: TranslationReference[]
45
- }
46
-
47
- export declare type MetadataDocument = SanityDocumentLike & {
48
- schemaTypes: string[]
49
- translations: TranslationReference[]
50
- }
51
-
52
- export declare type PluginCallbackArgs = {
53
- sourceDocument: SanityDocument
54
- newDocument: SanityDocument
55
- sourceLanguageId: string
56
- destinationLanguageId: string
57
- metaDocumentId: string
58
- client: SanityClient
59
- }
60
-
61
- export declare type PluginConfig = {
62
- supportedLanguages: SupportedLanguages
63
- schemaTypes: string[]
64
- languageField?: string
65
- weakReferences?: boolean
66
- bulkPublish?: boolean
67
- metadataFields?: FieldDefinition[]
68
- apiVersion?: string
69
- allowCreateMetaDoc?: boolean
70
- callback?: ((args: PluginCallbackArgs) => Promise<void>) | null
71
- }
72
-
73
- export declare type PluginConfigContext = Required<PluginConfig> & {
74
- supportedLanguages: Language[]
75
- }
76
-
77
- export declare type SupportedLanguages =
78
- | Language[]
79
- | ((client: SanityClient) => Promise<Language[]>)
80
-
81
- export declare type TranslationReference = KeyedObject & {
82
- _type: 'internationalizedArrayReferenceValue'
83
- value: Reference
84
- }
85
-
86
- export declare function useDocumentInternationalizationContext(): PluginConfigContext
87
-
88
- export {}
89
-
90
- declare module 'sanity' {
91
- interface ArrayOptions extends DocumentInternationalizationSchemaOpts {}
92
- interface BlockOptions extends DocumentInternationalizationSchemaOpts {}
93
- interface BooleanOptions extends DocumentInternationalizationSchemaOpts {}
94
- interface CrossDatasetReferenceOptions extends DocumentInternationalizationSchemaOpts {}
95
- interface DateOptions extends DocumentInternationalizationSchemaOpts {}
96
- interface DatetimeOptions extends DocumentInternationalizationSchemaOpts {}
97
- interface FileOptions extends DocumentInternationalizationSchemaOpts {}
98
- interface GeopointOptions extends DocumentInternationalizationSchemaOpts {}
99
- interface ImageOptions extends DocumentInternationalizationSchemaOpts {}
100
- interface NumberOptions extends DocumentInternationalizationSchemaOpts {}
101
- interface ObjectOptions extends DocumentInternationalizationSchemaOpts {}
102
- interface ReferenceBaseOptions extends DocumentInternationalizationSchemaOpts {}
103
- interface SlugOptions extends DocumentInternationalizationSchemaOpts {}
104
- interface StringOptions extends DocumentInternationalizationSchemaOpts {}
105
- interface TextOptions extends DocumentInternationalizationSchemaOpts {}
106
- interface UrlOptions extends DocumentInternationalizationSchemaOpts {}
107
- interface EmailOptions extends DocumentInternationalizationSchemaOpts {}
108
- }