@chrisflippen/blueprint-document-assembly 1.0.0 → 3.0.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/dist/index.d.mts CHANGED
@@ -1,3 +1,5 @@
1
+ import * as react from 'react';
2
+ import { ComponentType, CSSProperties, ReactNode, RefObject } from 'react';
1
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
4
 
3
5
  interface LogEntry {
@@ -20,6 +22,9 @@ interface Step {
20
22
  substeps?: SubStep[];
21
23
  documentSection?: string;
22
24
  logs: LogEntry[];
25
+ icon?: ComponentType<{
26
+ className?: string;
27
+ }>;
23
28
  }
24
29
  interface DocumentMetrics {
25
30
  tokens: number;
@@ -30,6 +35,262 @@ interface DocumentIds {
30
35
  caseNumber: string;
31
36
  fileNumber: string;
32
37
  }
38
+ interface DocumentSubsection {
39
+ revealOnSubstep: string;
40
+ content: string | ReactNode;
41
+ className?: string;
42
+ animation?: 'typewriter' | 'fade' | 'slide';
43
+ }
44
+ interface DocumentSection {
45
+ id: string;
46
+ title: string;
47
+ borderColor: string;
48
+ icon?: ComponentType<{
49
+ className?: string;
50
+ }>;
51
+ className?: string;
52
+ style?: CSSProperties;
53
+ subsections: DocumentSubsection[];
54
+ }
55
+ interface ClassNameSlots {
56
+ root?: string;
57
+ progressBar?: string;
58
+ leftPanel?: string;
59
+ rightPanel?: string;
60
+ header?: string;
61
+ footer?: string;
62
+ step?: string;
63
+ stepIcon?: string;
64
+ substep?: string;
65
+ log?: string;
66
+ logContainer?: string;
67
+ documentPreview?: string;
68
+ documentPaper?: string;
69
+ documentSection?: string;
70
+ wholeDocumentView?: string;
71
+ wholeDocumentContent?: string;
72
+ metricsBar?: string;
73
+ metricsItem?: string;
74
+ }
75
+ interface ThemeConfig {
76
+ primary?: string;
77
+ secondary?: string;
78
+ success?: string;
79
+ processing?: string;
80
+ warning?: string;
81
+ }
82
+ interface AnimationTimings {
83
+ stepActivation?: number;
84
+ substepDelay?: number;
85
+ logStreamBase?: number;
86
+ logStreamVariance?: number;
87
+ typewriterSpeed?: number;
88
+ sectionRevealDuration?: number;
89
+ completionDelay?: number;
90
+ }
91
+ interface LabelConfig {
92
+ title?: string;
93
+ statusProcessing?: string;
94
+ statusComplete?: string;
95
+ documentTitle?: string;
96
+ documentPrefix?: string;
97
+ documentSuffix?: string;
98
+ completionTitle?: string;
99
+ completionBadge?: string;
100
+ metricsTokens?: string;
101
+ metricsCost?: string;
102
+ metricsElapsed?: string;
103
+ stepPrefix?: string;
104
+ stepDone?: string;
105
+ substepCount?: (completed: number, total: number) => string;
106
+ logLabel?: string;
107
+ logLabelCompact?: string;
108
+ logEntriesSuffix?: string;
109
+ watermarkText?: string;
110
+ }
111
+ interface LayoutConfig {
112
+ leftWidth?: string;
113
+ rightWidth?: string;
114
+ direction?: 'horizontal' | 'vertical';
115
+ }
116
+ interface ResolvedThemeColors {
117
+ bg: string;
118
+ border: string;
119
+ text: string;
120
+ icon: string;
121
+ accent: string;
122
+ }
123
+ interface ResolvedTheme {
124
+ primary: ResolvedThemeColors;
125
+ secondary: ResolvedThemeColors;
126
+ success: ResolvedThemeColors;
127
+ processing: ResolvedThemeColors;
128
+ warning: ResolvedThemeColors;
129
+ stepStatus: Record<Step['status'], {
130
+ cardBg: string;
131
+ border: string;
132
+ iconBg: string;
133
+ textColor: string;
134
+ }>;
135
+ gradients: {
136
+ progress: string;
137
+ title: string;
138
+ completion: string;
139
+ };
140
+ }
141
+ interface AnimationPreset {
142
+ name: string;
143
+ durations: {
144
+ fast: number;
145
+ normal: number;
146
+ slow: number;
147
+ };
148
+ springs: {
149
+ stiff: {
150
+ type: 'spring';
151
+ stiffness: number;
152
+ damping: number;
153
+ };
154
+ gentle: {
155
+ type: 'spring';
156
+ stiffness: number;
157
+ damping: number;
158
+ };
159
+ bouncy: {
160
+ type: 'spring';
161
+ stiffness: number;
162
+ damping: number;
163
+ bounce: number;
164
+ };
165
+ };
166
+ stagger: {
167
+ step: number;
168
+ substep: number;
169
+ log: number;
170
+ sparkle: number;
171
+ };
172
+ typewriter: {
173
+ charDelay: number;
174
+ cursorBlink: number;
175
+ };
176
+ entrance: {
177
+ x: number;
178
+ y: number;
179
+ scale: number;
180
+ };
181
+ hookTimings: Required<AnimationTimings>;
182
+ }
183
+ interface UseDocumentAssemblyOptions {
184
+ steps?: Step[];
185
+ stepLogs?: Record<string, string[][]>;
186
+ substepLogs?: Record<string, string[][]>;
187
+ autoStart?: boolean;
188
+ autoScroll?: boolean;
189
+ showWholeDocumentView?: boolean;
190
+ documentIds?: DocumentIds;
191
+ animationSpeed?: number;
192
+ animationTimings?: AnimationTimings;
193
+ onStepStart?: (step: Step, index: number) => void;
194
+ onStepComplete?: (step: Step, metrics: DocumentMetrics) => void;
195
+ onSubstepComplete?: (substepId: string, stepIndex: number) => void;
196
+ onSectionReveal?: (sectionId: string) => void;
197
+ onLogEntry?: (log: LogEntry) => void;
198
+ onComplete?: (metrics: DocumentMetrics) => void;
199
+ onPause?: () => void;
200
+ onResume?: () => void;
201
+ onReset?: () => void;
202
+ }
203
+ interface UseDocumentAssemblyReturn {
204
+ steps: Step[];
205
+ completedSections: Set<string>;
206
+ completedSubsteps: Set<string>;
207
+ metrics: DocumentMetrics;
208
+ showRipple: string | null;
209
+ currentStep: number;
210
+ showWholeDocument: boolean;
211
+ isRunning: boolean;
212
+ isPaused: boolean;
213
+ isComplete: boolean;
214
+ progress: number;
215
+ documentIds: DocumentIds;
216
+ documentScrollRef: RefObject<HTMLDivElement | null>;
217
+ start: () => void;
218
+ pause: () => void;
219
+ resume: () => void;
220
+ reset: () => void;
221
+ goToStep: (stepIndex: number) => void;
222
+ setShowWholeDocument: (show: boolean) => void;
223
+ }
224
+ interface BlueprintDocumentAssemblyRef {
225
+ start: () => void;
226
+ pause: () => void;
227
+ resume: () => void;
228
+ reset: () => void;
229
+ goToStep: (stepIndex: number) => void;
230
+ }
231
+ interface StepItemProps$1 {
232
+ step: Step;
233
+ isLast: boolean;
234
+ showRipple: boolean;
235
+ classNames?: ClassNameSlots;
236
+ theme?: ThemeConfig;
237
+ labels?: LabelConfig;
238
+ renderStep?: (step: Step, defaultRender: ReactNode) => ReactNode;
239
+ }
240
+ interface SubStepItemProps$1 {
241
+ substep: SubStep;
242
+ delay: number;
243
+ classNames?: ClassNameSlots;
244
+ renderSubstep?: (substep: SubStep, defaultRender: ReactNode) => ReactNode;
245
+ }
246
+ interface LogLineProps$1 {
247
+ log: LogEntry;
248
+ compact?: boolean;
249
+ classNames?: ClassNameSlots;
250
+ }
251
+ interface LogContainerProps$1 {
252
+ logs: LogEntry[];
253
+ expanded: boolean;
254
+ onToggle: () => void;
255
+ compact?: boolean;
256
+ classNames?: ClassNameSlots;
257
+ labels?: LabelConfig;
258
+ renderLog?: (log: LogEntry, defaultRender: ReactNode) => ReactNode;
259
+ }
260
+ interface DocumentLineProps$1 {
261
+ text: string;
262
+ delay: number;
263
+ className?: string;
264
+ }
265
+ interface DocumentPreviewProps$1 {
266
+ completedSections: Set<string>;
267
+ completedSubsteps: Set<string>;
268
+ documentIds: DocumentIds;
269
+ sections?: DocumentSection[];
270
+ classNames?: ClassNameSlots;
271
+ watermarkText?: string;
272
+ paperTexture?: boolean;
273
+ fontFamily?: string;
274
+ renderSection?: (section: DocumentSection, completedSubsteps: Set<string>) => ReactNode;
275
+ }
276
+ interface WholeDocumentViewProps$1 {
277
+ show: boolean;
278
+ onClose: () => void;
279
+ documentIds: DocumentIds;
280
+ metrics: DocumentMetrics;
281
+ classNames?: ClassNameSlots;
282
+ labels?: LabelConfig;
283
+ celebrationTitle?: string;
284
+ sparkleCount?: number;
285
+ celebrationEnabled?: boolean;
286
+ children?: ReactNode;
287
+ }
288
+ interface WholeDocumentContentProps$1 {
289
+ documentIds: DocumentIds;
290
+ sections?: DocumentSection[];
291
+ classNames?: ClassNameSlots;
292
+ renderSection?: (section: DocumentSection) => ReactNode;
293
+ }
33
294
  interface BlueprintDocumentAssemblyProps {
34
295
  /**
35
296
  * Array of steps to process in the document assembly
@@ -77,13 +338,274 @@ interface BlueprintDocumentAssemblyProps {
77
338
  * Custom className for the root container
78
339
  */
79
340
  className?: string;
341
+ /**
342
+ * CSS class name overrides for internal slots
343
+ */
344
+ classNames?: ClassNameSlots;
345
+ /**
346
+ * Theme color configuration
347
+ */
348
+ theme?: ThemeConfig;
349
+ /**
350
+ * Animation timing overrides
351
+ */
352
+ animationTimings?: AnimationTimings;
353
+ /**
354
+ * Animation preset configuration (v3.0.0)
355
+ */
356
+ animationPreset?: AnimationPreset;
357
+ /**
358
+ * UI string overrides
359
+ */
360
+ labels?: LabelConfig;
361
+ /**
362
+ * Layout configuration
363
+ */
364
+ layout?: LayoutConfig;
365
+ /**
366
+ * Whether to auto-start the assembly on mount
367
+ * @default true
368
+ */
369
+ autoStart?: boolean;
370
+ /**
371
+ * Custom document sections (replaces legal preset)
372
+ */
373
+ documentSections?: DocumentSection[];
374
+ /**
375
+ * Render prop for custom step rendering
376
+ */
377
+ renderStep?: (step: Step, defaultRender: ReactNode) => ReactNode;
378
+ /**
379
+ * Render prop for custom substep rendering
380
+ */
381
+ renderSubstep?: (substep: SubStep, defaultRender: ReactNode) => ReactNode;
382
+ /**
383
+ * Render prop for custom log rendering
384
+ */
385
+ renderLog?: (log: LogEntry, defaultRender: ReactNode) => ReactNode;
386
+ /**
387
+ * Render prop for custom document section rendering
388
+ */
389
+ renderDocumentSection?: (section: DocumentSection, completedSubsteps: Set<string>) => ReactNode;
390
+ /**
391
+ * Callback when a step starts processing
392
+ */
393
+ onStepStart?: (step: Step, index: number) => void;
394
+ /**
395
+ * Callback when a substep completes
396
+ */
397
+ onSubstepComplete?: (substepId: string, stepIndex: number) => void;
398
+ /**
399
+ * Callback when a document section is revealed
400
+ */
401
+ onSectionReveal?: (sectionId: string) => void;
402
+ /**
403
+ * Callback when a log entry is added
404
+ */
405
+ onLogEntry?: (log: LogEntry) => void;
406
+ /**
407
+ * Callback when assembly is paused
408
+ */
409
+ onPause?: () => void;
410
+ /**
411
+ * Callback when assembly is resumed
412
+ */
413
+ onResume?: () => void;
414
+ /**
415
+ * Callback when assembly is reset
416
+ */
417
+ onReset?: () => void;
418
+ }
419
+
420
+ declare const BlueprintDocumentAssembly: react.ForwardRefExoticComponent<BlueprintDocumentAssemblyProps & react.RefAttributes<BlueprintDocumentAssemblyRef>>;
421
+
422
+ declare function useDocumentAssembly(options?: UseDocumentAssemblyOptions): UseDocumentAssemblyReturn;
423
+
424
+ declare function useReducedMotion(): boolean;
425
+
426
+ interface ResponsiveLayout {
427
+ isMobile: boolean;
428
+ isTablet: boolean;
429
+ direction: 'horizontal' | 'vertical';
430
+ }
431
+ declare function useResponsiveLayout(): ResponsiveLayout;
432
+
433
+ interface StepItemProps {
434
+ step: Step;
435
+ isLast: boolean;
436
+ showRipple: boolean;
437
+ classNames?: ClassNameSlots;
438
+ theme?: ThemeConfig;
439
+ labels?: LabelConfig;
440
+ renderStep?: (step: Step, defaultRender: ReactNode) => ReactNode;
441
+ }
442
+ declare const StepItem: react.NamedExoticComponent<StepItemProps>;
443
+
444
+ interface SubStepItemProps {
445
+ substep: SubStep;
446
+ delay: number;
447
+ classNames?: ClassNameSlots;
448
+ renderSubstep?: (substep: SubStep, defaultRender: ReactNode) => ReactNode;
449
+ }
450
+ declare const SubStepItem: react.NamedExoticComponent<SubStepItemProps>;
451
+
452
+ interface LogLineProps {
453
+ log: LogEntry;
454
+ compact?: boolean;
455
+ classNames?: ClassNameSlots;
456
+ }
457
+ declare const LogLine: react.NamedExoticComponent<LogLineProps>;
458
+ interface LogContainerProps {
459
+ logs: LogEntry[];
460
+ expanded: boolean;
461
+ onToggle: () => void;
462
+ compact?: boolean;
463
+ classNames?: ClassNameSlots;
464
+ labels?: LabelConfig;
465
+ renderLog?: (log: LogEntry, defaultRender: ReactNode) => ReactNode;
466
+ }
467
+ declare const LogContainer: react.NamedExoticComponent<LogContainerProps>;
468
+
469
+ interface DocumentPreviewProps {
470
+ completedSections: Set<string>;
471
+ completedSubsteps: Set<string>;
472
+ documentIds: DocumentIds;
473
+ sections?: DocumentSection[];
474
+ classNames?: ClassNameSlots;
475
+ watermarkText?: string;
476
+ paperTexture?: boolean;
477
+ fontFamily?: string;
478
+ renderSection?: (section: DocumentSection, completedSubsteps: Set<string>) => React.ReactNode;
479
+ }
480
+ declare function DocumentPreview({ completedSubsteps, documentIds, sections, classNames, watermarkText, paperTexture, fontFamily, renderSection, }: DocumentPreviewProps): react_jsx_runtime.JSX.Element;
481
+
482
+ interface DocumentLineProps {
483
+ text: string;
484
+ delay: number;
485
+ className?: string;
80
486
  }
487
+ declare function DocumentLine({ text, delay, className }: DocumentLineProps): react_jsx_runtime.JSX.Element;
81
488
 
82
- declare function BlueprintDocumentAssembly({ steps: initialSteps, stepLogs: customStepLogs, substepLogs: customSubstepLogs, autoScroll, showWholeDocumentView, documentIds: customDocumentIds, animationSpeed, onComplete, onStepComplete, className, }: BlueprintDocumentAssemblyProps): react_jsx_runtime.JSX.Element;
489
+ interface WholeDocumentViewProps {
490
+ show: boolean;
491
+ onClose: () => void;
492
+ documentIds: DocumentIds;
493
+ metrics: DocumentMetrics;
494
+ classNames?: ClassNameSlots;
495
+ labels?: LabelConfig;
496
+ celebrationTitle?: string;
497
+ sparkleCount?: number;
498
+ celebrationEnabled?: boolean;
499
+ children?: React.ReactNode;
500
+ }
501
+ declare function WholeDocumentView({ show, onClose, documentIds, metrics, classNames, labels, celebrationTitle, sparkleCount, celebrationEnabled, }: WholeDocumentViewProps): react_jsx_runtime.JSX.Element;
502
+
503
+ interface WholeDocumentContentProps {
504
+ documentIds: DocumentIds;
505
+ sections?: DocumentSection[];
506
+ classNames?: ClassNameSlots;
507
+ renderSection?: (section: DocumentSection) => React.ReactNode;
508
+ }
509
+ declare function WholeDocumentContent({ documentIds, sections, classNames, renderSection, }: WholeDocumentContentProps): react_jsx_runtime.JSX.Element;
510
+
511
+ declare function resolveTheme(config?: ThemeConfig): ResolvedTheme;
512
+ declare function getThemeSafelist(config?: ThemeConfig): string[];
513
+ interface ThemeProviderProps {
514
+ theme?: ThemeConfig;
515
+ children: ReactNode;
516
+ }
517
+ declare function ThemeProvider({ theme, children }: ThemeProviderProps): react_jsx_runtime.JSX.Element;
518
+ declare function useTheme(): ResolvedTheme;
519
+ declare function useThemeOptional(): ResolvedTheme | null;
520
+
521
+ interface AnimationContextValue {
522
+ preset: AnimationPreset;
523
+ reducedMotion: boolean;
524
+ getTransition: (type: 'fast' | 'normal' | 'slow') => {
525
+ duration: number;
526
+ };
527
+ getSpring: (type: 'stiff' | 'gentle' | 'bouncy') => object;
528
+ }
529
+ interface AnimationProviderProps {
530
+ preset?: AnimationPreset;
531
+ children: ReactNode;
532
+ }
533
+ declare function AnimationProvider({ preset, children }: AnimationProviderProps): react_jsx_runtime.JSX.Element;
534
+ declare function useAnimation(): AnimationContextValue;
535
+ declare function useAnimationOptional(): AnimationContextValue | null;
536
+
537
+ declare const SMOOTH_PRESET: AnimationPreset;
538
+ declare const SNAPPY_PRESET: AnimationPreset;
539
+ declare const CINEMATIC_PRESET: AnimationPreset;
540
+ declare const MINIMAL_PRESET: AnimationPreset;
83
541
 
84
542
  declare const DEFAULT_STEP_LOGS: Record<string, string[][]>;
85
543
  declare const DEFAULT_SUBSTEP_LOGS: Record<string, string[][]>;
86
544
 
87
545
  declare const DEFAULT_STEPS: Step[];
546
+ declare const STEP_ICON_MAP: Record<string, any>;
547
+
548
+ declare const DEFAULT_LABELS: Required<LabelConfig>;
549
+
550
+ declare const DEFAULT_THEME: Required<ThemeConfig>;
551
+
552
+ /**
553
+ * Legal sworn affidavit document sections preset.
554
+ * Each section corresponds to a step in the default assembly process,
555
+ * and each subsection is revealed when its trigger substep completes.
556
+ */
557
+ declare const LEGAL_DOCUMENT_SECTIONS: DocumentSection[];
558
+
559
+ /**
560
+ * Legal sworn affidavit whole document content preset.
561
+ * Used for the completion view when the full assembled document is shown.
562
+ */
563
+ declare const LEGAL_WHOLE_DOCUMENT_SECTIONS: DocumentSection[];
564
+
565
+ /**
566
+ * Generic squiggle text document sections preset.
567
+ * Uses tilde characters (~~~~) to simulate word shapes without real content.
568
+ * Drop-in replacement for LEGAL_DOCUMENT_SECTIONS with same section IDs and substep triggers.
569
+ */
570
+ declare const SQUIGGLE_DOCUMENT_SECTIONS: DocumentSection[];
571
+ /**
572
+ * Squiggle whole-document sections for completion view.
573
+ * Same structure but uses 'all' for revealOnSubstep triggers and smaller text.
574
+ */
575
+ declare const SQUIGGLE_WHOLE_DOCUMENT_SECTIONS: DocumentSection[];
576
+
577
+ /**
578
+ * Generic squiggle steps preset.
579
+ * Same IDs and structure as DEFAULT_STEPS but with generic labels.
580
+ * Pair with SQUIGGLE_DOCUMENT_SECTIONS for a fully generic demo.
581
+ */
582
+ declare const SQUIGGLE_STEPS: Step[];
583
+ /**
584
+ * Squiggle step-level logs. Uses same step IDs as SQUIGGLE_STEPS.
585
+ */
586
+ declare const SQUIGGLE_STEP_LOGS: Record<string, string[][]>;
587
+ /**
588
+ * Squiggle substep-level logs. Uses same substep IDs as SQUIGGLE_STEPS.
589
+ */
590
+ declare const SQUIGGLE_SUBSTEP_LOGS: Record<string, string[][]>;
591
+
592
+ /**
593
+ * Create a Step with sensible defaults.
594
+ * Auto-increments `number` if not provided.
595
+ */
596
+ declare function createStep(partial: Partial<Step> & Pick<Step, 'id' | 'title'>): Step;
597
+ /**
598
+ * Create a SubStep with sensible defaults.
599
+ */
600
+ declare function createSubStep(partial: Partial<SubStep> & Pick<SubStep, 'id' | 'label'>): SubStep;
601
+ /**
602
+ * Create a DocumentSection with sensible defaults.
603
+ */
604
+ declare function createDocumentSection(partial: Partial<DocumentSection> & Pick<DocumentSection, 'id' | 'title' | 'borderColor'>): DocumentSection;
605
+ /**
606
+ * Reset the auto-incrementing step counter.
607
+ * Useful when creating multiple independent step sequences.
608
+ */
609
+ declare function resetStepCounter(): void;
88
610
 
89
- export { BlueprintDocumentAssembly, type BlueprintDocumentAssemblyProps, DEFAULT_STEPS, DEFAULT_STEP_LOGS, DEFAULT_SUBSTEP_LOGS, type DocumentIds, type DocumentMetrics, type LogEntry, type Step, type SubStep };
611
+ export { type AnimationPreset, AnimationProvider, type AnimationTimings, BlueprintDocumentAssembly, type BlueprintDocumentAssemblyProps, type BlueprintDocumentAssemblyRef, CINEMATIC_PRESET, type ClassNameSlots, DEFAULT_LABELS, DEFAULT_STEPS, DEFAULT_STEP_LOGS, DEFAULT_SUBSTEP_LOGS, DEFAULT_THEME, type DocumentIds, DocumentLine, type DocumentLineProps$1 as DocumentLineProps, type DocumentMetrics, DocumentPreview, type DocumentPreviewProps$1 as DocumentPreviewProps, type DocumentSection, type DocumentSubsection, LEGAL_DOCUMENT_SECTIONS, LEGAL_WHOLE_DOCUMENT_SECTIONS, type LabelConfig, type LayoutConfig, LogContainer, type LogContainerProps$1 as LogContainerProps, type LogEntry, LogLine, type LogLineProps$1 as LogLineProps, MINIMAL_PRESET, type ResolvedTheme, type ResolvedThemeColors, SMOOTH_PRESET, SNAPPY_PRESET, SQUIGGLE_DOCUMENT_SECTIONS, SQUIGGLE_STEPS, SQUIGGLE_STEP_LOGS, SQUIGGLE_SUBSTEP_LOGS, SQUIGGLE_WHOLE_DOCUMENT_SECTIONS, STEP_ICON_MAP, type Step, StepItem, type StepItemProps$1 as StepItemProps, type SubStep, SubStepItem, type SubStepItemProps$1 as SubStepItemProps, type ThemeConfig, ThemeProvider, type UseDocumentAssemblyOptions, type UseDocumentAssemblyReturn, WholeDocumentContent, type WholeDocumentContentProps$1 as WholeDocumentContentProps, WholeDocumentView, type WholeDocumentViewProps$1 as WholeDocumentViewProps, createDocumentSection, createStep, createSubStep, getThemeSafelist, resetStepCounter, resolveTheme, useAnimation, useAnimationOptional, useDocumentAssembly, useReducedMotion, useResponsiveLayout, useTheme, useThemeOptional };