@contentstack/studio-registry 1.4.0 → 1.4.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.
- package/dist/cjs/index.cjs +534 -51
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/common/global-store.js +49 -0
- package/dist/esm/common/global-store.js.map +1 -0
- package/dist/esm/component-registry/registry-options-processor.js +27 -0
- package/dist/esm/component-registry/registry-options-processor.js.map +1 -1
- package/dist/esm/component-registry/registry.constant.js +7 -0
- package/dist/esm/component-registry/registry.constant.js.map +1 -1
- package/dist/esm/component-registry/registry.js +224 -9
- package/dist/esm/component-registry/registry.js.map +1 -1
- package/dist/esm/component-registry/singleton.js +51 -0
- package/dist/esm/component-registry/singleton.js.map +1 -0
- package/dist/esm/data-binder/retrieve-data.js +87 -17
- package/dist/esm/data-binder/retrieve-data.js.map +1 -1
- package/dist/esm/data-binder/retrieve-data.util.js +23 -4
- package/dist/esm/data-binder/retrieve-data.util.js.map +1 -1
- package/dist/esm/design-registry/singleton.js +37 -0
- package/dist/esm/design-registry/singleton.js.map +1 -0
- package/dist/esm/index.d.ts +232 -5
- package/dist/esm/index.js +5 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/utils/sections.js +13 -0
- package/dist/esm/utils/sections.js.map +1 -0
- package/package.json +8 -8
package/dist/esm/index.d.ts
CHANGED
|
@@ -50,7 +50,24 @@ type ImageUrlProp = PropBase<NodePropTypes["imageurl"], string>;
|
|
|
50
50
|
type ObjectProp = PropBase<NodePropTypes["object"], Record<string, unknown>> & {
|
|
51
51
|
properties: Props;
|
|
52
52
|
};
|
|
53
|
-
type SlotProp = PropBase<NodePropTypes["slot"], Node[]
|
|
53
|
+
type SlotProp = PropBase<NodePropTypes["slot"], Node[]> & {
|
|
54
|
+
/**
|
|
55
|
+
* References a `NumberProp` by name that controls how many children this slot holds.
|
|
56
|
+
* When the linked number prop value changes, slot children are automatically
|
|
57
|
+
* added or removed to match the count.
|
|
58
|
+
*/
|
|
59
|
+
countProp?: string;
|
|
60
|
+
/**
|
|
61
|
+
* Factory function that creates a new child node when the slot needs to grow.
|
|
62
|
+
* Required when `countProp` is specified.
|
|
63
|
+
*/
|
|
64
|
+
itemFactory?: () => Node;
|
|
65
|
+
/**
|
|
66
|
+
* Pre-computed serializable node template, generated from `itemFactory` during registration.
|
|
67
|
+
* Used by composable-studio to create new slot children across the postMessage boundary.
|
|
68
|
+
*/
|
|
69
|
+
itemTemplate?: Node;
|
|
70
|
+
};
|
|
54
71
|
type ChoiceProp = PropBase<NodePropTypes["choice"], string[]> & {
|
|
55
72
|
options: string[] | {
|
|
56
73
|
value: string | number | boolean;
|
|
@@ -109,8 +126,9 @@ declare const INTERNAL_COMPONENT_SECTIONS: {
|
|
|
109
126
|
readonly REGISTERED_COMPONENTS: "Registered Components";
|
|
110
127
|
readonly HTML_ELEMENT: "HTML Elements";
|
|
111
128
|
readonly SYMBOL: "Symbols";
|
|
129
|
+
readonly SECTION_COMPOSITION: "Sections";
|
|
112
130
|
};
|
|
113
|
-
declare const INTERNAL_SECTIONS: ("Basic" | "Media" | "Container" | "Smart Containers" | "Advanced" | "Registered Components" | "HTML Elements" | "Symbols")[];
|
|
131
|
+
declare const INTERNAL_SECTIONS: ("Basic" | "Media" | "Container" | "Smart Containers" | "Advanced" | "Registered Components" | "HTML Elements" | "Symbols" | "Sections")[];
|
|
114
132
|
declare const STYLE_SECTIONS_OPTIONS: readonly ["class", "size", "spacing", "position", "visibility", "layout", "typography", "transform", "media", "background", "shadow", "effect", "overflow", "border", "responsive"];
|
|
115
133
|
/**
|
|
116
134
|
* The style group is the group of the style sections options.
|
|
@@ -127,6 +145,7 @@ declare const INTERNAL_COMPONENTS_NAMES: {
|
|
|
127
145
|
readonly LINK: "link";
|
|
128
146
|
readonly LINK_CONTAINER: "link-container";
|
|
129
147
|
readonly TEXT: "text";
|
|
148
|
+
readonly NUMBER: "number";
|
|
130
149
|
readonly BUTTON: "button";
|
|
131
150
|
readonly JSON_RTE: "json-rte";
|
|
132
151
|
readonly COLLAPSIBLE_TEXT: "collapsible-text";
|
|
@@ -142,6 +161,7 @@ declare const INTERNAL_COMPONENTS_NAMES: {
|
|
|
142
161
|
readonly CONDITION_BLOCK: "condition-block";
|
|
143
162
|
readonly SYMBOL: "symbol";
|
|
144
163
|
readonly FRAGMENT: "fragment";
|
|
164
|
+
readonly SECTION_SLOT: "section-slot";
|
|
145
165
|
readonly HTML_ELEMENT: "html-element";
|
|
146
166
|
readonly STYLE_SHEET: "style-sheet";
|
|
147
167
|
};
|
|
@@ -159,6 +179,7 @@ declare const BUILT_IN_COMPONENTS: {
|
|
|
159
179
|
readonly LINK: "link";
|
|
160
180
|
readonly LINK_CONTAINER: "link-container";
|
|
161
181
|
readonly TEXT: "text";
|
|
182
|
+
readonly NUMBER: "number";
|
|
162
183
|
readonly BUTTON: "button";
|
|
163
184
|
readonly JSON_RTE: "json-rte";
|
|
164
185
|
readonly COLLAPSIBLE_TEXT: "collapsible-text";
|
|
@@ -290,6 +311,9 @@ declare class ComponentRegistry<C> {
|
|
|
290
311
|
private componentRegistry;
|
|
291
312
|
private propValidatorRegistry;
|
|
292
313
|
private config;
|
|
314
|
+
private componentLoaders;
|
|
315
|
+
private loadedComponents;
|
|
316
|
+
private loadingPromises;
|
|
293
317
|
constructor(config?: ComponentRegistryOptions);
|
|
294
318
|
setConfig(config?: Partial<ComponentRegistryOptions>): void;
|
|
295
319
|
/**
|
|
@@ -316,11 +340,37 @@ declare class ComponentRegistry<C> {
|
|
|
316
340
|
* @param componentsConfigs
|
|
317
341
|
*/
|
|
318
342
|
registerSymbolComponent(componentsConfigs: RegisterInternalComponentOptionsInput<C>[]): void;
|
|
343
|
+
registerSectionComponent(componentsConfigs: RegisterInternalComponentOptionsInput<C>[]): void;
|
|
319
344
|
/**
|
|
320
345
|
* Registers one or more components in the component registry.
|
|
346
|
+
*
|
|
347
|
+
* By default, duplicate registrations (same `type` registered twice) are
|
|
348
|
+
* silently skipped — making the call **idempotent**. This is the desired
|
|
349
|
+
* behaviour under:
|
|
350
|
+
* - HMR re-evaluation (the same module runs twice in dev),
|
|
351
|
+
* - dual-bundle scenarios (RSC + client both pull in the registration
|
|
352
|
+
* module),
|
|
353
|
+
* - prod build workers (each worker may re-import the module),
|
|
354
|
+
* - test setup re-runs.
|
|
355
|
+
*
|
|
356
|
+
* The previous default — throwing on duplicate — forced every consumer to
|
|
357
|
+
* wrap the call in `try/catch` to absorb the throw, which had the side
|
|
358
|
+
* effect of masking real registration errors (typos in `type`, malformed
|
|
359
|
+
* schemas). Real errors now surface on the first call; duplicates no longer
|
|
360
|
+
* trip them up.
|
|
361
|
+
*
|
|
362
|
+
* Pass `{ strict: true }` to opt back into the old behaviour (throw on any
|
|
363
|
+
* duplicate). This is useful in tests that want to assert a clean
|
|
364
|
+
* registration boundary. `overrideDefaultComponents` on the registry config
|
|
365
|
+
* still wins over both — it lets a duplicate replace the existing entry.
|
|
366
|
+
*
|
|
321
367
|
* @param components - An array of component options to register.
|
|
368
|
+
* @param options - Per-call registration options. `strict: true` reinstates
|
|
369
|
+
* the throw on duplicate.
|
|
322
370
|
*/
|
|
323
|
-
registerComponents(components: RegisterComponentOptionsInput<C>[]
|
|
371
|
+
registerComponents(components: RegisterComponentOptionsInput<C>[], options?: {
|
|
372
|
+
strict?: boolean;
|
|
373
|
+
}): void;
|
|
324
374
|
/**
|
|
325
375
|
* Retrieves an array of component registry values.
|
|
326
376
|
*
|
|
@@ -355,8 +405,105 @@ declare class ComponentRegistry<C> {
|
|
|
355
405
|
unregisterComponent(node: Node | string): void;
|
|
356
406
|
validateProp<V>(componentName: string, propName: string, value: V): ReturnType<PropValidator<V>>;
|
|
357
407
|
getComponentName(node: Node): string;
|
|
408
|
+
/**
|
|
409
|
+
* Registers a lazy-loadable component with a loader function.
|
|
410
|
+
* The component will be loaded on-demand when needed.
|
|
411
|
+
*
|
|
412
|
+
* @param config - Component configuration without the component itself
|
|
413
|
+
* @param loader - Function that returns a Promise resolving to the component
|
|
414
|
+
* @param registryType - Type of registry (internal or user-defined), defaults to user-defined
|
|
415
|
+
*/
|
|
416
|
+
registerLazyComponent(config: Omit<RegisterComponentOptionsInput<C>, "component">, loader: () => Promise<C>, registryType?: Registry): void;
|
|
417
|
+
/**
|
|
418
|
+
* Loads a single component if it's registered as lazy and not yet loaded.
|
|
419
|
+
* Returns immediately if already loaded or not a lazy component.
|
|
420
|
+
*
|
|
421
|
+
* @param componentType - The type of component to load
|
|
422
|
+
* @returns Promise that resolves when the component is loaded
|
|
423
|
+
*/
|
|
424
|
+
loadComponent(componentType: string): Promise<void>;
|
|
425
|
+
/**
|
|
426
|
+
* Loads multiple components in parallel.
|
|
427
|
+
* Deduplicates requests and uses caching.
|
|
428
|
+
*
|
|
429
|
+
* @param componentTypes - Array of component types to load
|
|
430
|
+
* @returns Promise that resolves when all components are loaded
|
|
431
|
+
*/
|
|
432
|
+
loadComponents(componentTypes: string[]): Promise<void>;
|
|
433
|
+
/**
|
|
434
|
+
* Checks if a component is registered as lazy-loadable.
|
|
435
|
+
*
|
|
436
|
+
* @param componentType - The type of component to check
|
|
437
|
+
* @returns true if the component is lazy-loadable
|
|
438
|
+
*/
|
|
439
|
+
isLazyComponent(componentType: string): boolean;
|
|
440
|
+
/**
|
|
441
|
+
* Checks if a lazy component has been loaded.
|
|
442
|
+
*
|
|
443
|
+
* @param componentType - The type of component to check
|
|
444
|
+
* @returns true if the component has been loaded
|
|
445
|
+
*/
|
|
446
|
+
isComponentLoaded(componentType: string): boolean;
|
|
447
|
+
/**
|
|
448
|
+
* Checks if a component has a loader registered (lazy) or is already registered (eager).
|
|
449
|
+
* This is useful for SSR validation to ensure components are available before rendering.
|
|
450
|
+
*
|
|
451
|
+
* @param componentType - The type of component to check
|
|
452
|
+
* @returns true if the component has a loader or is registered
|
|
453
|
+
*/
|
|
454
|
+
hasComponentLoader(componentType: string): boolean;
|
|
455
|
+
/**
|
|
456
|
+
* Gets all component types that have loaders registered (lazy components).
|
|
457
|
+
* Useful for debugging and SSR setup validation.
|
|
458
|
+
*
|
|
459
|
+
* @returns Array of component types with lazy loaders
|
|
460
|
+
*/
|
|
461
|
+
getLazyComponentTypes(): string[];
|
|
462
|
+
/**
|
|
463
|
+
* Gets all registered component types (both lazy and eager).
|
|
464
|
+
* Useful for debugging and validation.
|
|
465
|
+
*
|
|
466
|
+
* @returns Array of all registered component types
|
|
467
|
+
*/
|
|
468
|
+
getAllComponentTypes(): string[];
|
|
358
469
|
}
|
|
359
470
|
|
|
471
|
+
/**
|
|
472
|
+
* Singleton ComponentRegistry, backed by a versioned slot on `globalThis`.
|
|
473
|
+
*
|
|
474
|
+
* The previous module-scoped `let instance` only existed within whichever
|
|
475
|
+
* module-graph evaluated this file. Under Next.js's dual RSC/client graph or
|
|
476
|
+
* across prod build workers, that meant two registries with no sharing —
|
|
477
|
+
* `fetchCompositionData` (server) could see an empty registry while
|
|
478
|
+
* `<StudioComponent>` (client) saw a populated one. See `common/global-store.ts`
|
|
479
|
+
* for the full reasoning.
|
|
480
|
+
*
|
|
481
|
+
* After this change, all callers of `getComponentRegistryInstance()` resolve
|
|
482
|
+
* to the same `ComponentRegistry` instance within a single JS runtime,
|
|
483
|
+
* regardless of which graph or worker they were evaluated in.
|
|
484
|
+
*/
|
|
485
|
+
declare function getComponentRegistryInstance(): ComponentRegistry<any>;
|
|
486
|
+
/**
|
|
487
|
+
* Resets the singleton instance.
|
|
488
|
+
* Primarily useful for testing to ensure a clean state between tests.
|
|
489
|
+
*
|
|
490
|
+
* @example
|
|
491
|
+
* ```typescript
|
|
492
|
+
* import { resetComponentRegistryInstance } from '@contentstack/studio-registry';
|
|
493
|
+
*
|
|
494
|
+
* beforeEach(() => {
|
|
495
|
+
* resetComponentRegistryInstance();
|
|
496
|
+
* });
|
|
497
|
+
* ```
|
|
498
|
+
*/
|
|
499
|
+
declare function resetComponentRegistryInstance(): void;
|
|
500
|
+
/**
|
|
501
|
+
* Checks if the singleton instance has been created.
|
|
502
|
+
*
|
|
503
|
+
* @returns true if the instance exists, false otherwise
|
|
504
|
+
*/
|
|
505
|
+
declare function hasComponentRegistryInstance(): boolean;
|
|
506
|
+
|
|
360
507
|
type DesignTokensInput = Partial<SectionDesignTokens> & Partial<GlobalDesignTokens>;
|
|
361
508
|
type DesignTokensInputKeys = keyof DesignTokensInput;
|
|
362
509
|
type GlobalDesignTokens = {
|
|
@@ -637,6 +784,28 @@ declare class DesignRegistry {
|
|
|
637
784
|
updateClasses(classes: DesignClasses[]): void;
|
|
638
785
|
}
|
|
639
786
|
|
|
787
|
+
/**
|
|
788
|
+
* Singleton DesignRegistry, backed by a versioned slot on `globalThis`.
|
|
789
|
+
*
|
|
790
|
+
* Previously, `studio-react/src/composable-studio/sdk.ts` did
|
|
791
|
+
* `export const designRegistry = new DesignRegistry()` at module scope — which
|
|
792
|
+
* means every separate module-graph (RSC vs client, build workers) got its own
|
|
793
|
+
* `DesignRegistry`. Design tokens registered on one side were invisible to the
|
|
794
|
+
* other. See `common/global-store.ts` for the dual-graph background.
|
|
795
|
+
*
|
|
796
|
+
* After this change, all callers of `getDesignRegistryInstance()` resolve to
|
|
797
|
+
* the same `DesignRegistry` within a single JS runtime.
|
|
798
|
+
*/
|
|
799
|
+
declare function getDesignRegistryInstance(): DesignRegistry;
|
|
800
|
+
/**
|
|
801
|
+
* Resets the singleton instance. For tests only.
|
|
802
|
+
*/
|
|
803
|
+
declare function resetDesignRegistryInstance(): void;
|
|
804
|
+
/**
|
|
805
|
+
* Checks if the singleton instance has been created.
|
|
806
|
+
*/
|
|
807
|
+
declare function hasDesignRegistryInstance(): boolean;
|
|
808
|
+
|
|
640
809
|
declare function getDesignClassesNames<C extends DesignClassesInput[]>(classes: C): DesignClassesNames<C>;
|
|
641
810
|
|
|
642
811
|
declare const DEFAULT_DESIGN_TOKENS: {
|
|
@@ -1045,10 +1214,26 @@ interface DataSources {
|
|
|
1045
1214
|
contentstack?: any;
|
|
1046
1215
|
[source: string]: any;
|
|
1047
1216
|
}
|
|
1217
|
+
interface SectionScopedDataSources {
|
|
1218
|
+
template: unknown;
|
|
1219
|
+
contentstack: Record<string, any>;
|
|
1220
|
+
contentstack_queries: Record<string, any>;
|
|
1221
|
+
static_value?: Record<string, unknown>;
|
|
1222
|
+
page: DataSources;
|
|
1223
|
+
repeater?: Record<string, {
|
|
1224
|
+
context: unknown;
|
|
1225
|
+
}>;
|
|
1226
|
+
parentRepeaterUID?: string | null;
|
|
1227
|
+
selectedField?: string;
|
|
1228
|
+
uidRemapping?: Record<string, string>;
|
|
1229
|
+
componentPropsFallback?: Record<string, unknown>;
|
|
1230
|
+
}
|
|
1048
1231
|
interface StudioSpecData {
|
|
1049
1232
|
dataSources: DataSources;
|
|
1050
1233
|
static_value: StaticValue;
|
|
1051
1234
|
symbol_props?: Record<string, any>;
|
|
1235
|
+
component_props?: Record<string, any>;
|
|
1236
|
+
section_scoped_data?: Record<string, SectionScopedDataSources>;
|
|
1052
1237
|
}
|
|
1053
1238
|
interface ComposableStudioData extends StudioSpecData {
|
|
1054
1239
|
component_props: Record<string, any> | undefined;
|
|
@@ -1145,9 +1330,16 @@ declare function getDefaultPropStaticValue<K extends BindableNodePropType>(args:
|
|
|
1145
1330
|
declare function isKnownType(type: string): type is PropType;
|
|
1146
1331
|
declare function getSlotData<T>({ nodeProps, field, node, getSlots, }: GetSlotDataArgs<T>): T | null;
|
|
1147
1332
|
declare function getPlaceHolderComponent<T>(placeholders: PlaceHolders<T>, prop: PropInput, type: BindableNodePropType): any;
|
|
1333
|
+
|
|
1148
1334
|
declare const getBindingString: (binding: BindingType) => string;
|
|
1149
1335
|
declare const convertBindingPath: (bindingType: string, path: string) => string | string[];
|
|
1150
1336
|
declare const getFlattenedData: (data: any) => any;
|
|
1337
|
+
/**
|
|
1338
|
+
* Composition/static data often stores single-select choice as `string[]` (one element).
|
|
1339
|
+
* `isDataMatchingPropType` treats `choice` as a `string` or `string[]` (multi-select);
|
|
1340
|
+
* single-select stored as `string[]` must still be unwrapped here before the type-mismatch fallback.
|
|
1341
|
+
*/
|
|
1342
|
+
declare function normalizeSingleSelectChoiceValue(resolvedData: unknown, prop: PropInput): unknown;
|
|
1151
1343
|
declare const resolveMetadataBindings: (node: Node, data: ComposableStudioData) => void;
|
|
1152
1344
|
declare const getRepeaterContextPath: (binding: RepeaterBindingValue) => string;
|
|
1153
1345
|
declare function isDataMatchingPropType(data: unknown, type: BindableNodePropType): boolean;
|
|
@@ -1196,5 +1388,40 @@ declare class BreakpointRegistry {
|
|
|
1196
1388
|
declare const getSymbolUIDFromNode: (symbol: Node) => string;
|
|
1197
1389
|
declare const getSymbolUIDFromUID: (uid: string) => string;
|
|
1198
1390
|
|
|
1199
|
-
|
|
1200
|
-
|
|
1391
|
+
/**
|
|
1392
|
+
* Extracts the composition UID from a section-composition node's metadata.
|
|
1393
|
+
* Used to resolve section references to their actual composition identifiers.
|
|
1394
|
+
*
|
|
1395
|
+
* @param section - The section node containing metadata
|
|
1396
|
+
* @returns The composition UID or undefined if not present
|
|
1397
|
+
*/
|
|
1398
|
+
declare const getSectionUIDFromNode: (section: Node) => any;
|
|
1399
|
+
|
|
1400
|
+
/**
|
|
1401
|
+
* Shape of the slot we own on globalThis. Each field is lazily initialized by
|
|
1402
|
+
* the corresponding `get*Instance()` helper; storing `null` keeps the slot
|
|
1403
|
+
* type-stable while letting each consumer create its instance on first access.
|
|
1404
|
+
*/
|
|
1405
|
+
interface GlobalStudioStore {
|
|
1406
|
+
componentRegistry: unknown | null;
|
|
1407
|
+
designRegistry: unknown | null;
|
|
1408
|
+
breakpointManager: unknown | null;
|
|
1409
|
+
}
|
|
1410
|
+
/**
|
|
1411
|
+
* Returns the SDK's versioned slot on globalThis, creating it on first call.
|
|
1412
|
+
* Always returns the same object reference within a single JS runtime.
|
|
1413
|
+
*
|
|
1414
|
+
* Type-erased on purpose: each registry singleton casts to its own type on
|
|
1415
|
+
* read/write so the public API of `studio-registry` stays free of cross-
|
|
1416
|
+
* package import dependencies (e.g. `BreakpointManager` lives in
|
|
1417
|
+
* `studio-client`).
|
|
1418
|
+
*/
|
|
1419
|
+
declare function getGlobalStudioStore(): GlobalStudioStore;
|
|
1420
|
+
/**
|
|
1421
|
+
* Clears the entire store. For tests only. Production code should never call
|
|
1422
|
+
* this — it would orphan every existing reference to the previous instances.
|
|
1423
|
+
*/
|
|
1424
|
+
declare function resetGlobalStudioStore(): void;
|
|
1425
|
+
|
|
1426
|
+
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, getDesignRegistryInstance, getFlattenedData, getGlobalStudioStore, getPlaceHolderComponent, getRepeaterBinding, getRepeaterContextPath, getSectionUIDFromNode, getSlotData, getSymbolUIDFromNode, getSymbolUIDFromUID, hasComponentRegistryInstance, hasDesignRegistryInstance, isDataMatchingPropType, isKnownType, normalizeSingleSelectChoiceValue, resetComponentRegistryInstance, resetDesignRegistryInstance, resetGlobalStudioStore, resolveMetadataBindings, retrievePropValue };
|
|
1427
|
+
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, LengthToken, NodeProps, NumberProp, ObjectInput, ObjectProp, PlaceHolders, PreProcessedBreakpoint, PreProcessedDesignTokenInput, PropBase, PropInput, PropType, PropTypeOfNoOptionsRequired, PropValidator, Props, PropsWithNoOptionsRequired, RawStaticValue, RegisterComponentOptionsInput, RegisterComponentSchema, RegisterComponentSchemaInput, RegisterInternalComponentOptionsInput, Registry, RepeaterBindingValue, SectionDesignTokens, SectionScopedDataSources, SlotProp, StaticValue, StaticValueItem, StaticValueUid, StringProp, StudioSpecData, StyleGroupOptions, StyleSectionCategoriesOptions, StyleSectionOptions, StyleSections, TemplateBindingValue };
|
package/dist/esm/index.js
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
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
|
+
export { getComponentRegistryInstance, hasComponentRegistryInstance, resetComponentRegistryInstance } from './component-registry/singleton.js';
|
|
3
4
|
export { DesignRegistry } from './design-registry/design-registry.js';
|
|
5
|
+
export { getDesignRegistryInstance, hasDesignRegistryInstance, resetDesignRegistryInstance } from './design-registry/singleton.js';
|
|
4
6
|
export { getDesignClassesNames } from './design-registry/design-classes.js';
|
|
5
7
|
export { ALLOWED_DESIGN_VALUES_LEVELS, DEFAULT_DESIGN_TOKENS } from './design-registry/constants.js';
|
|
6
8
|
export { JSONRTERegistry } from './json-rte-registry/index.js';
|
|
7
9
|
export { retrievePropValue } from './data-binder/retrieve-data.js';
|
|
8
|
-
export { convertBindingPath, getBindingString, getDataType, getDefaultPropStaticValue, getFlattenedData, getPlaceHolderComponent, getRepeaterContextPath, getSlotData, isDataMatchingPropType, isKnownType, resolveMetadataBindings } from './data-binder/retrieve-data.util.js';
|
|
10
|
+
export { convertBindingPath, getBindingString, getDataType, getDefaultPropStaticValue, getFlattenedData, getPlaceHolderComponent, getRepeaterContextPath, getSlotData, isDataMatchingPropType, isKnownType, normalizeSingleSelectChoiceValue, resolveMetadataBindings } from './data-binder/retrieve-data.util.js';
|
|
9
11
|
export { getCslpPath, getCslpTag, getRepeaterBinding } from './data-binder/cslp.js';
|
|
10
12
|
export { BreakpointRegistry } from './breakpoint-registry/index.js';
|
|
11
13
|
export { getSymbolUIDFromNode, getSymbolUIDFromUID } from './utils/symbols.js';
|
|
14
|
+
export { getSectionUIDFromNode } from './utils/sections.js';
|
|
15
|
+
export { getGlobalStudioStore, resetGlobalStudioStore } from './common/global-store.js';
|
|
12
16
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -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.4.
|
|
3
|
+
"version": "1.4.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,13 +15,13 @@
|
|
|
15
15
|
"dist"
|
|
16
16
|
],
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@contentstack/common-config": "^1.1.
|
|
19
|
-
"@contentstack/studio-internal": "^1.2.
|
|
18
|
+
"@contentstack/common-config": "^1.1.7",
|
|
19
|
+
"@contentstack/studio-internal": "^1.2.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",
|
|
23
23
|
"@rollup/plugin-typescript": "^12.1.4",
|
|
24
|
-
"happy-dom": "^20.
|
|
24
|
+
"happy-dom": "^20.8.9",
|
|
25
25
|
"rollup": "^4.46.2",
|
|
26
26
|
"rollup-plugin-dts": "^6.2.1",
|
|
27
27
|
"rollup-plugin-node-externals": "^8.0.1",
|
|
@@ -53,10 +53,10 @@
|
|
|
53
53
|
"license": "MIT",
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@contentstack/json-rte-serializer": "^3.0.4",
|
|
56
|
-
"@contentstack/studio-message-types": "^1.2.
|
|
57
|
-
"@contentstack/studio-messenger": "^1.3.
|
|
56
|
+
"@contentstack/studio-message-types": "^1.2.1",
|
|
57
|
+
"@contentstack/studio-messenger": "^1.3.1",
|
|
58
58
|
"csstype": "^3.1.3",
|
|
59
|
-
"lodash-es": "^4.
|
|
59
|
+
"lodash-es": "^4.18.1"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "d4e0a1d80b39a2bfa9ac12baa5d4d4a852f4b326"
|
|
62
62
|
}
|