@sparkvault/sdk 1.8.4 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +9 -0
- package/dist/sparkvault.cjs.js +52 -4
- package/dist/sparkvault.cjs.js.map +1 -1
- package/dist/sparkvault.esm.js +52 -4
- package/dist/sparkvault.esm.js.map +1 -1
- package/dist/sparkvault.js +1 -1
- package/dist/sparkvault.js.map +1 -1
- package/dist/vaults/upload/renderer.d.ts +7 -0
- package/dist/vaults/upload/types.d.ts +9 -0
- package/package.json +1 -1
package/dist/sparkvault.esm.js
CHANGED
|
@@ -7505,11 +7505,15 @@ class UploadRenderer {
|
|
|
7505
7505
|
this.selectedFile = null;
|
|
7506
7506
|
// File input element for selection
|
|
7507
7507
|
this.fileInputElement = null;
|
|
7508
|
+
// Hybrid mode: modal overlay for upload/ceremony in inline mode
|
|
7509
|
+
this.uploadModal = null;
|
|
7510
|
+
this.isInlineMode = false;
|
|
7508
7511
|
this.pasteHandler = null;
|
|
7509
7512
|
this.container = container;
|
|
7510
7513
|
this.api = api;
|
|
7511
7514
|
this.options = options;
|
|
7512
7515
|
this.callbacks = callbacks;
|
|
7516
|
+
this.isInlineMode = !!options.target;
|
|
7513
7517
|
}
|
|
7514
7518
|
/**
|
|
7515
7519
|
* Start the upload flow.
|
|
@@ -7540,6 +7544,11 @@ class UploadRenderer {
|
|
|
7540
7544
|
close() {
|
|
7541
7545
|
this.cleanupFileInput();
|
|
7542
7546
|
this.cleanupPasteHandler();
|
|
7547
|
+
// Clean up modal if open (hybrid mode)
|
|
7548
|
+
if (this.uploadModal) {
|
|
7549
|
+
this.uploadModal.destroy();
|
|
7550
|
+
this.uploadModal = null;
|
|
7551
|
+
}
|
|
7543
7552
|
this.container.destroy();
|
|
7544
7553
|
}
|
|
7545
7554
|
handleClose() {
|
|
@@ -7551,17 +7560,27 @@ class UploadRenderer {
|
|
|
7551
7560
|
this.render();
|
|
7552
7561
|
}
|
|
7553
7562
|
render() {
|
|
7563
|
+
const isDarkState = this.viewState.view === 'uploading' || this.viewState.view === 'ceremony';
|
|
7564
|
+
// Hybrid mode: For inline containers, use a modal popup for upload/ceremony
|
|
7565
|
+
// This gives the polished full experience, then returns to inline for success
|
|
7566
|
+
if (this.isInlineMode && isDarkState) {
|
|
7567
|
+
this.renderInModal();
|
|
7568
|
+
return;
|
|
7569
|
+
}
|
|
7570
|
+
// Close modal if we're leaving upload/ceremony states
|
|
7571
|
+
if (this.uploadModal) {
|
|
7572
|
+
this.uploadModal.destroy();
|
|
7573
|
+
this.uploadModal = null;
|
|
7574
|
+
}
|
|
7554
7575
|
const body = this.container.getBody();
|
|
7555
7576
|
if (!body)
|
|
7556
7577
|
return;
|
|
7557
7578
|
// Clear body
|
|
7558
7579
|
body.innerHTML = '';
|
|
7559
|
-
// Handle dark mode for certain states
|
|
7580
|
+
// Handle dark mode for certain states (modal mode only)
|
|
7560
7581
|
const containerWithDarkMode = this.container;
|
|
7561
|
-
if ('setDarkMode' in containerWithDarkMode) {
|
|
7562
|
-
const isDarkState = this.viewState.view === 'uploading' || this.viewState.view === 'ceremony';
|
|
7582
|
+
if ('setDarkMode' in containerWithDarkMode && !this.isInlineMode) {
|
|
7563
7583
|
containerWithDarkMode.setDarkMode(isDarkState);
|
|
7564
|
-
// Show sidebar during dark states (uploading/ceremony)
|
|
7565
7584
|
this.container.toggleSidebar(isDarkState);
|
|
7566
7585
|
}
|
|
7567
7586
|
switch (this.viewState.view) {
|
|
@@ -7585,6 +7604,35 @@ class UploadRenderer {
|
|
|
7585
7604
|
break;
|
|
7586
7605
|
}
|
|
7587
7606
|
}
|
|
7607
|
+
/**
|
|
7608
|
+
* Render uploading/ceremony states in a modal overlay (for inline mode).
|
|
7609
|
+
* This provides the full polished experience during upload.
|
|
7610
|
+
*/
|
|
7611
|
+
renderInModal() {
|
|
7612
|
+
// Create modal if not exists
|
|
7613
|
+
if (!this.uploadModal) {
|
|
7614
|
+
this.uploadModal = new UploadModalContainer();
|
|
7615
|
+
this.uploadModal.createLoading({ backdropBlur: this.options.backdropBlur ?? true }, () => { } // No close callback - user can't cancel during upload
|
|
7616
|
+
);
|
|
7617
|
+
if (this.config) {
|
|
7618
|
+
this.uploadModal.updateBranding(this.config.branding);
|
|
7619
|
+
}
|
|
7620
|
+
}
|
|
7621
|
+
const body = this.uploadModal.getBody();
|
|
7622
|
+
if (!body)
|
|
7623
|
+
return;
|
|
7624
|
+
// Clear and render current state
|
|
7625
|
+
body.innerHTML = '';
|
|
7626
|
+
// Set dark mode and show sidebar
|
|
7627
|
+
this.uploadModal.setDarkMode(true);
|
|
7628
|
+
this.uploadModal.toggleSidebar(true);
|
|
7629
|
+
if (this.viewState.view === 'uploading') {
|
|
7630
|
+
body.appendChild(this.renderUploading(this.viewState));
|
|
7631
|
+
}
|
|
7632
|
+
else if (this.viewState.view === 'ceremony') {
|
|
7633
|
+
body.appendChild(this.renderCeremony(this.viewState));
|
|
7634
|
+
}
|
|
7635
|
+
}
|
|
7588
7636
|
renderLoading() {
|
|
7589
7637
|
const div = document.createElement('div');
|
|
7590
7638
|
div.className = 'svu-loading';
|