@unvired/turboforms-embed-sdk 1.0.30 → 1.0.33

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.
@@ -60710,7 +60710,7 @@ window.CommentOnBack = CommentOnBack;
60710
60710
 
60711
60711
 
60712
60712
  <div id="sticky-footer">
60713
- <div class="build-version">SDK v1.0.30</div>
60713
+ <div class="build-version">SDK v1.0.33</div>
60714
60714
  <div class="relative-position">
60715
60715
  <button id="unvired-more-btn" class="ui button primary dataGrid-addRow" onclick="toggleTooltip()">
60716
60716
  <i class="icon options"></i>
@@ -27948,7 +27948,7 @@ select.ui.dropdown {
27948
27948
  <div id="formio-cmt" style="margin-bottom: 20px;"></div>
27949
27949
  </div>
27950
27950
  <div id="sticky-footer">
27951
- <div class="build-version">SDK v1.0.30</div>
27951
+ <div class="build-version">SDK v1.0.33</div>
27952
27952
  <button class="ui button primary dataGrid-addRow" id="saveBtn" disabled="true" onclick="FormOnSave()">
27953
27953
  <i class="icon save large"></i>Save
27954
27954
  </button>
@@ -66461,7 +66461,15 @@ function updateFooterVisibility(keyboardOpen) {
66461
66461
 
66462
66462
  const footer = document.getElementById('sticky-footer');
66463
66463
  if (!footer) return;
66464
-
66464
+
66465
+ const options = window.__unviredFormsOptions || {};
66466
+ const isReadOnly = options.mode === "readOnly";
66467
+
66468
+ if (isReadOnly) {
66469
+ footer.style.display = 'none';
66470
+ return;
66471
+ }
66472
+
66465
66473
  if (keyboardOpen) {
66466
66474
  footer.style.display = 'none';
66467
66475
  } else {
@@ -66473,7 +66481,7 @@ function updateFooterVisibility(keyboardOpen) {
66473
66481
  document.addEventListener('focusin', (e) => {
66474
66482
  const el = e.target;
66475
66483
  if (!el || !['INPUT', 'TEXTAREA', 'SELECT'].includes(el.tagName)) return;
66476
-
66484
+
66477
66485
  console.log("[Focus] \u{1F3AF} focusin on:", el.name || el.id || el.tagName);
66478
66486
  updateFooterVisibility(true);
66479
66487
 
@@ -66500,7 +66508,7 @@ document.addEventListener('focusout', (e) => {
66500
66508
  setTimeout(() => {
66501
66509
  const currentlyFocused = document.activeElement;
66502
66510
  const isInputFocused = currentlyFocused && ['INPUT', 'TEXTAREA', 'SELECT'].includes(currentlyFocused.tagName);
66503
-
66511
+
66504
66512
  if (!isInputFocused && !isKeyboardOpen) {
66505
66513
  console.log("[Focus] \u{1F6AA} focusout and keyboard closed, restoring footer.");
66506
66514
  updateFooterVisibility(false);
@@ -66508,6 +66516,9 @@ document.addEventListener('focusout', (e) => {
66508
66516
  }, 200);
66509
66517
  });
66510
66518
 
66519
+ let lastWidth = window.innerWidth;
66520
+ let baselineHeight = window.innerHeight;
66521
+
66511
66522
  // Detect keyboard open/close
66512
66523
  if (window.visualViewport) {
66513
66524
  window.visualViewport.addEventListener('resize', () => {
@@ -66515,8 +66526,23 @@ if (window.visualViewport) {
66515
66526
  if (!isIOS) return;
66516
66527
 
66517
66528
  const viewport = window.visualViewport;
66529
+ const currentWidth = window.innerWidth;
66530
+
66531
+ // Detect orientation change or significant width resize
66532
+ if (Math.abs(currentWidth - lastWidth) > 50) {
66533
+ lastWidth = currentWidth;
66534
+ // Reset baseline to the new orientation's innerHeight
66535
+ baselineHeight = window.innerHeight;
66536
+ }
66537
+
66518
66538
  const vpH = viewport.height;
66519
- const isNowOpen = vpH < INITIAL_WINDOW_HEIGHT - 100;
66539
+
66540
+ // Constantly update baseline if we see a larger height (e.g., URL bar hides)
66541
+ if (vpH > baselineHeight) {
66542
+ baselineHeight = vpH;
66543
+ }
66544
+
66545
+ const isNowOpen = vpH < baselineHeight - 100;
66520
66546
 
66521
66547
  if (isNowOpen) {
66522
66548
  const wasAlreadyOpen = isKeyboardOpen;
@@ -66555,7 +66581,7 @@ function centerActiveElement() {
66555
66581
  if (!wrapper) return;
66556
66582
 
66557
66583
  const vpH = window.visualViewport ? window.visualViewport.height : window.innerHeight;
66558
-
66584
+
66559
66585
  // Calculate absolute offset of element relative to wrapper
66560
66586
  let offsetTop = 0;
66561
66587
  let curr = activeElement;
@@ -66570,7 +66596,7 @@ function centerActiveElement() {
66570
66596
 
66571
66597
  // targetScroll = (distance from top) - (half of available space) + (half of element height)
66572
66598
  const targetScroll = offsetTop - (vpH / 2) + (elementHeight / 2);
66573
-
66599
+
66574
66600
  // Apply instantly but accurately
66575
66601
  if (Math.abs(wrapper.scrollTop - targetScroll) > 5) {
66576
66602
  wrapper.scrollTop = targetScroll;
@@ -68561,7 +68587,7 @@ window.deleteAppDocument = async function(id) {
68561
68587
  window.getAllDocuments = getAllDocuments;
68562
68588
  window.hasDocuments = hasDocuments;
68563
68589
  function getBuildVersion() {
68564
- return "1.0.30";
68590
+ return "1.0.33";
68565
68591
  }
68566
68592
  export {
68567
68593
  getBuildVersion,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unvired/turboforms-embed-sdk",
3
- "version": "1.0.30",
3
+ "version": "1.0.33",
4
4
  "description": "Reusable vanilla JS form library that works with React, Angular, Ionic, etc.",
5
5
  "main": "dist/unvired-forms-sdk.js",
6
6
  "types": "dist/index.d.ts",