@contentstack/studio-registry 1.5.0 → 1.6.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.
@@ -68,28 +68,90 @@ type SlotProp = PropBase<NodePropTypes["slot"], Node[]> & {
68
68
  */
69
69
  itemTemplate?: Node;
70
70
  };
71
- type ChoiceProp = PropBase<NodePropTypes["choice"], string[]> & {
71
+ /** Fields shared by single- and multi-select choice props. */
72
+ type ChoiceCommon = {
72
73
  options: string[] | {
73
- value: string | number | boolean;
74
+ value: string;
74
75
  label: string;
75
76
  }[];
76
- /**
77
- * @default false
78
- */
79
- multiSelect?: boolean;
80
77
  /**
81
78
  * If the multiSelect is false, then the control will be radio, else select field.
82
79
  * @default "radio"
83
80
  */
84
81
  control?: "radio" | "dropdown";
85
82
  };
83
+ /**
84
+ * Single-select choice. `defaultValue` may be a single value (`"a"`) or an array
85
+ * — the array form (`["a"]`) is kept for backward compatibility.
86
+ */
87
+ type SingleChoiceProp = PropBase<NodePropTypes["choice"], string | string[]> & ChoiceCommon & {
88
+ /**
89
+ * @default false
90
+ */
91
+ multiSelect?: false;
92
+ };
93
+ /**
94
+ * Multi-select choice. `defaultValue` must be an array; passing a bare string is
95
+ * a compile error.
96
+ */
97
+ type MultiChoiceProp = PropBase<NodePropTypes["choice"], string[]> & ChoiceCommon & {
98
+ multiSelect: true;
99
+ };
100
+ type ChoiceProp = SingleChoiceProp | MultiChoiceProp;
86
101
  type ObjectInput = PropBase<NodePropTypes["object"], Record<string, unknown>> & {
87
102
  properties?: unknown;
88
103
  };
89
104
  type AnyProp = PropBase<NodePropTypes["any"], any>;
105
+ /**
106
+ * Use `json_rte` for props bound to a **Contentstack JSON Rich-Text Editor field**.
107
+ *
108
+ * **Why a dedicated type:** RTE fields deliver structured content. Binding an RTE field
109
+ * to a plain `string` prop tries to render the structured value as text, which produces
110
+ * `[object Object]` or stringified JSON in the page. The `json_rte` type signals to Studio's
111
+ * data picker that the prop expects RTE content, and to component code that the prop value
112
+ * is a **JSON RTE document object** (not a string).
113
+ *
114
+ * **Runtime value shape.** The prop receives the JSON RTE field's structured value (an
115
+ * object — root node with `children`, `attrs`, etc.). To render it, the component must:
116
+ * 1. Convert the JSON RTE document to HTML via `@contentstack/json-rte-serializer`
117
+ * (`jsonToHtml(doc)`)
118
+ * 2. Sanitize the HTML (e.g. DOMPurify) — JSON RTE content is editor-supplied
119
+ * 3. Render with `dangerouslySetInnerHTML`
120
+ *
121
+ * @example
122
+ * ```tsx
123
+ * // register the prop
124
+ * registerComponent(BlogBody, {
125
+ * type: "blog-body",
126
+ * props: {
127
+ * body: { type: "json_rte", displayName: "Body" },
128
+ * },
129
+ * });
130
+ *
131
+ * // component serializes JSON RTE → HTML → sanitize → render
132
+ * import { jsonToHtml } from "@contentstack/json-rte-serializer";
133
+ * import DOMPurify from "isomorphic-dompurify";
134
+ * function BlogBody({ body }: { body: object | undefined }) {
135
+ * if (!body) return null;
136
+ * const html = jsonToHtml(body); // JSON RTE doc → HTML string
137
+ * const safe = DOMPurify.sanitize(html); // sanitize the HTML
138
+ * return <article dangerouslySetInnerHTML={{ __html: safe }} />;
139
+ * }
140
+ * ```
141
+ *
142
+ * **Do NOT type the prop as `string`** and skip the serializer — the runtime value is
143
+ * an object, not a pre-serialized HTML string.
144
+ *
145
+ * See docs: `docs/20-bring-your-own-components/component-schema.md` § json_rte.
146
+ */
90
147
  type JsonRTEProp = PropBase<NodePropTypes["json_rte"], object>;
148
+ /** Accepts singleline and multiline text fields only; excludes HTML RTE and Markdown. */
149
+ type PlainTextProp = PropBase<NodePropTypes["plaintext"], string> & {
150
+ control?: "default" | "large";
151
+ placeholder?: string;
152
+ };
91
153
  type PropsWithNoOptionsRequired = StringProp | BooleanProp | NumberProp | DateStringProp | HrefProp | ImageUrlProp | ObjectProp | ArrayProp | SlotProp;
92
- type PropInput = StringProp | BooleanProp | NumberProp | DateStringProp | HrefProp | ImageUrlProp | ObjectProp | ArrayProp | SlotProp | ChoiceProp | AnyProp | JsonRTEProp;
154
+ type PropInput = StringProp | BooleanProp | NumberProp | DateStringProp | HrefProp | ImageUrlProp | ObjectProp | ArrayProp | SlotProp | ChoiceProp | AnyProp | JsonRTEProp | PlainTextProp;
93
155
  type PropTypeOfNoOptionsRequired = PropsWithNoOptionsRequired["type"];
94
156
  type PropType = PropInput["type"];
95
157
  type Props = {
@@ -126,8 +188,9 @@ declare const INTERNAL_COMPONENT_SECTIONS: {
126
188
  readonly REGISTERED_COMPONENTS: "Registered Components";
127
189
  readonly HTML_ELEMENT: "HTML Elements";
128
190
  readonly SYMBOL: "Symbols";
191
+ readonly SECTION_COMPOSITION: "Sections";
129
192
  };
130
- declare const INTERNAL_SECTIONS: ("Basic" | "Media" | "Container" | "Smart Containers" | "Advanced" | "Registered Components" | "HTML Elements" | "Symbols")[];
193
+ declare const INTERNAL_SECTIONS: ("Basic" | "Media" | "Container" | "Smart Containers" | "Advanced" | "Registered Components" | "HTML Elements" | "Symbols" | "Sections")[];
131
194
  declare const STYLE_SECTIONS_OPTIONS: readonly ["class", "size", "spacing", "position", "visibility", "layout", "typography", "transform", "media", "background", "shadow", "effect", "overflow", "border", "responsive"];
132
195
  /**
133
196
  * The style group is the group of the style sections options.
@@ -149,6 +212,7 @@ declare const INTERNAL_COMPONENTS_NAMES: {
149
212
  readonly JSON_RTE: "json-rte";
150
213
  readonly COLLAPSIBLE_TEXT: "collapsible-text";
151
214
  readonly PLAIN_TEXT: "plain-text";
215
+ readonly RICH_TEXT: "rich-text";
152
216
  readonly VIDEO: "video";
153
217
  readonly EMBED: "embed";
154
218
  readonly IMAGE: "image";
@@ -160,6 +224,7 @@ declare const INTERNAL_COMPONENTS_NAMES: {
160
224
  readonly CONDITION_BLOCK: "condition-block";
161
225
  readonly SYMBOL: "symbol";
162
226
  readonly FRAGMENT: "fragment";
227
+ readonly SECTION_SLOT: "section-slot";
163
228
  readonly HTML_ELEMENT: "html-element";
164
229
  readonly STYLE_SHEET: "style-sheet";
165
230
  };
@@ -243,13 +308,34 @@ interface RegisterComponentSchemaInput<C = unknown> {
243
308
  */
244
309
  hideFromComponentList?: boolean;
245
310
  icon?: string;
311
+ /**
312
+ * A custom icon for this component, shown in the Studio Layers tree and other
313
+ * component-icon surfaces. Accepts one of:
314
+ * - an inline SVG string (e.g. `"<svg ...>...</svg>"`) — recommended; themeable via `currentColor`
315
+ * - an absolute URL (`"https://..."` or a `"data:image/..."` data URI)
316
+ * - a servable relative/root-relative path on your app (`"/icons/foo.svg"`, or an imported asset URL)
317
+ *
318
+ * Note: a raw source-tree path (e.g. `"./icons/foo.svg"`) will not resolve — bundlers hash and
319
+ * relocate assets. Put the asset in `public/` and pass a root-relative path, or import it
320
+ * (`import url from "./icon.svg"`) and pass the resulting URL.
321
+ *
322
+ * Invalid values are ignored (with a console warning) and fall back to the default icon.
323
+ */
324
+ layerIcon?: LayerIcon;
246
325
  /**
247
326
  * This can be used to store extra metadata for components. For eg for symbols we can store uid here.
248
327
  */
249
328
  metadata?: Record<string, unknown>;
250
329
  }
251
- interface RegisterComponentSchema<C> extends Required<Omit<RegisterComponentSchemaInput<C>, "props">> {
330
+ /**
331
+ * Accepted shapes for {@link RegisterComponentSchemaInput.layerIcon}. The template-literal
332
+ * members are editor hints only — the trailing `string` keeps any value assignable (imported
333
+ * SVG vars, relative paths, xml-prolog SVGs), and the real validation happens at runtime.
334
+ */
335
+ type LayerIcon = `<svg${string}` | `<?xml${string}` | `http://${string}` | `https://${string}` | `data:image/${string}` | `/${string}` | string;
336
+ interface RegisterComponentSchema<C> extends Required<Omit<RegisterComponentSchemaInput<C>, "props" | "layerIcon">> {
252
337
  registry: Registry;
338
+ layerIcon?: LayerIcon;
253
339
  sections: string[];
254
340
  styles: {
255
341
  [styleGroup: string]: Required<StyleGroupOptions>;
@@ -338,11 +424,37 @@ declare class ComponentRegistry<C> {
338
424
  * @param componentsConfigs
339
425
  */
340
426
  registerSymbolComponent(componentsConfigs: RegisterInternalComponentOptionsInput<C>[]): void;
427
+ registerSectionComponent(componentsConfigs: RegisterInternalComponentOptionsInput<C>[]): void;
341
428
  /**
342
429
  * Registers one or more components in the component registry.
430
+ *
431
+ * By default, duplicate registrations (same `type` registered twice) are
432
+ * silently skipped — making the call **idempotent**. This is the desired
433
+ * behaviour under:
434
+ * - HMR re-evaluation (the same module runs twice in dev),
435
+ * - dual-bundle scenarios (RSC + client both pull in the registration
436
+ * module),
437
+ * - prod build workers (each worker may re-import the module),
438
+ * - test setup re-runs.
439
+ *
440
+ * The previous default — throwing on duplicate — forced every consumer to
441
+ * wrap the call in `try/catch` to absorb the throw, which had the side
442
+ * effect of masking real registration errors (typos in `type`, malformed
443
+ * schemas). Real errors now surface on the first call; duplicates no longer
444
+ * trip them up.
445
+ *
446
+ * Pass `{ strict: true }` to opt back into the old behaviour (throw on any
447
+ * duplicate). This is useful in tests that want to assert a clean
448
+ * registration boundary. `overrideDefaultComponents` on the registry config
449
+ * still wins over both — it lets a duplicate replace the existing entry.
450
+ *
343
451
  * @param components - An array of component options to register.
452
+ * @param options - Per-call registration options. `strict: true` reinstates
453
+ * the throw on duplicate.
344
454
  */
345
- registerComponents(components: RegisterComponentOptionsInput<C>[]): void;
455
+ registerComponents(components: RegisterComponentOptionsInput<C>[], options?: {
456
+ strict?: boolean;
457
+ }): void;
346
458
  /**
347
459
  * Retrieves an array of component registry values.
348
460
  *
@@ -441,18 +553,18 @@ declare class ComponentRegistry<C> {
441
553
  }
442
554
 
443
555
  /**
444
- * Gets the singleton ComponentRegistry instance.
445
- * Creates it if it doesn't exist yet.
556
+ * Singleton ComponentRegistry, backed by a versioned slot on `globalThis`.
446
557
  *
447
- * @returns The singleton ComponentRegistry instance
558
+ * The previous module-scoped `let instance` only existed within whichever
559
+ * module-graph evaluated this file. Under Next.js's dual RSC/client graph or
560
+ * across prod build workers, that meant two registries with no sharing —
561
+ * `fetchCompositionData` (server) could see an empty registry while
562
+ * `<StudioComponent>` (client) saw a populated one. See `common/global-store.ts`
563
+ * for the full reasoning.
448
564
  *
449
- * @example
450
- * ```typescript
451
- * import { getComponentRegistryInstance } from '@contentstack/studio-registry';
452
- *
453
- * const registry = getComponentRegistryInstance();
454
- * await registry.loadComponent('my-component');
455
- * ```
565
+ * After this change, all callers of `getComponentRegistryInstance()` resolve
566
+ * to the same `ComponentRegistry` instance within a single JS runtime,
567
+ * regardless of which graph or worker they were evaluated in.
456
568
  */
457
569
  declare function getComponentRegistryInstance(): ComponentRegistry<any>;
458
570
  /**
@@ -756,6 +868,28 @@ declare class DesignRegistry {
756
868
  updateClasses(classes: DesignClasses[]): void;
757
869
  }
758
870
 
871
+ /**
872
+ * Singleton DesignRegistry, backed by a versioned slot on `globalThis`.
873
+ *
874
+ * Previously, `studio-react/src/composable-studio/sdk.ts` did
875
+ * `export const designRegistry = new DesignRegistry()` at module scope — which
876
+ * means every separate module-graph (RSC vs client, build workers) got its own
877
+ * `DesignRegistry`. Design tokens registered on one side were invisible to the
878
+ * other. See `common/global-store.ts` for the dual-graph background.
879
+ *
880
+ * After this change, all callers of `getDesignRegistryInstance()` resolve to
881
+ * the same `DesignRegistry` within a single JS runtime.
882
+ */
883
+ declare function getDesignRegistryInstance(): DesignRegistry;
884
+ /**
885
+ * Resets the singleton instance. For tests only.
886
+ */
887
+ declare function resetDesignRegistryInstance(): void;
888
+ /**
889
+ * Checks if the singleton instance has been created.
890
+ */
891
+ declare function hasDesignRegistryInstance(): boolean;
892
+
759
893
  declare function getDesignClassesNames<C extends DesignClassesInput[]>(classes: C): DesignClassesNames<C>;
760
894
 
761
895
  declare const DEFAULT_DESIGN_TOKENS: {
@@ -1164,10 +1298,26 @@ interface DataSources {
1164
1298
  contentstack?: any;
1165
1299
  [source: string]: any;
1166
1300
  }
1301
+ interface SectionScopedDataSources {
1302
+ template: unknown;
1303
+ contentstack: Record<string, any>;
1304
+ contentstack_queries: Record<string, any>;
1305
+ static_value?: Record<string, unknown>;
1306
+ page: DataSources;
1307
+ repeater?: Record<string, {
1308
+ context: unknown;
1309
+ }>;
1310
+ parentRepeaterUID?: string | null;
1311
+ selectedField?: string;
1312
+ uidRemapping?: Record<string, string>;
1313
+ componentPropsFallback?: Record<string, unknown>;
1314
+ }
1167
1315
  interface StudioSpecData {
1168
1316
  dataSources: DataSources;
1169
1317
  static_value: StaticValue;
1170
1318
  symbol_props?: Record<string, any>;
1319
+ component_props?: Record<string, any>;
1320
+ section_scoped_data?: Record<string, SectionScopedDataSources>;
1171
1321
  }
1172
1322
  interface ComposableStudioData extends StudioSpecData {
1173
1323
  component_props: Record<string, any> | undefined;
@@ -1179,6 +1329,12 @@ interface StaticValueItem<T> {
1179
1329
  }
1180
1330
  type RawStaticValue = {
1181
1331
  text?: Array<StaticValueItem<string>>;
1332
+ /**
1333
+ * COMS-1035: text-node content props use the `plaintext` prop type and
1334
+ * persist their authored static value under this `plaintext` schema key
1335
+ * (was `text` before the migration).
1336
+ */
1337
+ plaintext?: Array<StaticValueItem<string>>;
1182
1338
  /**
1183
1339
  * NOTE: We are storing the Markdown value in the html_rte field.
1184
1340
  * Earlier we used to store the HTML Values, here we are storing the Markdown Values.
@@ -1229,6 +1385,21 @@ type PlaceHolders<T> = PartialRecord<PropType, (placeholder?: string) => T>;
1229
1385
  * @throws {Error} - Throws an error if the prop type does not match the component registry or if the type is not handled.
1230
1386
  */
1231
1387
 
1388
+ /**
1389
+ * Retract every binding-mismatch error previously reported for `nodeUid`'s
1390
+ * props and forget them.
1391
+ *
1392
+ * The in-render retraction in `retrievePropValue` only clears the editor badge
1393
+ * when the SAME node re-renders with matching data — which never happens once
1394
+ * the node disappears (e.g. a repeater item removed, or a section swapped for a
1395
+ * different schema). Without this, such a node's badge would latch and its
1396
+ * entry would leak in `reportedBindingErrors` forever. Call this from the
1397
+ * node's unmount path so the badge reflects the live tree.
1398
+ *
1399
+ * Keys are `${nodeUid}-${field}`; the trailing `-` (and fixed-length uids)
1400
+ * makes the prefix match exact, so one node's uid can't match another's.
1401
+ */
1402
+ declare function clearReportedBindingErrorsForNode(nodeUid: string): void;
1232
1403
  type CommonNodeProps<T> = T & {
1233
1404
  binding?: string;
1234
1405
  placeholder?: string;
@@ -1322,5 +1493,40 @@ declare class BreakpointRegistry {
1322
1493
  declare const getSymbolUIDFromNode: (symbol: Node) => string;
1323
1494
  declare const getSymbolUIDFromUID: (uid: string) => string;
1324
1495
 
1325
- export { ALLOWED_DESIGN_VALUES_LEVELS, BUILT_IN_COMPONENTS, BreakpointRegistry, ComponentRegistry, DATA_SOURCES, DATA_SOURCES_PREFIX, DEFAULT_DESIGN_TOKENS, DesignRegistry, INTERNAL_COMPONENTS_NAMES, INTERNAL_COMPONENT_SECTIONS, INTERNAL_SECTIONS, JSONRTERegistry, STYLE_SECTIONS_OPTIONS, STYLE_SECTION_CATEGORIES, SYSTEM_COMPONENTS, convertBindingPath, getBindingString, getComponentRegistryInstance, getCslpPath, getCslpTag, getDataType, getDefaultPropStaticValue, getDesignClassesNames, getFlattenedData, getPlaceHolderComponent, getRepeaterBinding, getRepeaterContextPath, getSlotData, getSymbolUIDFromNode, getSymbolUIDFromUID, hasComponentRegistryInstance, isDataMatchingPropType, isKnownType, normalizeSingleSelectChoiceValue, resetComponentRegistryInstance, resolveMetadataBindings, retrievePropValue };
1326
- export type { AllowedDesignValues, AllowedDesignValuesLevel, AnyProp, ArrayProp, BooleanProp, Breakpoint, BreakpointInput, CSBindingPath, CSDataSources, ChoiceProp, ComponentRegistryOptions, ComponentType, ComposableStudioData, ContentstackBindingValue, CssVariablesToDesignTokens, CssVariablesToValue, DataSourceItem, DataSources, DateStringProp, DefaultBreakpoint, DesignClassValue, DesignClasses, DesignClassesInput, DesignClassesNames, DesignTokenCssVariable, DesignTokens, DesignTokensInput, DesignTokensInputKeys, DesignTokensOptions, DesignTokensOptionsInput, GetSlots, GetSlotsParams, GlobalDesignTokens, HrefProp, ICSEntryReference, ImageUrlProp, InternalComponentRegistryOptions, JSONRTERegistryOptions, JsonRTEProp, LengthToken, NodeProps, NumberProp, ObjectInput, ObjectProp, PlaceHolders, PreProcessedBreakpoint, PreProcessedDesignTokenInput, PropBase, PropInput, PropType, PropTypeOfNoOptionsRequired, PropValidator, Props, PropsWithNoOptionsRequired, RawStaticValue, RegisterComponentOptionsInput, RegisterComponentSchema, RegisterComponentSchemaInput, RegisterInternalComponentOptionsInput, Registry, RepeaterBindingValue, SectionDesignTokens, SlotProp, StaticValue, StaticValueItem, StaticValueUid, StringProp, StudioSpecData, StyleGroupOptions, StyleSectionCategoriesOptions, StyleSectionOptions, StyleSections, TemplateBindingValue };
1496
+ /**
1497
+ * Extracts the composition UID from a section-composition node's metadata.
1498
+ * Used to resolve section references to their actual composition identifiers.
1499
+ *
1500
+ * @param section - The section node containing metadata
1501
+ * @returns The composition UID or undefined if not present
1502
+ */
1503
+ declare const getSectionUIDFromNode: (section: Node) => any;
1504
+
1505
+ /**
1506
+ * Shape of the slot we own on globalThis. Each field is lazily initialized by
1507
+ * the corresponding `get*Instance()` helper; storing `null` keeps the slot
1508
+ * type-stable while letting each consumer create its instance on first access.
1509
+ */
1510
+ interface GlobalStudioStore {
1511
+ componentRegistry: unknown | null;
1512
+ designRegistry: unknown | null;
1513
+ breakpointManager: unknown | null;
1514
+ }
1515
+ /**
1516
+ * Returns the SDK's versioned slot on globalThis, creating it on first call.
1517
+ * Always returns the same object reference within a single JS runtime.
1518
+ *
1519
+ * Type-erased on purpose: each registry singleton casts to its own type on
1520
+ * read/write so the public API of `studio-registry` stays free of cross-
1521
+ * package import dependencies (e.g. `BreakpointManager` lives in
1522
+ * `studio-client`).
1523
+ */
1524
+ declare function getGlobalStudioStore(): GlobalStudioStore;
1525
+ /**
1526
+ * Clears the entire store. For tests only. Production code should never call
1527
+ * this — it would orphan every existing reference to the previous instances.
1528
+ */
1529
+ declare function resetGlobalStudioStore(): void;
1530
+
1531
+ export { ALLOWED_DESIGN_VALUES_LEVELS, BUILT_IN_COMPONENTS, BreakpointRegistry, ComponentRegistry, DATA_SOURCES, DATA_SOURCES_PREFIX, DEFAULT_DESIGN_TOKENS, DesignRegistry, INTERNAL_COMPONENTS_NAMES, INTERNAL_COMPONENT_SECTIONS, INTERNAL_SECTIONS, JSONRTERegistry, STYLE_SECTIONS_OPTIONS, STYLE_SECTION_CATEGORIES, SYSTEM_COMPONENTS, clearReportedBindingErrorsForNode, convertBindingPath, getBindingString, getComponentRegistryInstance, getCslpPath, getCslpTag, getDataType, getDefaultPropStaticValue, getDesignClassesNames, getDesignRegistryInstance, getFlattenedData, getGlobalStudioStore, getPlaceHolderComponent, getRepeaterBinding, getRepeaterContextPath, getSectionUIDFromNode, getSlotData, getSymbolUIDFromNode, getSymbolUIDFromUID, hasComponentRegistryInstance, hasDesignRegistryInstance, isDataMatchingPropType, isKnownType, normalizeSingleSelectChoiceValue, resetComponentRegistryInstance, resetDesignRegistryInstance, resetGlobalStudioStore, resolveMetadataBindings, retrievePropValue };
1532
+ export type { AllowedDesignValues, AllowedDesignValuesLevel, AnyProp, ArrayProp, BooleanProp, Breakpoint, BreakpointInput, CSBindingPath, CSDataSources, ChoiceProp, ComponentRegistryOptions, ComponentType, ComposableStudioData, ContentstackBindingValue, CssVariablesToDesignTokens, CssVariablesToValue, DataSourceItem, DataSources, DateStringProp, DefaultBreakpoint, DesignClassValue, DesignClasses, DesignClassesInput, DesignClassesNames, DesignTokenCssVariable, DesignTokens, DesignTokensInput, DesignTokensInputKeys, DesignTokensOptions, DesignTokensOptionsInput, GetSlots, GetSlotsParams, GlobalDesignTokens, GlobalStudioStore, HrefProp, ICSEntryReference, ImageUrlProp, InternalComponentRegistryOptions, JSONRTERegistryOptions, JsonRTEProp, LayerIcon, LengthToken, MultiChoiceProp, NodeProps, NumberProp, ObjectInput, ObjectProp, PlaceHolders, PlainTextProp, PreProcessedBreakpoint, PreProcessedDesignTokenInput, PropBase, PropInput, PropType, PropTypeOfNoOptionsRequired, PropValidator, Props, PropsWithNoOptionsRequired, RawStaticValue, RegisterComponentOptionsInput, RegisterComponentSchema, RegisterComponentSchemaInput, RegisterInternalComponentOptionsInput, Registry, RepeaterBindingValue, SectionDesignTokens, SectionScopedDataSources, SingleChoiceProp, SlotProp, StaticValue, StaticValueItem, StaticValueUid, StringProp, StudioSpecData, StyleGroupOptions, StyleSectionCategoriesOptions, StyleSectionOptions, StyleSections, TemplateBindingValue };
package/dist/esm/index.js CHANGED
@@ -2,12 +2,15 @@ export { ComponentRegistry } from './component-registry/registry.js';
2
2
  export { BUILT_IN_COMPONENTS, DATA_SOURCES, DATA_SOURCES_PREFIX, INTERNAL_COMPONENTS_NAMES, INTERNAL_COMPONENT_SECTIONS, INTERNAL_SECTIONS, STYLE_SECTIONS_OPTIONS, STYLE_SECTION_CATEGORIES, SYSTEM_COMPONENTS } from './component-registry/registry.constant.js';
3
3
  export { getComponentRegistryInstance, hasComponentRegistryInstance, resetComponentRegistryInstance } from './component-registry/singleton.js';
4
4
  export { DesignRegistry } from './design-registry/design-registry.js';
5
+ export { getDesignRegistryInstance, hasDesignRegistryInstance, resetDesignRegistryInstance } from './design-registry/singleton.js';
5
6
  export { getDesignClassesNames } from './design-registry/design-classes.js';
6
7
  export { ALLOWED_DESIGN_VALUES_LEVELS, DEFAULT_DESIGN_TOKENS } from './design-registry/constants.js';
7
8
  export { JSONRTERegistry } from './json-rte-registry/index.js';
8
- export { retrievePropValue } from './data-binder/retrieve-data.js';
9
+ export { clearReportedBindingErrorsForNode, retrievePropValue } from './data-binder/retrieve-data.js';
9
10
  export { convertBindingPath, getBindingString, getDataType, getDefaultPropStaticValue, getFlattenedData, getPlaceHolderComponent, getRepeaterContextPath, getSlotData, isDataMatchingPropType, isKnownType, normalizeSingleSelectChoiceValue, resolveMetadataBindings } from './data-binder/retrieve-data.util.js';
10
11
  export { getCslpPath, getCslpTag, getRepeaterBinding } from './data-binder/cslp.js';
11
12
  export { BreakpointRegistry } from './breakpoint-registry/index.js';
12
13
  export { getSymbolUIDFromNode, getSymbolUIDFromUID } from './utils/symbols.js';
14
+ export { getSectionUIDFromNode } from './utils/sections.js';
15
+ export { getGlobalStudioStore, resetGlobalStudioStore } from './common/global-store.js';
13
16
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Extracts the composition UID from a section-composition node's metadata.
3
+ * Used to resolve section references to their actual composition identifiers.
4
+ *
5
+ * @param section - The section node containing metadata
6
+ * @returns The composition UID or undefined if not present
7
+ */
8
+ const getSectionUIDFromNode = (section) => {
9
+ return section.metadata?.compositionUID;
10
+ };
11
+
12
+ export { getSectionUIDFromNode };
13
+ //# sourceMappingURL=sections.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sections.js","sources":["../../../src/utils/sections.ts"],"sourcesContent":[null],"names":[],"mappings":"AAEA;;;;;;AAMG;AACI,MAAM,qBAAqB,GAAG,CAAC,OAAa,KAAI;AACrD,IAAA,OAAO,OAAO,CAAC,QAAQ,EAAE,cAAc;AACzC;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentstack/studio-registry",
3
- "version": "1.5.0",
3
+ "version": "1.6.1",
4
4
  "description": "This package houses all the registry related to the visual builder",
5
5
  "main": "dist/cjs/index.cjs",
6
6
  "module": "dist/esm/index.js",
@@ -15,8 +15,8 @@
15
15
  "dist"
16
16
  ],
17
17
  "devDependencies": {
18
- "@contentstack/common-config": "^1.1.8",
19
- "@contentstack/studio-internal": "^1.2.2",
18
+ "@contentstack/common-config": "^1.2.1",
19
+ "@contentstack/studio-internal": "^1.3.1",
20
20
  "@rollup/plugin-commonjs": "^28.0.6",
21
21
  "@rollup/plugin-node-resolve": "^16.0.1",
22
22
  "@rollup/plugin-terser": "^1.0.0",
@@ -52,14 +52,11 @@
52
52
  "author": "Contentstack",
53
53
  "license": "MIT",
54
54
  "dependencies": {
55
- "@contentstack/json-rte-serializer": "^3.0.5",
56
- "@contentstack/studio-message-types": "^1.2.2",
57
- "@contentstack/studio-messenger": "^1.4.0",
55
+ "@contentstack/json-rte-serializer": "^3.1.0",
56
+ "@contentstack/studio-message-types": "^1.3.1",
57
+ "@contentstack/studio-messenger": "^1.5.1",
58
58
  "csstype": "^3.1.3",
59
59
  "lodash-es": "^4.18.1"
60
60
  },
61
- "publishConfig": {
62
- "access": "public"
63
- },
64
- "gitHead": "1877b45f4a73ffb0c570ea06c197ba95504c014a"
61
+ "gitHead": "27539dc404d9358c9aa334ccbe6cd98e0405c205"
65
62
  }