@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/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-DQ6bDuSZ.js";
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocode-factory/sanity-kit",
3
- "version": "2.44.2",
3
+ "version": "2.45.0",
4
4
  "description": "Outils Studio de NoCode Factory : Pages (liste + board), Composants, Historique",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,
@@ -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) {
@@ -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
- fields: t.fields.map(relax) as never,
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
@@ -3,4 +3,4 @@
3
3
  * quelle version. Recopiée de `package.json` par `npm version` (scripts/sync-version.mjs) ; un test
4
4
  * le vérifie.
5
5
  */
6
- export const KIT_VERSION = '2.44.2'
6
+ export const KIT_VERSION = '2.45.0'