@chrisflippen/blueprint-document-assembly 3.3.0 → 3.3.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 +215 -9
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -9,8 +9,15 @@ An animation-heavy React component library for visualizing multi-step processes
|
|
|
9
9
|
|
|
10
10
|
- **Cinematic Animations** — Smooth, professional animations powered by Motion (Framer Motion) with 4 built-in presets
|
|
11
11
|
- **Progressive Document Assembly** — Watch documents build piece-by-piece as steps complete with typewriter effects
|
|
12
|
+
- **External Mode** — Disable the internal timer loop and drive all state via imperative ref methods for real API integration
|
|
13
|
+
- **Document Export** — Extract rendered HTML via `getDocumentHTML()` for PDF generation or downstream processing
|
|
14
|
+
- **Error Handling** — Steps can error and retry, with `ErrorBoundary` wrapping and `onError` callbacks
|
|
15
|
+
- **Portal Support** — Render the completion modal at `document.body` or a custom target to avoid z-index conflicts
|
|
16
|
+
- **Panel Visibility** — Hide/show header, left panel, right panel, metrics footer, and progress bar independently
|
|
17
|
+
- **Render Slots** — Replace the header or footer with custom render functions
|
|
12
18
|
- **ThemeProvider** — Full React Context theming; change all colors by passing a single config
|
|
13
19
|
- **Animation Presets** — Smooth, Snappy, Cinematic, and Minimal presets with configurable timings
|
|
20
|
+
- **SSR Safe** — `'use client'` directives on all components/hooks, guarded `document`/`window` access
|
|
14
21
|
- **Accessibility** — `prefers-reduced-motion` support, ARIA roles (`progressbar`, `log`, `dialog`), focus trap in modal, keyboard navigation
|
|
15
22
|
- **Mobile Responsive** — Automatic vertical stacking on small screens via `useResponsiveLayout`
|
|
16
23
|
- **Headless Hook** — `useDocumentAssembly()` for full control without any UI
|
|
@@ -257,6 +264,196 @@ function App() {
|
|
|
257
264
|
}
|
|
258
265
|
```
|
|
259
266
|
|
|
267
|
+
### External Mode — Real API Integration
|
|
268
|
+
|
|
269
|
+
When `externalMode={true}`, the internal simulation loop is disabled. The host app drives all state transitions via imperative ref methods. This is the key unlock for production use.
|
|
270
|
+
|
|
271
|
+
```tsx
|
|
272
|
+
import { useRef, useEffect } from 'react';
|
|
273
|
+
import { BlueprintDocumentAssembly } from '@chrisflippen/blueprint-document-assembly';
|
|
274
|
+
import type { BlueprintDocumentAssemblyRef } from '@chrisflippen/blueprint-document-assembly';
|
|
275
|
+
|
|
276
|
+
function App() {
|
|
277
|
+
const ref = useRef<BlueprintDocumentAssemblyRef>(null);
|
|
278
|
+
|
|
279
|
+
useEffect(() => {
|
|
280
|
+
async function runAssembly() {
|
|
281
|
+
ref.current?.start();
|
|
282
|
+
|
|
283
|
+
// Step 0: start processing
|
|
284
|
+
ref.current?.updateStep(0, { status: 'active' });
|
|
285
|
+
ref.current?.addLog(0, null, 'info', 'Connecting to API...');
|
|
286
|
+
|
|
287
|
+
try {
|
|
288
|
+
const result = await fetch('/api/process-step-0');
|
|
289
|
+
const data = await result.json();
|
|
290
|
+
|
|
291
|
+
ref.current?.addLog(0, null, 'success', `Received ${data.tokens} tokens`);
|
|
292
|
+
ref.current?.updateMetrics({ tokens: data.tokens, cost: data.cost });
|
|
293
|
+
ref.current?.completeStep(0);
|
|
294
|
+
} catch (err) {
|
|
295
|
+
ref.current?.setStepError(0, err.message);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
runAssembly();
|
|
299
|
+
}, []);
|
|
300
|
+
|
|
301
|
+
return (
|
|
302
|
+
<BlueprintDocumentAssembly
|
|
303
|
+
ref={ref}
|
|
304
|
+
externalMode
|
|
305
|
+
autoStart={false}
|
|
306
|
+
onError={(err) => console.error(`Step ${err.stepIndex} failed:`, err.message)}
|
|
307
|
+
/>
|
|
308
|
+
);
|
|
309
|
+
}
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
#### External Mode Ref Methods
|
|
313
|
+
|
|
314
|
+
| Method | Description |
|
|
315
|
+
|--------|-------------|
|
|
316
|
+
| `updateStep(index, { status, errorMessage })` | Merge partial state into a step |
|
|
317
|
+
| `completeStep(index)` | Mark step completed, reveal its document section, advance `currentStep` |
|
|
318
|
+
| `completeSubstep(index, substepId)` | Mark a substep completed |
|
|
319
|
+
| `setStepError(index, message)` | Set step to `'error'` status with a message |
|
|
320
|
+
| `retryStep(index)` | Reset step back to `'pending'`, clear error |
|
|
321
|
+
| `addLog(index, substepId, level, message)` | Add a log entry (`'info'` \| `'success'` \| `'warning'` \| `'processing'`) |
|
|
322
|
+
| `updateMetrics(partial \| updater)` | Update metrics with a partial object or updater function |
|
|
323
|
+
| `getDocumentContentRef()` | Get the DOM element containing the rendered document |
|
|
324
|
+
| `getDocumentHTML()` | Get the `innerHTML` of the rendered document for PDF generation |
|
|
325
|
+
|
|
326
|
+
#### State Snapshots
|
|
327
|
+
|
|
328
|
+
The headless hook also exposes `getSnapshot()` and `restoreSnapshot()` for persisting state:
|
|
329
|
+
|
|
330
|
+
```tsx
|
|
331
|
+
const { getSnapshot, restoreSnapshot } = useDocumentAssembly({ externalMode: true });
|
|
332
|
+
|
|
333
|
+
// Save to localStorage
|
|
334
|
+
const snapshot = getSnapshot();
|
|
335
|
+
localStorage.setItem('assembly-state', JSON.stringify(snapshot));
|
|
336
|
+
|
|
337
|
+
// Restore later
|
|
338
|
+
const saved = JSON.parse(localStorage.getItem('assembly-state')!);
|
|
339
|
+
restoreSnapshot(saved);
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
### Document Export
|
|
343
|
+
|
|
344
|
+
Extract rendered HTML for PDF generation or downstream processing:
|
|
345
|
+
|
|
346
|
+
```tsx
|
|
347
|
+
const ref = useRef<BlueprintDocumentAssemblyRef>(null);
|
|
348
|
+
|
|
349
|
+
// Get raw HTML string
|
|
350
|
+
const html = ref.current?.getDocumentHTML();
|
|
351
|
+
|
|
352
|
+
// Or get the DOM element directly
|
|
353
|
+
const el = ref.current?.getDocumentContentRef();
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
### Error Handling
|
|
357
|
+
|
|
358
|
+
Steps support an `'error'` status with visual feedback (warning-colored badge, `AlertCircle` icon, error message). The component is also wrapped in an `ErrorBoundary` for render errors.
|
|
359
|
+
|
|
360
|
+
```tsx
|
|
361
|
+
<BlueprintDocumentAssembly
|
|
362
|
+
onError={(err) => reportError(err)}
|
|
363
|
+
errorFallback={(error, reset) => (
|
|
364
|
+
<div>
|
|
365
|
+
<p>Assembly crashed: {error.message}</p>
|
|
366
|
+
<button onClick={reset}>Retry</button>
|
|
367
|
+
</div>
|
|
368
|
+
)}
|
|
369
|
+
onRenderError={(error, info) => logToSentry(error, info)}
|
|
370
|
+
/>
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
The `ErrorBoundary` component is also exported for standalone use:
|
|
374
|
+
|
|
375
|
+
```tsx
|
|
376
|
+
import { ErrorBoundary } from '@chrisflippen/blueprint-document-assembly';
|
|
377
|
+
|
|
378
|
+
<ErrorBoundary
|
|
379
|
+
fallback={(error, reset) => <p>{error.message} <button onClick={reset}>Retry</button></p>}
|
|
380
|
+
onError={(error, info) => console.error(error)}
|
|
381
|
+
>
|
|
382
|
+
<MyComponent />
|
|
383
|
+
</ErrorBoundary>
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
### Portal Support
|
|
387
|
+
|
|
388
|
+
By default, the completion modal uses `absolute` positioning within the component. In host apps with their own modals, this can cause z-index conflicts. Use `portalTarget` to render it elsewhere:
|
|
389
|
+
|
|
390
|
+
```tsx
|
|
391
|
+
// Portal to document.body
|
|
392
|
+
<BlueprintDocumentAssembly portalTarget />
|
|
393
|
+
|
|
394
|
+
// Portal to a specific CSS selector
|
|
395
|
+
<BlueprintDocumentAssembly portalTarget="#modal-root" />
|
|
396
|
+
|
|
397
|
+
// Portal to a specific element
|
|
398
|
+
<BlueprintDocumentAssembly portalTarget={myContainerRef.current} />
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
When portaled, the modal uses `fixed` positioning instead of `absolute`.
|
|
402
|
+
|
|
403
|
+
### Panel Visibility
|
|
404
|
+
|
|
405
|
+
Hide or show individual UI sections:
|
|
406
|
+
|
|
407
|
+
```tsx
|
|
408
|
+
// Hide the left panel (steps) — show only the document preview
|
|
409
|
+
<BlueprintDocumentAssembly visibility={{ leftPanel: false }} />
|
|
410
|
+
|
|
411
|
+
// Hide metrics footer and progress bar
|
|
412
|
+
<BlueprintDocumentAssembly visibility={{ metricsFooter: false, progressBar: false }} />
|
|
413
|
+
|
|
414
|
+
// Hide everything except the document
|
|
415
|
+
<BlueprintDocumentAssembly
|
|
416
|
+
visibility={{ leftPanel: false, header: false, metricsFooter: false, progressBar: false }}
|
|
417
|
+
/>
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
When only one panel is visible, it automatically takes full width.
|
|
421
|
+
|
|
422
|
+
### Custom Render Slots
|
|
423
|
+
|
|
424
|
+
Replace the header or footer with custom UI:
|
|
425
|
+
|
|
426
|
+
```tsx
|
|
427
|
+
<BlueprintDocumentAssembly
|
|
428
|
+
renderSlots={{
|
|
429
|
+
header: ({ currentStep, totalSteps, progress }) => (
|
|
430
|
+
<div className="mb-8">
|
|
431
|
+
<h2>Custom Header — Step {currentStep + 1}/{totalSteps}</h2>
|
|
432
|
+
<progress value={progress} max={100} />
|
|
433
|
+
</div>
|
|
434
|
+
),
|
|
435
|
+
footer: ({ metrics }) => (
|
|
436
|
+
<div className="p-4 text-center text-sm">
|
|
437
|
+
{metrics.tokens} tokens · ${metrics.cost.toFixed(4)}
|
|
438
|
+
</div>
|
|
439
|
+
),
|
|
440
|
+
}}
|
|
441
|
+
/>
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
### SSR / Next.js Compatibility
|
|
445
|
+
|
|
446
|
+
All component and hook files include `'use client'` directives. Style injection uses an SSR-safe `injectStyle()` utility that checks for `document` availability before DOM access.
|
|
447
|
+
|
|
448
|
+
```tsx
|
|
449
|
+
// Safe to import in Next.js App Router
|
|
450
|
+
import { BlueprintDocumentAssembly } from '@chrisflippen/blueprint-document-assembly';
|
|
451
|
+
|
|
452
|
+
// The injectStyle utility is also exported for custom use
|
|
453
|
+
import { injectStyle } from '@chrisflippen/blueprint-document-assembly';
|
|
454
|
+
injectStyle('my-styles', '.my-class { color: red; }');
|
|
455
|
+
```
|
|
456
|
+
|
|
260
457
|
## Accessibility
|
|
261
458
|
|
|
262
459
|
### Reduced Motion
|
|
@@ -354,11 +551,18 @@ Or override via the `layout` prop:
|
|
|
354
551
|
| `onPause` | `() => void` | - | Paused callback |
|
|
355
552
|
| `onResume` | `() => void` | - | Resumed callback |
|
|
356
553
|
| `onReset` | `() => void` | - | Reset callback |
|
|
554
|
+
| `externalMode` | `boolean` | `false` | Disable internal timer; drive state via ref methods |
|
|
555
|
+
| `onError` | `(error) => void` | - | Step error callback (external mode) |
|
|
556
|
+
| `portalTarget` | `boolean \| string \| HTMLElement` | - | Portal target for completion modal |
|
|
557
|
+
| `visibility` | `VisibilityConfig` | all `true` | Show/hide header, panels, footer, progress bar |
|
|
558
|
+
| `renderSlots` | `RenderSlots` | - | Custom header/footer render functions |
|
|
559
|
+
| `errorFallback` | `ReactNode \| (error, reset) => ReactNode` | - | Error boundary fallback UI |
|
|
560
|
+
| `onRenderError` | `(error, errorInfo) => void` | - | Render error callback |
|
|
357
561
|
|
|
358
562
|
### Exports
|
|
359
563
|
|
|
360
564
|
**Components:**
|
|
361
|
-
`BlueprintDocumentAssembly`, `StepItem`, `SubStepItem`, `LogLine`, `LogContainer`, `DocumentPreview`, `DocumentLine`, `WholeDocumentView`, `WholeDocumentContent`
|
|
565
|
+
`BlueprintDocumentAssembly`, `StepItem`, `SubStepItem`, `LogLine`, `LogContainer`, `DocumentPreview`, `DocumentLine`, `WholeDocumentView`, `WholeDocumentContent`, `ErrorBoundary`
|
|
362
566
|
|
|
363
567
|
**Theme:**
|
|
364
568
|
`ThemeProvider`, `useTheme`, `useThemeOptional`, `resolveTheme`, `buildCssVars`, `resolveColorValue`, `colorMix`, `TAILWIND_COLOR_MAP`, ~~`getThemeSafelist`~~ (deprecated)
|
|
@@ -376,10 +580,10 @@ Or override via the `layout` prop:
|
|
|
376
580
|
`DEFAULT_STEPS`, `DEFAULT_STEP_LOGS`, `DEFAULT_SUBSTEP_LOGS`, `DEFAULT_LABELS`, `DEFAULT_THEME`, `STEP_ICON_MAP`
|
|
377
581
|
|
|
378
582
|
**Utilities:**
|
|
379
|
-
`createStep`, `createSubStep`, `createDocumentSection`, `resetStepCounter`, `resolveContent`
|
|
583
|
+
`createStep`, `createSubStep`, `createDocumentSection`, `resetStepCounter`, `resolveContent`, `injectStyle`
|
|
380
584
|
|
|
381
585
|
**Types:**
|
|
382
|
-
`Step`, `SubStep`, `LogEntry`, `DocumentMetrics`, `DocumentIds`, `DocumentSection`, `DocumentSubsection`, `ClassNameSlots`, `ThemeConfig`, `AnimationTimings`, `AnimationPreset`, `ResolvedTheme`, `ResolvedThemeColors`, `LabelConfig`, `LayoutConfig`, `UseDocumentAssemblyOptions`, `UseDocumentAssemblyReturn`, `BlueprintDocumentAssemblyRef`, `BlueprintDocumentAssemblyProps`, and all component prop types
|
|
586
|
+
`Step`, `SubStep`, `LogEntry`, `DocumentMetrics`, `DocumentIds`, `DocumentSection`, `DocumentSubsection`, `ClassNameSlots`, `ThemeConfig`, `AnimationTimings`, `AnimationPreset`, `ResolvedTheme`, `ResolvedThemeColors`, `LabelConfig`, `LayoutConfig`, `UseDocumentAssemblyOptions`, `UseDocumentAssemblyReturn`, `BlueprintDocumentAssemblyRef`, `BlueprintDocumentAssemblyProps`, `AssemblySnapshot`, `VisibilityConfig`, `RenderSlots`, and all component prop types
|
|
383
587
|
|
|
384
588
|
## Architecture
|
|
385
589
|
|
|
@@ -387,15 +591,16 @@ Or override via the `layout` prop:
|
|
|
387
591
|
src/
|
|
388
592
|
├── components/
|
|
389
593
|
│ ├── BlueprintDocumentAssembly.tsx # Main component (providers, responsive, ARIA)
|
|
390
|
-
│ ├── StepItem.tsx # Step card with
|
|
594
|
+
│ ├── StepItem.tsx # Step card with error state support
|
|
391
595
|
│ ├── SubStepItem.tsx # Substep with ARIA listitem
|
|
392
596
|
│ ├── LogComponents.tsx # Log display with ARIA log role
|
|
393
597
|
│ ├── DocumentPreview.tsx # Progressive document builder
|
|
394
598
|
│ ├── DocumentLine.tsx # Typewriter text (reduced motion aware)
|
|
395
|
-
│ ├── WholeDocumentView.tsx # Completion overlay
|
|
396
|
-
│
|
|
599
|
+
│ ├── WholeDocumentView.tsx # Completion overlay with portal support
|
|
600
|
+
│ ├── WholeDocumentContent.tsx # Static document renderer with contentRef
|
|
601
|
+
│ └── ErrorBoundary.tsx # React error boundary with custom fallback
|
|
397
602
|
├── theme/
|
|
398
|
-
│ ├── ThemeContext.tsx # ThemeProvider, resolveTheme
|
|
603
|
+
│ ├── ThemeContext.tsx # ThemeProvider, resolveTheme (incl. error status)
|
|
399
604
|
│ ├── css-vars.ts # CSS variable helpers, Tailwind color lookup
|
|
400
605
|
│ └── index.ts
|
|
401
606
|
├── animation/
|
|
@@ -403,7 +608,7 @@ src/
|
|
|
403
608
|
│ ├── AnimationContext.tsx # AnimationProvider, useAnimation
|
|
404
609
|
│ └── index.ts
|
|
405
610
|
├── hooks/
|
|
406
|
-
│ ├── useDocumentAssembly.ts # Headless
|
|
611
|
+
│ ├── useDocumentAssembly.ts # Headless hook with external mode + snapshots
|
|
407
612
|
│ ├── useReducedMotion.ts # prefers-reduced-motion detection
|
|
408
613
|
│ ├── useResponsiveLayout.ts # Breakpoint detection
|
|
409
614
|
│ └── index.ts
|
|
@@ -416,11 +621,12 @@ src/
|
|
|
416
621
|
├── utils/
|
|
417
622
|
│ ├── factories.ts # createStep, createSubStep, etc.
|
|
418
623
|
│ ├── content-resolvers.ts # Shared resolveContent utility
|
|
624
|
+
│ ├── inject-style.ts # SSR-safe style injection utility
|
|
419
625
|
│ └── index.ts
|
|
420
626
|
├── constants/
|
|
421
627
|
│ ├── default-labels.ts
|
|
422
628
|
│ └── default-theme.ts
|
|
423
|
-
├── types.ts
|
|
629
|
+
├── types.ts # All types incl. AssemblySnapshot, VisibilityConfig, RenderSlots
|
|
424
630
|
├── constants.ts
|
|
425
631
|
├── default-steps.ts
|
|
426
632
|
└── index.tsx # Public API
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';var react=require('react'),react$1=require('motion/react'),lucideReact=require('lucide-react'),jsxRuntime=require('react/jsx-runtime'),reactDom=require('react-dom');/* Blueprint Document Assembly v3.3.
|
|
1
|
+
'use strict';var react=require('react'),react$1=require('motion/react'),lucideReact=require('lucide-react'),jsxRuntime=require('react/jsx-runtime'),reactDom=require('react-dom');/* Blueprint Document Assembly v3.3.1 | MIT License */
|
|
2
2
|
var vo=Object.defineProperty;var So=(t,e,o)=>e in t?vo(t,e,{enumerable:true,configurable:true,writable:true,value:o}):t[e]=o;var kt=(t,e,o)=>So(t,e+"",o);var Mt="(prefers-reduced-motion: reduce)";function No(){return typeof window>"u"?false:window.matchMedia(Mt).matches}function ut(){let[t,e]=react.useState(No);return react.useEffect(()=>{let o=window.matchMedia(Mt);e(o.matches);let d=r=>e(r.matches);return o.addEventListener("change",d),()=>o.removeEventListener("change",d)},[]),t}var me={name:"smooth",durations:{fast:.3,normal:.5,slow:.8},springs:{stiff:{type:"spring",stiffness:300,damping:30},gentle:{type:"spring",stiffness:120,damping:20},bouncy:{type:"spring",stiffness:200,damping:15,bounce:.3}},stagger:{step:.15,substep:.15,log:.05,sparkle:.1},typewriter:{charDelay:25,cursorBlink:700},entrance:{x:-30,y:0,scale:.8},hookTimings:{stepActivation:800,substepDelay:500,logStreamBase:250,logStreamVariance:300,typewriterSpeed:25,sectionRevealDuration:500,completionDelay:400}},Ft={name:"snappy",durations:{fast:.15,normal:.25,slow:.4},springs:{stiff:{type:"spring",stiffness:500,damping:35},gentle:{type:"spring",stiffness:250,damping:25},bouncy:{type:"spring",stiffness:350,damping:18,bounce:.2}},stagger:{step:.08,substep:.08,log:.03,sparkle:.05},typewriter:{charDelay:15,cursorBlink:500},entrance:{x:-20,y:0,scale:.9},hookTimings:{stepActivation:400,substepDelay:250,logStreamBase:125,logStreamVariance:150,typewriterSpeed:15,sectionRevealDuration:250,completionDelay:200}},Gt={name:"cinematic",durations:{fast:.5,normal:.8,slow:1.2},springs:{stiff:{type:"spring",stiffness:200,damping:25},gentle:{type:"spring",stiffness:80,damping:15},bouncy:{type:"spring",stiffness:150,damping:10,bounce:.5}},stagger:{step:.2,substep:.2,log:.08,sparkle:.15},typewriter:{charDelay:35,cursorBlink:900},entrance:{x:-40,y:10,scale:.7},hookTimings:{stepActivation:1200,substepDelay:750,logStreamBase:400,logStreamVariance:500,typewriterSpeed:35,sectionRevealDuration:750,completionDelay:600}},Xe={name:"minimal",durations:{fast:.1,normal:.15,slow:.2},springs:{stiff:{type:"spring",stiffness:500,damping:40},gentle:{type:"spring",stiffness:400,damping:35},bouncy:{type:"spring",stiffness:450,damping:38,bounce:0}},stagger:{step:.05,substep:.05,log:.02,sparkle:.02},typewriter:{charDelay:10,cursorBlink:0},entrance:{x:0,y:0,scale:1},hookTimings:{stepActivation:200,substepDelay:100,logStreamBase:50,logStreamVariance:50,typewriterSpeed:5,sectionRevealDuration:100,completionDelay:100}};var pt=react.createContext(null);function Ke({preset:t,children:e}){let o=ut(),d=react.useMemo(()=>{let r=o?Xe:t??me;return {preset:r,reducedMotion:o,getTransition:i=>({duration:r.durations[i]}),getSpring:i=>o?{duration:r.durations.fast}:r.springs[i]}},[t,o]);return jsxRuntime.jsx(pt.Provider,{value:d,children:e})}function U(){let t=react.useContext(pt);return t||{preset:me,reducedMotion:false,getTransition:e=>({duration:me.durations[e]}),getSpring:e=>me.springs[e]}}function Bt(){return react.useContext(pt)}var Wt=react.memo(function({log:e,compact:o=false,classNames:d}){let i={info:{color:"var(--bda-secondary)",symbol:"\u2192"},success:{color:"var(--bda-success)",symbol:"\u2713"},warning:{color:"var(--bda-warning)",symbol:"\u26A0"},processing:{color:"var(--bda-processing)",symbol:"\u27F3"}}[e.level],{reducedMotion:l}=U();return jsxRuntime.jsxs(react$1.motion.div,{initial:l?false:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{duration:l?.1:.3},className:`flex items-start gap-2 ${d?.log||""}`,style:{color:"color-mix(in srgb, var(--bda-fg) 80%, transparent)"},children:[!o&&jsxRuntime.jsx("span",{className:"text-[10px]",style:{color:"var(--bda-muted-fg)"},children:e.timestamp}),jsxRuntime.jsx("span",{className:"font-bold",style:{color:i.color},children:i.symbol}),jsxRuntime.jsx("span",{className:"flex-1 text-[11px]",children:e.message})]})}),Me=react.memo(function({logs:e,expanded:o,onToggle:d,compact:r=false,classNames:i,labels:l,renderLog:u}){let f=react.useRef(null);if(react.useEffect(()=>{f.current&&(f.current.scrollTop=f.current.scrollHeight);},[e]),e.length===0)return null;let{reducedMotion:a}=U(),S=r?l?.logLabelCompact??"LOG":l?.logLabel??"SYSTEM LOG",p=r?"":l?.logEntriesSuffix??" entries";return jsxRuntime.jsxs(react$1.motion.div,{role:"log","aria-live":"polite",initial:a?false:{opacity:0},animate:{opacity:1},transition:{duration:a?.1:.4},className:`${r?"mt-2":"mt-3 ml-14"} ${i?.logContainer||""}`,children:[jsxRuntime.jsxs("button",{onClick:d,"aria-expanded":o,"aria-label":`${S} - ${e.length} entries`,className:`flex items-center ${r?"gap-1.5":"gap-2"} text-xs font-mono transition-colors ${r?"":"px-2 py-1 rounded"} focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none rounded`,style:{color:"var(--bda-muted-fg)","--tw-ring-color":"var(--bda-primary)"},children:[o?jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3"}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3 h-3"}),jsxRuntime.jsx(lucideReact.Terminal,{className:r?"w-2.5 h-2.5":"w-3 h-3"}),jsxRuntime.jsxs("span",{children:[S," (",e.length,p,")"]})]}),jsxRuntime.jsx(react$1.AnimatePresence,{children:o&&jsxRuntime.jsx(react$1.motion.div,{initial:a?false:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:a?.1:.3},className:"overflow-hidden",children:jsxRuntime.jsx("div",{ref:f,className:`rounded-md p-2 font-mono text-xs ${r?"max-h-24":"max-h-32"} overflow-y-auto space-y-1 mt-2`,style:{background:"var(--bda-bg)",border:"1px solid color-mix(in srgb, var(--bda-border) 50%, transparent)"},children:e.map(x=>{let h=jsxRuntime.jsx(Wt,{log:x,compact:r,classNames:i},x.id);return u?jsxRuntime.jsx("div",{children:u(x,h)},x.id):h})})})})]})});var bt=react.memo(function({substep:e,delay:o,classNames:d,renderSubstep:r}){let[i,l]=react.useState(false),u=react.useCallback(()=>l(p=>!p),[]),{reducedMotion:f,preset:a}=U(),S=jsxRuntime.jsx(react$1.motion.div,{role:"listitem",initial:f?false:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{delay:o,duration:a.durations.normal},className:"pl-3",children:jsxRuntime.jsxs("div",{className:"flex items-start gap-2.5",children:[jsxRuntime.jsx(react$1.motion.div,{className:"w-4 h-4 mt-0.5 rounded border-2 flex items-center justify-center flex-shrink-0 transition-all duration-500",style:e.completed?{background:"var(--bda-success)",borderColor:"var(--bda-success)"}:{borderColor:"var(--bda-border)",background:"var(--bda-bg)"},children:e.completed&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("span",{className:"text-sm font-mono transition-colors duration-500",style:{color:e.completed?"var(--bda-fg)":"var(--bda-muted-fg)"},children:e.label}),jsxRuntime.jsx(Me,{logs:e.logs,expanded:i,onToggle:u,compact:true,classNames:d})]})]})});return r?jsxRuntime.jsx(jsxRuntime.Fragment,{children:r(e,S)}):S});var gt=[{id:"verify",number:1,title:"Document Verification",status:"pending",icon:lucideReact.FileText,substeps:[{id:"v1",label:"Validate document template",completed:false,logs:[]},{id:"v2",label:"Check legal requirements",completed:false,logs:[]},{id:"v3",label:"Verify jurisdiction compliance",completed:false,logs:[]},{id:"v4",label:"Generate document metadata",completed:false,logs:[]}],documentSection:"header",logs:[]},{id:"identity",number:2,title:"Identity Validation",status:"pending",icon:lucideReact.Shield,substeps:[{id:"i1",label:"Request credential check",completed:false,logs:[]},{id:"i2",label:"Verify biometric data",completed:false,logs:[]},{id:"i3",label:"Cross-reference databases",completed:false,logs:[]},{id:"i4",label:"Confirm identity match",completed:false,logs:[]}],documentSection:"affiant",logs:[]},{id:"statement",number:3,title:"Statement Processing",status:"pending",icon:lucideReact.FileText,substeps:[{id:"s1",label:"Parse statement content",completed:false,logs:[]},{id:"s2",label:"Verify factual accuracy",completed:false,logs:[]},{id:"s3",label:"Format legal language",completed:false,logs:[]},{id:"s4",label:"Generate numbered paragraphs",completed:false,logs:[]}],documentSection:"statement",logs:[]},{id:"witness",number:4,title:"Witness Authorization",status:"pending",icon:lucideReact.Users,substeps:[{id:"w1",label:"Verify witness eligibility",completed:false,logs:[]},{id:"w2",label:"Check credential validity",completed:false,logs:[]},{id:"w3",label:"Generate attestation block",completed:false,logs:[]},{id:"w4",label:"Record witness information",completed:false,logs:[]}],documentSection:"witness",logs:[]},{id:"notary",number:5,title:"Notarization",status:"pending",icon:lucideReact.Stamp,substeps:[{id:"n1",label:"Connect to notary registry",completed:false,logs:[]},{id:"n2",label:"Validate commission status",completed:false,logs:[]},{id:"n3",label:"Generate cryptographic seal",completed:false,logs:[]},{id:"n4",label:"Apply digital signature",completed:false,logs:[]}],documentSection:"notary",logs:[]}],et={verify:lucideReact.FileText,identity:lucideReact.Shield,statement:lucideReact.FileText,witness:lucideReact.Users,notary:lucideReact.Stamp};var yt={primary:"#f97316",accent:"#ef4444",secondary:"#06b6d4",success:"#10b981",processing:"#8b5cf6",warning:"#f59e0b"};var vt={orange:"#f97316",red:"#ef4444",amber:"#f59e0b",yellow:"#eab308",lime:"#84cc16",green:"#22c55e",emerald:"#10b981",teal:"#14b8a6",cyan:"#06b6d4",sky:"#0ea5e9",blue:"#3b82f6",indigo:"#6366f1",violet:"#8b5cf6",purple:"#a855f7",fuchsia:"#d946ef",pink:"#ec4899",rose:"#f43f5e",slate:"#64748b",gray:"#6b7280",zinc:"#71717a",neutral:"#737373",stone:"#78716c"};function K(t){return vt[t]??t}function m(t,e,o="transparent"){return `color-mix(in srgb, ${t} ${e}%, ${o})`}function tt(t){let e=K(t.primary),o=K(t.accent),d=K(t.secondary),r=K(t.success),i=K(t.processing),l=K(t.warning);return {"--bda-primary":e,"--bda-accent":o,"--bda-success":r,"--bda-processing":i,"--bda-secondary":d,"--bda-warning":l,"--bda-bg":"var(--background, #ffffff)","--bda-fg":"var(--foreground, #0a0a0a)","--bda-muted":"var(--muted, #f4f4f5)","--bda-muted-fg":"var(--muted-foreground, #71717a)","--bda-border":"var(--border, #e4e4e7)"}}function Fe(t){let e=K(t);return {color:e,mutedBg:m(e,5),border:m(e,20)}}function Ge(t={}){let e={...yt,...t},o=Fe(e.primary),d=Fe(e.secondary),r=Fe(e.success),i=Fe(e.processing),l=Fe(e.warning),u=K(e.accent),f={completed:{color:r.color,mutedBg:r.mutedBg,border:m(r.color,30),iconGradient:`linear-gradient(to bottom right, ${r.color}, ${m(r.color,80,"#000")})`},active:{color:o.color,mutedBg:o.mutedBg,border:m(o.color,30),iconGradient:`linear-gradient(to bottom right, ${o.color}, ${u})`},processing:{color:i.color,mutedBg:i.mutedBg,border:m(i.color,30),iconGradient:`linear-gradient(to bottom right, ${i.color}, ${m(i.color,80,"#000")})`},pending:{color:"var(--bda-muted-fg)",mutedBg:"color-mix(in srgb, var(--bda-muted) 20%, transparent)",border:"var(--bda-border)",iconGradient:"none"},error:{color:l.color,mutedBg:l.mutedBg,border:m(l.color,30),iconGradient:`linear-gradient(to bottom right, ${l.color}, ${m(l.color,80,"#000")})`}},a={progress:`linear-gradient(to right, ${o.color}, ${u})`,title:`linear-gradient(to right, ${o.color}, ${u})`,completion:`linear-gradient(to right, ${o.color}, ${u}, ${r.color})`},S=tt(e);return {primary:o,secondary:d,success:r,processing:i,warning:l,stepStatus:f,gradients:a,cssVars:S}}function jt(t){return typeof console<"u"&&console.warn("[blueprint-document-assembly] getThemeSafelist() is deprecated and returns an empty array. CSS variables are now used instead of dynamic Tailwind classes. Safe to remove this call."),[]}var St=react.createContext(null);function ot({theme:t,children:e}){let o=react.useMemo(()=>Ge(t),[t]);return jsxRuntime.jsx(St.Provider,{value:o,children:e})}function Xt(){let t=react.useContext(St);if(!t)throw new Error("useTheme must be used within a ThemeProvider");return t}function rt(){return react.useContext(St)}var ht=react.memo(function({step:e,isLast:o,showRipple:d,classNames:r,theme:i,labels:l,renderStep:u}){let[f,a]=react.useState(false),[S,p]=react.useState(false),x=rt(),{preset:h,reducedMotion:B}=U();react.useEffect(()=>{e.status==="processing"&&a(true);},[e.status]),react.useEffect(()=>{if(e.status==="completed"){let T=setTimeout(()=>{a(false);},800);return ()=>clearTimeout(T)}},[e.status]);let I=e.icon||et[e.id]||et.verify,O=react.useMemo(()=>{if(x)return x.stepStatus[e.status];switch(e.status){case "completed":return {color:"var(--bda-success, #10b981)",mutedBg:m("var(--bda-success, #10b981)",5),border:m("var(--bda-success, #10b981)",30),iconGradient:"linear-gradient(to bottom right, var(--bda-success, #10b981), #059669)"};case "active":return {color:"var(--bda-primary, #f97316)",mutedBg:m("var(--bda-primary, #f97316)",5),border:m("var(--bda-primary, #f97316)",30),iconGradient:"linear-gradient(to bottom right, var(--bda-primary, #f97316), var(--bda-accent, #ef4444))"};case "processing":return {color:"var(--bda-processing, #8b5cf6)",mutedBg:m("var(--bda-processing, #8b5cf6)",5),border:m("var(--bda-processing, #8b5cf6)",30),iconGradient:"linear-gradient(to bottom right, var(--bda-processing, #8b5cf6), #7c3aed)"};case "error":return {color:"var(--bda-warning, #f59e0b)",mutedBg:m("var(--bda-warning, #f59e0b)",5),border:m("var(--bda-warning, #f59e0b)",30),iconGradient:"linear-gradient(to bottom right, var(--bda-warning, #f59e0b), #d97706)"};default:return {color:"var(--bda-muted-fg, #71717a)",mutedBg:"color-mix(in srgb, var(--bda-muted, #f4f4f5) 20%, transparent)",border:"var(--bda-border, #e4e4e7)",iconGradient:"none"}}},[e.status,x]),z=react.useMemo(()=>e.substeps?.filter(T=>T.completed).length||0,[e.substeps]),$=react.useMemo(()=>e.substeps?.length||0,[e.substeps]),A=l?.stepPrefix??"STEP_",M=l?.stepDone??"\u2713 DONE",H=l?.substepCount?l.substepCount(z,$):`${z}/${$} substeps`,J=jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx(react$1.AnimatePresence,{children:d&&jsxRuntime.jsx(react$1.motion.div,{className:"absolute inset-0 rounded-lg",style:{background:m("var(--bda-success)",20)},initial:{scale:1,opacity:.4},animate:{scale:1.05,opacity:0},exit:{opacity:0},transition:{duration:.8,ease:"easeOut"}})}),jsxRuntime.jsxs(react$1.motion.div,{initial:B?false:{opacity:0,x:h.entrance.x},animate:{opacity:1,x:0},transition:{delay:e.number*h.stagger.step,duration:h.durations.normal},className:"relative",children:[jsxRuntime.jsx("div",{className:`relative p-5 rounded-lg transition-all duration-500 border-2 ${r?.step||""}`,style:{background:O.mutedBg,borderColor:O.border},children:jsxRuntime.jsxs("div",{className:"flex items-start gap-4",children:[jsxRuntime.jsx(react$1.motion.div,{className:`w-11 h-11 rounded-full flex items-center justify-center flex-shrink-0 border-2 transition-all duration-500 ${r?.stepIcon||""}`,style:{background:O.iconGradient,borderColor:"transparent"},initial:{scale:.8},animate:{scale:1},transition:B?{duration:.1}:{delay:e.number*h.stagger.step+.2,...h.springs.stiff},children:e.status==="completed"?jsxRuntime.jsx(lucideReact.Check,{className:"w-5 h-5 text-white"}):e.status==="error"?jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-5 h-5 text-white"}):e.status==="processing"?jsxRuntime.jsx(lucideReact.Loader2,{className:"w-5 h-5 text-white animate-spin"}):e.status==="active"?jsxRuntime.jsx(I,{className:"w-5 h-5 text-white"}):jsxRuntime.jsx("span",{className:"text-sm font-semibold",style:{color:"var(--bda-muted-fg)"},children:e.number})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("h3",{className:"text-base font-semibold transition-colors duration-500",style:{color:O.color},children:e.title}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[jsxRuntime.jsxs("p",{className:"text-xs font-mono",style:{color:"var(--bda-muted-fg)"},children:[A,e.number.toString().padStart(2,"0")]}),e.status==="completed"&&jsxRuntime.jsx("span",{className:"text-[10px] px-2 py-0.5 rounded-full font-mono",style:{background:m("var(--bda-success)",10),color:"var(--bda-success)",border:`1px solid ${m("var(--bda-success)",20)}`},children:M}),e.status==="completed"&&e.substeps&&jsxRuntime.jsx("span",{className:"text-[10px] px-2 py-0.5 rounded-full font-mono",style:{background:m("var(--bda-success)",10),color:"var(--bda-success)"},children:H}),e.status==="error"&&jsxRuntime.jsx("span",{className:"text-[10px] px-2 py-0.5 rounded-full font-mono",style:{background:m("var(--bda-warning)",10),color:"var(--bda-warning)",border:`1px solid ${m("var(--bda-warning)",20)}`},children:"ERROR"})]}),e.status==="error"&&e.errorMessage&&jsxRuntime.jsx("p",{className:"text-xs mt-1.5 font-mono",style:{color:"var(--bda-warning)"},children:e.errorMessage}),jsxRuntime.jsx(react$1.AnimatePresence,{children:f&&e.substeps&&jsxRuntime.jsx(react$1.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.4},className:"overflow-hidden",children:jsxRuntime.jsx("div",{role:"list","aria-label":"Substeps",className:`mt-4 space-y-3 pl-3 border-l-2 ${r?.substep||""}`,style:{borderColor:m("var(--bda-processing)",20)},children:e.substeps.map((T,E)=>jsxRuntime.jsx(bt,{substep:T,delay:E*.15,classNames:r},T.id))})})})]})]})}),jsxRuntime.jsx(Me,{logs:e.logs,expanded:S,onToggle:()=>p(!S),classNames:r,labels:l}),!o&&jsxRuntime.jsx(react$1.motion.div,{className:"absolute left-[22px] top-full h-6 w-0.5",initial:{scaleY:0},animate:{scaleY:1},transition:{delay:e.number*h.stagger.step+.4,duration:h.durations.fast},style:{transformOrigin:"top",backgroundColor:"var(--bda-border)"}})]})]});return u?jsxRuntime.jsx(jsxRuntime.Fragment,{children:u(e,J)}):J});function Be(t,e){if(typeof document>"u"||document.getElementById(t))return;let o=document.createElement("style");o.id=t,o.textContent=e,document.head.appendChild(o);}function de({text:t,delay:e,className:o=""}){let[d,r]=react.useState(""),[i,l]=react.useState(true),u=react.useRef(null),f=react.useRef(null),{reducedMotion:a,preset:S}=U();return react.useEffect(()=>{if(a){r(t),l(false);return}r(""),l(true);let p=S.typewriter.charDelay,x=setTimeout(()=>{let h=0;u.current=setInterval(()=>{h<=t.length?(r(t.slice(0,h)),h++):(u.current&&clearInterval(u.current),u.current=null,f.current=setTimeout(()=>l(false),300));},p);},e*1e3);return ()=>{clearTimeout(x),u.current&&(clearInterval(u.current),u.current=null),f.current&&(clearTimeout(f.current),f.current=null);}},[t,e,a,S.typewriter.charDelay]),react.useEffect(()=>{Be("bda-blink-keyframes","@keyframes bda-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }");},[]),jsxRuntime.jsxs("div",{className:`${o} font-serif`,style:{lineHeight:"1.8"},"aria-busy":d.length<t.length,children:[d,i&&jsxRuntime.jsx("span",{className:"inline-block w-0.5 h-4 ml-1",style:{backgroundColor:"var(--bda-secondary)",animation:`bda-blink ${S.typewriter.cursorBlink}ms step-end infinite`}})]})}var st=[{id:"header",title:"",borderColor:"cyan",className:"border-b-2 pb-6",subsections:[{revealOnSubstep:"v1",content:"SWORN AFFIDAVIT",className:"text-3xl font-extrabold tracking-widest text-center",animation:"typewriter"},{revealOnSubstep:"v2",content:"STATE OF [JURISDICTION]",className:"text-sm tracking-widest text-center",animation:"typewriter"},{revealOnSubstep:"v2",content:"COUNTY OF [COUNTY NAME]",className:"text-sm tracking-widest text-center",animation:"typewriter"},{revealOnSubstep:"v4",content:"__CASE_NUMBER__",className:"text-base font-bold tracking-wider mt-2 text-center",animation:"typewriter"}]},{id:"affiant",title:"AFFIANT INFORMATION:",borderColor:"cyan",className:"border-l-[6px] pl-6 py-4",subsections:[{revealOnSubstep:"i1",content:"I, [FULL NAME], being duly sworn, depose and state:",className:"text-base leading-relaxed mb-4 italic",animation:"typewriter"},{revealOnSubstep:"i2",content:`Address: [STREET ADDRESS]
|
|
3
3
|
City/State: [CITY, STATE ZIP]`,className:"space-y-2 ml-8 text-sm",animation:"typewriter"},{revealOnSubstep:"i3",content:"DOB: [DATE OF BIRTH]",className:"space-y-2 ml-8 text-sm mt-2",animation:"typewriter"},{revealOnSubstep:"i4",content:"ID Verified: \u2713 CONFIRMED",className:"font-bold ml-8 text-sm mt-2",animation:"typewriter"}]},{id:"statement",title:"STATEMENT OF FACTS:",borderColor:"orange",className:"border-l-[6px] pl-6 py-4",subsections:[{revealOnSubstep:"s1",content:"1. That I have personal knowledge of the facts stated herein and am competent to testify to the same.",className:"ml-8 text-base leading-loose mb-5",animation:"typewriter"},{revealOnSubstep:"s2",content:"2. That on or about [DATE], the following events occurred: [DETAILED STATEMENT OF MATERIAL FACTS]",className:"ml-8 text-base leading-loose mb-5",animation:"typewriter"},{revealOnSubstep:"s3",content:"3. That the information provided herein is true and correct to the best of my knowledge and belief.",className:"ml-8 text-base leading-loose mb-5",animation:"typewriter"},{revealOnSubstep:"s4",content:"4. That I understand the penalties for perjury under law.",className:"ml-8 text-base leading-loose",animation:"typewriter"}]},{id:"witness",title:"WITNESS ATTESTATION:",borderColor:"purple",className:"border-l-[6px] pl-6 py-4",subsections:[{revealOnSubstep:"w1",content:"",className:"",animation:"fade"},{revealOnSubstep:"w2",content:`Witnessed by: [WITNESS NAME]
|
|
4
4
|
Witness Address: [ADDRESS]`,className:"space-y-2 text-sm",animation:"typewriter"},{revealOnSubstep:"w4",content:"__WITNESS_SIGNATURE__",className:"mt-8 pt-6 border-t",animation:"fade"}]},{id:"notary",title:"NOTARY PUBLIC CERTIFICATION:",borderColor:"emerald",className:"border-2 rounded-lg p-6 relative overflow-hidden",subsections:[{revealOnSubstep:"n1",content:"__NOTARY_DATE__",className:"leading-relaxed text-sm",animation:"typewriter"},{revealOnSubstep:"n2",content:`Notary Public: [NOTARY NAME]
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {createContext,memo,useRef,useEffect,useState,useCallback,useMemo,forwardRef,useImperativeHandle,useContext,Component}from'react';import {motion,AnimatePresence}from'motion/react';import {ChevronDown,ChevronRight,Terminal,Check,Stamp,Users,FileText,Shield,AlertCircle,Loader2,Zap,DollarSign,Clock,X,Sparkles}from'lucide-react';import {jsxs,jsx,Fragment}from'react/jsx-runtime';import {createPortal}from'react-dom';/* Blueprint Document Assembly v3.3.
|
|
1
|
+
import {createContext,memo,useRef,useEffect,useState,useCallback,useMemo,forwardRef,useImperativeHandle,useContext,Component}from'react';import {motion,AnimatePresence}from'motion/react';import {ChevronDown,ChevronRight,Terminal,Check,Stamp,Users,FileText,Shield,AlertCircle,Loader2,Zap,DollarSign,Clock,X,Sparkles}from'lucide-react';import {jsxs,jsx,Fragment}from'react/jsx-runtime';import {createPortal}from'react-dom';/* Blueprint Document Assembly v3.3.1 | MIT License */
|
|
2
2
|
var vo=Object.defineProperty;var So=(t,e,o)=>e in t?vo(t,e,{enumerable:true,configurable:true,writable:true,value:o}):t[e]=o;var kt=(t,e,o)=>So(t,e+"",o);var Mt="(prefers-reduced-motion: reduce)";function No(){return typeof window>"u"?false:window.matchMedia(Mt).matches}function ut(){let[t,e]=useState(No);return useEffect(()=>{let o=window.matchMedia(Mt);e(o.matches);let d=r=>e(r.matches);return o.addEventListener("change",d),()=>o.removeEventListener("change",d)},[]),t}var me={name:"smooth",durations:{fast:.3,normal:.5,slow:.8},springs:{stiff:{type:"spring",stiffness:300,damping:30},gentle:{type:"spring",stiffness:120,damping:20},bouncy:{type:"spring",stiffness:200,damping:15,bounce:.3}},stagger:{step:.15,substep:.15,log:.05,sparkle:.1},typewriter:{charDelay:25,cursorBlink:700},entrance:{x:-30,y:0,scale:.8},hookTimings:{stepActivation:800,substepDelay:500,logStreamBase:250,logStreamVariance:300,typewriterSpeed:25,sectionRevealDuration:500,completionDelay:400}},Ft={name:"snappy",durations:{fast:.15,normal:.25,slow:.4},springs:{stiff:{type:"spring",stiffness:500,damping:35},gentle:{type:"spring",stiffness:250,damping:25},bouncy:{type:"spring",stiffness:350,damping:18,bounce:.2}},stagger:{step:.08,substep:.08,log:.03,sparkle:.05},typewriter:{charDelay:15,cursorBlink:500},entrance:{x:-20,y:0,scale:.9},hookTimings:{stepActivation:400,substepDelay:250,logStreamBase:125,logStreamVariance:150,typewriterSpeed:15,sectionRevealDuration:250,completionDelay:200}},Gt={name:"cinematic",durations:{fast:.5,normal:.8,slow:1.2},springs:{stiff:{type:"spring",stiffness:200,damping:25},gentle:{type:"spring",stiffness:80,damping:15},bouncy:{type:"spring",stiffness:150,damping:10,bounce:.5}},stagger:{step:.2,substep:.2,log:.08,sparkle:.15},typewriter:{charDelay:35,cursorBlink:900},entrance:{x:-40,y:10,scale:.7},hookTimings:{stepActivation:1200,substepDelay:750,logStreamBase:400,logStreamVariance:500,typewriterSpeed:35,sectionRevealDuration:750,completionDelay:600}},Xe={name:"minimal",durations:{fast:.1,normal:.15,slow:.2},springs:{stiff:{type:"spring",stiffness:500,damping:40},gentle:{type:"spring",stiffness:400,damping:35},bouncy:{type:"spring",stiffness:450,damping:38,bounce:0}},stagger:{step:.05,substep:.05,log:.02,sparkle:.02},typewriter:{charDelay:10,cursorBlink:0},entrance:{x:0,y:0,scale:1},hookTimings:{stepActivation:200,substepDelay:100,logStreamBase:50,logStreamVariance:50,typewriterSpeed:5,sectionRevealDuration:100,completionDelay:100}};var pt=createContext(null);function Ke({preset:t,children:e}){let o=ut(),d=useMemo(()=>{let r=o?Xe:t??me;return {preset:r,reducedMotion:o,getTransition:i=>({duration:r.durations[i]}),getSpring:i=>o?{duration:r.durations.fast}:r.springs[i]}},[t,o]);return jsx(pt.Provider,{value:d,children:e})}function U(){let t=useContext(pt);return t||{preset:me,reducedMotion:false,getTransition:e=>({duration:me.durations[e]}),getSpring:e=>me.springs[e]}}function Bt(){return useContext(pt)}var Wt=memo(function({log:e,compact:o=false,classNames:d}){let i={info:{color:"var(--bda-secondary)",symbol:"\u2192"},success:{color:"var(--bda-success)",symbol:"\u2713"},warning:{color:"var(--bda-warning)",symbol:"\u26A0"},processing:{color:"var(--bda-processing)",symbol:"\u27F3"}}[e.level],{reducedMotion:l}=U();return jsxs(motion.div,{initial:l?false:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{duration:l?.1:.3},className:`flex items-start gap-2 ${d?.log||""}`,style:{color:"color-mix(in srgb, var(--bda-fg) 80%, transparent)"},children:[!o&&jsx("span",{className:"text-[10px]",style:{color:"var(--bda-muted-fg)"},children:e.timestamp}),jsx("span",{className:"font-bold",style:{color:i.color},children:i.symbol}),jsx("span",{className:"flex-1 text-[11px]",children:e.message})]})}),Me=memo(function({logs:e,expanded:o,onToggle:d,compact:r=false,classNames:i,labels:l,renderLog:u}){let f=useRef(null);if(useEffect(()=>{f.current&&(f.current.scrollTop=f.current.scrollHeight);},[e]),e.length===0)return null;let{reducedMotion:a}=U(),S=r?l?.logLabelCompact??"LOG":l?.logLabel??"SYSTEM LOG",p=r?"":l?.logEntriesSuffix??" entries";return jsxs(motion.div,{role:"log","aria-live":"polite",initial:a?false:{opacity:0},animate:{opacity:1},transition:{duration:a?.1:.4},className:`${r?"mt-2":"mt-3 ml-14"} ${i?.logContainer||""}`,children:[jsxs("button",{onClick:d,"aria-expanded":o,"aria-label":`${S} - ${e.length} entries`,className:`flex items-center ${r?"gap-1.5":"gap-2"} text-xs font-mono transition-colors ${r?"":"px-2 py-1 rounded"} focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none rounded`,style:{color:"var(--bda-muted-fg)","--tw-ring-color":"var(--bda-primary)"},children:[o?jsx(ChevronDown,{className:"w-3 h-3"}):jsx(ChevronRight,{className:"w-3 h-3"}),jsx(Terminal,{className:r?"w-2.5 h-2.5":"w-3 h-3"}),jsxs("span",{children:[S," (",e.length,p,")"]})]}),jsx(AnimatePresence,{children:o&&jsx(motion.div,{initial:a?false:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:a?.1:.3},className:"overflow-hidden",children:jsx("div",{ref:f,className:`rounded-md p-2 font-mono text-xs ${r?"max-h-24":"max-h-32"} overflow-y-auto space-y-1 mt-2`,style:{background:"var(--bda-bg)",border:"1px solid color-mix(in srgb, var(--bda-border) 50%, transparent)"},children:e.map(x=>{let h=jsx(Wt,{log:x,compact:r,classNames:i},x.id);return u?jsx("div",{children:u(x,h)},x.id):h})})})})]})});var bt=memo(function({substep:e,delay:o,classNames:d,renderSubstep:r}){let[i,l]=useState(false),u=useCallback(()=>l(p=>!p),[]),{reducedMotion:f,preset:a}=U(),S=jsx(motion.div,{role:"listitem",initial:f?false:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{delay:o,duration:a.durations.normal},className:"pl-3",children:jsxs("div",{className:"flex items-start gap-2.5",children:[jsx(motion.div,{className:"w-4 h-4 mt-0.5 rounded border-2 flex items-center justify-center flex-shrink-0 transition-all duration-500",style:e.completed?{background:"var(--bda-success)",borderColor:"var(--bda-success)"}:{borderColor:"var(--bda-border)",background:"var(--bda-bg)"},children:e.completed&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:"text-sm font-mono transition-colors duration-500",style:{color:e.completed?"var(--bda-fg)":"var(--bda-muted-fg)"},children:e.label}),jsx(Me,{logs:e.logs,expanded:i,onToggle:u,compact:true,classNames:d})]})]})});return r?jsx(Fragment,{children:r(e,S)}):S});var gt=[{id:"verify",number:1,title:"Document Verification",status:"pending",icon:FileText,substeps:[{id:"v1",label:"Validate document template",completed:false,logs:[]},{id:"v2",label:"Check legal requirements",completed:false,logs:[]},{id:"v3",label:"Verify jurisdiction compliance",completed:false,logs:[]},{id:"v4",label:"Generate document metadata",completed:false,logs:[]}],documentSection:"header",logs:[]},{id:"identity",number:2,title:"Identity Validation",status:"pending",icon:Shield,substeps:[{id:"i1",label:"Request credential check",completed:false,logs:[]},{id:"i2",label:"Verify biometric data",completed:false,logs:[]},{id:"i3",label:"Cross-reference databases",completed:false,logs:[]},{id:"i4",label:"Confirm identity match",completed:false,logs:[]}],documentSection:"affiant",logs:[]},{id:"statement",number:3,title:"Statement Processing",status:"pending",icon:FileText,substeps:[{id:"s1",label:"Parse statement content",completed:false,logs:[]},{id:"s2",label:"Verify factual accuracy",completed:false,logs:[]},{id:"s3",label:"Format legal language",completed:false,logs:[]},{id:"s4",label:"Generate numbered paragraphs",completed:false,logs:[]}],documentSection:"statement",logs:[]},{id:"witness",number:4,title:"Witness Authorization",status:"pending",icon:Users,substeps:[{id:"w1",label:"Verify witness eligibility",completed:false,logs:[]},{id:"w2",label:"Check credential validity",completed:false,logs:[]},{id:"w3",label:"Generate attestation block",completed:false,logs:[]},{id:"w4",label:"Record witness information",completed:false,logs:[]}],documentSection:"witness",logs:[]},{id:"notary",number:5,title:"Notarization",status:"pending",icon:Stamp,substeps:[{id:"n1",label:"Connect to notary registry",completed:false,logs:[]},{id:"n2",label:"Validate commission status",completed:false,logs:[]},{id:"n3",label:"Generate cryptographic seal",completed:false,logs:[]},{id:"n4",label:"Apply digital signature",completed:false,logs:[]}],documentSection:"notary",logs:[]}],et={verify:FileText,identity:Shield,statement:FileText,witness:Users,notary:Stamp};var yt={primary:"#f97316",accent:"#ef4444",secondary:"#06b6d4",success:"#10b981",processing:"#8b5cf6",warning:"#f59e0b"};var vt={orange:"#f97316",red:"#ef4444",amber:"#f59e0b",yellow:"#eab308",lime:"#84cc16",green:"#22c55e",emerald:"#10b981",teal:"#14b8a6",cyan:"#06b6d4",sky:"#0ea5e9",blue:"#3b82f6",indigo:"#6366f1",violet:"#8b5cf6",purple:"#a855f7",fuchsia:"#d946ef",pink:"#ec4899",rose:"#f43f5e",slate:"#64748b",gray:"#6b7280",zinc:"#71717a",neutral:"#737373",stone:"#78716c"};function K(t){return vt[t]??t}function m(t,e,o="transparent"){return `color-mix(in srgb, ${t} ${e}%, ${o})`}function tt(t){let e=K(t.primary),o=K(t.accent),d=K(t.secondary),r=K(t.success),i=K(t.processing),l=K(t.warning);return {"--bda-primary":e,"--bda-accent":o,"--bda-success":r,"--bda-processing":i,"--bda-secondary":d,"--bda-warning":l,"--bda-bg":"var(--background, #ffffff)","--bda-fg":"var(--foreground, #0a0a0a)","--bda-muted":"var(--muted, #f4f4f5)","--bda-muted-fg":"var(--muted-foreground, #71717a)","--bda-border":"var(--border, #e4e4e7)"}}function Fe(t){let e=K(t);return {color:e,mutedBg:m(e,5),border:m(e,20)}}function Ge(t={}){let e={...yt,...t},o=Fe(e.primary),d=Fe(e.secondary),r=Fe(e.success),i=Fe(e.processing),l=Fe(e.warning),u=K(e.accent),f={completed:{color:r.color,mutedBg:r.mutedBg,border:m(r.color,30),iconGradient:`linear-gradient(to bottom right, ${r.color}, ${m(r.color,80,"#000")})`},active:{color:o.color,mutedBg:o.mutedBg,border:m(o.color,30),iconGradient:`linear-gradient(to bottom right, ${o.color}, ${u})`},processing:{color:i.color,mutedBg:i.mutedBg,border:m(i.color,30),iconGradient:`linear-gradient(to bottom right, ${i.color}, ${m(i.color,80,"#000")})`},pending:{color:"var(--bda-muted-fg)",mutedBg:"color-mix(in srgb, var(--bda-muted) 20%, transparent)",border:"var(--bda-border)",iconGradient:"none"},error:{color:l.color,mutedBg:l.mutedBg,border:m(l.color,30),iconGradient:`linear-gradient(to bottom right, ${l.color}, ${m(l.color,80,"#000")})`}},a={progress:`linear-gradient(to right, ${o.color}, ${u})`,title:`linear-gradient(to right, ${o.color}, ${u})`,completion:`linear-gradient(to right, ${o.color}, ${u}, ${r.color})`},S=tt(e);return {primary:o,secondary:d,success:r,processing:i,warning:l,stepStatus:f,gradients:a,cssVars:S}}function jt(t){return typeof console<"u"&&console.warn("[blueprint-document-assembly] getThemeSafelist() is deprecated and returns an empty array. CSS variables are now used instead of dynamic Tailwind classes. Safe to remove this call."),[]}var St=createContext(null);function ot({theme:t,children:e}){let o=useMemo(()=>Ge(t),[t]);return jsx(St.Provider,{value:o,children:e})}function Xt(){let t=useContext(St);if(!t)throw new Error("useTheme must be used within a ThemeProvider");return t}function rt(){return useContext(St)}var ht=memo(function({step:e,isLast:o,showRipple:d,classNames:r,theme:i,labels:l,renderStep:u}){let[f,a]=useState(false),[S,p]=useState(false),x=rt(),{preset:h,reducedMotion:B}=U();useEffect(()=>{e.status==="processing"&&a(true);},[e.status]),useEffect(()=>{if(e.status==="completed"){let T=setTimeout(()=>{a(false);},800);return ()=>clearTimeout(T)}},[e.status]);let I=e.icon||et[e.id]||et.verify,O=useMemo(()=>{if(x)return x.stepStatus[e.status];switch(e.status){case "completed":return {color:"var(--bda-success, #10b981)",mutedBg:m("var(--bda-success, #10b981)",5),border:m("var(--bda-success, #10b981)",30),iconGradient:"linear-gradient(to bottom right, var(--bda-success, #10b981), #059669)"};case "active":return {color:"var(--bda-primary, #f97316)",mutedBg:m("var(--bda-primary, #f97316)",5),border:m("var(--bda-primary, #f97316)",30),iconGradient:"linear-gradient(to bottom right, var(--bda-primary, #f97316), var(--bda-accent, #ef4444))"};case "processing":return {color:"var(--bda-processing, #8b5cf6)",mutedBg:m("var(--bda-processing, #8b5cf6)",5),border:m("var(--bda-processing, #8b5cf6)",30),iconGradient:"linear-gradient(to bottom right, var(--bda-processing, #8b5cf6), #7c3aed)"};case "error":return {color:"var(--bda-warning, #f59e0b)",mutedBg:m("var(--bda-warning, #f59e0b)",5),border:m("var(--bda-warning, #f59e0b)",30),iconGradient:"linear-gradient(to bottom right, var(--bda-warning, #f59e0b), #d97706)"};default:return {color:"var(--bda-muted-fg, #71717a)",mutedBg:"color-mix(in srgb, var(--bda-muted, #f4f4f5) 20%, transparent)",border:"var(--bda-border, #e4e4e7)",iconGradient:"none"}}},[e.status,x]),z=useMemo(()=>e.substeps?.filter(T=>T.completed).length||0,[e.substeps]),$=useMemo(()=>e.substeps?.length||0,[e.substeps]),A=l?.stepPrefix??"STEP_",M=l?.stepDone??"\u2713 DONE",H=l?.substepCount?l.substepCount(z,$):`${z}/${$} substeps`,J=jsxs("div",{className:"relative",children:[jsx(AnimatePresence,{children:d&&jsx(motion.div,{className:"absolute inset-0 rounded-lg",style:{background:m("var(--bda-success)",20)},initial:{scale:1,opacity:.4},animate:{scale:1.05,opacity:0},exit:{opacity:0},transition:{duration:.8,ease:"easeOut"}})}),jsxs(motion.div,{initial:B?false:{opacity:0,x:h.entrance.x},animate:{opacity:1,x:0},transition:{delay:e.number*h.stagger.step,duration:h.durations.normal},className:"relative",children:[jsx("div",{className:`relative p-5 rounded-lg transition-all duration-500 border-2 ${r?.step||""}`,style:{background:O.mutedBg,borderColor:O.border},children:jsxs("div",{className:"flex items-start gap-4",children:[jsx(motion.div,{className:`w-11 h-11 rounded-full flex items-center justify-center flex-shrink-0 border-2 transition-all duration-500 ${r?.stepIcon||""}`,style:{background:O.iconGradient,borderColor:"transparent"},initial:{scale:.8},animate:{scale:1},transition:B?{duration:.1}:{delay:e.number*h.stagger.step+.2,...h.springs.stiff},children:e.status==="completed"?jsx(Check,{className:"w-5 h-5 text-white"}):e.status==="error"?jsx(AlertCircle,{className:"w-5 h-5 text-white"}):e.status==="processing"?jsx(Loader2,{className:"w-5 h-5 text-white animate-spin"}):e.status==="active"?jsx(I,{className:"w-5 h-5 text-white"}):jsx("span",{className:"text-sm font-semibold",style:{color:"var(--bda-muted-fg)"},children:e.number})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("h3",{className:"text-base font-semibold transition-colors duration-500",style:{color:O.color},children:e.title}),jsxs("div",{className:"flex items-center gap-2 mt-1",children:[jsxs("p",{className:"text-xs font-mono",style:{color:"var(--bda-muted-fg)"},children:[A,e.number.toString().padStart(2,"0")]}),e.status==="completed"&&jsx("span",{className:"text-[10px] px-2 py-0.5 rounded-full font-mono",style:{background:m("var(--bda-success)",10),color:"var(--bda-success)",border:`1px solid ${m("var(--bda-success)",20)}`},children:M}),e.status==="completed"&&e.substeps&&jsx("span",{className:"text-[10px] px-2 py-0.5 rounded-full font-mono",style:{background:m("var(--bda-success)",10),color:"var(--bda-success)"},children:H}),e.status==="error"&&jsx("span",{className:"text-[10px] px-2 py-0.5 rounded-full font-mono",style:{background:m("var(--bda-warning)",10),color:"var(--bda-warning)",border:`1px solid ${m("var(--bda-warning)",20)}`},children:"ERROR"})]}),e.status==="error"&&e.errorMessage&&jsx("p",{className:"text-xs mt-1.5 font-mono",style:{color:"var(--bda-warning)"},children:e.errorMessage}),jsx(AnimatePresence,{children:f&&e.substeps&&jsx(motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.4},className:"overflow-hidden",children:jsx("div",{role:"list","aria-label":"Substeps",className:`mt-4 space-y-3 pl-3 border-l-2 ${r?.substep||""}`,style:{borderColor:m("var(--bda-processing)",20)},children:e.substeps.map((T,E)=>jsx(bt,{substep:T,delay:E*.15,classNames:r},T.id))})})})]})]})}),jsx(Me,{logs:e.logs,expanded:S,onToggle:()=>p(!S),classNames:r,labels:l}),!o&&jsx(motion.div,{className:"absolute left-[22px] top-full h-6 w-0.5",initial:{scaleY:0},animate:{scaleY:1},transition:{delay:e.number*h.stagger.step+.4,duration:h.durations.fast},style:{transformOrigin:"top",backgroundColor:"var(--bda-border)"}})]})]});return u?jsx(Fragment,{children:u(e,J)}):J});function Be(t,e){if(typeof document>"u"||document.getElementById(t))return;let o=document.createElement("style");o.id=t,o.textContent=e,document.head.appendChild(o);}function de({text:t,delay:e,className:o=""}){let[d,r]=useState(""),[i,l]=useState(true),u=useRef(null),f=useRef(null),{reducedMotion:a,preset:S}=U();return useEffect(()=>{if(a){r(t),l(false);return}r(""),l(true);let p=S.typewriter.charDelay,x=setTimeout(()=>{let h=0;u.current=setInterval(()=>{h<=t.length?(r(t.slice(0,h)),h++):(u.current&&clearInterval(u.current),u.current=null,f.current=setTimeout(()=>l(false),300));},p);},e*1e3);return ()=>{clearTimeout(x),u.current&&(clearInterval(u.current),u.current=null),f.current&&(clearTimeout(f.current),f.current=null);}},[t,e,a,S.typewriter.charDelay]),useEffect(()=>{Be("bda-blink-keyframes","@keyframes bda-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }");},[]),jsxs("div",{className:`${o} font-serif`,style:{lineHeight:"1.8"},"aria-busy":d.length<t.length,children:[d,i&&jsx("span",{className:"inline-block w-0.5 h-4 ml-1",style:{backgroundColor:"var(--bda-secondary)",animation:`bda-blink ${S.typewriter.cursorBlink}ms step-end infinite`}})]})}var st=[{id:"header",title:"",borderColor:"cyan",className:"border-b-2 pb-6",subsections:[{revealOnSubstep:"v1",content:"SWORN AFFIDAVIT",className:"text-3xl font-extrabold tracking-widest text-center",animation:"typewriter"},{revealOnSubstep:"v2",content:"STATE OF [JURISDICTION]",className:"text-sm tracking-widest text-center",animation:"typewriter"},{revealOnSubstep:"v2",content:"COUNTY OF [COUNTY NAME]",className:"text-sm tracking-widest text-center",animation:"typewriter"},{revealOnSubstep:"v4",content:"__CASE_NUMBER__",className:"text-base font-bold tracking-wider mt-2 text-center",animation:"typewriter"}]},{id:"affiant",title:"AFFIANT INFORMATION:",borderColor:"cyan",className:"border-l-[6px] pl-6 py-4",subsections:[{revealOnSubstep:"i1",content:"I, [FULL NAME], being duly sworn, depose and state:",className:"text-base leading-relaxed mb-4 italic",animation:"typewriter"},{revealOnSubstep:"i2",content:`Address: [STREET ADDRESS]
|
|
3
3
|
City/State: [CITY, STATE ZIP]`,className:"space-y-2 ml-8 text-sm",animation:"typewriter"},{revealOnSubstep:"i3",content:"DOB: [DATE OF BIRTH]",className:"space-y-2 ml-8 text-sm mt-2",animation:"typewriter"},{revealOnSubstep:"i4",content:"ID Verified: \u2713 CONFIRMED",className:"font-bold ml-8 text-sm mt-2",animation:"typewriter"}]},{id:"statement",title:"STATEMENT OF FACTS:",borderColor:"orange",className:"border-l-[6px] pl-6 py-4",subsections:[{revealOnSubstep:"s1",content:"1. That I have personal knowledge of the facts stated herein and am competent to testify to the same.",className:"ml-8 text-base leading-loose mb-5",animation:"typewriter"},{revealOnSubstep:"s2",content:"2. That on or about [DATE], the following events occurred: [DETAILED STATEMENT OF MATERIAL FACTS]",className:"ml-8 text-base leading-loose mb-5",animation:"typewriter"},{revealOnSubstep:"s3",content:"3. That the information provided herein is true and correct to the best of my knowledge and belief.",className:"ml-8 text-base leading-loose mb-5",animation:"typewriter"},{revealOnSubstep:"s4",content:"4. That I understand the penalties for perjury under law.",className:"ml-8 text-base leading-loose",animation:"typewriter"}]},{id:"witness",title:"WITNESS ATTESTATION:",borderColor:"purple",className:"border-l-[6px] pl-6 py-4",subsections:[{revealOnSubstep:"w1",content:"",className:"",animation:"fade"},{revealOnSubstep:"w2",content:`Witnessed by: [WITNESS NAME]
|
|
4
4
|
Witness Address: [ADDRESS]`,className:"space-y-2 text-sm",animation:"typewriter"},{revealOnSubstep:"w4",content:"__WITNESS_SIGNATURE__",className:"mt-8 pt-6 border-t",animation:"fade"}]},{id:"notary",title:"NOTARY PUBLIC CERTIFICATION:",borderColor:"emerald",className:"border-2 rounded-lg p-6 relative overflow-hidden",subsections:[{revealOnSubstep:"n1",content:"__NOTARY_DATE__",className:"leading-relaxed text-sm",animation:"typewriter"},{revealOnSubstep:"n2",content:`Notary Public: [NOTARY NAME]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chrisflippen/blueprint-document-assembly",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.1",
|
|
4
4
|
"description": "An animation-heavy React component for visualizing multi-step processes as a Blueprint/Technical Document Assembly system with streaming logs, progressive document construction, and cinematic completion effects",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|