drill-widgets 2.7.2 → 2.7.4
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
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
# ✨
|
|
1
|
+
# ✨ Drill Widgets ✨
|
|
2
2
|
|
|
3
3
|
Easily embed powerful workflow building and running capabilities into your web applications!
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Drill Widgets provides Lit-based web components that let you:
|
|
6
6
|
|
|
7
7
|
- Visually **build workflow templates** with custom forms and steps.
|
|
8
8
|
- **Run instances** of those workflows, guiding users through steps.
|
|
@@ -12,16 +12,8 @@ Perfect for onboarding flows, request processes, checklists, approvals, and any
|
|
|
12
12
|
|
|
13
13
|
## Installation
|
|
14
14
|
|
|
15
|
-
### From npm (Recommended)
|
|
16
|
-
|
|
17
15
|
```bash
|
|
18
|
-
npm install
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
### From CDN
|
|
22
|
-
|
|
23
|
-
```html
|
|
24
|
-
<script src="https://unpkg.com/begin-widgets/dist/begin-widgets.umd.js"></script>
|
|
16
|
+
npm install drill-widgets
|
|
25
17
|
```
|
|
26
18
|
|
|
27
19
|
---
|
|
@@ -321,7 +313,7 @@ createRunner("runner-container", {
|
|
|
321
313
|
|
|
322
314
|
### Installation & Setup
|
|
323
315
|
|
|
324
|
-
1. **Clone:** `git clone <your-repo-url> && cd
|
|
316
|
+
1. **Clone:** `git clone <your-repo-url> && cd drill-widgets`
|
|
325
317
|
2. **Install:** `npm install`
|
|
326
318
|
|
|
327
319
|
## Development Workflow
|
|
@@ -386,11 +378,11 @@ The build process includes a custom script that:
|
|
|
386
378
|
### From npm (Recommended)
|
|
387
379
|
|
|
388
380
|
```bash
|
|
389
|
-
npm install
|
|
381
|
+
npm install drill-widgets
|
|
390
382
|
```
|
|
391
383
|
|
|
392
384
|
```typescript
|
|
393
|
-
import { createBuilder, createRunner } from "
|
|
385
|
+
import { createBuilder, createRunner } from "drill-widgets";
|
|
394
386
|
|
|
395
387
|
// Initialize Builder
|
|
396
388
|
createBuilder("workflow-builder", {
|
|
@@ -476,222 +468,6 @@ if (workflowData && workflowData.steps) {
|
|
|
476
468
|
}
|
|
477
469
|
```
|
|
478
470
|
|
|
479
|
-
### From CDN (UMD Bundle)
|
|
480
|
-
|
|
481
|
-
1. **Include Script:**
|
|
482
|
-
```html
|
|
483
|
-
<script src="https://unpkg.com/begin-widgets/dist/begin-widgets.umd.js"></script>
|
|
484
|
-
```
|
|
485
|
-
2. **Add Mount Points:**
|
|
486
|
-
```html
|
|
487
|
-
<div id="workflow-builder"></div>
|
|
488
|
-
<div id="workflow-runner"></div>
|
|
489
|
-
```
|
|
490
|
-
3. **Initialize with JavaScript:**
|
|
491
|
-
|
|
492
|
-
```javascript
|
|
493
|
-
document.addEventListener('DOMContentLoaded', () => {
|
|
494
|
-
// --- Initialize Builder ---
|
|
495
|
-
if (Begin.createBuilder) {
|
|
496
|
-
Begin.createBuilder('workflow-builder', {
|
|
497
|
-
// Callback when a workflow template is saved
|
|
498
|
-
onSave: (workflowData) => {
|
|
499
|
-
console.log('New workflow template created:', workflowData);
|
|
500
|
-
// Save the workflow template to your backend
|
|
501
|
-
saveWorkflowTemplate(workflowData);
|
|
502
|
-
},
|
|
503
|
-
onCancel: () => {
|
|
504
|
-
console.log('Template creation cancelled');
|
|
505
|
-
// Handle cancellation (e.g., redirect to workflows list)
|
|
506
|
-
}
|
|
507
|
-
});
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
// --- Initialize Runner (Default Mode) ---
|
|
511
|
-
if (Begin.createRunner) {
|
|
512
|
-
// Fetch a specific instance object from your backend.
|
|
513
|
-
// This instance object MUST contain the 'steps' array.
|
|
514
|
-
const instanceData = await fetchInstanceFromBackend('instance-id-123');
|
|
515
|
-
|
|
516
|
-
if (instanceData && instanceData.steps) {
|
|
517
|
-
Begin.createRunner('workflow-runner', {
|
|
518
|
-
instance: instanceData,
|
|
519
|
-
mode: 'default', // Optional: Default if not specified
|
|
520
|
-
onInstanceUpdated: (detail) => {
|
|
521
|
-
console.log('Progress Update:', detail);
|
|
522
|
-
// Save progress data (for both step updates and final submission)
|
|
523
|
-
saveInstanceProgress(detail.instanceId, detail);
|
|
524
|
-
|
|
525
|
-
// Check if this is the final submission (no current step)
|
|
526
|
-
if (!detail.currentStep) {
|
|
527
|
-
console.log('Workflow Complete!');
|
|
528
|
-
}
|
|
529
|
-
},
|
|
530
|
-
onSignatureCaptured: (detail) => {
|
|
531
|
-
console.log('Signature captured:', detail.questionId);
|
|
532
|
-
console.log('Instance ID:', detail.instanceId);
|
|
533
|
-
console.log('Step ID:', detail.stepId);
|
|
534
|
-
console.log('SVG Data:', detail.svgData);
|
|
535
|
-
console.log('Data URL:', detail.dataURL);
|
|
536
|
-
// Save signature data to your backend
|
|
537
|
-
// Note: This callback is triggered when user clicks "Next" or "Submit"
|
|
538
|
-
saveSignatureData(detail.instanceId, detail.questionId, detail.svgData, detail.dataURL);
|
|
539
|
-
},
|
|
540
|
-
onFileUploaded: (detail) => {
|
|
541
|
-
console.log('File uploaded:', detail.questionId);
|
|
542
|
-
console.log('Instance ID:', detail.instanceId);
|
|
543
|
-
console.log('Step ID:', detail.stepId);
|
|
544
|
-
console.log('File name:', detail.fileName);
|
|
545
|
-
console.log('File size:', detail.fileSize);
|
|
546
|
-
console.log('File type:', detail.fileType);
|
|
547
|
-
// Handle file upload to your backend/storage
|
|
548
|
-
// Note: This callback is triggered immediately when a file is selected
|
|
549
|
-
handleFileUpload(detail.instanceId, detail.questionId, detail.file);
|
|
550
|
-
}
|
|
551
|
-
});
|
|
552
|
-
} else {
|
|
553
|
-
console.error("Failed to load instance or instance missing steps.");
|
|
554
|
-
}
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
// --- Initialize Runner (Preview Mode) ---
|
|
558
|
-
if (Begin.createRunner) {
|
|
559
|
-
// Fetch a workflow template from your backend for preview.
|
|
560
|
-
// This workflow object MUST contain the 'steps' array.
|
|
561
|
-
const workflowData = await fetchWorkflowFromBackend('workflow-id-456');
|
|
562
|
-
|
|
563
|
-
if (workflowData && workflowData.steps) {
|
|
564
|
-
Begin.createRunner('workflow-preview', {
|
|
565
|
-
workflow: workflowData, // Note: workflow, not instance
|
|
566
|
-
mode: 'preview', // Required for preview mode
|
|
567
|
-
onSignatureCaptured: (detail) => {
|
|
568
|
-
console.log('Preview: Signature captured:', detail.questionId);
|
|
569
|
-
console.log('Preview: Instance ID:', detail.instanceId);
|
|
570
|
-
console.log('Preview: Step ID:', detail.stepId);
|
|
571
|
-
// Callbacks are disabled in preview mode, but still available for logging
|
|
572
|
-
},
|
|
573
|
-
onFileUploaded: (detail) => {
|
|
574
|
-
console.log('Preview: File uploaded:', detail.questionId);
|
|
575
|
-
console.log('Preview: Instance ID:', detail.instanceId);
|
|
576
|
-
console.log('Preview: Step ID:', detail.stepId);
|
|
577
|
-
console.log('Preview: File name:', detail.fileName);
|
|
578
|
-
// Callbacks are disabled in preview mode, but still available for logging
|
|
579
|
-
}
|
|
580
|
-
});
|
|
581
|
-
} else {
|
|
582
|
-
console.error("Failed to load workflow or workflow missing steps.");
|
|
583
|
-
}
|
|
584
|
-
}
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
});
|
|
588
|
-
```
|
|
589
|
-
|
|
590
|
-
### For ES Module Projects
|
|
591
|
-
|
|
592
|
-
If you're integrating into a modern build system that supports ES modules:
|
|
593
|
-
|
|
594
|
-
```javascript
|
|
595
|
-
import { createBuilder, createRunner } from "./src/lib.ts";
|
|
596
|
-
|
|
597
|
-
// Use createBuilder and createRunner directly
|
|
598
|
-
createBuilder("builder-container", {
|
|
599
|
-
onSave: (workflowData) => console.log("Template saved:", workflowData),
|
|
600
|
-
onCancel: () => console.log("Template creation cancelled"),
|
|
601
|
-
});
|
|
602
|
-
|
|
603
|
-
// Default mode (production execution)
|
|
604
|
-
createRunner("runner-container", {
|
|
605
|
-
instance: instanceData,
|
|
606
|
-
mode: "default", // Optional: Default if not specified
|
|
607
|
-
onInstanceUpdated: (detail) => {
|
|
608
|
-
console.log("Progress:", detail);
|
|
609
|
-
if (!detail.currentStep) console.log("Complete!");
|
|
610
|
-
},
|
|
611
|
-
onSignatureCaptured: (detail) =>
|
|
612
|
-
console.log(
|
|
613
|
-
"Signature:",
|
|
614
|
-
detail.questionId,
|
|
615
|
-
"Step:",
|
|
616
|
-
detail.stepId,
|
|
617
|
-
"Instance:",
|
|
618
|
-
detail.instanceId
|
|
619
|
-
),
|
|
620
|
-
onFileUploaded: (detail) =>
|
|
621
|
-
console.log(
|
|
622
|
-
"File:",
|
|
623
|
-
detail.fileName,
|
|
624
|
-
"Step:",
|
|
625
|
-
detail.stepId,
|
|
626
|
-
"Instance:",
|
|
627
|
-
detail.instanceId
|
|
628
|
-
),
|
|
629
|
-
});
|
|
630
|
-
|
|
631
|
-
// Preview mode (template preview)
|
|
632
|
-
createRunner("preview-container", {
|
|
633
|
-
workflow: workflowData, // Note: workflow, not instance
|
|
634
|
-
mode: "preview", // Required for preview mode
|
|
635
|
-
onSignatureCaptured: (detail) =>
|
|
636
|
-
console.log(
|
|
637
|
-
"Preview Signature:",
|
|
638
|
-
detail.questionId,
|
|
639
|
-
"Step:",
|
|
640
|
-
detail.stepId
|
|
641
|
-
),
|
|
642
|
-
onFileUploaded: (detail) =>
|
|
643
|
-
console.log("Preview File:", detail.fileName, "Step:", detail.stepId),
|
|
644
|
-
});
|
|
645
|
-
|
|
646
|
-
// Admin mode (administrative access)
|
|
647
|
-
createRunner("admin-container", {
|
|
648
|
-
instance: instanceData, // Instance object with current state
|
|
649
|
-
mode: "admin", // Required for admin mode
|
|
650
|
-
currentUser: adminUserData, // Admin user credentials
|
|
651
|
-
onInstanceUpdated: (detail) => {
|
|
652
|
-
console.log("Admin: Progress updated:", detail);
|
|
653
|
-
// Save admin changes to backend
|
|
654
|
-
saveAdminChanges(detail.instanceId, detail);
|
|
655
|
-
},
|
|
656
|
-
onSignatureCaptured: (detail) =>
|
|
657
|
-
console.log("Admin Signature:", detail.questionId, "Step:", detail.stepId),
|
|
658
|
-
onFileUploaded: (detail) =>
|
|
659
|
-
console.log("Admin File:", detail.fileName, "Step:", detail.stepId),
|
|
660
|
-
});
|
|
661
|
-
|
|
662
|
-
// View-only mode (read-only viewing of completed data)
|
|
663
|
-
createRunner("view-only-container", {
|
|
664
|
-
instance: completedInstanceData, // Instance with filled responses
|
|
665
|
-
mode: "view-only", // Required for view-only mode
|
|
666
|
-
currentUser: viewerUserData, // Optional: For display purposes
|
|
667
|
-
// Note: Callbacks are disabled in view-only mode
|
|
668
|
-
// Files and signatures display as clickable links instead of form inputs
|
|
669
|
-
});
|
|
670
|
-
|
|
671
|
-
// Print mode (print-optimized display of all steps on one page)
|
|
672
|
-
createRunner("print-container", {
|
|
673
|
-
instance: completedInstanceData, // Instance with filled responses
|
|
674
|
-
mode: "print", // Required for print mode
|
|
675
|
-
currentUser: viewerUserData, // Optional: For display purposes
|
|
676
|
-
// Note: Callbacks are disabled in print mode
|
|
677
|
-
// All steps displayed on one continuous page without sidebar
|
|
678
|
-
// Files show detailed info (filename, size, type) instead of links
|
|
679
|
-
});
|
|
680
|
-
|
|
681
|
-
// Loading state (can be used with any mode)
|
|
682
|
-
createRunner("loading-container", {
|
|
683
|
-
instance: instanceData,
|
|
684
|
-
mode: "default",
|
|
685
|
-
isLoading: true, // Shows loading spinner and disables step navigation
|
|
686
|
-
currentUser: userData,
|
|
687
|
-
onInstanceUpdated: (detail) => {
|
|
688
|
-
console.log("Progress:", detail);
|
|
689
|
-
// Update isLoading to false when ready
|
|
690
|
-
// runnerWidget.isLoading = false;
|
|
691
|
-
},
|
|
692
|
-
});
|
|
693
|
-
```
|
|
694
|
-
|
|
695
471
|
### Loading State
|
|
696
472
|
|
|
697
473
|
The Runner widget supports a loading state that can be used with any mode to show a loading indicator and disable user interaction while data is being processed or fetched.
|
|
@@ -807,7 +583,7 @@ const completedInstanceData = {
|
|
|
807
583
|
|
|
808
584
|
## HTML Export Utility
|
|
809
585
|
|
|
810
|
-
|
|
586
|
+
Drill Widgets includes a powerful HTML export utility that generates print-ready HTML from workflow instances. This is perfect for server-side PDF generation, email reports, and documentation.
|
|
811
587
|
|
|
812
588
|
### Overview
|
|
813
589
|
|
|
@@ -816,7 +592,7 @@ The `generateInstanceHTML()` function takes a workflow `Instance` object and pro
|
|
|
816
592
|
### Basic Usage
|
|
817
593
|
|
|
818
594
|
```typescript
|
|
819
|
-
import { generateInstanceHTML } from "
|
|
595
|
+
import { generateInstanceHTML } from "drill-widgets";
|
|
820
596
|
|
|
821
597
|
const result = generateInstanceHTML(myInstance);
|
|
822
598
|
console.log(result.html); // Complete HTML string ready for PDF generation
|
|
@@ -866,7 +642,7 @@ async function generatePDF(instance) {
|
|
|
866
642
|
|
|
867
643
|
```javascript
|
|
868
644
|
const express = require("express");
|
|
869
|
-
const { generateInstanceHTML } = require("
|
|
645
|
+
const { generateInstanceHTML } = require("drill-widgets");
|
|
870
646
|
|
|
871
647
|
app.get("/report/:instanceId", async (req, res) => {
|
|
872
648
|
const instance = await getInstanceFromDatabase(req.params.instanceId);
|
|
@@ -910,14 +686,14 @@ interface HTMLExportResult {
|
|
|
910
686
|
|
|
911
687
|
## TypeScript Support
|
|
912
688
|
|
|
913
|
-
|
|
689
|
+
Drill Widgets includes comprehensive TypeScript definitions for full type safety and developer experience.
|
|
914
690
|
|
|
915
691
|
### Installing Types
|
|
916
692
|
|
|
917
|
-
When you install `
|
|
693
|
+
When you install `drill-widgets` from npm, the TypeScript declaration files are automatically included:
|
|
918
694
|
|
|
919
695
|
```bash
|
|
920
|
-
npm install
|
|
696
|
+
npm install drill-widgets
|
|
921
697
|
```
|
|
922
698
|
|
|
923
699
|
### Importing Types
|
|
@@ -934,7 +710,7 @@ import {
|
|
|
934
710
|
type StepElement,
|
|
935
711
|
type QuestionElement,
|
|
936
712
|
type ContentElement,
|
|
937
|
-
} from "
|
|
713
|
+
} from "drill-widgets";
|
|
938
714
|
|
|
939
715
|
// Use the types for type safety
|
|
940
716
|
const myWorkflow: Workflow = {
|
|
@@ -969,7 +745,7 @@ import type {
|
|
|
969
745
|
StepAssignment,
|
|
970
746
|
BuilderConfig,
|
|
971
747
|
RunnerConfig,
|
|
972
|
-
} from "
|
|
748
|
+
} from "drill-widgets";
|
|
973
749
|
```
|
|
974
750
|
|
|
975
751
|
#### Option 3: Dedicated Types Entry Point
|
|
@@ -983,7 +759,7 @@ import type {
|
|
|
983
759
|
ContentElement,
|
|
984
760
|
BuilderConfig,
|
|
985
761
|
RunnerConfig,
|
|
986
|
-
} from "
|
|
762
|
+
} from "drill-widgets/types";
|
|
987
763
|
```
|
|
988
764
|
|
|
989
765
|
### Available Types
|
|
@@ -1012,8 +788,8 @@ For JavaScript projects, you can still get type hints using JSDoc:
|
|
|
1012
788
|
|
|
1013
789
|
```javascript
|
|
1014
790
|
/**
|
|
1015
|
-
* @typedef {import('
|
|
1016
|
-
* @typedef {import('
|
|
791
|
+
* @typedef {import('drill-widgets').Workflow} Workflow
|
|
792
|
+
* @typedef {import('drill-widgets').Instance} Instance
|
|
1017
793
|
*/
|
|
1018
794
|
|
|
1019
795
|
/**
|
|
@@ -1027,25 +803,6 @@ function processWorkflow(workflow, instance) {
|
|
|
1027
803
|
}
|
|
1028
804
|
```
|
|
1029
805
|
|
|
1030
|
-
### UMD Bundle with Types
|
|
1031
|
-
|
|
1032
|
-
When using the UMD bundle directly in the browser, you can still import types separately for TypeScript projects:
|
|
1033
|
-
|
|
1034
|
-
```html
|
|
1035
|
-
<!-- Runtime: UMD bundle -->
|
|
1036
|
-
<script src="https://unpkg.com/begin-widgets/dist/begin-widgets.umd.js"></script>
|
|
1037
|
-
|
|
1038
|
-
<script>
|
|
1039
|
-
// Runtime usage
|
|
1040
|
-
const { createBuilder, createRunner } = Begin;
|
|
1041
|
-
</script>
|
|
1042
|
-
```
|
|
1043
|
-
|
|
1044
|
-
```typescript
|
|
1045
|
-
// Types: Import separately in TypeScript files
|
|
1046
|
-
import type { Workflow, Instance } from "begin-widgets";
|
|
1047
|
-
```
|
|
1048
|
-
|
|
1049
806
|
### Type Safety Benefits
|
|
1050
807
|
|
|
1051
808
|
- **Intellisense**: Full autocomplete in VS Code, WebStorm, and other IDEs
|
|
@@ -1057,7 +814,7 @@ import type { Workflow, Instance } from "begin-widgets";
|
|
|
1057
814
|
## Project Structure
|
|
1058
815
|
|
|
1059
816
|
```
|
|
1060
|
-
|
|
817
|
+
drill-widgets/
|
|
1061
818
|
├── src/
|
|
1062
819
|
│ ├── models.ts # TypeScript interfaces
|
|
1063
820
|
│ ├── lib.ts # Main library API
|
|
@@ -1074,7 +831,7 @@ begin-widgets/
|
|
|
1074
831
|
├── scripts/
|
|
1075
832
|
│ └── build-html.js # Build script for production HTML
|
|
1076
833
|
├── dist/ # Generated files (after build)
|
|
1077
|
-
│ ├──
|
|
834
|
+
│ ├── drill-widgets.umd.js
|
|
1078
835
|
│ └── index.html
|
|
1079
836
|
├── index.html # Development HTML (ES modules)
|
|
1080
837
|
├── vite.config.js # Vite configuration
|
|
@@ -1099,7 +856,7 @@ npm test
|
|
|
1099
856
|
|
|
1100
857
|
## Troubleshooting
|
|
1101
858
|
|
|
1102
|
-
### "
|
|
859
|
+
### "Drill library not found" Error
|
|
1103
860
|
|
|
1104
861
|
- **In Development:** Make sure you're using `npm run dev`, not `npm run preview`
|
|
1105
862
|
- **In Production:** Make sure you ran `npm run build` before `npm run preview`
|
|
@@ -1116,4 +873,4 @@ npm test
|
|
|
1116
873
|
|
|
1117
874
|
---
|
|
1118
875
|
|
|
1119
|
-
Let
|
|
876
|
+
Let Drill Widgets streamline your application's workflows!
|
|
@@ -8084,7 +8084,7 @@ function Zt(i, e = {}) {
|
|
|
8084
8084
|
const n = document.createElement(
|
|
8085
8085
|
"builder-widget"
|
|
8086
8086
|
);
|
|
8087
|
-
return e.onWorkflowCreated && (n.onWorkflowCreated = e.onWorkflowCreated), e.onWorkflowDeleted && (n.onWorkflowDeleted = e.onWorkflowDeleted), e.onWorkflowUpdated && (n.onWorkflowUpdated = e.onWorkflowUpdated), t.appendChild(n), console.log(`
|
|
8087
|
+
return e.onWorkflowCreated && (n.onWorkflowCreated = e.onWorkflowCreated), e.onWorkflowDeleted && (n.onWorkflowDeleted = e.onWorkflowDeleted), e.onWorkflowUpdated && (n.onWorkflowUpdated = e.onWorkflowUpdated), t.appendChild(n), console.log(`Drill Builder mounted on #${i}`), n;
|
|
8088
8088
|
}
|
|
8089
8089
|
function ei(i, e) {
|
|
8090
8090
|
if (!customElements.get("runner-widget"))
|
|
@@ -8116,7 +8116,7 @@ function ei(i, e) {
|
|
|
8116
8116
|
} catch (o) {
|
|
8117
8117
|
console.error("Error executing onInstanceUpdated callback:", o);
|
|
8118
8118
|
}
|
|
8119
|
-
}), t.appendChild(n), console.log(`
|
|
8119
|
+
}), t.appendChild(n), console.log(`Drill Runner mounted on #${i}`), n;
|
|
8120
8120
|
}
|
|
8121
8121
|
function ti(i, e) {
|
|
8122
8122
|
const t = i.getFormData(), n = JSON.parse(JSON.stringify(e));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(D,A){typeof exports=="object"&&typeof module<"u"?A(exports):typeof define=="function"&&define.amd?define(["exports"],A):(D=typeof globalThis<"u"?globalThis:D||self,A(D.
|
|
1
|
+
(function(D,A){typeof exports=="object"&&typeof module<"u"?A(exports):typeof define=="function"&&define.amd?define(["exports"],A):(D=typeof globalThis<"u"?globalThis:D||self,A(D.Drill={}))})(this,function(D){"use strict";/**
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2019 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -6,13 +6,13 @@
|
|
|
6
6
|
* @license
|
|
7
7
|
* Copyright 2017 Google LLC
|
|
8
8
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
9
|
-
*/const{is:Ve,defineProperty:je,getOwnPropertyDescriptor:
|
|
9
|
+
*/const{is:Ve,defineProperty:je,getOwnPropertyDescriptor:Qe,getOwnPropertyNames:Be,getOwnPropertySymbols:qe,getPrototypeOf:Ge}=Object,M=globalThis,Se=M.trustedTypes,Ye=Se?Se.emptyScript:"",oe=M.reactiveElementPolyfillSupport,W=(i,e)=>i,Y={toAttribute(i,e){switch(e){case Boolean:i=i?Ye:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,e){let t=i;switch(e){case Boolean:t=i!==null;break;case Number:t=i===null?null:Number(i);break;case Object:case Array:try{t=JSON.parse(i)}catch{t=null}}return t}},ae=(i,e)=>!Ve(i,e),we={attribute:!0,type:String,converter:Y,reflect:!1,useDefault:!1,hasChanged:ae};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),M.litPropertyMetadata??(M.litPropertyMetadata=new WeakMap);let N=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??(this.l=[])).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=we){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const n=Symbol(),s=this.getPropertyDescriptor(e,n,t);s!==void 0&&je(this.prototype,e,s)}}static getPropertyDescriptor(e,t,n){const{get:s,set:r}=Qe(this.prototype,e)??{get(){return this[t]},set(o){this[t]=o}};return{get:s,set(o){const a=s==null?void 0:s.call(this);r==null||r.call(this,o),this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??we}static _$Ei(){if(this.hasOwnProperty(W("elementProperties")))return;const e=Ge(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(W("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(W("properties"))){const t=this.properties,n=[...Be(t),...qe(t)];for(const s of n)this.createProperty(s,t[s])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[n,s]of t)this.elementProperties.set(n,s)}this._$Eh=new Map;for(const[t,n]of this.elementProperties){const s=this._$Eu(t,n);s!==void 0&&this._$Eh.set(s,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const s of n)t.unshift(ye(s))}else e!==void 0&&t.push(ye(e));return t}static _$Eu(e,t){const n=t.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var e;this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),(e=this.constructor.l)==null||e.forEach(t=>t(this))}addController(e){var t;(this._$EO??(this._$EO=new Set)).add(e),this.renderRoot!==void 0&&this.isConnected&&((t=e.hostConnected)==null||t.call(e))}removeController(e){var t;(t=this._$EO)==null||t.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return He(e,this.constructor.elementStyles),e}connectedCallback(){var e;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$EO)==null||e.forEach(t=>{var n;return(n=t.hostConnected)==null?void 0:n.call(t)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$EO)==null||e.forEach(t=>{var n;return(n=t.hostDisconnected)==null?void 0:n.call(t)})}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$ET(e,t){var r;const n=this.constructor.elementProperties.get(e),s=this.constructor._$Eu(e,n);if(s!==void 0&&n.reflect===!0){const o=(((r=n.converter)==null?void 0:r.toAttribute)!==void 0?n.converter:Y).toAttribute(t,n.type);this._$Em=e,o==null?this.removeAttribute(s):this.setAttribute(s,o),this._$Em=null}}_$AK(e,t){var r,o;const n=this.constructor,s=n._$Eh.get(e);if(s!==void 0&&this._$Em!==s){const a=n.getPropertyOptions(s),d=typeof a.converter=="function"?{fromAttribute:a.converter}:((r=a.converter)==null?void 0:r.fromAttribute)!==void 0?a.converter:Y;this._$Em=s,this[s]=d.fromAttribute(t,a.type)??((o=this._$Ej)==null?void 0:o.get(s))??null,this._$Em=null}}requestUpdate(e,t,n){var s;if(e!==void 0){const r=this.constructor,o=this[e];if(n??(n=r.getPropertyOptions(e)),!((n.hasChanged??ae)(o,t)||n.useDefault&&n.reflect&&o===((s=this._$Ej)==null?void 0:s.get(e))&&!this.hasAttribute(r._$Eu(e,n))))return;this.C(e,t,n)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:n,reflect:s,wrapped:r},o){n&&!(this._$Ej??(this._$Ej=new Map)).has(e)&&(this._$Ej.set(e,o??t??this[e]),r!==!0||o!==void 0)||(this._$AL.has(e)||(this.hasUpdated||n||(t=void 0),this._$AL.set(e,t)),s===!0&&this._$Em!==e&&(this._$Eq??(this._$Eq=new Set)).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var n;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[r,o]of this._$Ep)this[r]=o;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[r,o]of s){const{wrapped:a}=o,d=this[r];a!==!0||this._$AL.has(r)||d===void 0||this.C(r,void 0,o,d)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),(n=this._$EO)==null||n.forEach(s=>{var r;return(r=s.hostUpdate)==null?void 0:r.call(s)}),this.update(t)):this._$EM()}catch(s){throw e=!1,this._$EM(),s}e&&this._$AE(t)}willUpdate(e){}_$AE(e){var t;(t=this._$EO)==null||t.forEach(n=>{var s;return(s=n.hostUpdated)==null?void 0:s.call(n)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&(this._$Eq=this._$Eq.forEach(t=>this._$ET(t,this[t]))),this._$EM()}updated(e){}firstUpdated(e){}};N.elementStyles=[],N.shadowRootOptions={mode:"open"},N[W("elementProperties")]=new Map,N[W("finalized")]=new Map,oe==null||oe({ReactiveElement:N}),(M.reactiveElementVersions??(M.reactiveElementVersions=[])).push("2.1.0");/**
|
|
10
10
|
* @license
|
|
11
11
|
* Copyright 2017 Google LLC
|
|
12
12
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
13
13
|
*/const H=globalThis,J=H.trustedTypes,ke=J?J.createPolicy("lit-html",{createHTML:i=>i}):void 0,$e="$lit$",T=`lit$${Math.random().toFixed(9).slice(2)}$`,De="?"+T,Je=`<${De}>`,F=document,V=()=>F.createComment(""),j=i=>i===null||typeof i!="object"&&typeof i!="function",de=Array.isArray,Ke=i=>de(i)||typeof(i==null?void 0:i[Symbol.iterator])=="function",le=`[
|
|
14
|
-
\f\r]`,
|
|
15
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),Ae=/'/g,Me=/"/g,Te=/^(?:script|style|textarea|title)$/i,Xe=i=>(e,...t)=>({_$litType$:i,strings:e,values:t}),l=Xe(1),I=Symbol.for("lit-noChange"),v=Symbol.for("lit-nothing"),Fe=new WeakMap,U=F.createTreeWalker(F,129);function ze(i,e){if(!de(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return ke!==void 0?ke.createHTML(e):e}const Ze=(i,e)=>{const t=i.length-1,n=[];let s,r=e===2?"<svg>":e===3?"<math>":"",o=
|
|
14
|
+
\f\r]`,Q=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ce=/-->/g,Ee=/>/g,z=RegExp(`>|${le}(?:([^\\s"'>=/]+)(${le}*=${le}*(?:[^
|
|
15
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Ae=/'/g,Me=/"/g,Te=/^(?:script|style|textarea|title)$/i,Xe=i=>(e,...t)=>({_$litType$:i,strings:e,values:t}),l=Xe(1),I=Symbol.for("lit-noChange"),v=Symbol.for("lit-nothing"),Fe=new WeakMap,U=F.createTreeWalker(F,129);function ze(i,e){if(!de(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return ke!==void 0?ke.createHTML(e):e}const Ze=(i,e)=>{const t=i.length-1,n=[];let s,r=e===2?"<svg>":e===3?"<math>":"",o=Q;for(let a=0;a<t;a++){const d=i[a];let p,c,u=-1,h=0;for(;h<d.length&&(o.lastIndex=h,c=o.exec(d),c!==null);)h=o.lastIndex,o===Q?c[1]==="!--"?o=Ce:c[1]!==void 0?o=Ee:c[2]!==void 0?(Te.test(c[2])&&(s=RegExp("</"+c[2],"g")),o=z):c[3]!==void 0&&(o=z):o===z?c[0]===">"?(o=s??Q,u=-1):c[1]===void 0?u=-2:(u=o.lastIndex-c[2].length,p=c[1],o=c[3]===void 0?z:c[3]==='"'?Me:Ae):o===Me||o===Ae?o=z:o===Ce||o===Ee?o=Q:(o=z,s=void 0);const f=o===z&&i[a+1].startsWith("/>")?" ":"";r+=o===Q?d+Je:u>=0?(n.push(p),d.slice(0,u)+$e+d.slice(u)+T+f):d+T+(u===-2?a:f)}return[ze(i,r+(i[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]};class B{constructor({strings:e,_$litType$:t},n){let s;this.parts=[];let r=0,o=0;const a=e.length-1,d=this.parts,[p,c]=Ze(e,t);if(this.el=B.createElement(p,n),U.currentNode=this.el.content,t===2||t===3){const u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(s=U.nextNode())!==null&&d.length<a;){if(s.nodeType===1){if(s.hasAttributes())for(const u of s.getAttributeNames())if(u.endsWith($e)){const h=c[o++],f=s.getAttribute(u).split(T),b=/([.?@])?(.*)/.exec(h);d.push({type:1,index:r,name:b[2],strings:f,ctor:b[1]==="."?tt:b[1]==="?"?it:b[1]==="@"?nt:K}),s.removeAttribute(u)}else u.startsWith(T)&&(d.push({type:6,index:r}),s.removeAttribute(u));if(Te.test(s.tagName)){const u=s.textContent.split(T),h=u.length-1;if(h>0){s.textContent=J?J.emptyScript:"";for(let f=0;f<h;f++)s.append(u[f],V()),U.nextNode(),d.push({type:2,index:++r});s.append(u[h],V())}}}else if(s.nodeType===8)if(s.data===De)d.push({type:2,index:r});else{let u=-1;for(;(u=s.data.indexOf(T,u+1))!==-1;)d.push({type:7,index:r}),u+=T.length-1}r++}}static createElement(e,t){const n=F.createElement("template");return n.innerHTML=e,n}}function O(i,e,t=i,n){var o,a;if(e===I)return e;let s=n!==void 0?(o=t._$Co)==null?void 0:o[n]:t._$Cl;const r=j(e)?void 0:e._$litDirective$;return(s==null?void 0:s.constructor)!==r&&((a=s==null?void 0:s._$AO)==null||a.call(s,!1),r===void 0?s=void 0:(s=new r(i),s._$AT(i,t,n)),n!==void 0?(t._$Co??(t._$Co=[]))[n]=s:t._$Cl=s),s!==void 0&&(e=O(i,s._$AS(i,e.values),s,n)),e}class et{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:n}=this._$AD,s=((e==null?void 0:e.creationScope)??F).importNode(t,!0);U.currentNode=s;let r=U.nextNode(),o=0,a=0,d=n[0];for(;d!==void 0;){if(o===d.index){let p;d.type===2?p=new q(r,r.nextSibling,this,e):d.type===1?p=new d.ctor(r,d.name,d.strings,this,e):d.type===6&&(p=new st(r,this,e)),this._$AV.push(p),d=n[++a]}o!==(d==null?void 0:d.index)&&(r=U.nextNode(),o++)}return U.currentNode=F,s}p(e){let t=0;for(const n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}}class q{get _$AU(){var e;return((e=this._$AM)==null?void 0:e._$AU)??this._$Cv}constructor(e,t,n,s){this.type=2,this._$AH=v,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=s,this._$Cv=(s==null?void 0:s.isConnected)??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&(e==null?void 0:e.nodeType)===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=O(this,e,t),j(e)?e===v||e==null||e===""?(this._$AH!==v&&this._$AR(),this._$AH=v):e!==this._$AH&&e!==I&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Ke(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==v&&j(this._$AH)?this._$AA.nextSibling.data=e:this.T(F.createTextNode(e)),this._$AH=e}$(e){var r;const{values:t,_$litType$:n}=e,s=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=B.createElement(ze(n.h,n.h[0]),this.options)),n);if(((r=this._$AH)==null?void 0:r._$AD)===s)this._$AH.p(t);else{const o=new et(s,this),a=o.u(this.options);o.p(t),this.T(a),this._$AH=o}}_$AC(e){let t=Fe.get(e.strings);return t===void 0&&Fe.set(e.strings,t=new B(e)),t}k(e){de(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let n,s=0;for(const r of e)s===t.length?t.push(n=new q(this.O(V()),this.O(V()),this,this.options)):n=t[s],n._$AI(r),s++;s<t.length&&(this._$AR(n&&n._$AB.nextSibling,s),t.length=s)}_$AR(e=this._$AA.nextSibling,t){var n;for((n=this._$AP)==null?void 0:n.call(this,!1,!0,t);e&&e!==this._$AB;){const s=e.nextSibling;e.remove(),e=s}}setConnected(e){var t;this._$AM===void 0&&(this._$Cv=e,(t=this._$AP)==null||t.call(this,e))}}class K{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,s,r){this.type=1,this._$AH=v,this._$AN=void 0,this.element=e,this.name=t,this._$AM=s,this.options=r,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=v}_$AI(e,t=this,n,s){const r=this.strings;let o=!1;if(r===void 0)e=O(this,e,t,0),o=!j(e)||e!==this._$AH&&e!==I,o&&(this._$AH=e);else{const a=e;let d,p;for(e=r[0],d=0;d<r.length-1;d++)p=O(this,a[n+d],t,d),p===I&&(p=this._$AH[d]),o||(o=!j(p)||p!==this._$AH[d]),p===v?e=v:e!==v&&(e+=(p??"")+r[d+1]),this._$AH[d]=p}o&&!s&&this.j(e)}j(e){e===v?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class tt extends K{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===v?void 0:e}}class it extends K{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==v)}}class nt extends K{constructor(e,t,n,s,r){super(e,t,n,s,r),this.type=5}_$AI(e,t=this){if((e=O(this,e,t,0)??v)===I)return;const n=this._$AH,s=e===v&&n!==v||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,r=e!==v&&(n===v||s);s&&this.element.removeEventListener(this.name,this,n),r&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t;typeof this._$AH=="function"?this._$AH.call(((t=this.options)==null?void 0:t.host)??this.element,e):this._$AH.handleEvent(e)}}class st{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){O(this,e)}}const pe=H.litHtmlPolyfillSupport;pe==null||pe(B,q),(H.litHtmlVersions??(H.litHtmlVersions=[])).push("3.3.0");const rt=(i,e,t)=>{const n=(t==null?void 0:t.renderBefore)??e;let s=n._$litPart$;if(s===void 0){const r=(t==null?void 0:t.renderBefore)??null;n._$litPart$=s=new q(e.insertBefore(V(),r),r,void 0,t??{})}return s._$AI(i),s};/**
|
|
16
16
|
* @license
|
|
17
17
|
* Copyright 2017 Google LLC
|
|
18
18
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -3560,7 +3560,7 @@ Use **bold** and *italic* text.`;break}const n=this._templateData.steps.map(r=>r
|
|
|
3560
3560
|
</div>
|
|
3561
3561
|
<hr class="print-question-separator" />
|
|
3562
3562
|
|
|
3563
|
-
${r?
|
|
3563
|
+
${r?Qt(i,o):""}
|
|
3564
3564
|
${i.steps.map(d=>Tt(d)).join(`
|
|
3565
3565
|
`)}
|
|
3566
3566
|
</div>
|
|
@@ -3690,7 +3690,7 @@ Use **bold** and *italic* text.`;break}const n=this._templateData.steps.map(r=>r
|
|
|
3690
3690
|
`}}function Wt(i,e){if(!e)return'<div class="print-response-value file-response"><span class="print-no-response">No file uploaded</span></div>';const t=typeof e=="string";if(typeof e=="object"&&e.name)return`
|
|
3691
3691
|
<div class="print-response-value file-response">
|
|
3692
3692
|
📎 ${g(e.name)}
|
|
3693
|
-
${e.size?` <span class="file-size">(${
|
|
3693
|
+
${e.size?` <span class="file-size">(${Bt(e.size)})</span>`:""}
|
|
3694
3694
|
</div>
|
|
3695
3695
|
`;if(t){const s=qt(e);return`
|
|
3696
3696
|
<div class="print-response-value file-response">
|
|
@@ -3712,7 +3712,7 @@ Use **bold** and *italic* text.`;break}const n=this._templateData.steps.map(r=>r
|
|
|
3712
3712
|
<div class="signature-fallback">
|
|
3713
3713
|
<div class="signature-error">Unable to display signature</div>
|
|
3714
3714
|
</div>
|
|
3715
|
-
`}function Vt(i){return["text_input","textarea","select","number","radio","checkbox","date","file_upload","signature"].includes(i.type)}function jt(i,e){return e==null?void 0:e.find(t=>t.elementId===i)}function
|
|
3715
|
+
`}function Vt(i){return["text_input","textarea","select","number","radio","checkbox","date","file_upload","signature"].includes(i.type)}function jt(i,e){return e==null?void 0:e.find(t=>t.elementId===i)}function Qt(i,e){return`
|
|
3716
3716
|
<div class="runner-card" style="margin-bottom: 40px; border-left: 4px solid #3b82f6;">
|
|
3717
3717
|
<div style="display: flex; justify-content: between; align-items: center; gap: 20px;">
|
|
3718
3718
|
<div>
|
|
@@ -3730,7 +3730,7 @@ Use **bold** and *italic* text.`;break}const n=this._templateData.steps.map(r=>r
|
|
|
3730
3730
|
</div>
|
|
3731
3731
|
</div>
|
|
3732
3732
|
</div>
|
|
3733
|
-
`}function g(i){if(i==null)return"";const e=String(i);return{innerHTML:""}.innerHTML||e.replace(/[&<>"']/g,n=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[n])}function
|
|
3733
|
+
`}function g(i){if(i==null)return"";const e=String(i);return{innerHTML:""}.innerHTML||e.replace(/[&<>"']/g,n=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[n])}function Bt(i){if(i===0)return"0 Bytes";const e=1024,t=["Bytes","KB","MB","GB"],n=Math.floor(Math.log(i)/Math.log(e));return parseFloat((i/Math.pow(e,n)).toFixed(2))+" "+t[n]}function qt(i){try{return new URL(i).pathname.split("/").pop()||""||"Uploaded File"}catch{const e=i.split("/"),t=e[e.length-1];return t&&t.includes(".")?t:"Uploaded File"}}function Gt(i){return i==null?"":String(i).replace(/^### (.*$)/gim,"<h3>$1</h3>").replace(/^## (.*$)/gim,"<h2>$1</h2>").replace(/^# (.*$)/gim,"<h1>$1</h1>").replace(/\*\*(.*)\*\*/gim,"<strong>$1</strong>").replace(/\*(.*)\*/gim,"<em>$1</em>").replace(/`(.*)`/gim,"<code>$1</code>").replace(/\n/gim,"<br>")}function Yt(){return`
|
|
3734
3734
|
/* Print Layout Styles - Extracted from step-styles.ts */
|
|
3735
3735
|
.print-layout {
|
|
3736
3736
|
width: 100%;
|
|
@@ -4235,4 +4235,4 @@ Use **bold** and *italic* text.`;break}const n=this._templateData.steps.map(r=>r
|
|
|
4235
4235
|
margin: 2px 0;
|
|
4236
4236
|
line-height: 1.4;
|
|
4237
4237
|
}
|
|
4238
|
-
`}function Jt(i,e={}){if(!customElements.get("builder-widget"))return console.error("Error: <builder-widget> is not defined. Make sure it was imported."),null;const t=document.getElementById(i);if(!t)return console.error(`Error: Target element with ID '${i}' not found.`),null;t.innerHTML="";const n=document.createElement("builder-widget");return e.onWorkflowCreated&&(n.onWorkflowCreated=e.onWorkflowCreated),e.onWorkflowDeleted&&(n.onWorkflowDeleted=e.onWorkflowDeleted),e.onWorkflowUpdated&&(n.onWorkflowUpdated=e.onWorkflowUpdated),t.appendChild(n),console.log(`
|
|
4238
|
+
`}function Jt(i,e={}){if(!customElements.get("builder-widget"))return console.error("Error: <builder-widget> is not defined. Make sure it was imported."),null;const t=document.getElementById(i);if(!t)return console.error(`Error: Target element with ID '${i}' not found.`),null;t.innerHTML="";const n=document.createElement("builder-widget");return e.onWorkflowCreated&&(n.onWorkflowCreated=e.onWorkflowCreated),e.onWorkflowDeleted&&(n.onWorkflowDeleted=e.onWorkflowDeleted),e.onWorkflowUpdated&&(n.onWorkflowUpdated=e.onWorkflowUpdated),t.appendChild(n),console.log(`Drill Builder mounted on #${i}`),n}function Kt(i,e){if(!customElements.get("runner-widget"))return console.error("Error: <runner-widget> is not defined. Make sure it was imported."),null;const t=document.getElementById(i);if(!t)return console.error(`Error: Target element with ID '${i}' not found.`),null;if(e.mode==="preview"){if(!e||!e.workflow)return console.error("Error: Workflow data must be provided for preview mode."),t.innerHTML='<p style="color: red;">Error: Workflow data required for preview mode.</p>',null;if(!e.workflow.steps||e.workflow.steps.length===0)return console.error("Error: Workflow provided to runner has no steps defined."),t.innerHTML='<p style="color: red;">Error: Workflow has no steps.</p>',null}else{if(!e||!e.instance)return console.error("Error: Instance data must be provided in runner config."),t.innerHTML='<p style="color: red;">Error: Instance data required.</p>',null;if(!e.instance.steps||e.instance.steps.length===0)return console.error("Error: Instance provided to runner has no steps defined."),t.innerHTML='<p style="color: red;">Error: Instance has no steps.</p>',null}t.innerHTML="";const n=document.createElement("runner-widget");return e.mode==="preview"?(n.workflow=e.workflow,n.mode="preview"):(n.instance=e.instance,n.mode=e.mode||"default"),e.mode&&(n.mode=e.mode),e.isLoading!==void 0&&(n.isLoading=e.isLoading),e.onSignatureCaptured&&(n.onSignatureCaptured=e.onSignatureCaptured),e.onFileUploaded&&(n.onFileUploaded=e.onFileUploaded),e.currentUser&&(n.currentUser=e.currentUser),e.onInstanceUpdated&&n.addEventListener("instance-updated",s=>{const r=s;try{e.onInstanceUpdated(r.detail)}catch(o){console.error("Error executing onInstanceUpdated callback:",o)}}),t.appendChild(n),console.log(`Drill Runner mounted on #${i}`),n}function Xt(i,e){const t=i.getFormData(),n=JSON.parse(JSON.stringify(e));return n.steps&&n.steps.forEach(s=>{s.responses||(s.responses=[]),s.elements.forEach(r=>{if(r.type==="text_input"||r.type==="textarea"||r.type==="select"||r.type==="number"||r.type==="radio"||r.type==="checkbox"||r.type==="date"||r.type==="file_upload"||r.type==="signature"){const o=t[r.id];if(o!==void 0){let a=s.responses.find(d=>d.elementId===r.id);a?(a.value=o,a.answeredAt=new Date):(a={elementId:r.id,value:o,answeredAt:new Date},s.responses.push(a))}}})}),n}function Zt(i,e){const t={};e.steps&&e.steps.forEach(n=>{n.responses&&n.responses.forEach(s=>{t[s.elementId]=s.value})}),i.restoreFormData(),console.log("Form data restored to runner widget:",t)}D.createBuilder=Jt,D.createRunner=Kt,D.generateInstanceHTML=Mt,D.restoreFormDataToRunner=Zt,D.updateInstanceFromRunnerForm=Xt,Object.defineProperty(D,Symbol.toStringTag,{value:"Module"})});
|
package/dist/lib.d.ts
CHANGED
|
@@ -75,14 +75,14 @@ export declare interface ContentElement extends BaseElement {
|
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
/**
|
|
78
|
-
* Creates and mounts the
|
|
78
|
+
* Creates and mounts the Drill Workflow Builder widget.
|
|
79
79
|
* @param targetElementId The ID of the DOM element to mount the widget into.
|
|
80
80
|
* @param config Configuration options including callbacks.
|
|
81
81
|
*/
|
|
82
82
|
export declare function createBuilder(targetElementId: string, config?: BuilderConfig): BuilderWidget | null;
|
|
83
83
|
|
|
84
84
|
/**
|
|
85
|
-
* Creates and mounts the
|
|
85
|
+
* Creates and mounts the Drill Workflow Runner widget.
|
|
86
86
|
* @param targetElementId The ID of the DOM element to mount the widget into.
|
|
87
87
|
* @param config Configuration options including instance and callbacks.
|
|
88
88
|
*/
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "drill-widgets",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.4",
|
|
4
4
|
"description": "Easily embed powerful workflow building and running capabilities into your web applications with Lit-based web components. Includes HTML export for server-side PDF generation.",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "vite",
|
|
7
7
|
"build": "tsc && vite build && node scripts/build-html.js",
|
|
8
8
|
"preview": "vite preview",
|
|
9
|
-
"test": "
|
|
9
|
+
"test": "vitest",
|
|
10
|
+
"test:coverage": "vitest run --coverage"
|
|
10
11
|
},
|
|
11
12
|
"keywords": [
|
|
12
13
|
"workflow",
|
|
@@ -23,14 +24,14 @@
|
|
|
23
24
|
"author": "Clay Grumieaux <claygrumeo@gmail.com>",
|
|
24
25
|
"license": "UNLICENSED",
|
|
25
26
|
"type": "module",
|
|
26
|
-
"main": "./dist/
|
|
27
|
-
"module": "./dist/
|
|
27
|
+
"main": "./dist/drill-widgets.umd.js",
|
|
28
|
+
"module": "./dist/drill-widgets.es.js",
|
|
28
29
|
"types": "./dist/lib.d.ts",
|
|
29
30
|
"exports": {
|
|
30
31
|
".": {
|
|
31
32
|
"types": "./dist/lib.d.ts",
|
|
32
|
-
"import": "./dist/
|
|
33
|
-
"require": "./dist/
|
|
33
|
+
"import": "./dist/drill-widgets.es.js",
|
|
34
|
+
"require": "./dist/drill-widgets.umd.js"
|
|
34
35
|
},
|
|
35
36
|
"./types": {
|
|
36
37
|
"types": "./dist/api-types.d.ts"
|
|
@@ -44,17 +45,19 @@
|
|
|
44
45
|
},
|
|
45
46
|
"devDependencies": {
|
|
46
47
|
"@types/uuid": "^10.0.0",
|
|
48
|
+
"@vitest/coverage-v8": "^4.0.1",
|
|
47
49
|
"typescript": "^5.8.3",
|
|
48
|
-
"vite": "^6.3.0"
|
|
50
|
+
"vite": "^6.3.0",
|
|
51
|
+
"vitest": "^4.0.1"
|
|
49
52
|
},
|
|
50
53
|
"repository": {
|
|
51
54
|
"type": "git",
|
|
52
|
-
"url": "git+https://github.com/
|
|
55
|
+
"url": "git+https://github.com/Paragraph-Studio/drill-widgets.git"
|
|
53
56
|
},
|
|
54
57
|
"bugs": {
|
|
55
|
-
"url": "https://github.com/
|
|
58
|
+
"url": "https://github.com/Paragraph-Studio/drill-widgets/issues"
|
|
56
59
|
},
|
|
57
|
-
"homepage": "https://github.com/
|
|
60
|
+
"homepage": "https://github.com/Paragraph-Studio/drill-widgets#readme",
|
|
58
61
|
"files": [
|
|
59
62
|
"dist/*.js",
|
|
60
63
|
"dist/*.d.ts",
|