@codefluss/base-types 0.0.1-alpha.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/README.md +60 -0
- package/dist/common-types.d.ts +138 -0
- package/dist/common-types.d.ts.map +1 -0
- package/dist/common-types.js +11 -0
- package/dist/common-types.js.map +1 -0
- package/dist/dependencies.d.ts +487 -0
- package/dist/dependencies.d.ts.map +1 -0
- package/dist/dependencies.js +11 -0
- package/dist/dependencies.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/dist/plugin-system.d.ts +658 -0
- package/dist/plugin-system.d.ts.map +1 -0
- package/dist/plugin-system.js +11 -0
- package/dist/plugin-system.js.map +1 -0
- package/package.json +36 -0
- package/src/common-types.ts +154 -0
- package/src/dependencies.ts +606 -0
- package/src/index.ts +68 -0
- package/src/plugin-system.ts +785 -0
package/README.md
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# @codefluss/base-types
|
|
2
|
+
|
|
3
|
+
Shared type definitions for the Codefluss Page Builder plugin system.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
This package provides the single source of truth for all plugin-related TypeScript types, ensuring
|
|
8
|
+
type consistency across the entire plugin ecosystem.
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
pnpm add @codefluss/base-types
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
```typescript
|
|
19
|
+
import type {
|
|
20
|
+
PluginConfig,
|
|
21
|
+
PropertyDefinition,
|
|
22
|
+
PluginDependencies,
|
|
23
|
+
PluginCapabilities,
|
|
24
|
+
} from '@codefluss/base-types';
|
|
25
|
+
|
|
26
|
+
export const myPluginConfig: PluginConfig = {
|
|
27
|
+
id: 'my-plugin',
|
|
28
|
+
name: 'My Plugin',
|
|
29
|
+
// ...
|
|
30
|
+
};
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Exported Types
|
|
34
|
+
|
|
35
|
+
### Plugin System Types (`plugin-system.ts`)
|
|
36
|
+
|
|
37
|
+
- **Core Types**: `PropertyControlType`, `PropertyType`, `PropertyCategory`, `PropertyPriority`
|
|
38
|
+
- **Control Configs**: `SliderConfig`, `NumberConfig`, `SelectConfig`, `InputConfig`, etc.
|
|
39
|
+
- **Property Definition**: `PropertyDefinition`, `PropertyUIConfig`, `PropertyValidation`
|
|
40
|
+
- **Plugin Config**: `PluginConfig`, `PluginCapabilities`, `PluginMeta`
|
|
41
|
+
|
|
42
|
+
### Dependency Injection Types (`dependencies.ts`)
|
|
43
|
+
|
|
44
|
+
- **Design System**: `PluginDesignSystem`, `DesignSystemFont`, `DesignSystemColor`
|
|
45
|
+
- **Spacing & Layout**: `DesignSystemSpacing`, `DesignSystemGrid`, `DesignSystemLayout`
|
|
46
|
+
- **Utilities**: `PluginUtils`, `PluginRenderer`, `PluginRendererProps`
|
|
47
|
+
- **Callbacks**: `PluginCallbacks`
|
|
48
|
+
- **Complete DI**: `PluginDependencies`
|
|
49
|
+
|
|
50
|
+
## Architecture
|
|
51
|
+
|
|
52
|
+
This package follows the **Plugin-Driven Architecture** principle:
|
|
53
|
+
|
|
54
|
+
- Plugins declare their own capabilities and requirements
|
|
55
|
+
- The host application provides dependencies via dependency injection
|
|
56
|
+
- Type safety is enforced at compile-time across all plugins
|
|
57
|
+
|
|
58
|
+
## License
|
|
59
|
+
|
|
60
|
+
MIT
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Common Type Definitions
|
|
3
|
+
*
|
|
4
|
+
* Single source of truth for types used across multiple plugins and packages.
|
|
5
|
+
* NO DUPLICATION - all plugins import from here.
|
|
6
|
+
*
|
|
7
|
+
* @package @codefluss/base-types
|
|
8
|
+
* @version 1.0.0
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Box model value for spacing (padding/margin)
|
|
12
|
+
* Used for both static and responsive spacing
|
|
13
|
+
*/
|
|
14
|
+
export interface BoxModelValue {
|
|
15
|
+
top: number;
|
|
16
|
+
right: number;
|
|
17
|
+
bottom: number;
|
|
18
|
+
left: number;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Viewport types for responsive design
|
|
22
|
+
* Only 3 breakpoints: mobile, tablet, desktop
|
|
23
|
+
*/
|
|
24
|
+
export type Viewport = 'mobile' | 'tablet' | 'desktop';
|
|
25
|
+
/**
|
|
26
|
+
* Generic responsive values structure
|
|
27
|
+
* Enforces consistent viewport naming across the system
|
|
28
|
+
*/
|
|
29
|
+
export interface ResponsiveValues<T> {
|
|
30
|
+
mobile: T;
|
|
31
|
+
tablet: T;
|
|
32
|
+
desktop: T;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Responsive box model values
|
|
36
|
+
* Used for spacing presets and responsive overrides
|
|
37
|
+
*/
|
|
38
|
+
export type ResponsiveBoxValues = ResponsiveValues<BoxModelValue>;
|
|
39
|
+
/**
|
|
40
|
+
* Text alignment options
|
|
41
|
+
*/
|
|
42
|
+
export type TextAlign = 'left' | 'center' | 'right' | 'justify';
|
|
43
|
+
/**
|
|
44
|
+
* Font weight options
|
|
45
|
+
* Supports both named weights and numeric values
|
|
46
|
+
*/
|
|
47
|
+
export type FontWeight = 'normal' | 'medium' | 'semibold' | 'bold' | number;
|
|
48
|
+
/**
|
|
49
|
+
* Text decoration options
|
|
50
|
+
*/
|
|
51
|
+
export type TextDecoration = 'none' | 'underline' | 'line-through';
|
|
52
|
+
/**
|
|
53
|
+
* Text transform options
|
|
54
|
+
*/
|
|
55
|
+
export type TextTransform = 'none' | 'uppercase' | 'lowercase' | 'capitalize';
|
|
56
|
+
/**
|
|
57
|
+
* Vertical alignment options for content within element
|
|
58
|
+
* Uses flexbox for positioning
|
|
59
|
+
*/
|
|
60
|
+
export type VerticalAlign = 'start' | 'center' | 'end';
|
|
61
|
+
/**
|
|
62
|
+
* Multi-language content structure
|
|
63
|
+
* Keys are ISO language codes (en, de, fr, es, it)
|
|
64
|
+
*
|
|
65
|
+
* Fallback chain:
|
|
66
|
+
* 1. Requested language
|
|
67
|
+
* 2. English ('en')
|
|
68
|
+
* 3. First available language
|
|
69
|
+
* 4. Empty string
|
|
70
|
+
*/
|
|
71
|
+
export interface MultiLangContent {
|
|
72
|
+
[languageCode: string]: string;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Responsive font sizes for different breakpoints
|
|
76
|
+
*/
|
|
77
|
+
export interface ResponsiveFontSizes {
|
|
78
|
+
mobile: string;
|
|
79
|
+
tablet: string;
|
|
80
|
+
desktop: string;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Common style properties shared across text-based components
|
|
84
|
+
*/
|
|
85
|
+
export interface TextStyleData {
|
|
86
|
+
fontPresetId?: string | null;
|
|
87
|
+
colorPresetId?: string | null;
|
|
88
|
+
backgroundColorPresetId?: string | null;
|
|
89
|
+
textAlign?: TextAlign | null;
|
|
90
|
+
verticalAlign?: VerticalAlign | null;
|
|
91
|
+
textDecoration?: TextDecoration | null;
|
|
92
|
+
textTransform?: TextTransform | null;
|
|
93
|
+
letterSpacing?: number | null;
|
|
94
|
+
maxWidth?: string | null;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Common layout properties shared across all components
|
|
98
|
+
*/
|
|
99
|
+
export interface LayoutData {
|
|
100
|
+
spacingPresetId: string;
|
|
101
|
+
spacingOverride?: {
|
|
102
|
+
margin?: BoxModelValue;
|
|
103
|
+
padding?: BoxModelValue;
|
|
104
|
+
} | null;
|
|
105
|
+
context?: 'default' | 'cards' | 'sections';
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Grid placement properties for components in grid layouts
|
|
109
|
+
*/
|
|
110
|
+
export interface GridPlacementData {
|
|
111
|
+
colStart: number;
|
|
112
|
+
colSpan: number;
|
|
113
|
+
rowStart: number;
|
|
114
|
+
rowSpan: number;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Common advanced properties
|
|
118
|
+
*/
|
|
119
|
+
export interface AdvancedData {
|
|
120
|
+
className?: string;
|
|
121
|
+
ariaLabel?: string;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Resolved text styles after applying fallback chain
|
|
125
|
+
*/
|
|
126
|
+
export interface ResolvedTextStyles {
|
|
127
|
+
fontSize: string;
|
|
128
|
+
lineHeight: string;
|
|
129
|
+
fontWeight: string;
|
|
130
|
+
color: string;
|
|
131
|
+
textAlign: TextAlign;
|
|
132
|
+
textDecoration: TextDecoration;
|
|
133
|
+
textTransform: TextTransform;
|
|
134
|
+
letterSpacing: string;
|
|
135
|
+
maxWidth: string;
|
|
136
|
+
fontFamily: string;
|
|
137
|
+
}
|
|
138
|
+
//# sourceMappingURL=common-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common-types.d.ts","sourceRoot":"","sources":["../src/common-types.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Common Type Definitions
|
|
3
|
+
*
|
|
4
|
+
* Single source of truth for types used across multiple plugins and packages.
|
|
5
|
+
* NO DUPLICATION - all plugins import from here.
|
|
6
|
+
*
|
|
7
|
+
* @package @codefluss/base-types
|
|
8
|
+
* @version 1.0.0
|
|
9
|
+
*/
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=common-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common-types.js","sourceRoot":"","sources":["../src/common-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
|
|
@@ -0,0 +1,487 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dependency Injection Types
|
|
3
|
+
*
|
|
4
|
+
* These types define the external dependencies that the plugin requires
|
|
5
|
+
* from the host application. All dependencies must be injected via props.
|
|
6
|
+
*
|
|
7
|
+
* @package @codefluss/base-types
|
|
8
|
+
* @version 1.0.0
|
|
9
|
+
*/
|
|
10
|
+
import type { ComponentType } from 'react';
|
|
11
|
+
/**
|
|
12
|
+
* Responsive font size values for different breakpoints
|
|
13
|
+
*/
|
|
14
|
+
export interface ResponsiveFontSizes {
|
|
15
|
+
mobile: string;
|
|
16
|
+
tablet: string;
|
|
17
|
+
desktop: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Responsive line height values for different breakpoints
|
|
21
|
+
*/
|
|
22
|
+
export interface ResponsiveLineHeights {
|
|
23
|
+
mobile: number;
|
|
24
|
+
tablet: number;
|
|
25
|
+
desktop: number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Design System Font Configuration
|
|
29
|
+
*/
|
|
30
|
+
export interface DesignSystemFont {
|
|
31
|
+
family: string;
|
|
32
|
+
size: string;
|
|
33
|
+
weight: string;
|
|
34
|
+
lineHeight: string;
|
|
35
|
+
element?: string;
|
|
36
|
+
responsive?: ResponsiveFontSizes;
|
|
37
|
+
responsiveLineHeight?: ResponsiveLineHeights;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Design System Color Configuration
|
|
41
|
+
*/
|
|
42
|
+
export interface DesignSystemColor {
|
|
43
|
+
value: string;
|
|
44
|
+
label: string;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Box Model Value - Single side values
|
|
48
|
+
*/
|
|
49
|
+
export interface BoxModelValue {
|
|
50
|
+
top: number;
|
|
51
|
+
right: number;
|
|
52
|
+
bottom: number;
|
|
53
|
+
left: number;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Grid Preset Values (Container-specific)
|
|
57
|
+
* Clean camelCase naming
|
|
58
|
+
*/
|
|
59
|
+
export interface GridPresetValues {
|
|
60
|
+
columns: number;
|
|
61
|
+
rows: number;
|
|
62
|
+
columnGap: number;
|
|
63
|
+
rowGap: number;
|
|
64
|
+
maxWidth: number;
|
|
65
|
+
margin: number | string;
|
|
66
|
+
alignmentHorizontal: string;
|
|
67
|
+
alignmentVertical: string;
|
|
68
|
+
alignmentContent: string;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Responsive spacing values for different breakpoints
|
|
72
|
+
* Only 3 viewports: mobile, tablet, desktop
|
|
73
|
+
*/
|
|
74
|
+
export interface ResponsiveBoxValues {
|
|
75
|
+
mobile: BoxModelValue;
|
|
76
|
+
tablet: BoxModelValue;
|
|
77
|
+
desktop: BoxModelValue;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Spacing Preset - Combined margin + padding with responsive values
|
|
81
|
+
*/
|
|
82
|
+
export interface SpacingPreset {
|
|
83
|
+
presetId: string;
|
|
84
|
+
name: string;
|
|
85
|
+
margin: ResponsiveBoxValues;
|
|
86
|
+
padding: ResponsiveBoxValues;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Responsive spacing scale entry
|
|
90
|
+
*/
|
|
91
|
+
export interface ResponsiveSpacingScale {
|
|
92
|
+
mobile: number;
|
|
93
|
+
tablet: number;
|
|
94
|
+
desktop: number;
|
|
95
|
+
unit: string;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Design System Spacing Configuration
|
|
99
|
+
* Clean, type-safe API
|
|
100
|
+
*/
|
|
101
|
+
export interface DesignSystemSpacing {
|
|
102
|
+
/** Spacing scale values */
|
|
103
|
+
scale: number[];
|
|
104
|
+
/** Responsive spacing scales by token */
|
|
105
|
+
scaleResponsive: Map<string, ResponsiveSpacingScale>;
|
|
106
|
+
/**
|
|
107
|
+
* Get a spacing preset by ID
|
|
108
|
+
* @param presetId - The preset identifier
|
|
109
|
+
* @returns The spacing preset (guaranteed to exist, falls back to 'default')
|
|
110
|
+
*/
|
|
111
|
+
getPreset(presetId: string): SpacingPreset;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Design System Grid Configuration
|
|
115
|
+
* Clean, type-safe API
|
|
116
|
+
*/
|
|
117
|
+
export interface DesignSystemGrid {
|
|
118
|
+
/**
|
|
119
|
+
* Get a grid preset by ID
|
|
120
|
+
* @param presetId - The preset identifier
|
|
121
|
+
* @returns The grid preset values (guaranteed to exist, falls back to 'default')
|
|
122
|
+
*/
|
|
123
|
+
getPreset(presetId: string): GridPresetValues;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Breakpoint configuration for responsive design
|
|
127
|
+
*/
|
|
128
|
+
export interface BreakpointConfig {
|
|
129
|
+
minWidth: number;
|
|
130
|
+
name: string;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Design System Breakpoints
|
|
134
|
+
*/
|
|
135
|
+
export interface DesignSystemBreakpoints {
|
|
136
|
+
mobile: BreakpointConfig;
|
|
137
|
+
tablet: BreakpointConfig;
|
|
138
|
+
desktop: BreakpointConfig;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Design System Layout Configuration
|
|
142
|
+
*/
|
|
143
|
+
export interface DesignSystemLayout {
|
|
144
|
+
maxWidth?: string;
|
|
145
|
+
gap?: string;
|
|
146
|
+
padding?: string;
|
|
147
|
+
margin?: string;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Button Style Preset Configuration (Unified)
|
|
151
|
+
*
|
|
152
|
+
* Complete button style preset that replaces the separate
|
|
153
|
+
* ButtonSizePreset and ButtonVariantPreset interfaces.
|
|
154
|
+
* Matches design_system_button_styles table structure.
|
|
155
|
+
*/
|
|
156
|
+
export interface ButtonStylePreset {
|
|
157
|
+
id: string;
|
|
158
|
+
presetId: string;
|
|
159
|
+
name: string;
|
|
160
|
+
size: string;
|
|
161
|
+
fontSizePresetId?: string;
|
|
162
|
+
fontWeight?: string;
|
|
163
|
+
spacingPresetId?: string;
|
|
164
|
+
borderRadiusPresetId?: string;
|
|
165
|
+
shadowPresetId?: string;
|
|
166
|
+
focusRingPresetId?: string;
|
|
167
|
+
animationPresetId?: string;
|
|
168
|
+
hoverEffectPresetId?: string;
|
|
169
|
+
backgroundColorPresetId?: string;
|
|
170
|
+
textColorPresetId?: string;
|
|
171
|
+
borderColorPresetId?: string;
|
|
172
|
+
hoverBackgroundColorPresetId?: string;
|
|
173
|
+
hoverTextColorPresetId?: string;
|
|
174
|
+
hoverBorderColorPresetId?: string;
|
|
175
|
+
activeBackgroundColorPresetId?: string;
|
|
176
|
+
activeTextColorPresetId?: string;
|
|
177
|
+
activeBorderColorPresetId?: string;
|
|
178
|
+
defaultTransitionDuration: number;
|
|
179
|
+
hoverTransitionDuration: number;
|
|
180
|
+
activeTransitionDuration: number;
|
|
181
|
+
disabledOpacity: number;
|
|
182
|
+
defaultTextDecoration?: string;
|
|
183
|
+
hoverTextDecoration?: string;
|
|
184
|
+
activeTextDecoration?: string;
|
|
185
|
+
defaultTextTransform?: string;
|
|
186
|
+
hoverTextTransform?: string;
|
|
187
|
+
activeTextTransform?: string;
|
|
188
|
+
usageDescription?: string;
|
|
189
|
+
isDefault: boolean;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* @deprecated Use ButtonStylePreset instead
|
|
193
|
+
* Legacy Button Size Preset Configuration
|
|
194
|
+
*/
|
|
195
|
+
export interface ButtonSizePreset {
|
|
196
|
+
button_id: string;
|
|
197
|
+
name: string;
|
|
198
|
+
padding: string;
|
|
199
|
+
fontSize: string;
|
|
200
|
+
iconSize: string;
|
|
201
|
+
minHeight: string;
|
|
202
|
+
borderRadius?: string;
|
|
203
|
+
fontWeight?: string;
|
|
204
|
+
usage_description?: string;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* @deprecated Use ButtonStylePreset instead
|
|
208
|
+
* Legacy Button Variant Preset Configuration
|
|
209
|
+
*/
|
|
210
|
+
export interface ButtonVariantPreset {
|
|
211
|
+
background: string;
|
|
212
|
+
hoverBackground: string;
|
|
213
|
+
textColor: string;
|
|
214
|
+
borderColor: string;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Shadow Configuration
|
|
218
|
+
*/
|
|
219
|
+
export interface ShadowConfig {
|
|
220
|
+
value: string;
|
|
221
|
+
dark?: string;
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Accordion Style Preset Configuration
|
|
225
|
+
*
|
|
226
|
+
* Complete accordion style preset for collapsible components.
|
|
227
|
+
* Matches design_system_accordion_presets table structure.
|
|
228
|
+
*/
|
|
229
|
+
export interface AccordionStylePreset {
|
|
230
|
+
id: string;
|
|
231
|
+
presetId: string;
|
|
232
|
+
name: string;
|
|
233
|
+
headerHeight?: string;
|
|
234
|
+
headerFontSizePresetId?: string;
|
|
235
|
+
headerFontWeight?: string;
|
|
236
|
+
headerPaddingPresetId?: string;
|
|
237
|
+
headerBackgroundColorPresetId?: string;
|
|
238
|
+
headerHoverBackgroundColorPresetId?: string;
|
|
239
|
+
headerTextColorPresetId?: string;
|
|
240
|
+
headerBorderColorPresetId?: string;
|
|
241
|
+
bodyMinHeight?: string;
|
|
242
|
+
bodyPaddingPresetId?: string;
|
|
243
|
+
bodyBackgroundColorPresetId?: string;
|
|
244
|
+
bodyBorderColorPresetId?: string;
|
|
245
|
+
borderRadiusPresetId?: string;
|
|
246
|
+
shadowPresetId?: string;
|
|
247
|
+
spacingPresetId?: string;
|
|
248
|
+
transitionDuration: number;
|
|
249
|
+
transitionEasing?: string;
|
|
250
|
+
expandedBackgroundColorPresetId?: string;
|
|
251
|
+
expandedTextColorPresetId?: string;
|
|
252
|
+
usageDescription?: string;
|
|
253
|
+
isDefault: boolean;
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Form Style Preset Configuration (Unified)
|
|
257
|
+
*
|
|
258
|
+
* Complete form style preset that contains all styling for form elements.
|
|
259
|
+
* Matches design_system_form_styles table structure.
|
|
260
|
+
*/
|
|
261
|
+
export interface FormStylePreset {
|
|
262
|
+
id: string;
|
|
263
|
+
presetId: string;
|
|
264
|
+
name: string;
|
|
265
|
+
variant: string;
|
|
266
|
+
size: string;
|
|
267
|
+
fontSizePresetId?: string;
|
|
268
|
+
paddingX: number;
|
|
269
|
+
paddingY: number;
|
|
270
|
+
borderWidth: number;
|
|
271
|
+
borderRadiusPresetId?: string;
|
|
272
|
+
shadowPresetId?: string;
|
|
273
|
+
focusRingPresetId?: string;
|
|
274
|
+
animationPresetId?: string;
|
|
275
|
+
hoverEffectPresetId?: string;
|
|
276
|
+
backgroundColorPresetId?: string;
|
|
277
|
+
textColorPresetId?: string;
|
|
278
|
+
borderColorPresetId?: string;
|
|
279
|
+
placeholderColorPresetId?: string;
|
|
280
|
+
focusRingColorPresetId?: string;
|
|
281
|
+
hoverBackgroundColorPresetId?: string;
|
|
282
|
+
hoverBorderColorPresetId?: string;
|
|
283
|
+
disabledOpacity: number;
|
|
284
|
+
errorBorderColorPresetId?: string;
|
|
285
|
+
errorTextColorPresetId?: string;
|
|
286
|
+
submitButtonPresetId?: string;
|
|
287
|
+
containerBackgroundColorPresetId?: string;
|
|
288
|
+
containerSpacingPresetId?: string;
|
|
289
|
+
labelFontPresetId?: string;
|
|
290
|
+
labelColorPresetId?: string;
|
|
291
|
+
descriptionFontPresetId?: string;
|
|
292
|
+
descriptionColorPresetId?: string;
|
|
293
|
+
fieldGap?: number;
|
|
294
|
+
usageDescription?: string;
|
|
295
|
+
isDefault: boolean;
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Design System API
|
|
299
|
+
*
|
|
300
|
+
* Interface for accessing global design system values.
|
|
301
|
+
* The host application must provide an implementation.
|
|
302
|
+
*/
|
|
303
|
+
export interface PluginDesignSystem {
|
|
304
|
+
fonts: {
|
|
305
|
+
getPreset: (presetId: string) => DesignSystemFont | undefined;
|
|
306
|
+
};
|
|
307
|
+
colors: {
|
|
308
|
+
getPreset: (presetId: string) => DesignSystemColor | undefined;
|
|
309
|
+
};
|
|
310
|
+
spacing: DesignSystemSpacing;
|
|
311
|
+
grid?: DesignSystemGrid;
|
|
312
|
+
layout: {
|
|
313
|
+
getPreset: (presetId: string) => DesignSystemLayout | undefined;
|
|
314
|
+
};
|
|
315
|
+
breakpoints: {
|
|
316
|
+
getConfig: () => DesignSystemBreakpoints;
|
|
317
|
+
};
|
|
318
|
+
/**
|
|
319
|
+
* Button System (optional)
|
|
320
|
+
* Provides unified button style presets from design system database
|
|
321
|
+
* Each preset contains colors, typography, spacing, and effects
|
|
322
|
+
*/
|
|
323
|
+
buttons?: {
|
|
324
|
+
/**
|
|
325
|
+
* Get button style preset by ID
|
|
326
|
+
* @param presetId - Button preset identifier (e.g., 'primary', 'secondary', 'custom-1')
|
|
327
|
+
* @returns Button style preset or undefined if not found
|
|
328
|
+
*/
|
|
329
|
+
getPreset: (presetId: string) => ButtonStylePreset | undefined;
|
|
330
|
+
/**
|
|
331
|
+
* List all available button style presets
|
|
332
|
+
* @returns Array of button style presets sorted by sort_order
|
|
333
|
+
*/
|
|
334
|
+
listPresets?: () => ButtonStylePreset[];
|
|
335
|
+
};
|
|
336
|
+
/**
|
|
337
|
+
* Form System (optional)
|
|
338
|
+
* Provides unified form style presets from design system database
|
|
339
|
+
* Each preset contains colors, typography, spacing, and effects for form elements
|
|
340
|
+
*/
|
|
341
|
+
forms?: {
|
|
342
|
+
/**
|
|
343
|
+
* Get form style preset by ID
|
|
344
|
+
* @param presetId - Form preset identifier (e.g., 'default', 'outlined', 'custom-1')
|
|
345
|
+
* @returns Form style preset or undefined if not found
|
|
346
|
+
*/
|
|
347
|
+
getPreset: (presetId: string) => FormStylePreset | undefined;
|
|
348
|
+
/**
|
|
349
|
+
* List all available form style presets
|
|
350
|
+
* @returns Array of form style presets sorted by sort_order
|
|
351
|
+
*/
|
|
352
|
+
listPresets?: () => FormStylePreset[];
|
|
353
|
+
};
|
|
354
|
+
/**
|
|
355
|
+
* Accordion System (optional)
|
|
356
|
+
* Provides unified accordion style presets from design system database
|
|
357
|
+
* Each preset contains colors, typography, spacing, and effects for accordion components
|
|
358
|
+
*/
|
|
359
|
+
accordions?: {
|
|
360
|
+
/**
|
|
361
|
+
* Get accordion style preset by ID
|
|
362
|
+
* @param presetId - Accordion preset identifier (e.g., 'default', 'sm', 'lg', 'custom-1')
|
|
363
|
+
* @returns Accordion style preset or undefined if not found
|
|
364
|
+
*/
|
|
365
|
+
getPreset: (presetId: string) => AccordionStylePreset | undefined;
|
|
366
|
+
/**
|
|
367
|
+
* List all available accordion style presets
|
|
368
|
+
* @returns Array of accordion style presets sorted by sort_order
|
|
369
|
+
*/
|
|
370
|
+
listPresets?: () => AccordionStylePreset[];
|
|
371
|
+
};
|
|
372
|
+
/**
|
|
373
|
+
* Shadow System (optional)
|
|
374
|
+
* Provides shadow presets with light and dark mode variants
|
|
375
|
+
*/
|
|
376
|
+
shadows?: {
|
|
377
|
+
getPreset: (presetId: string) => ShadowConfig;
|
|
378
|
+
};
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* Utility Functions API
|
|
382
|
+
*
|
|
383
|
+
* Interface for utility functions required by the plugin.
|
|
384
|
+
* The host application must provide implementations.
|
|
385
|
+
*/
|
|
386
|
+
export interface PluginUtils {
|
|
387
|
+
/**
|
|
388
|
+
* Class name utility (e.g., clsx, classnames, tailwind-merge)
|
|
389
|
+
* Combines multiple class names intelligently
|
|
390
|
+
*/
|
|
391
|
+
cn: (...inputs: any[]) => string;
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* Plugin Renderer Props
|
|
395
|
+
*
|
|
396
|
+
* Props interface for the PluginRenderer component.
|
|
397
|
+
* This is injected by the host application to render child plugins.
|
|
398
|
+
*/
|
|
399
|
+
export interface PluginRendererProps {
|
|
400
|
+
/**
|
|
401
|
+
* Plugin ID to render (e.g., 'base-text', 'base-image')
|
|
402
|
+
*/
|
|
403
|
+
pluginId: string;
|
|
404
|
+
/**
|
|
405
|
+
* Element ID for tracking
|
|
406
|
+
*/
|
|
407
|
+
elementId: string;
|
|
408
|
+
/**
|
|
409
|
+
* Plugin data/configuration
|
|
410
|
+
*/
|
|
411
|
+
data: Record<string, unknown>;
|
|
412
|
+
/**
|
|
413
|
+
* Current language code
|
|
414
|
+
*/
|
|
415
|
+
language: string;
|
|
416
|
+
/**
|
|
417
|
+
* Is in editor mode?
|
|
418
|
+
*/
|
|
419
|
+
isEditorMode?: boolean;
|
|
420
|
+
/**
|
|
421
|
+
* Is element selected?
|
|
422
|
+
*/
|
|
423
|
+
isSelected?: boolean;
|
|
424
|
+
/**
|
|
425
|
+
* Click handler
|
|
426
|
+
*/
|
|
427
|
+
onClick?: (id: string) => void;
|
|
428
|
+
}
|
|
429
|
+
/**
|
|
430
|
+
* Plugin Callbacks
|
|
431
|
+
*
|
|
432
|
+
* Event callbacks that plugins can use to communicate with the host application.
|
|
433
|
+
*/
|
|
434
|
+
export interface PluginCallbacks {
|
|
435
|
+
/**
|
|
436
|
+
* Called when content changes (for text, rich-text components)
|
|
437
|
+
* @param elementId - ID of the element
|
|
438
|
+
* @param language - Language code
|
|
439
|
+
* @param content - New content value
|
|
440
|
+
*/
|
|
441
|
+
onContentChange?: (elementId: string, language: string, content: string) => void;
|
|
442
|
+
/**
|
|
443
|
+
* Called when child element is dropped into container
|
|
444
|
+
* @param containerId - ID of the container element
|
|
445
|
+
* @param droppedElementId - ID of the dropped element
|
|
446
|
+
* @param index - Optional insertion index
|
|
447
|
+
*/
|
|
448
|
+
onChildAdded?: (containerId: string, droppedElementId: string, index?: number) => void;
|
|
449
|
+
/**
|
|
450
|
+
* Called when child element is removed from container
|
|
451
|
+
* @param containerId - ID of the container element
|
|
452
|
+
* @param removedElementId - ID of the removed element
|
|
453
|
+
*/
|
|
454
|
+
onChildRemoved?: (containerId: string, removedElementId: string) => void;
|
|
455
|
+
/**
|
|
456
|
+
* Called when container layout is changed
|
|
457
|
+
* @param containerId - ID of the container element
|
|
458
|
+
* @param layoutMode - New layout mode
|
|
459
|
+
*/
|
|
460
|
+
onLayoutChange?: (containerId: string, layoutMode: 'flexbox' | 'grid') => void;
|
|
461
|
+
}
|
|
462
|
+
/**
|
|
463
|
+
* Complete Plugin Dependencies
|
|
464
|
+
*
|
|
465
|
+
* All external dependencies that must be injected into the plugin.
|
|
466
|
+
* PLUGIN-DRIVEN ARCHITECTURE: Plugins receive dependencies from the host app.
|
|
467
|
+
*/
|
|
468
|
+
export interface PluginDependencies {
|
|
469
|
+
/**
|
|
470
|
+
* Design System API for accessing global design tokens
|
|
471
|
+
*/
|
|
472
|
+
designSystem: PluginDesignSystem;
|
|
473
|
+
/**
|
|
474
|
+
* Utility functions (e.g., cn for classnames)
|
|
475
|
+
*/
|
|
476
|
+
utils: PluginUtils;
|
|
477
|
+
/**
|
|
478
|
+
* PluginRenderer component for rendering child plugins
|
|
479
|
+
* CRITICAL: Container plugins need this to render their NESTED children
|
|
480
|
+
*/
|
|
481
|
+
PluginRenderer: ComponentType<PluginRendererProps>;
|
|
482
|
+
/**
|
|
483
|
+
* Optional callbacks for communication with host app
|
|
484
|
+
*/
|
|
485
|
+
callbacks?: PluginCallbacks;
|
|
486
|
+
}
|
|
487
|
+
//# sourceMappingURL=dependencies.d.ts.map
|