@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/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "@codefluss/base-types",
3
+ "version": "0.0.1-alpha.1",
4
+ "description": "Shared type definitions for Codefluss Page Builder plugins",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": [
8
+ "dist",
9
+ "src",
10
+ "README.md"
11
+ ],
12
+ "keywords": [
13
+ "codefluss",
14
+ "page-builder",
15
+ "plugin",
16
+ "types",
17
+ "typescript"
18
+ ],
19
+ "author": "Codefluss",
20
+ "license": "MIT",
21
+ "peerDependencies": {
22
+ "react": "^19.2.0"
23
+ },
24
+ "devDependencies": {
25
+ "@types/react": "^19.2.7",
26
+ "typescript": "^5.9.3"
27
+ },
28
+ "publishConfig": {
29
+ "access": "public"
30
+ },
31
+ "scripts": {
32
+ "build": "tsc",
33
+ "dev": "tsc --watch",
34
+ "clean": "rm -rf dist"
35
+ }
36
+ }
@@ -0,0 +1,154 @@
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
+ /**
12
+ * Box model value for spacing (padding/margin)
13
+ * Used for both static and responsive spacing
14
+ */
15
+ export interface BoxModelValue {
16
+ top: number;
17
+ right: number;
18
+ bottom: number;
19
+ left: number;
20
+ }
21
+
22
+ /**
23
+ * Viewport types for responsive design
24
+ * Only 3 breakpoints: mobile, tablet, desktop
25
+ */
26
+ export type Viewport = 'mobile' | 'tablet' | 'desktop';
27
+
28
+ /**
29
+ * Generic responsive values structure
30
+ * Enforces consistent viewport naming across the system
31
+ */
32
+ export interface ResponsiveValues<T> {
33
+ mobile: T;
34
+ tablet: T;
35
+ desktop: T;
36
+ }
37
+
38
+ /**
39
+ * Responsive box model values
40
+ * Used for spacing presets and responsive overrides
41
+ */
42
+ export type ResponsiveBoxValues = ResponsiveValues<BoxModelValue>;
43
+
44
+ /**
45
+ * Text alignment options
46
+ */
47
+ export type TextAlign = 'left' | 'center' | 'right' | 'justify';
48
+
49
+ /**
50
+ * Font weight options
51
+ * Supports both named weights and numeric values
52
+ */
53
+ export type FontWeight = 'normal' | 'medium' | 'semibold' | 'bold' | number;
54
+
55
+ /**
56
+ * Text decoration options
57
+ */
58
+ export type TextDecoration = 'none' | 'underline' | 'line-through';
59
+
60
+ /**
61
+ * Text transform options
62
+ */
63
+ export type TextTransform = 'none' | 'uppercase' | 'lowercase' | 'capitalize';
64
+
65
+ /**
66
+ * Vertical alignment options for content within element
67
+ * Uses flexbox for positioning
68
+ */
69
+ export type VerticalAlign = 'start' | 'center' | 'end';
70
+
71
+ /**
72
+ * Multi-language content structure
73
+ * Keys are ISO language codes (en, de, fr, es, it)
74
+ *
75
+ * Fallback chain:
76
+ * 1. Requested language
77
+ * 2. English ('en')
78
+ * 3. First available language
79
+ * 4. Empty string
80
+ */
81
+ export interface MultiLangContent {
82
+ [languageCode: string]: string;
83
+ }
84
+
85
+ /**
86
+ * Responsive font sizes for different breakpoints
87
+ */
88
+ export interface ResponsiveFontSizes {
89
+ mobile: string;
90
+ tablet: string;
91
+ desktop: string;
92
+ }
93
+
94
+ /**
95
+ * Common style properties shared across text-based components
96
+ */
97
+ export interface TextStyleData {
98
+ fontPresetId?: string | null;
99
+ colorPresetId?: string | null;
100
+ backgroundColorPresetId?: string | null;
101
+ textAlign?: TextAlign | null;
102
+ verticalAlign?: VerticalAlign | null;
103
+ textDecoration?: TextDecoration | null;
104
+ textTransform?: TextTransform | null;
105
+ letterSpacing?: number | null;
106
+ maxWidth?: string | null;
107
+ }
108
+
109
+ /**
110
+ * Common layout properties shared across all components
111
+ */
112
+ export interface LayoutData {
113
+ spacingPresetId: string;
114
+ spacingOverride?: {
115
+ margin?: BoxModelValue;
116
+ padding?: BoxModelValue;
117
+ } | null;
118
+ context?: 'default' | 'cards' | 'sections';
119
+ }
120
+
121
+ /**
122
+ * Grid placement properties for components in grid layouts
123
+ */
124
+ export interface GridPlacementData {
125
+ colStart: number;
126
+ colSpan: number;
127
+ rowStart: number;
128
+ rowSpan: number;
129
+ }
130
+
131
+ /**
132
+ * Common advanced properties
133
+ */
134
+ export interface AdvancedData {
135
+ className?: string;
136
+ ariaLabel?: string;
137
+ }
138
+
139
+
140
+ /**
141
+ * Resolved text styles after applying fallback chain
142
+ */
143
+ export interface ResolvedTextStyles {
144
+ fontSize: string;
145
+ lineHeight: string;
146
+ fontWeight: string;
147
+ color: string;
148
+ textAlign: TextAlign;
149
+ textDecoration: TextDecoration;
150
+ textTransform: TextTransform;
151
+ letterSpacing: string;
152
+ maxWidth: string;
153
+ fontFamily: string;
154
+ }