@codefluss/base-types 0.0.2-alpha.1 → 0.0.2-alpha.2

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.
@@ -1,8 +1,18 @@
1
1
  /**
2
2
  * Dependency Injection Types
3
3
  *
4
- * These types define the external dependencies that the plugin requires
5
- * from the host application. All dependencies must be injected via props.
4
+ * Defines the external dependencies that plugins require from the host
5
+ * application. All dependencies are injected via props — plugins never
6
+ * import host-application code directly.
7
+ *
8
+ * The **plugin-driven architecture** ensures plugins are self-contained:
9
+ * the host provides Design System tokens, utility functions, a renderer
10
+ * component, and optional callbacks through these interfaces.
11
+ *
12
+ * @see {@link PluginDependencies} — Top-level dependency container
13
+ * @see {@link PluginDesignSystem} — Design token access API
14
+ * @see {@link PluginUtils} — Shared utility functions
15
+ * @see {@link PluginCallbacks} — Host communication callbacks
6
16
  *
7
17
  * @package @codefluss/base-types
8
18
  * @version 1.0.0
@@ -11,533 +21,1093 @@
11
21
  import type { ComponentType } from 'react';
12
22
 
13
23
  /**
14
- * Responsive font size values for different breakpoints
24
+ * Responsive font size values for different viewport breakpoints.
25
+ *
26
+ * Each value is a CSS font-size string (e.g., `'1rem'`, `'16px'`).
27
+ *
28
+ * @see {@link DesignSystemFont.responsive}
29
+ *
30
+ * @example
31
+ * ```typescript
32
+ * const sizes: ResponsiveFontSizes = {
33
+ * mobile: '1rem',
34
+ * tablet: '1.25rem',
35
+ * desktop: '1.5rem',
36
+ * };
37
+ * ```
15
38
  */
16
39
  export interface ResponsiveFontSizes {
40
+ /** Font size on mobile viewports */
17
41
  mobile: string;
42
+
43
+ /** Font size on tablet viewports */
18
44
  tablet: string;
45
+
46
+ /** Font size on desktop viewports */
19
47
  desktop: string;
20
48
  }
21
49
 
22
50
  /**
23
- * Responsive line height values for different breakpoints
51
+ * Responsive line height values for different viewport breakpoints.
52
+ *
53
+ * Values are unitless multipliers (e.g., `1.4` means 140% of font size).
54
+ *
55
+ * @see {@link DesignSystemFont.responsiveLineHeight}
24
56
  */
25
57
  export interface ResponsiveLineHeights {
58
+ /** Line height on mobile viewports */
26
59
  mobile: number;
60
+
61
+ /** Line height on tablet viewports */
27
62
  tablet: number;
63
+
64
+ /** Line height on desktop viewports */
28
65
  desktop: number;
29
66
  }
30
67
 
31
68
  /**
32
- * Design System Font Configuration
69
+ * Design System font configuration for a single typography preset.
70
+ *
71
+ * Each preset defines a complete typographic style — family, size, weight,
72
+ * line-height, and optional responsive overrides.
73
+ *
74
+ * @see {@link PluginDesignSystem.fonts}
75
+ *
76
+ * @example
77
+ * ```typescript
78
+ * const heading1: DesignSystemFont = {
79
+ * family: '"Inter", sans-serif',
80
+ * size: '2.5rem',
81
+ * weight: '700',
82
+ * lineHeight: '1.2',
83
+ * element: 'h1',
84
+ * responsive: { mobile: '1.75rem', tablet: '2rem', desktop: '2.5rem' },
85
+ * };
86
+ * ```
33
87
  */
34
88
  export interface DesignSystemFont {
89
+ /** CSS `font-family` value (e.g., `'"Inter", sans-serif'`) */
35
90
  family: string;
91
+
92
+ /** CSS `font-size` value — desktop default (e.g., `'2.5rem'`) */
36
93
  size: string;
94
+
95
+ /** CSS `font-weight` value (e.g., `'700'`, `'bold'`) */
37
96
  weight: string;
97
+
98
+ /** CSS `line-height` value (e.g., `'1.2'`, `'28px'`) */
38
99
  lineHeight: string;
100
+
101
+ /**
102
+ * Recommended HTML element for this preset (e.g., `'h1'`, `'h2'`, `'p'`).
103
+ * Used by heading/paragraph plugins to pick the semantic element.
104
+ */
39
105
  element?: string; // HTML element (h1, h2, p, etc.)
106
+
107
+ /**
108
+ * Per-viewport font size overrides.
109
+ * When provided, the plugin should apply these sizes at each breakpoint.
110
+ * @see {@link ResponsiveFontSizes}
111
+ */
40
112
  responsive?: ResponsiveFontSizes; // Optional responsive font sizes
113
+
114
+ /**
115
+ * Per-viewport line-height overrides.
116
+ * @see {@link ResponsiveLineHeights}
117
+ */
41
118
  responsiveLineHeight?: ResponsiveLineHeights; // Optional responsive line heights
42
119
  }
43
120
 
44
121
  /**
45
- * Design System Color Configuration
122
+ * Design System color configuration for a single color preset.
123
+ *
124
+ * @see {@link PluginDesignSystem.colors}
125
+ *
126
+ * @example
127
+ * ```typescript
128
+ * const primary: DesignSystemColor = { value: '#3b82f6', label: 'Primary' };
129
+ * ```
46
130
  */
47
131
  export interface DesignSystemColor {
132
+ /** CSS color value (hex, rgb, hsl, or CSS variable) */
48
133
  value: string;
134
+
135
+ /** Human-readable label displayed in color pickers */
49
136
  label: string;
50
137
  }
51
138
 
52
139
  /**
53
- * Box Model Value - Single side values
140
+ * Four-sided box model value for spacing (padding / margin / gap).
141
+ *
142
+ * @see BoxModelValue in `common-types.ts` for the canonical definition.
143
+ * This is a parallel declaration required by the dependencies module.
54
144
  */
55
145
  export interface BoxModelValue {
146
+ /** Top spacing in pixels */
56
147
  top: number;
148
+
149
+ /** Right spacing in pixels */
57
150
  right: number;
151
+
152
+ /** Bottom spacing in pixels */
58
153
  bottom: number;
154
+
155
+ /** Left spacing in pixels */
59
156
  left: number;
60
157
  }
61
158
 
62
159
  /**
63
- * Grid Preset Values (Container-specific)
64
- * Clean camelCase naming
160
+ * Grid preset values for container grid layout configuration.
161
+ *
162
+ * Defines the complete grid parameters: columns, rows, gaps, and alignment.
163
+ * Uses clean camelCase naming.
164
+ *
165
+ * @see {@link DesignSystemGrid}
166
+ *
167
+ * @example
168
+ * ```typescript
169
+ * const defaultGrid: GridPresetValues = {
170
+ * columns: 3,
171
+ * rows: 1,
172
+ * columnGap: 16,
173
+ * rowGap: 16,
174
+ * maxWidth: 1200,
175
+ * margin: 'auto',
176
+ * alignmentHorizontal: 'stretch',
177
+ * alignmentVertical: 'start',
178
+ * alignmentContent: 'start',
179
+ * };
180
+ * ```
65
181
  */
66
182
  export interface GridPresetValues {
183
+ /** Number of grid columns */
67
184
  columns: number;
185
+
186
+ /** Number of grid rows */
68
187
  rows: number;
188
+
189
+ /** Horizontal gap between columns in pixels */
69
190
  columnGap: number;
191
+
192
+ /** Vertical gap between rows in pixels */
70
193
  rowGap: number;
194
+
195
+ /** Maximum grid width in pixels */
71
196
  maxWidth: number;
197
+
198
+ /** Horizontal margin — number (px) or CSS string (e.g., `'auto'`) */
72
199
  margin: number | string;
200
+
201
+ /** CSS `justify-items` value (e.g., `'stretch'`, `'center'`) */
73
202
  alignmentHorizontal: string;
203
+
204
+ /** CSS `align-items` value (e.g., `'start'`, `'center'`, `'stretch'`) */
74
205
  alignmentVertical: string;
206
+
207
+ /** CSS `align-content` value (e.g., `'start'`, `'stretch'`) */
75
208
  alignmentContent: string;
76
209
  }
77
210
 
78
211
  /**
79
- * Responsive spacing values for different breakpoints
80
- * Only 3 viewports: mobile, tablet, desktop
212
+ * Responsive box model values — spacing for each viewport breakpoint.
213
+ *
214
+ * @see {@link BoxModelValue}
215
+ *
216
+ * @example
217
+ * ```typescript
218
+ * const padding: ResponsiveBoxValues = {
219
+ * mobile: { top: 8, right: 8, bottom: 8, left: 8 },
220
+ * tablet: { top: 16, right: 16, bottom: 16, left: 16 },
221
+ * desktop: { top: 24, right: 24, bottom: 24, left: 24 },
222
+ * };
223
+ * ```
81
224
  */
82
225
  export interface ResponsiveBoxValues {
226
+ /** Spacing values on mobile viewports */
83
227
  mobile: BoxModelValue;
228
+
229
+ /** Spacing values on tablet viewports */
84
230
  tablet: BoxModelValue;
231
+
232
+ /** Spacing values on desktop viewports */
85
233
  desktop: BoxModelValue;
86
234
  }
87
235
 
88
236
  /**
89
- * Spacing Preset - Combined margin + padding with responsive values
237
+ * Spacing preset combined margin and padding with responsive values.
238
+ *
239
+ * Presets are managed in the Design System and referenced by ID.
240
+ * Plugins use `spacingPresetId` to apply a preset, with optional per-element overrides.
241
+ *
242
+ * @see {@link DesignSystemSpacing.getPreset}
243
+ *
244
+ * @example
245
+ * ```typescript
246
+ * const preset: SpacingPreset = {
247
+ * presetId: 'spacing-text-default',
248
+ * name: 'Text Default',
249
+ * margin: { mobile: { top: 0, ... }, tablet: { ... }, desktop: { ... } },
250
+ * padding: { mobile: { top: 8, ... }, tablet: { ... }, desktop: { ... } },
251
+ * };
252
+ * ```
90
253
  */
91
254
  export interface SpacingPreset {
255
+ /** Unique preset identifier (e.g., `'spacing-text-default'`, `'default'`) */
92
256
  presetId: string;
257
+
258
+ /** Human-readable preset name shown in the editor */
93
259
  name: string;
260
+
261
+ /** Responsive margin values (per-viewport) */
94
262
  margin: ResponsiveBoxValues;
263
+
264
+ /** Responsive padding values (per-viewport) */
95
265
  padding: ResponsiveBoxValues;
96
266
  }
97
267
 
98
268
  /**
99
- * Responsive spacing scale entry
269
+ * Responsive spacing scale entry — a single token in the spacing scale.
270
+ *
271
+ * Defines a spacing value that varies by viewport.
272
+ *
273
+ * @see {@link DesignSystemSpacing.scaleResponsive}
100
274
  */
101
275
  export interface ResponsiveSpacingScale {
276
+ /** Spacing value on mobile viewports */
102
277
  mobile: number;
278
+
279
+ /** Spacing value on tablet viewports */
103
280
  tablet: number;
281
+
282
+ /** Spacing value on desktop viewports */
104
283
  desktop: number;
284
+
285
+ /** CSS unit for this scale entry (e.g., `'px'`, `'rem'`) */
105
286
  unit: string;
106
287
  }
107
288
 
108
289
  /**
109
- * Design System Spacing Configuration
110
- * Clean, type-safe API
290
+ * Design System spacing configuration — provides spacing presets and scales.
291
+ *
292
+ * @see {@link PluginDesignSystem.spacing}
111
293
  */
112
294
  export interface DesignSystemSpacing {
113
- /** Spacing scale values */
295
+ /** Base spacing scale values (e.g., `[0, 4, 8, 12, 16, 24, 32, 48, 64]`) */
114
296
  scale: number[];
115
-
116
- /** Responsive spacing scales by token */
297
+
298
+ /** Responsive spacing scales keyed by design token name */
117
299
  scaleResponsive: Map<string, ResponsiveSpacingScale>;
118
-
300
+
119
301
  /**
120
- * Get a spacing preset by ID
121
- * @param presetId - The preset identifier
122
- * @returns The spacing preset (guaranteed to exist, falls back to 'default')
302
+ * Retrieve a spacing preset by ID.
303
+ *
304
+ * Guaranteed to return a valid preset falls back to `'default'`
305
+ * if the requested ID is not found.
306
+ *
307
+ * @param presetId - The preset identifier (e.g., `'spacing-text-default'`)
308
+ * @returns The spacing preset with margin and padding values
123
309
  */
124
310
  getPreset(presetId: string): SpacingPreset;
125
311
  }
126
312
 
127
313
  /**
128
- * Design System Grid Configuration
129
- * Clean, type-safe API
314
+ * Design System grid configuration — provides grid layout presets.
315
+ *
316
+ * @see {@link PluginDesignSystem.grid}
130
317
  */
131
318
  export interface DesignSystemGrid {
132
319
  /**
133
- * Get a grid preset by ID
134
- * @param presetId - The preset identifier
135
- * @returns The grid preset values (guaranteed to exist, falls back to 'default')
320
+ * Retrieve a grid preset by ID.
321
+ *
322
+ * Guaranteed to return valid values falls back to `'default'`
323
+ * if the requested ID is not found.
324
+ *
325
+ * @param presetId - The preset identifier (e.g., `'default'`, `'narrow'`)
326
+ * @returns Grid preset values (columns, rows, gaps, alignment)
136
327
  */
137
328
  getPreset(presetId: string): GridPresetValues;
138
329
  }
139
330
 
140
331
  /**
141
- * Breakpoint configuration for responsive design
332
+ * Breakpoint configuration for a single viewport.
333
+ *
334
+ * @see {@link DesignSystemBreakpoints}
142
335
  */
143
336
  export interface BreakpointConfig {
337
+ /** Minimum viewport width in pixels for this breakpoint */
144
338
  minWidth: number;
339
+
340
+ /** Breakpoint display name (e.g., `'Mobile'`, `'Tablet'`, `'Desktop'`) */
145
341
  name: string;
146
342
  }
147
343
 
148
344
  /**
149
- * Design System Breakpoints
345
+ * Design System breakpoint definitions for responsive design.
346
+ *
347
+ * @see {@link PluginDesignSystem.breakpoints}
348
+ *
349
+ * @example
350
+ * ```typescript
351
+ * const breakpoints: DesignSystemBreakpoints = {
352
+ * mobile: { minWidth: 0, name: 'Mobile' },
353
+ * tablet: { minWidth: 768, name: 'Tablet' },
354
+ * desktop: { minWidth: 1024, name: 'Desktop' },
355
+ * };
356
+ * ```
150
357
  */
151
358
  export interface DesignSystemBreakpoints {
359
+ /** Mobile breakpoint configuration */
152
360
  mobile: BreakpointConfig;
361
+
362
+ /** Tablet breakpoint configuration */
153
363
  tablet: BreakpointConfig;
364
+
365
+ /** Desktop breakpoint configuration */
154
366
  desktop: BreakpointConfig;
155
367
  }
156
368
 
157
369
  /**
158
- * Design System Layout Configuration
370
+ * Design System layout configuration — global layout defaults.
371
+ *
372
+ * @see {@link PluginDesignSystem.layout}
159
373
  */
160
374
  export interface DesignSystemLayout {
375
+ /** Maximum content width (CSS value, e.g., `'1200px'`) */
161
376
  maxWidth?: string;
377
+
378
+ /** Default gap between elements (CSS value) */
162
379
  gap?: string;
380
+
381
+ /** Default padding (CSS value) */
163
382
  padding?: string;
383
+
384
+ /** Default margin (CSS value) */
164
385
  margin?: string;
165
386
  }
166
387
 
167
388
  /**
168
- * Button Style Preset Configuration (Unified)
169
- *
170
- * Complete button style preset that replaces the separate
171
- * ButtonSizePreset and ButtonVariantPreset interfaces.
172
- * Matches design_system_button_styles table structure.
389
+ * Unified button style preset from the Design System.
390
+ *
391
+ * Contains all styling for a button variant: colors (per state),
392
+ * typography, spacing, border, effects, and animations.
393
+ * Matches the `design_system_button_styles` database table structure.
394
+ *
395
+ * @see {@link PluginDesignSystem.buttons}
396
+ *
397
+ * @example
398
+ * ```typescript
399
+ * const primary: ButtonStylePreset = {
400
+ * id: 'btn-1',
401
+ * presetId: 'primary',
402
+ * name: 'Primary',
403
+ * size: 'md',
404
+ * backgroundColorPresetId: 'primary',
405
+ * textColorPresetId: 'primary-foreground',
406
+ * defaultTransitionDuration: 150,
407
+ * hoverTransitionDuration: 150,
408
+ * activeTransitionDuration: 100,
409
+ * disabledOpacity: 0.5,
410
+ * isDefault: true,
411
+ * };
412
+ * ```
173
413
  */
174
414
  export interface ButtonStylePreset {
175
- // Identifiers
415
+ // ── Identifiers ──
416
+
417
+ /** Database row ID */
176
418
  id: string;
419
+
420
+ /** Unique preset identifier (e.g., `'primary'`, `'secondary'`, `'ghost'`) */
177
421
  presetId: string;
422
+
423
+ /** Human-readable name shown in the editor */
178
424
  name: string;
425
+
426
+ /** Size variant (e.g., `'sm'`, `'md'`, `'lg'`) */
179
427
  size: string;
180
-
181
- // Typography
428
+
429
+ // ── Typography ──
430
+
431
+ /** Design System font preset ID for button text */
182
432
  fontSizePresetId?: string;
433
+
434
+ /** CSS `font-weight` value */
183
435
  fontWeight?: string;
184
-
185
- // Spacing (reference to spacing preset)
436
+
437
+ // ── Spacing ──
438
+
439
+ /** Spacing preset ID for internal padding */
186
440
  spacingPresetId?: string;
187
-
188
- // Border
441
+
442
+ // ── Border ──
443
+
444
+ /** Border radius preset ID */
189
445
  borderRadiusPresetId?: string;
190
-
191
- // Effect Presets
446
+
447
+ // ── Effect Presets ──
448
+
449
+ /** Box shadow preset ID */
192
450
  shadowPresetId?: string;
451
+
452
+ /** Focus ring preset ID (accessibility) */
193
453
  focusRingPresetId?: string;
194
-
195
- // Animation Presets
454
+
455
+ // ── Animation Presets ──
456
+
457
+ /** Entry/exit animation preset ID */
196
458
  animationPresetId?: string;
459
+
460
+ /** Hover animation effect preset ID */
197
461
  hoverEffectPresetId?: string;
198
-
199
- // Colors - Default State
462
+
463
+ // ── Colors: Default State ──
464
+
465
+ /** Background color preset ID (default state) */
200
466
  backgroundColorPresetId?: string;
467
+
468
+ /** Text color preset ID (default state) */
201
469
  textColorPresetId?: string;
470
+
471
+ /** Border color preset ID (default state) */
202
472
  borderColorPresetId?: string;
203
-
204
- // Colors - Hover State
473
+
474
+ // ── Colors: Hover State ──
475
+
476
+ /** Background color preset ID on hover */
205
477
  hoverBackgroundColorPresetId?: string;
478
+
479
+ /** Text color preset ID on hover */
206
480
  hoverTextColorPresetId?: string;
481
+
482
+ /** Border color preset ID on hover */
207
483
  hoverBorderColorPresetId?: string;
208
-
209
- // Colors - Active/Pressed State
484
+
485
+ // ── Colors: Active/Pressed State ──
486
+
487
+ /** Background color preset ID when pressed */
210
488
  activeBackgroundColorPresetId?: string;
489
+
490
+ /** Text color preset ID when pressed */
211
491
  activeTextColorPresetId?: string;
492
+
493
+ /** Border color preset ID when pressed */
212
494
  activeBorderColorPresetId?: string;
213
-
214
- // Transition Durations (in milliseconds)
495
+
496
+ // ── Transition Durations ──
497
+
498
+ /** Default state transition duration in milliseconds */
215
499
  defaultTransitionDuration: number;
500
+
501
+ /** Hover state transition duration in milliseconds */
216
502
  hoverTransitionDuration: number;
503
+
504
+ /** Active/pressed state transition duration in milliseconds */
217
505
  activeTransitionDuration: number;
218
-
219
- // Disabled State
506
+
507
+ // ── Disabled State ──
508
+
509
+ /** Opacity applied when the button is disabled (0–1) */
220
510
  disabledOpacity: number;
221
-
222
- // Text Decoration per state
511
+
512
+ // ── Text Decoration per State ──
513
+
514
+ /** CSS `text-decoration` in default state */
223
515
  defaultTextDecoration?: string;
516
+
517
+ /** CSS `text-decoration` on hover */
224
518
  hoverTextDecoration?: string;
519
+
520
+ /** CSS `text-decoration` when active/pressed */
225
521
  activeTextDecoration?: string;
226
-
227
- // Text Transform per state
522
+
523
+ // ── Text Transform per State ──
524
+
525
+ /** CSS `text-transform` in default state */
228
526
  defaultTextTransform?: string;
527
+
528
+ /** CSS `text-transform` on hover */
229
529
  hoverTextTransform?: string;
530
+
531
+ /** CSS `text-transform` when active/pressed */
230
532
  activeTextTransform?: string;
231
-
232
- // Metadata
533
+
534
+ // ── Metadata ──
535
+
536
+ /** Description of when/where to use this preset */
233
537
  usageDescription?: string;
538
+
539
+ /** Whether this is the default preset for new button instances */
234
540
  isDefault: boolean;
235
541
  }
236
542
 
237
543
  /**
238
- * @deprecated Use ButtonStylePreset instead
239
- * Legacy Button Size Preset Configuration
544
+ * Legacy button size preset configuration.
545
+ *
546
+ * @deprecated Use {@link ButtonStylePreset} instead — this interface
547
+ * will be removed in a future version.
240
548
  */
241
549
  export interface ButtonSizePreset {
550
+ /** Button preset ID */
242
551
  button_id: string;
552
+
553
+ /** Preset display name */
243
554
  name: string;
555
+
556
+ /** CSS padding value */
244
557
  padding: string;
558
+
559
+ /** CSS font-size value */
245
560
  fontSize: string;
561
+
562
+ /** Icon size value */
246
563
  iconSize: string;
564
+
565
+ /** CSS min-height value */
247
566
  minHeight: string;
567
+
568
+ /** CSS border-radius value */
248
569
  borderRadius?: string;
570
+
571
+ /** CSS font-weight value */
249
572
  fontWeight?: string;
573
+
574
+ /** Description of intended usage */
250
575
  usage_description?: string;
251
576
  }
252
577
 
253
578
  /**
254
- * @deprecated Use ButtonStylePreset instead
255
- * Legacy Button Variant Preset Configuration
579
+ * Legacy button variant preset configuration.
580
+ *
581
+ * @deprecated Use {@link ButtonStylePreset} instead — this interface
582
+ * will be removed in a future version.
256
583
  */
257
584
  export interface ButtonVariantPreset {
585
+ /** Background color */
258
586
  background: string;
587
+
588
+ /** Background color on hover */
259
589
  hoverBackground: string;
590
+
591
+ /** Text color */
260
592
  textColor: string;
593
+
594
+ /** Border color */
261
595
  borderColor: string;
262
596
  }
263
597
 
264
598
  /**
265
- * Shadow Configuration
599
+ * Shadow configuration with optional dark-mode variant.
600
+ *
601
+ * @see {@link PluginDesignSystem.shadows}
602
+ *
603
+ * @example
604
+ * ```typescript
605
+ * const shadow: ShadowConfig = {
606
+ * value: '0 4px 6px rgba(0, 0, 0, 0.1)',
607
+ * dark: '0 4px 6px rgba(0, 0, 0, 0.3)',
608
+ * };
609
+ * ```
266
610
  */
267
611
  export interface ShadowConfig {
612
+ /** CSS `box-shadow` value for light mode */
268
613
  value: string;
614
+
615
+ /** CSS `box-shadow` value for dark mode (falls back to `value` if not set) */
269
616
  dark?: string;
270
617
  }
271
618
 
272
619
  /**
273
- * Accordion Style Preset Configuration
274
- *
275
- * Complete accordion style preset for collapsible components.
276
- * Matches design_system_accordion_presets table structure.
620
+ * Accordion style preset from the Design System.
621
+ *
622
+ * Contains all styling for collapsible accordion components: header/body
623
+ * colors, typography, spacing, animations, and state variants.
624
+ * Matches the `design_system_accordion_presets` database table structure.
625
+ *
626
+ * @see {@link PluginDesignSystem.accordions}
277
627
  */
278
628
  export interface AccordionStylePreset {
279
- // Identifiers
629
+ // ── Identifiers ──
630
+
631
+ /** Database row ID */
280
632
  id: string;
633
+
634
+ /** Unique preset identifier (e.g., `'default'`, `'sm'`, `'lg'`) */
281
635
  presetId: string;
636
+
637
+ /** Human-readable preset name */
282
638
  name: string;
283
-
284
- // Header Settings
639
+
640
+ // ── Header Settings ──
641
+
642
+ /** CSS height for the accordion header (e.g., `'48px'`) */
285
643
  headerHeight?: string;
644
+
645
+ /** Font preset ID for header text */
286
646
  headerFontSizePresetId?: string;
647
+
648
+ /** CSS `font-weight` for header text */
287
649
  headerFontWeight?: string;
650
+
651
+ /** Spacing preset ID for header padding */
288
652
  headerPaddingPresetId?: string;
653
+
654
+ /** Background color preset ID for header (default state) */
289
655
  headerBackgroundColorPresetId?: string;
656
+
657
+ /** Background color preset ID for header on hover */
290
658
  headerHoverBackgroundColorPresetId?: string;
659
+
660
+ /** Text color preset ID for header */
291
661
  headerTextColorPresetId?: string;
662
+
663
+ /** Border color preset ID for header */
292
664
  headerBorderColorPresetId?: string;
293
-
294
- // Body Settings
665
+
666
+ // ── Body Settings ──
667
+
668
+ /** Minimum height for the accordion body (e.g., `'100px'`) */
295
669
  bodyMinHeight?: string;
670
+
671
+ /** Spacing preset ID for body padding */
296
672
  bodyPaddingPresetId?: string;
673
+
674
+ /** Background color preset ID for body */
297
675
  bodyBackgroundColorPresetId?: string;
676
+
677
+ /** Border color preset ID for body */
298
678
  bodyBorderColorPresetId?: string;
299
-
300
- // General
679
+
680
+ // ── General ──
681
+
682
+ /** Border radius preset ID */
301
683
  borderRadiusPresetId?: string;
684
+
685
+ /** Box shadow preset ID */
302
686
  shadowPresetId?: string;
687
+
688
+ /** Outer spacing preset ID */
303
689
  spacingPresetId?: string;
304
-
305
- // Animation
690
+
691
+ // ── Animation ──
692
+
693
+ /** Expand/collapse transition duration in milliseconds */
306
694
  transitionDuration: number;
695
+
696
+ /** CSS easing function (e.g., `'ease-in-out'`) */
307
697
  transitionEasing?: string;
308
-
309
- // State Colors
698
+
699
+ // ── State Colors ──
700
+
701
+ /** Background color preset ID when expanded */
310
702
  expandedBackgroundColorPresetId?: string;
703
+
704
+ /** Text color preset ID when expanded */
311
705
  expandedTextColorPresetId?: string;
312
-
313
- // Metadata
706
+
707
+ // ── Metadata ──
708
+
709
+ /** Description of when/where to use this preset */
314
710
  usageDescription?: string;
711
+
712
+ /** Whether this is the default preset for new accordion instances */
315
713
  isDefault: boolean;
316
714
  }
317
715
 
318
716
  /**
319
- * Form Style Preset Configuration (Unified)
320
- *
321
- * Complete form style preset that contains all styling for form elements.
322
- * Matches design_system_form_styles table structure.
717
+ * Unified form style preset from the Design System.
718
+ *
719
+ * Contains all styling for form elements: input fields, labels, descriptions,
720
+ * error states, and submit buttons. Matches the `design_system_form_styles`
721
+ * database table structure.
722
+ *
723
+ * @see {@link PluginDesignSystem.forms}
323
724
  */
324
725
  export interface FormStylePreset {
325
- // Identifiers
726
+ // ── Identifiers ──
727
+
728
+ /** Database row ID */
326
729
  id: string;
730
+
731
+ /** Unique preset identifier (e.g., `'default'`, `'outlined'`) */
327
732
  presetId: string;
733
+
734
+ /** Human-readable preset name */
328
735
  name: string;
736
+
737
+ /** Visual variant (e.g., `'filled'`, `'outlined'`, `'underlined'`) */
329
738
  variant: string;
739
+
740
+ /** Size variant (e.g., `'sm'`, `'md'`, `'lg'`) */
330
741
  size: string;
331
-
332
- // Typography
742
+
743
+ // ── Typography ──
744
+
745
+ /** Font preset ID for input text */
333
746
  fontSizePresetId?: string;
334
-
335
- // Spacing
747
+
748
+ // ── Spacing ──
749
+
750
+ /** Horizontal padding in pixels */
336
751
  paddingX: number;
752
+
753
+ /** Vertical padding in pixels */
337
754
  paddingY: number;
755
+
756
+ /** Border width in pixels */
338
757
  borderWidth: number;
758
+
759
+ /** Border radius preset ID */
339
760
  borderRadiusPresetId?: string;
340
-
341
- // Effect Presets
761
+
762
+ // ── Effect Presets ──
763
+
764
+ /** Box shadow preset ID */
342
765
  shadowPresetId?: string;
766
+
767
+ /** Focus ring preset ID */
343
768
  focusRingPresetId?: string;
344
-
345
- // Animation Presets
769
+
770
+ // ── Animation Presets ──
771
+
772
+ /** Entry/exit animation preset ID */
346
773
  animationPresetId?: string;
774
+
775
+ /** Hover animation effect preset ID */
347
776
  hoverEffectPresetId?: string;
348
-
349
- // Colors - Default State
777
+
778
+ // ── Colors: Default State ──
779
+
780
+ /** Input background color preset ID */
350
781
  backgroundColorPresetId?: string;
782
+
783
+ /** Input text color preset ID */
351
784
  textColorPresetId?: string;
785
+
786
+ /** Input border color preset ID */
352
787
  borderColorPresetId?: string;
788
+
789
+ /** Placeholder text color preset ID */
353
790
  placeholderColorPresetId?: string;
791
+
792
+ /** Focus ring color preset ID */
354
793
  focusRingColorPresetId?: string;
355
-
356
- // Colors - Hover State
794
+
795
+ // ── Colors: Hover State ──
796
+
797
+ /** Background color preset ID on hover */
357
798
  hoverBackgroundColorPresetId?: string;
799
+
800
+ /** Border color preset ID on hover */
358
801
  hoverBorderColorPresetId?: string;
359
-
360
- // Disabled State
802
+
803
+ // ── Disabled State ──
804
+
805
+ /** Opacity applied when the input is disabled (0–1) */
361
806
  disabledOpacity: number;
362
-
363
- // Error State
807
+
808
+ // ── Error State ──
809
+
810
+ /** Border color preset ID in error state */
364
811
  errorBorderColorPresetId?: string;
812
+
813
+ /** Error message text color preset ID */
365
814
  errorTextColorPresetId?: string;
366
-
367
- // Submit Button Reference
815
+
816
+ // ── Submit Button ──
817
+
818
+ /** Button style preset ID for the form's submit button */
368
819
  submitButtonPresetId?: string;
369
-
370
- // Container Styling
820
+
821
+ // ── Container Styling ──
822
+
823
+ /** Background color preset ID for the form container */
371
824
  containerBackgroundColorPresetId?: string;
825
+
826
+ /** Spacing preset ID for the form container */
372
827
  containerSpacingPresetId?: string;
373
-
374
- // Label Styling
828
+
829
+ // ── Label Styling ──
830
+
831
+ /** Font preset ID for field labels */
375
832
  labelFontPresetId?: string;
833
+
834
+ /** Color preset ID for field labels */
376
835
  labelColorPresetId?: string;
377
-
378
- // Description/Help Text Styling
836
+
837
+ // ── Description/Help Text ──
838
+
839
+ /** Font preset ID for help/description text */
379
840
  descriptionFontPresetId?: string;
841
+
842
+ /** Color preset ID for help/description text */
380
843
  descriptionColorPresetId?: string;
381
-
382
- // Field Spacing
844
+
845
+ // ── Field Spacing ──
846
+
847
+ /** Vertical gap between form fields in pixels */
383
848
  fieldGap?: number;
384
-
385
- // Metadata
849
+
850
+ // ── Metadata ──
851
+
852
+ /** Description of when/where to use this preset */
386
853
  usageDescription?: string;
854
+
855
+ /** Whether this is the default preset for new form instances */
387
856
  isDefault: boolean;
388
857
  }
389
858
 
390
859
  /**
391
- * Design System API
860
+ * Design System API — the unified interface for accessing design tokens.
392
861
  *
393
- * Interface for accessing global design system values.
394
- * The host application must provide an implementation.
862
+ * Plugins receive this via {@link PluginDependencies.designSystem}.
863
+ * The host application provides an implementation backed by the database
864
+ * or configuration files.
865
+ *
866
+ * @see {@link PluginDependencies}
867
+ *
868
+ * @example
869
+ * ```typescript
870
+ * // Inside a plugin component
871
+ * const { designSystem } = dependencies;
872
+ * const font = designSystem.fonts.getPreset('heading-1');
873
+ * const color = designSystem.colors.getPreset('primary');
874
+ * const spacing = designSystem.spacing.getPreset('default');
875
+ * ```
395
876
  */
396
877
  export interface PluginDesignSystem {
878
+ /**
879
+ * Typography preset system.
880
+ * @see {@link DesignSystemFont}
881
+ */
397
882
  fonts: {
883
+ /**
884
+ * Get a font preset by ID.
885
+ * @param presetId - Font preset identifier (e.g., `'heading-1'`, `'body'`)
886
+ * @returns Font configuration or `undefined` if not found
887
+ */
398
888
  getPreset: (presetId: string) => DesignSystemFont | undefined;
399
889
  };
890
+
891
+ /**
892
+ * Color preset system.
893
+ * @see {@link DesignSystemColor}
894
+ */
400
895
  colors: {
896
+ /**
897
+ * Get a color preset by ID.
898
+ * @param presetId - Color preset identifier (e.g., `'primary'`, `'foreground'`)
899
+ * @returns Color configuration or `undefined` if not found
900
+ */
401
901
  getPreset: (presetId: string) => DesignSystemColor | undefined;
402
902
  };
903
+
904
+ /**
905
+ * Spacing system with presets and scales.
906
+ * @see {@link DesignSystemSpacing}
907
+ */
403
908
  spacing: DesignSystemSpacing;
909
+
910
+ /**
911
+ * Grid layout system (optional, container-specific).
912
+ * @see {@link DesignSystemGrid}
913
+ */
404
914
  grid?: DesignSystemGrid; // Container-specific, optional
915
+
916
+ /**
917
+ * Layout preset system for global layout defaults.
918
+ * @see {@link DesignSystemLayout}
919
+ */
405
920
  layout: {
921
+ /**
922
+ * Get a layout preset by ID.
923
+ * @param presetId - Layout preset identifier
924
+ * @returns Layout configuration or `undefined` if not found
925
+ */
406
926
  getPreset: (presetId: string) => DesignSystemLayout | undefined;
407
927
  };
928
+
929
+ /**
930
+ * Viewport breakpoint configuration.
931
+ * @see {@link DesignSystemBreakpoints}
932
+ */
408
933
  breakpoints: {
934
+ /**
935
+ * Get all breakpoint configurations.
936
+ * @returns Mobile, tablet, and desktop breakpoint definitions
937
+ */
409
938
  getConfig: () => DesignSystemBreakpoints;
410
939
  };
940
+
411
941
  /**
412
- * Button System (optional)
413
- * Provides unified button style presets from design system database
414
- * Each preset contains colors, typography, spacing, and effects
942
+ * Button style preset system (optional).
943
+ *
944
+ * Provides unified button styling from the design system database.
945
+ * Each preset contains colors, typography, spacing, and effects.
946
+ *
947
+ * @see {@link ButtonStylePreset}
415
948
  */
416
949
  buttons?: {
417
950
  /**
418
- * Get button style preset by ID
419
- * @param presetId - Button preset identifier (e.g., 'primary', 'secondary', 'custom-1')
420
- * @returns Button style preset or undefined if not found
951
+ * Get a button style preset by ID.
952
+ * @param presetId - Button preset identifier (e.g., `'primary'`, `'secondary'`)
953
+ * @returns Button style preset or `undefined` if not found
421
954
  */
422
955
  getPreset: (presetId: string) => ButtonStylePreset | undefined;
956
+
423
957
  /**
424
- * List all available button style presets
425
- * @returns Array of button style presets sorted by sort_order
958
+ * List all available button style presets.
959
+ * @returns Array of button style presets sorted by sort order
426
960
  */
427
961
  listPresets?: () => ButtonStylePreset[];
428
962
  };
963
+
429
964
  /**
430
- * Form System (optional)
431
- * Provides unified form style presets from design system database
432
- * Each preset contains colors, typography, spacing, and effects for form elements
965
+ * Form style preset system (optional).
966
+ *
967
+ * Provides unified form element styling from the design system database.
968
+ *
969
+ * @see {@link FormStylePreset}
433
970
  */
434
971
  forms?: {
435
972
  /**
436
- * Get form style preset by ID
437
- * @param presetId - Form preset identifier (e.g., 'default', 'outlined', 'custom-1')
438
- * @returns Form style preset or undefined if not found
973
+ * Get a form style preset by ID.
974
+ * @param presetId - Form preset identifier (e.g., `'default'`, `'outlined'`)
975
+ * @returns Form style preset or `undefined` if not found
439
976
  */
440
977
  getPreset: (presetId: string) => FormStylePreset | undefined;
978
+
441
979
  /**
442
- * List all available form style presets
443
- * @returns Array of form style presets sorted by sort_order
980
+ * List all available form style presets.
981
+ * @returns Array of form style presets sorted by sort order
444
982
  */
445
983
  listPresets?: () => FormStylePreset[];
446
984
  };
985
+
447
986
  /**
448
- * Accordion System (optional)
449
- * Provides unified accordion style presets from design system database
450
- * Each preset contains colors, typography, spacing, and effects for accordion components
987
+ * Accordion style preset system (optional).
988
+ *
989
+ * Provides unified accordion styling from the design system database.
990
+ *
991
+ * @see {@link AccordionStylePreset}
451
992
  */
452
993
  accordions?: {
453
994
  /**
454
- * Get accordion style preset by ID
455
- * @param presetId - Accordion preset identifier (e.g., 'default', 'sm', 'lg', 'custom-1')
456
- * @returns Accordion style preset or undefined if not found
995
+ * Get an accordion style preset by ID.
996
+ * @param presetId - Accordion preset identifier (e.g., `'default'`, `'sm'`, `'lg'`)
997
+ * @returns Accordion style preset or `undefined` if not found
457
998
  */
458
999
  getPreset: (presetId: string) => AccordionStylePreset | undefined;
1000
+
459
1001
  /**
460
- * List all available accordion style presets
461
- * @returns Array of accordion style presets sorted by sort_order
1002
+ * List all available accordion style presets.
1003
+ * @returns Array of accordion style presets sorted by sort order
462
1004
  */
463
1005
  listPresets?: () => AccordionStylePreset[];
464
1006
  };
1007
+
465
1008
  /**
466
- * Shadow System (optional)
467
- * Provides shadow presets with light and dark mode variants
1009
+ * Shadow preset system (optional).
1010
+ *
1011
+ * Provides box-shadow values with optional dark-mode variants.
1012
+ *
1013
+ * @see {@link ShadowConfig}
468
1014
  */
469
1015
  shadows?: {
1016
+ /**
1017
+ * Get a shadow preset by ID.
1018
+ * @param presetId - Shadow preset identifier (e.g., `'sm'`, `'md'`, `'lg'`)
1019
+ * @returns Shadow configuration (guaranteed to exist)
1020
+ */
470
1021
  getPreset: (presetId: string) => ShadowConfig;
471
1022
  };
472
1023
  }
473
1024
 
474
1025
  /**
475
- * Utility Functions API
1026
+ * Utility functions API injected into plugins by the host application.
476
1027
  *
477
- * Interface for utility functions required by the plugin.
478
- * The host application must provide implementations.
1028
+ * @see {@link PluginDependencies.utils}
479
1029
  */
480
1030
  export interface PluginUtils {
481
1031
  /**
482
- * Class name utility (e.g., clsx, classnames, tailwind-merge)
483
- * Combines multiple class names intelligently
1032
+ * Class name utility function (e.g., `clsx`, `classnames`, `tailwind-merge`).
1033
+ *
1034
+ * Combines and deduplicates class names intelligently.
1035
+ *
1036
+ * @param inputs - Class names, arrays, objects, or falsy values
1037
+ * @returns Merged class name string
1038
+ *
1039
+ * @example
1040
+ * ```typescript
1041
+ * const { cn } = dependencies.utils;
1042
+ * const className = cn('base', isActive && 'active', { 'selected': isSelected });
1043
+ * ```
484
1044
  */
485
1045
  cn: (...inputs: any[]) => string;
486
1046
  }
487
1047
 
488
1048
  /**
489
- * Plugin Renderer Props
1049
+ * Props for the `PluginRenderer` component injected by the host application.
490
1050
  *
491
- * Props interface for the PluginRenderer component.
492
- * This is injected by the host application to render child plugins.
1051
+ * Container plugins use this to recursively render their child elements.
1052
+ * The host provides the actual implementation that resolves plugin IDs
1053
+ * to component instances.
1054
+ *
1055
+ * @see {@link PluginDependencies.PluginRenderer}
493
1056
  */
494
1057
  export interface PluginRendererProps {
495
1058
  /**
496
- * Plugin ID to render (e.g., 'base-text', 'base-image')
1059
+ * Plugin ID to render (e.g., `'base-text'`, `'base-image'`)
497
1060
  */
498
1061
  pluginId: string;
499
1062
 
500
1063
  /**
501
- * Element ID for tracking
1064
+ * Unique element ID for tracking and callbacks
502
1065
  */
503
1066
  elementId: string;
504
1067
 
505
1068
  /**
506
- * Plugin data/configuration
1069
+ * Plugin data / configuration object
507
1070
  */
508
1071
  data: Record<string, unknown>;
509
1072
 
510
1073
  /**
511
- * Current language code
1074
+ * Current language code (ISO) for content resolution
512
1075
  */
513
1076
  language: string;
514
1077
 
515
1078
  /**
516
- * Is in editor mode?
1079
+ * Whether the host is in editor mode (interactive editing enabled)
1080
+ * @default false
517
1081
  */
518
1082
  isEditorMode?: boolean;
519
1083
 
520
1084
  /**
521
- * Is element selected?
1085
+ * Whether this element is currently selected in the editor
1086
+ * @default false
522
1087
  */
523
1088
  isSelected?: boolean;
524
1089
 
525
1090
  /**
526
- * Click handler
1091
+ * Click handler for element selection
1092
+ * @param id - Element ID that was clicked
527
1093
  */
528
1094
  onClick?: (id: string) => void;
529
1095
  }
530
1096
 
531
1097
  /**
532
- * Plugin Callbacks
1098
+ * Event callbacks for plugin-to-host communication.
1099
+ *
1100
+ * Plugins invoke these to notify the host application of user actions
1101
+ * like content edits, child additions/removals, and layout changes.
533
1102
  *
534
- * Event callbacks that plugins can use to communicate with the host application.
1103
+ * @see {@link PluginDependencies.callbacks}
535
1104
  */
536
1105
  export interface PluginCallbacks {
537
1106
  /**
538
- * Called when content changes (for text, rich-text components)
539
- * @param elementId - ID of the element
540
- * @param language - Language code
1107
+ * Called when text content changes (for text, rich-text components).
1108
+ *
1109
+ * @param elementId - ID of the element being edited
1110
+ * @param language - ISO language code of the content
541
1111
  * @param content - New content value
542
1112
  */
543
1113
  onContentChange?: (
@@ -547,10 +1117,11 @@ export interface PluginCallbacks {
547
1117
  ) => void;
548
1118
 
549
1119
  /**
550
- * Called when child element is dropped into container
551
- * @param containerId - ID of the container element
1120
+ * Called when a child element is dropped into a container.
1121
+ *
1122
+ * @param containerId - ID of the receiving container
552
1123
  * @param droppedElementId - ID of the dropped element
553
- * @param index - Optional insertion index
1124
+ * @param index - Optional insertion index (append if omitted)
554
1125
  */
555
1126
  onChildAdded?: (
556
1127
  containerId: string,
@@ -559,15 +1130,17 @@ export interface PluginCallbacks {
559
1130
  ) => void;
560
1131
 
561
1132
  /**
562
- * Called when child element is removed from container
563
- * @param containerId - ID of the container element
1133
+ * Called when a child element is removed from a container.
1134
+ *
1135
+ * @param containerId - ID of the container
564
1136
  * @param removedElementId - ID of the removed element
565
1137
  */
566
1138
  onChildRemoved?: (containerId: string, removedElementId: string) => void;
567
1139
 
568
1140
  /**
569
- * Called when container layout is changed
570
- * @param containerId - ID of the container element
1141
+ * Called when a container's layout mode changes.
1142
+ *
1143
+ * @param containerId - ID of the container
571
1144
  * @param layoutMode - New layout mode
572
1145
  */
573
1146
  onLayoutChange?: (
@@ -577,30 +1150,47 @@ export interface PluginCallbacks {
577
1150
  }
578
1151
 
579
1152
  /**
580
- * Complete Plugin Dependencies
1153
+ * Complete plugin dependencies — everything a plugin receives from the host.
1154
+ *
1155
+ * This is the full dependency interface used by the `dependencies.ts` module.
1156
+ * It includes the `PluginRenderer` component and optional callbacks,
1157
+ * which are not present in the simplified version in `plugin-system.ts`.
1158
+ *
1159
+ * **Plugin-driven architecture:** Plugins never import host code directly.
1160
+ * All external functionality is injected through this interface.
581
1161
  *
582
- * All external dependencies that must be injected into the plugin.
583
- * PLUGIN-DRIVEN ARCHITECTURE: Plugins receive dependencies from the host app.
1162
+ * @see {@link PluginDesignSystem} for design token access
1163
+ * @see {@link PluginUtils} for utility functions
1164
+ * @see {@link PluginRendererProps} for the renderer component props
1165
+ * @see {@link PluginCallbacks} for event communication
584
1166
  */
585
1167
  export interface PluginDependencies {
586
1168
  /**
587
1169
  * Design System API for accessing global design tokens
1170
+ * (fonts, colors, spacing, breakpoints, etc.).
1171
+ * @see {@link PluginDesignSystem}
588
1172
  */
589
1173
  designSystem: PluginDesignSystem;
590
1174
 
591
1175
  /**
592
- * Utility functions (e.g., cn for classnames)
1176
+ * Utility functions (e.g., `cn` for class name merging).
1177
+ * @see {@link PluginUtils}
593
1178
  */
594
1179
  utils: PluginUtils;
595
1180
 
596
1181
  /**
597
- * PluginRenderer component for rendering child plugins
598
- * CRITICAL: Container plugins need this to render their NESTED children
1182
+ * Component for recursively rendering child plugins inside containers.
1183
+ *
1184
+ * **Critical** for container plugins with `supportsChildren = true` —
1185
+ * they use this to render their nested children.
1186
+ *
1187
+ * @see {@link PluginRendererProps}
599
1188
  */
600
1189
  PluginRenderer: ComponentType<PluginRendererProps>;
601
1190
 
602
1191
  /**
603
- * Optional callbacks for communication with host app
1192
+ * Optional event callbacks for communicating with the host application.
1193
+ * @see {@link PluginCallbacks}
604
1194
  */
605
1195
  callbacks?: PluginCallbacks;
606
1196
  }