reneco-advanced-input-module 0.0.23 → 0.0.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{index-BTSzTkSZ.js → index-BtdDZbi5.js} +11 -4
- package/dist/cjs/index-BtdDZbi5.js.map +1 -0
- package/dist/cjs/loader.cjs.js +3 -4
- package/dist/cjs/loader.cjs.js.map +1 -1
- package/dist/cjs/ocr-file-uploader.cjs.entry.js +1 -1
- package/dist/cjs/voice-input-module.cjs.entry.js +43 -7
- package/dist/cjs/voice-input-module.cjs.entry.js.map +1 -1
- package/dist/cjs/voice-input-module.cjs.js +3 -4
- package/dist/cjs/voice-input-module.cjs.js.map +1 -1
- package/dist/cjs/voice-input-module.entry.cjs.js.map +1 -1
- package/dist/collection/components/voice-input-module/voice-input-module.css +34 -0
- package/dist/collection/components/voice-input-module/voice-input-module.js +43 -6
- package/dist/collection/components/voice-input-module/voice-input-module.js.map +1 -1
- package/dist/components/voice-input-module.js +43 -6
- package/dist/components/voice-input-module.js.map +1 -1
- package/dist/esm/{index-jmc2yzBp.js → index-a7QWC-5I.js} +11 -5
- package/dist/esm/index-a7QWC-5I.js.map +1 -0
- package/dist/esm/loader.js +3 -4
- package/dist/esm/loader.js.map +1 -1
- package/dist/esm/ocr-file-uploader.entry.js +1 -1
- package/dist/esm/voice-input-module.entry.js +43 -7
- package/dist/esm/voice-input-module.entry.js.map +1 -1
- package/dist/esm/voice-input-module.js +3 -4
- package/dist/esm/voice-input-module.js.map +1 -1
- package/dist/types/components/voice-input-module/voice-input-module.d.ts +3 -0
- package/dist/voice-input-module/loader.esm.js.map +1 -1
- package/dist/voice-input-module/{p-920964b2.entry.js → p-334644ec.entry.js} +3 -3
- package/dist/voice-input-module/p-334644ec.entry.js.map +1 -0
- package/dist/voice-input-module/p-a7QWC-5I.js +3 -0
- package/dist/voice-input-module/p-a7QWC-5I.js.map +1 -0
- package/dist/voice-input-module/{p-a5eeaf1c.entry.js → p-ba3d83d1.entry.js} +2 -2
- package/dist/voice-input-module/voice-input-module.css +6 -0
- package/dist/voice-input-module/voice-input-module.entry.esm.js.map +1 -1
- package/dist/voice-input-module/voice-input-module.esm.js +1 -1
- package/dist/voice-input-module/voice-input-module.esm.js.map +1 -1
- package/package.json +1 -1
- package/www/build/loader.esm.js.map +1 -1
- package/www/build/{p-920964b2.entry.js → p-334644ec.entry.js} +3 -3
- package/www/build/p-334644ec.entry.js.map +1 -0
- package/www/build/p-6cd2a3a1.css +6 -0
- package/www/build/p-a7QWC-5I.js +3 -0
- package/www/build/p-a7QWC-5I.js.map +1 -0
- package/www/build/{p-a5eeaf1c.entry.js → p-ba3d83d1.entry.js} +2 -2
- package/www/build/p-dfdcd9a6.js +2 -0
- package/www/build/voice-input-module.css +6 -0
- package/www/build/voice-input-module.entry.esm.js.map +1 -1
- package/www/build/voice-input-module.esm.js +1 -1
- package/www/build/voice-input-module.esm.js.map +1 -1
- package/www/index.html +1 -1
- package/dist/cjs/app-globals-V2Kpy_OQ.js +0 -8
- package/dist/cjs/app-globals-V2Kpy_OQ.js.map +0 -1
- package/dist/cjs/index-BTSzTkSZ.js.map +0 -1
- package/dist/esm/app-globals-DQuL1Twl.js +0 -6
- package/dist/esm/app-globals-DQuL1Twl.js.map +0 -1
- package/dist/esm/index-jmc2yzBp.js.map +0 -1
- package/dist/voice-input-module/p-920964b2.entry.js.map +0 -1
- package/dist/voice-input-module/p-DQuL1Twl.js +0 -2
- package/dist/voice-input-module/p-DQuL1Twl.js.map +0 -1
- package/dist/voice-input-module/p-jmc2yzBp.js +0 -3
- package/dist/voice-input-module/p-jmc2yzBp.js.map +0 -1
- package/www/build/p-920964b2.entry.js.map +0 -1
- package/www/build/p-DQuL1Twl.js +0 -2
- package/www/build/p-DQuL1Twl.js.map +0 -1
- package/www/build/p-cbf8974a.js +0 -2
- package/www/build/p-jmc2yzBp.js +0 -3
- package/www/build/p-jmc2yzBp.js.map +0 -1
- /package/dist/voice-input-module/{p-a5eeaf1c.entry.js.map → p-ba3d83d1.entry.js.map} +0 -0
- /package/www/build/{p-a5eeaf1c.entry.js.map → p-ba3d83d1.entry.js.map} +0 -0
|
@@ -341,6 +341,40 @@ input[type="date"].form-input {
|
|
|
341
341
|
user-select: none;
|
|
342
342
|
}
|
|
343
343
|
|
|
344
|
+
/* Skeleton loading state */
|
|
345
|
+
@keyframes skeleton-shimmer {
|
|
346
|
+
0% { background-position: -200% 0; }
|
|
347
|
+
100% { background-position: 200% 0; }
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
.skeleton-circle {
|
|
351
|
+
border-radius: 50%;
|
|
352
|
+
flex-shrink: 0;
|
|
353
|
+
background: linear-gradient(
|
|
354
|
+
90deg,
|
|
355
|
+
#e2e8f0 25%,
|
|
356
|
+
#f8fafc 50%,
|
|
357
|
+
#e2e8f0 75%
|
|
358
|
+
);
|
|
359
|
+
background-size: 200% 100%;
|
|
360
|
+
animation: skeleton-shimmer 1.5s ease-in-out infinite;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
.skeleton-status {
|
|
364
|
+
height: 14px;
|
|
365
|
+
border-radius: 7px;
|
|
366
|
+
width: 140px;
|
|
367
|
+
background: linear-gradient(
|
|
368
|
+
90deg,
|
|
369
|
+
#e2e8f0 25%,
|
|
370
|
+
#f8fafc 50%,
|
|
371
|
+
#e2e8f0 75%
|
|
372
|
+
);
|
|
373
|
+
background-size: 200% 100%;
|
|
374
|
+
animation: skeleton-shimmer 1.5s ease-in-out infinite;
|
|
375
|
+
animation-delay: 0.15s;
|
|
376
|
+
}
|
|
377
|
+
|
|
344
378
|
/* Force OCR component to respect size */
|
|
345
379
|
ocr-file-uploader {
|
|
346
380
|
display: block;
|
|
@@ -42,6 +42,7 @@ export class VoiceFormRecorder {
|
|
|
42
42
|
this.filledData = null;
|
|
43
43
|
this.debugInfo = {};
|
|
44
44
|
this.isReadonlyMode = true; // Start in readonly preview mode
|
|
45
|
+
this.isInitializing = true;
|
|
45
46
|
this.triggerAudioRecordUpload = () => {
|
|
46
47
|
this.fileInputAudioRecord.click();
|
|
47
48
|
};
|
|
@@ -49,6 +50,10 @@ export class VoiceFormRecorder {
|
|
|
49
50
|
const input = event.target;
|
|
50
51
|
if (!input.files || input.files.length === 0)
|
|
51
52
|
return;
|
|
53
|
+
if (this.isProcessing || this.isRecording) {
|
|
54
|
+
input.value = '';
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
52
57
|
const file = input.files[0];
|
|
53
58
|
const isEn = this.language === 'en';
|
|
54
59
|
// Validate file type
|
|
@@ -69,7 +74,18 @@ export class VoiceFormRecorder {
|
|
|
69
74
|
this.audioRecorder = new AudioRecorderService();
|
|
70
75
|
}
|
|
71
76
|
componentWillLoad() {
|
|
77
|
+
// Parse theme only so the skeleton can be styled correctly on first render.
|
|
78
|
+
// Full initialization runs in componentDidLoad() to give the skeleton time to paint.
|
|
79
|
+
try {
|
|
80
|
+
this.parsedTheme = this.theme ? JSON.parse(this.theme) : this.getDefaultTheme();
|
|
81
|
+
}
|
|
82
|
+
catch (_a) {
|
|
83
|
+
this.parsedTheme = this.getDefaultTheme();
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
componentDidLoad() {
|
|
72
87
|
this.initializeServices();
|
|
88
|
+
this.isInitializing = false;
|
|
73
89
|
}
|
|
74
90
|
initializeServices() {
|
|
75
91
|
var _a;
|
|
@@ -267,6 +283,8 @@ export class VoiceFormRecorder {
|
|
|
267
283
|
}
|
|
268
284
|
async processJsonForm(ocrData) {
|
|
269
285
|
var _a, _b, _c;
|
|
286
|
+
if (this.isProcessing || this.isRecording)
|
|
287
|
+
return;
|
|
270
288
|
this.isProcessing = true;
|
|
271
289
|
this.hasTransientError = false;
|
|
272
290
|
this.statusMessage = ((_a = this.parsedTheme.texts) === null || _a === void 0 ? void 0 : _a.processing) || (this.language == 'en' ? 'Processing document...' : 'Traitement du document ...');
|
|
@@ -304,6 +322,8 @@ export class VoiceFormRecorder {
|
|
|
304
322
|
}
|
|
305
323
|
async processAudioContent(audioFile) {
|
|
306
324
|
var _a, _b, _c;
|
|
325
|
+
if (this.isProcessing || this.isRecording)
|
|
326
|
+
return;
|
|
307
327
|
this.isProcessing = true;
|
|
308
328
|
this.hasTransientError = false;
|
|
309
329
|
this.updateDebugInfo('Audio Captured', { size: audioFile.size, type: audioFile.type });
|
|
@@ -622,7 +642,7 @@ export class VoiceFormRecorder {
|
|
|
622
642
|
textColor: ocrStyle.textColor || '#ffffff'
|
|
623
643
|
}
|
|
624
644
|
};
|
|
625
|
-
const isDisabled = this.isProcessing || this.hasError;
|
|
645
|
+
const isDisabled = this.isProcessing || this.hasError || this.isRecording;
|
|
626
646
|
return (h("div", { style: { width: size, height: size, flexShrink: '0', opacity: isDisabled ? '0.6' : '1', pointerEvents: isDisabled ? 'none' : 'auto' } }, h("ocr-file-uploader", { batch: false, "json-schema": this.convertSchemaToOcrFormat(this.parsedSchema), callback: (data) => { this.processJsonForm(data); }, theme: JSON.stringify(ocrTheme), style: { width: '100%', height: '100%' } })));
|
|
627
647
|
}
|
|
628
648
|
convertSchemaToOcrFormat(schema) {
|
|
@@ -677,7 +697,7 @@ export class VoiceFormRecorder {
|
|
|
677
697
|
return;
|
|
678
698
|
const audioStyle = ((_a = this.parsedTheme.buttons) === null || _a === void 0 ? void 0 : _a.audio) || {};
|
|
679
699
|
const size = audioStyle.size || '50px';
|
|
680
|
-
const isDisabled = this.isProcessing || this.hasError;
|
|
700
|
+
const isDisabled = this.isProcessing || this.hasError || this.isRecording;
|
|
681
701
|
const buttonStyle = {
|
|
682
702
|
stroke: audioStyle.backgroundColor || '#3b82f6',
|
|
683
703
|
fill: audioStyle.backgroundColor || '#3b82f6',
|
|
@@ -706,6 +726,17 @@ export class VoiceFormRecorder {
|
|
|
706
726
|
};
|
|
707
727
|
return (h("button", { class: buttonClass, style: buttonStyle, onClick: () => this.handleRecordClick(), disabled: isDisabled, "aria-label": this.isRecording ? 'Stop recording' : 'Start recording' }, this.isProcessing ? (h("svg", { class: "record-icon", viewBox: "0 0 24 24" }, h("circle", { cx: "12", cy: "12", r: "3" }, h("animate", { attributeName: "r", values: "3;6;3", dur: "1s", repeatCount: "indefinite" }), h("animate", { attributeName: "opacity", values: "1;0.3;1", dur: "1s", repeatCount: "indefinite" })))) : this.isRecording ? (h("svg", { class: "record-icon", viewBox: "0 0 24 24" }, h("rect", { x: "6", y: "6", width: "12", height: "12", rx: "2" }))) : (h("svg", { class: "record-icon", viewBox: "0 0 24 24" }, h("circle", { cx: "12", cy: "12", r: "8" })))));
|
|
708
728
|
}
|
|
729
|
+
renderLoadingSkeleton() {
|
|
730
|
+
var _a;
|
|
731
|
+
const types = this.parsedInputTypes.length > 0 ? this.parsedInputTypes : ['voice'];
|
|
732
|
+
const containerStyle = this.getContainerStyle();
|
|
733
|
+
const buttons = (((_a = this.parsedTheme) === null || _a === void 0 ? void 0 : _a.buttons) || {});
|
|
734
|
+
const getSize = (type) => { var _a, _b; return ((_a = buttons[type]) === null || _a === void 0 ? void 0 : _a.size) || ((_b = buttons.voice) === null || _b === void 0 ? void 0 : _b.size) || '50px'; };
|
|
735
|
+
return (h("div", null, h("div", { class: "voice-recorder-container" + (this.debug || this.renderForm ? "-debug" : ""), style: containerStyle }, h("div", { class: "row-audio-area" }, types.map(type => {
|
|
736
|
+
const size = getSize(type);
|
|
737
|
+
return h("div", { class: "skeleton-circle", style: { width: size, height: size } });
|
|
738
|
+
})), this.displayStatus && h("div", { class: "skeleton-status" }))));
|
|
739
|
+
}
|
|
709
740
|
renderStatusMessage() {
|
|
710
741
|
const hasAnyError = this.hasError || this.hasTransientError;
|
|
711
742
|
const statusClass = [
|
|
@@ -867,7 +898,8 @@ export class VoiceFormRecorder {
|
|
|
867
898
|
};
|
|
868
899
|
}
|
|
869
900
|
getContainerStyle() {
|
|
870
|
-
|
|
901
|
+
var _a;
|
|
902
|
+
const c = ((_a = this.parsedTheme) === null || _a === void 0 ? void 0 : _a.container) || {};
|
|
871
903
|
return {
|
|
872
904
|
width: c.width || 'auto',
|
|
873
905
|
height: c.height || 'auto',
|
|
@@ -879,15 +911,19 @@ export class VoiceFormRecorder {
|
|
|
879
911
|
};
|
|
880
912
|
}
|
|
881
913
|
getStatusStyle() {
|
|
882
|
-
|
|
914
|
+
var _a;
|
|
915
|
+
const s = ((_a = this.parsedTheme) === null || _a === void 0 ? void 0 : _a.statusText) || {};
|
|
883
916
|
return {
|
|
884
917
|
color: s.color || '#1e293b',
|
|
885
918
|
fontSize: s.fontSize || '14px'
|
|
886
919
|
};
|
|
887
920
|
}
|
|
888
921
|
render() {
|
|
922
|
+
if (this.isInitializing) {
|
|
923
|
+
return this.renderLoadingSkeleton();
|
|
924
|
+
}
|
|
889
925
|
const containerStyle = this.getContainerStyle();
|
|
890
|
-
return (h("div",
|
|
926
|
+
return (h("div", null, h("div", { class: "voice-recorder-container" + (this.debug || this.renderForm ? "-debug" : ""), style: containerStyle }, h("div", { class: "row-audio-area" }, this.renderRecordButton(), this.renderUploadRecordButton(), this.renderUploadButton()), this.displayStatus ? this.renderStatusMessage() : "", this.renderForm ? this.renderFormPreview() : "", this.debug ? this.renderDebugPanel() : "")));
|
|
891
927
|
}
|
|
892
928
|
static get is() { return "voice-input-module"; }
|
|
893
929
|
static get encapsulation() { return "shadow"; }
|
|
@@ -1246,7 +1282,8 @@ export class VoiceFormRecorder {
|
|
|
1246
1282
|
"transcription": {},
|
|
1247
1283
|
"filledData": {},
|
|
1248
1284
|
"debugInfo": {},
|
|
1249
|
-
"isReadonlyMode": {}
|
|
1285
|
+
"isReadonlyMode": {},
|
|
1286
|
+
"isInitializing": {}
|
|
1250
1287
|
};
|
|
1251
1288
|
}
|
|
1252
1289
|
static get events() {
|