@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.
- package/README.md +130 -0
- package/dist/cjs/index.cjs +5625 -0
- package/dist/cjs/index.cjs.map +1 -0
- package/dist/esm/breakpoint-registry/index.js +68 -0
- package/dist/esm/breakpoint-registry/index.js.map +1 -0
- package/dist/esm/component-registry/registry-options-processor.js +195 -0
- package/dist/esm/component-registry/registry-options-processor.js.map +1 -0
- package/dist/esm/component-registry/registry.constant.js +119 -0
- package/dist/esm/component-registry/registry.constant.js.map +1 -0
- package/dist/esm/component-registry/registry.js +245 -0
- package/dist/esm/component-registry/registry.js.map +1 -0
- package/dist/esm/data-binder/cslp.js +31 -0
- package/dist/esm/data-binder/cslp.js.map +1 -0
- package/dist/esm/data-binder/handle-binding-map.util.js +103 -0
- package/dist/esm/data-binder/handle-binding-map.util.js.map +1 -0
- package/dist/esm/data-binder/retrieve-data.js +146 -0
- package/dist/esm/data-binder/retrieve-data.js.map +1 -0
- package/dist/esm/data-binder/retrieve-data.util.js +177 -0
- package/dist/esm/data-binder/retrieve-data.util.js.map +1 -0
- package/dist/esm/design-registry/constants.js +386 -0
- package/dist/esm/design-registry/constants.js.map +1 -0
- package/dist/esm/design-registry/design-classes.js +36 -0
- package/dist/esm/design-registry/design-classes.js.map +1 -0
- package/dist/esm/design-registry/design-registry.js +87 -0
- package/dist/esm/design-registry/design-registry.js.map +1 -0
- package/dist/esm/design-registry/design-token.js +332 -0
- package/dist/esm/design-registry/design-token.js.map +1 -0
- package/dist/esm/index.d.ts +1196 -0
- package/dist/esm/index.js +12 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/json-rte-registry/index.js +18 -0
- package/dist/esm/json-rte-registry/index.js.map +1 -0
- package/dist/esm/utils/symbols.js +12 -0
- package/dist/esm/utils/symbols.js.map +1 -0
- 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
|
+
|