@contentstack/studio-registry 0.1.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.
Files changed (35) hide show
  1. package/README.md +130 -0
  2. package/dist/cjs/index.cjs +5625 -0
  3. package/dist/cjs/index.cjs.map +1 -0
  4. package/dist/esm/breakpoint-registry/index.js +68 -0
  5. package/dist/esm/breakpoint-registry/index.js.map +1 -0
  6. package/dist/esm/component-registry/registry-options-processor.js +195 -0
  7. package/dist/esm/component-registry/registry-options-processor.js.map +1 -0
  8. package/dist/esm/component-registry/registry.constant.js +119 -0
  9. package/dist/esm/component-registry/registry.constant.js.map +1 -0
  10. package/dist/esm/component-registry/registry.js +245 -0
  11. package/dist/esm/component-registry/registry.js.map +1 -0
  12. package/dist/esm/data-binder/cslp.js +31 -0
  13. package/dist/esm/data-binder/cslp.js.map +1 -0
  14. package/dist/esm/data-binder/handle-binding-map.util.js +103 -0
  15. package/dist/esm/data-binder/handle-binding-map.util.js.map +1 -0
  16. package/dist/esm/data-binder/retrieve-data.js +146 -0
  17. package/dist/esm/data-binder/retrieve-data.js.map +1 -0
  18. package/dist/esm/data-binder/retrieve-data.util.js +177 -0
  19. package/dist/esm/data-binder/retrieve-data.util.js.map +1 -0
  20. package/dist/esm/design-registry/constants.js +386 -0
  21. package/dist/esm/design-registry/constants.js.map +1 -0
  22. package/dist/esm/design-registry/design-classes.js +36 -0
  23. package/dist/esm/design-registry/design-classes.js.map +1 -0
  24. package/dist/esm/design-registry/design-registry.js +87 -0
  25. package/dist/esm/design-registry/design-registry.js.map +1 -0
  26. package/dist/esm/design-registry/design-token.js +332 -0
  27. package/dist/esm/design-registry/design-token.js.map +1 -0
  28. package/dist/esm/index.d.ts +1196 -0
  29. package/dist/esm/index.js +12 -0
  30. package/dist/esm/index.js.map +1 -0
  31. package/dist/esm/json-rte-registry/index.js +18 -0
  32. package/dist/esm/json-rte-registry/index.js.map +1 -0
  33. package/dist/esm/utils/symbols.js +12 -0
  34. package/dist/esm/utils/symbols.js.map +1 -0
  35. package/package.json +62 -0
package/README.md ADDED
@@ -0,0 +1,130 @@
1
+ # Studio Registry
2
+
3
+ A comprehensive registry system for the Studio visual builder that manages components, design tokens, data binding, and breakpoints.
4
+
5
+ <details>
6
+ <summary>Table of Contents</summary>
7
+
8
+ - [Studio Registry](#studio-registry)
9
+ - [Overview](#overview)
10
+ - [Installation](#installation)
11
+ - [Features](#features)
12
+ - [Component Registry](#component-registry)
13
+ - [Design Registry](#design-registry)
14
+ - [Data Binder](#data-binder)
15
+ - [Breakpoint Registry](#breakpoint-registry)
16
+
17
+ </details>
18
+
19
+ # Overview
20
+
21
+ This package provides a centralized registry system for managing various aspects of the Studio visual builder:
22
+
23
+ - **Component Registry**: Register and manage React components with their properties and validation
24
+ - **Design Registry**: Handle design tokens, classes, and styling configurations
25
+ - **Data Binder**: Resolve data bindings and retrieve values from data sources
26
+ - **Breakpoint Registry**: Manage responsive breakpoints for components
27
+ - **JSON RTE Registry**: Handle rich text editor configurations
28
+
29
+ # Installation
30
+
31
+ ```bash
32
+ npm install @contentstack/studio-registry
33
+ ```
34
+
35
+ # Features
36
+
37
+ ## Component Registry
38
+
39
+ The component registry allows you to register React components with their properties, validation rules, and metadata.
40
+
41
+ ```typescript
42
+ import { ComponentRegistry } from '@contentstack/studio-registry';
43
+
44
+ const registry = new ComponentRegistry({
45
+ allowedBuiltInComponents: true,
46
+ overrideDefaultComponents: false,
47
+ debug: false
48
+ });
49
+
50
+ // Register a component
51
+ registry.registerComponents([
52
+ {
53
+ name: 'MyButton',
54
+ component: MyButtonComponent,
55
+ props: {
56
+ text: {
57
+ type: 'string',
58
+ defaultValue: 'Click me',
59
+ required: true
60
+ },
61
+ variant: {
62
+ type: 'choice',
63
+ choices: ['primary', 'secondary', 'outline'],
64
+ defaultValue: 'primary'
65
+ }
66
+ }
67
+ }
68
+ ]);
69
+ ```
70
+
71
+ ## Design Registry
72
+
73
+ Manage design tokens and classes for consistent styling across components.
74
+
75
+ ```typescript
76
+ import { DesignRegistry, DEFAULT_DESIGN_TOKENS } from '@contentstack/studio-registry';
77
+
78
+ const designRegistry = new DesignRegistry();
79
+
80
+ // Register design tokens
81
+ designRegistry.registerTokens({
82
+ colors: {
83
+ primary: '#007bff',
84
+ secondary: '#6c757d'
85
+ },
86
+ spacing: {
87
+ sm: '0.5rem',
88
+ md: '1rem',
89
+ lg: '1.5rem'
90
+ }
91
+ });
92
+ ```
93
+
94
+ ## Data Binder
95
+
96
+ Resolve data bindings and retrieve values from various data sources.
97
+
98
+ ```typescript
99
+ import { retrievePropValue } from '@contentstack/studio-registry';
100
+
101
+ const props = retrievePropValue({
102
+ data: compositionData,
103
+ defaultSlot: null,
104
+ componentOptions: componentSchema,
105
+ node: currentNode,
106
+ cslp: { appendTags: true },
107
+ nodeUid: 'node-123',
108
+ getSlots: getSlotsFunction,
109
+ jsonRTE: jsonRteOptions,
110
+ isCompositionBeingEdited: true
111
+ });
112
+ ```
113
+
114
+ ## Breakpoint Registry
115
+
116
+ Manage responsive breakpoints for components.
117
+
118
+ ```typescript
119
+ import { BreakpointRegistry } from '@contentstack/studio-registry';
120
+
121
+ const breakpointRegistry = new BreakpointRegistry();
122
+
123
+ // Register breakpoints
124
+ breakpointRegistry.registerBreakpoints([
125
+ { name: 'mobile', width: 768 },
126
+ { name: 'tablet', width: 1024 },
127
+ { name: 'desktop', width: 1200 }
128
+ ]);
129
+ ```
130
+