sanity-plugin-taxonomy-manager 4.5.0 → 4.7.0
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/lib/index.d.ts +46 -9
- package/lib/index.esm.d.mts +46 -9
- package/lib/index.esm.esm.js +168 -167
- package/lib/index.esm.esm.js.map +1 -1
- package/lib/index.esm.mjs +168 -167
- package/lib/index.esm.mjs.map +1 -1
- package/lib/index.js +168 -167
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Children.tsx +1 -1
- package/src/components/Concepts.tsx +3 -1
- package/src/components/Hierarchy.tsx +1 -2
- package/src/components/TopConcepts.tsx +3 -1
- package/src/components/TreeStructure.tsx +1 -1
- package/src/components/TreeView.tsx +4 -0
- package/src/components/inputs/ArrayHierarchyInput.tsx +15 -5
- package/src/components/inputs/Identifier.tsx +25 -9
- package/src/components/inputs/InputHierarchy.tsx +72 -7
- package/src/components/inputs/ReferenceHierarchyInput.tsx +25 -12
- package/src/components/interactions/ConceptSelectLink.tsx +7 -1
- package/src/config.ts +16 -0
- package/src/helpers/createId.ts +20 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useCreateConcept.tsx +8 -3
- package/src/hooks/useEmbeddingsRecs.tsx +75 -0
- package/src/index.ts +19 -16
- package/src/skosConcept.tsx +13 -7
- package/src/skosConceptScheme.tsx +12 -8
- package/src/types.tsx +34 -2
package/lib/index.d.ts
CHANGED
|
@@ -17,7 +17,11 @@ import type {useClient} from 'sanity'
|
|
|
17
17
|
* plugin `schemeFilter` or `branchFilter` options.
|
|
18
18
|
*
|
|
19
19
|
*/
|
|
20
|
-
export declare function ArrayHierarchyInput(props:
|
|
20
|
+
export declare function ArrayHierarchyInput(props: ArrayHierarchyInputProps): JSX.Element
|
|
21
|
+
|
|
22
|
+
declare type ArrayHierarchyInputProps = ArrayFieldProps & {
|
|
23
|
+
embeddingsIndex?: EmbeddingsIndexConfig
|
|
24
|
+
}
|
|
21
25
|
|
|
22
26
|
/**
|
|
23
27
|
* #### Reference Field Scheme & Branch Filter
|
|
@@ -103,10 +107,34 @@ declare interface ConceptSchemeDocument extends SanityDocument {
|
|
|
103
107
|
}
|
|
104
108
|
}
|
|
105
109
|
|
|
110
|
+
declare interface EmbeddingsIndexConfig {
|
|
111
|
+
indexName: string
|
|
112
|
+
fieldReferences: string[]
|
|
113
|
+
maxResults?: number
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
declare interface EmbeddingsResult {
|
|
117
|
+
score: number
|
|
118
|
+
value: {
|
|
119
|
+
documentId: string
|
|
120
|
+
type: string
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
declare type HierarchyInput = ObjectFieldProps<Reference> & {
|
|
125
|
+
embeddingsIndex?: EmbeddingsIndexConfig
|
|
126
|
+
}
|
|
127
|
+
|
|
106
128
|
declare interface Options {
|
|
107
129
|
baseUri?: string
|
|
108
130
|
customConceptFields?: FieldDefinition[]
|
|
109
131
|
customSchemeFields?: FieldDefinition[]
|
|
132
|
+
ident?: {
|
|
133
|
+
pattern?: string
|
|
134
|
+
length?: number
|
|
135
|
+
prefix?: string
|
|
136
|
+
regenUi?: boolean
|
|
137
|
+
}
|
|
110
138
|
}
|
|
111
139
|
|
|
112
140
|
/**
|
|
@@ -118,7 +146,7 @@ declare interface Options {
|
|
|
118
146
|
* Hierarchy view must be used in conjunction with the Taxonomy Manager
|
|
119
147
|
* plugin `schemeFilter` or `branchFilter` options.
|
|
120
148
|
*/
|
|
121
|
-
export declare function ReferenceHierarchyInput(props:
|
|
149
|
+
export declare function ReferenceHierarchyInput(props: HierarchyInput): JSX.Element
|
|
122
150
|
|
|
123
151
|
/**
|
|
124
152
|
* #### Reference Field Scheme Filter
|
|
@@ -181,12 +209,17 @@ declare type SchemeOptions = {
|
|
|
181
209
|
}
|
|
182
210
|
|
|
183
211
|
/**
|
|
184
|
-
* ####
|
|
185
|
-
*
|
|
186
|
-
*
|
|
187
|
-
* @param
|
|
188
|
-
* @param
|
|
189
|
-
* @param
|
|
212
|
+
* #### Sanity Taxonomy Manager
|
|
213
|
+
* Defines a Sanity plugin for managing SKOS compliant taxonomies in Sanity Studio.
|
|
214
|
+
* #### Options
|
|
215
|
+
* @param baseUri - The base URI to use for SKOS concepts and concept schemes. BaseURI should follow an IANA http/s scheme and should terminate with either a / or #.
|
|
216
|
+
* @param customConceptFields - An array of additional fields to add to the skosConcept type.
|
|
217
|
+
* @param customSchemeFields - An array of additional fields to add to the skosConceptScheme type.
|
|
218
|
+
* #### Identifier Configuration
|
|
219
|
+
* @param ident.pattern - The character set to use for identifiers (default: '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz').
|
|
220
|
+
* @param ident.length - The length of the generated identifier (default: 6).
|
|
221
|
+
* @param ident.prefix - A prefix to prepend to generated identifiers, for example to use Wikidata style IDs like "Q27521" (default: '').
|
|
222
|
+
* @param ident.regenUi - Whether to display the "Create Unique Identifier" button in the UI by default.
|
|
190
223
|
* @returns A Sanity plugin object.
|
|
191
224
|
*/
|
|
192
225
|
export declare const taxonomyManager: Plugin_2<Options | undefined>
|
|
@@ -207,14 +240,18 @@ export declare const TreeView: ({
|
|
|
207
240
|
inputComponent,
|
|
208
241
|
selectConcept,
|
|
209
242
|
expanded,
|
|
243
|
+
conceptRecs,
|
|
244
|
+
recsError,
|
|
210
245
|
}: TreeViewProps) => JSX.Element
|
|
211
246
|
|
|
212
247
|
declare interface TreeViewProps {
|
|
213
248
|
document?: ConceptSchemeDocument
|
|
214
|
-
branchId
|
|
249
|
+
branchId?: string | null
|
|
215
250
|
selectConcept?: (conceptId: {_ref: string; _type: 'reference'; _originalId?: string}) => void
|
|
216
251
|
inputComponent?: boolean
|
|
217
252
|
expanded?: boolean
|
|
253
|
+
conceptRecs?: EmbeddingsResult[]
|
|
254
|
+
recsError?: string | null
|
|
218
255
|
}
|
|
219
256
|
|
|
220
257
|
export {}
|
package/lib/index.esm.d.mts
CHANGED
|
@@ -17,7 +17,11 @@ import type {useClient} from 'sanity'
|
|
|
17
17
|
* plugin `schemeFilter` or `branchFilter` options.
|
|
18
18
|
*
|
|
19
19
|
*/
|
|
20
|
-
export declare function ArrayHierarchyInput(props:
|
|
20
|
+
export declare function ArrayHierarchyInput(props: ArrayHierarchyInputProps): JSX.Element
|
|
21
|
+
|
|
22
|
+
declare type ArrayHierarchyInputProps = ArrayFieldProps & {
|
|
23
|
+
embeddingsIndex?: EmbeddingsIndexConfig
|
|
24
|
+
}
|
|
21
25
|
|
|
22
26
|
/**
|
|
23
27
|
* #### Reference Field Scheme & Branch Filter
|
|
@@ -103,10 +107,34 @@ declare interface ConceptSchemeDocument extends SanityDocument {
|
|
|
103
107
|
}
|
|
104
108
|
}
|
|
105
109
|
|
|
110
|
+
declare interface EmbeddingsIndexConfig {
|
|
111
|
+
indexName: string
|
|
112
|
+
fieldReferences: string[]
|
|
113
|
+
maxResults?: number
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
declare interface EmbeddingsResult {
|
|
117
|
+
score: number
|
|
118
|
+
value: {
|
|
119
|
+
documentId: string
|
|
120
|
+
type: string
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
declare type HierarchyInput = ObjectFieldProps<Reference> & {
|
|
125
|
+
embeddingsIndex?: EmbeddingsIndexConfig
|
|
126
|
+
}
|
|
127
|
+
|
|
106
128
|
declare interface Options {
|
|
107
129
|
baseUri?: string
|
|
108
130
|
customConceptFields?: FieldDefinition[]
|
|
109
131
|
customSchemeFields?: FieldDefinition[]
|
|
132
|
+
ident?: {
|
|
133
|
+
pattern?: string
|
|
134
|
+
length?: number
|
|
135
|
+
prefix?: string
|
|
136
|
+
regenUi?: boolean
|
|
137
|
+
}
|
|
110
138
|
}
|
|
111
139
|
|
|
112
140
|
/**
|
|
@@ -118,7 +146,7 @@ declare interface Options {
|
|
|
118
146
|
* Hierarchy view must be used in conjunction with the Taxonomy Manager
|
|
119
147
|
* plugin `schemeFilter` or `branchFilter` options.
|
|
120
148
|
*/
|
|
121
|
-
export declare function ReferenceHierarchyInput(props:
|
|
149
|
+
export declare function ReferenceHierarchyInput(props: HierarchyInput): JSX.Element
|
|
122
150
|
|
|
123
151
|
/**
|
|
124
152
|
* #### Reference Field Scheme Filter
|
|
@@ -181,12 +209,17 @@ declare type SchemeOptions = {
|
|
|
181
209
|
}
|
|
182
210
|
|
|
183
211
|
/**
|
|
184
|
-
* ####
|
|
185
|
-
*
|
|
186
|
-
*
|
|
187
|
-
* @param
|
|
188
|
-
* @param
|
|
189
|
-
* @param
|
|
212
|
+
* #### Sanity Taxonomy Manager
|
|
213
|
+
* Defines a Sanity plugin for managing SKOS compliant taxonomies in Sanity Studio.
|
|
214
|
+
* #### Options
|
|
215
|
+
* @param baseUri - The base URI to use for SKOS concepts and concept schemes. BaseURI should follow an IANA http/s scheme and should terminate with either a / or #.
|
|
216
|
+
* @param customConceptFields - An array of additional fields to add to the skosConcept type.
|
|
217
|
+
* @param customSchemeFields - An array of additional fields to add to the skosConceptScheme type.
|
|
218
|
+
* #### Identifier Configuration
|
|
219
|
+
* @param ident.pattern - The character set to use for identifiers (default: '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz').
|
|
220
|
+
* @param ident.length - The length of the generated identifier (default: 6).
|
|
221
|
+
* @param ident.prefix - A prefix to prepend to generated identifiers, for example to use Wikidata style IDs like "Q27521" (default: '').
|
|
222
|
+
* @param ident.regenUi - Whether to display the "Create Unique Identifier" button in the UI by default.
|
|
190
223
|
* @returns A Sanity plugin object.
|
|
191
224
|
*/
|
|
192
225
|
export declare const taxonomyManager: Plugin_2<Options | undefined>
|
|
@@ -207,14 +240,18 @@ export declare const TreeView: ({
|
|
|
207
240
|
inputComponent,
|
|
208
241
|
selectConcept,
|
|
209
242
|
expanded,
|
|
243
|
+
conceptRecs,
|
|
244
|
+
recsError,
|
|
210
245
|
}: TreeViewProps) => JSX.Element
|
|
211
246
|
|
|
212
247
|
declare interface TreeViewProps {
|
|
213
248
|
document?: ConceptSchemeDocument
|
|
214
|
-
branchId
|
|
249
|
+
branchId?: string | null
|
|
215
250
|
selectConcept?: (conceptId: {_ref: string; _type: 'reference'; _originalId?: string}) => void
|
|
216
251
|
inputComponent?: boolean
|
|
217
252
|
expanded?: boolean
|
|
253
|
+
conceptRecs?: EmbeddingsResult[]
|
|
254
|
+
recsError?: string | null
|
|
218
255
|
}
|
|
219
256
|
|
|
220
257
|
export {}
|