@nocode-factory/sanity-kit 2.44.2 → 2.45.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/dist/{fixCrossLanguageReferences-DQ6bDuSZ.js → fixCrossLanguageReferences-CQGzpNii.js} +2 -2
- package/dist/{fixCrossLanguageReferences-DQ6bDuSZ.js.map → fixCrossLanguageReferences-CQGzpNii.js.map} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -4
- package/dist/index.js.map +1 -1
- package/dist/schema.js +1 -1
- package/package.json +1 -1
- package/src/form/OverrideInput.tsx +3 -0
- package/src/lib/propagate.ts +4 -1
- package/src/schema/componentDefaults.ts +3 -1
- package/src/version.ts +1 -1
package/dist/schema.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as DEFAULT_PAGE_BUILDER_FIELD, S as toPath, _ as redirectMapOf, a as componentDefaultsMainDocument, c as defineComponentDefaults, d as syncTranslationRedirects, f as translationRedirectId, g as redirectKey, h as followRedirects, i as DEFAULT_COMPONENT_DEFAULTS_TYPE, l as requiredUnlessDefault, n as withSameLanguageReferences, o as componentDefaultsMainDocuments, r as pageTypesFromSiteRoutes, s as defaultsFieldName, t as fixCrossLanguageReferences, u as requiredUnlessDefaultFor } from "./fixCrossLanguageReferences-
|
|
1
|
+
import { A as DEFAULT_PAGE_BUILDER_FIELD, S as toPath, _ as redirectMapOf, a as componentDefaultsMainDocument, c as defineComponentDefaults, d as syncTranslationRedirects, f as translationRedirectId, g as redirectKey, h as followRedirects, i as DEFAULT_COMPONENT_DEFAULTS_TYPE, l as requiredUnlessDefault, n as withSameLanguageReferences, o as componentDefaultsMainDocuments, r as pageTypesFromSiteRoutes, s as defaultsFieldName, t as fixCrossLanguageReferences, u as requiredUnlessDefaultFor } from "./fixCrossLanguageReferences-CQGzpNii.js";
|
|
2
2
|
/**
|
|
3
3
|
* Onglets du formulaire d'un document : Content, Sections, SEO, Settings.
|
|
4
4
|
*
|
package/package.json
CHANGED
|
@@ -196,6 +196,9 @@ export function createOverrideInput(config: ResolvedKitConfig): ComponentType<In
|
|
|
196
196
|
// (image, référence, ou objet à saisie personnalisée comme une couleur de charte).
|
|
197
197
|
type TypeChain = {name?: string; type?: TypeChain; components?: {input?: unknown}}
|
|
198
198
|
function carriesDot(schemaType: InputProps['schemaType']): boolean {
|
|
199
|
+
// Champ propre à l'instance (options.instanceOnly, ex. ancre) : pas de valeur par
|
|
200
|
+
// défaut, donc ni pastille ni héritage.
|
|
201
|
+
if ((schemaType.options as {instanceOnly?: boolean} | undefined)?.instanceOnly) return false
|
|
199
202
|
if (schemaType.jsonType !== 'object') return true
|
|
200
203
|
let t: TypeChain | undefined = schemaType as unknown as TypeChain
|
|
201
204
|
while (t) {
|
package/src/lib/propagate.ts
CHANGED
|
@@ -27,7 +27,7 @@ export interface SchemaTypeLike {
|
|
|
27
27
|
fields?: {name: string; type: SchemaTypeLike}[]
|
|
28
28
|
of?: SchemaTypeLike[]
|
|
29
29
|
to?: unknown
|
|
30
|
-
options?: {list?: unknown[]}
|
|
30
|
+
options?: {list?: unknown[]; instanceOnly?: boolean}
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
export interface PropagationResult {
|
|
@@ -58,6 +58,9 @@ function typeNames(t: SchemaTypeLike | undefined): string[] {
|
|
|
58
58
|
export function kindOf(t: SchemaTypeLike | undefined, value: unknown): FieldKind {
|
|
59
59
|
if (t) {
|
|
60
60
|
const names = typeNames(t)
|
|
61
|
+
// Champ propre à l'instance (options.instanceOnly, ex. ancre d'une section) :
|
|
62
|
+
// une valeur recopiée telle quelle, jamais traduite.
|
|
63
|
+
if (t.options?.instanceOnly) return 'value'
|
|
61
64
|
if (names.some((n) => VALUE_TYPE_NAMES.has(n)) || t.to) return 'value'
|
|
62
65
|
if (t.jsonType === 'array') {
|
|
63
66
|
const of = t.of ?? []
|
|
@@ -52,7 +52,9 @@ export function defineComponentDefaults(options: {sections: readonly unknown[];
|
|
|
52
52
|
type: 'object',
|
|
53
53
|
description: 'Default values of this component. Empty = design system value.',
|
|
54
54
|
options: {collapsible: true, collapsed: true},
|
|
55
|
-
|
|
55
|
+
// Un champ propre à l'instance (options.instanceOnly, ex. ancre) n'a pas de
|
|
56
|
+
// valeur par défaut : absent des réglages du composant.
|
|
57
|
+
fields: t.fields.filter((f) => !(f.options as {instanceOnly?: boolean} | undefined)?.instanceOnly).map(relax) as never,
|
|
56
58
|
}),
|
|
57
59
|
),
|
|
58
60
|
preview: {prepare: () => ({title: title.replace(/^\S+\s/, '')})},
|
package/src/version.ts
CHANGED