native-fn 1.3.3 → 1.3.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/dist/native.cjs +17 -61
- package/dist/native.min.cjs +1 -1
- package/dist/native.min.mjs +1 -1
- package/dist/native.mjs +17 -61
- package/dist/native.umd.js +17 -61
- package/dist/native.umd.min.js +1 -1
- package/dist/plugin/dimension/index.cjs +16 -60
- package/dist/plugin/dimension/index.mjs +16 -60
- package/package.json +1 -1
|
@@ -727,26 +727,17 @@ function createVirtualKeyboardObserver() {
|
|
|
727
727
|
var onChangeSubscriptionManager = createSubscriptionManager(attachOnChange, detachOnChange);
|
|
728
728
|
var virtualKeyboard = globalThis.navigator.virtualKeyboard;
|
|
729
729
|
var pendingRaf = null;
|
|
730
|
-
var pendingStabilize = null;
|
|
731
|
-
var stableInnerHeight = globalThis.innerHeight;
|
|
732
|
-
var stableInnerWidth = globalThis.innerWidth;
|
|
733
730
|
function attachOnChange() {
|
|
734
731
|
EventListener.add(virtualKeyboard, { type: 'geometrychange', callback: onGeometryChange, options: { passive: true } });
|
|
735
|
-
EventListener.add(globalThis, { type: 'resize', callback: onResize, options: { passive: true } });
|
|
736
732
|
}
|
|
737
733
|
function detachOnChange() {
|
|
738
734
|
EventListener.remove(virtualKeyboard, { type: 'geometrychange', callback: onGeometryChange, options: { passive: true } });
|
|
739
|
-
EventListener.remove(globalThis, { type: 'resize', callback: onResize, options: { passive: true } });
|
|
740
735
|
if (pendingRaf !== null) {
|
|
741
736
|
globalThis.cancelAnimationFrame(pendingRaf);
|
|
742
737
|
pendingRaf = null;
|
|
743
738
|
}
|
|
744
|
-
if (pendingStabilize !== null) {
|
|
745
|
-
globalThis.clearTimeout(pendingStabilize);
|
|
746
|
-
pendingStabilize = null;
|
|
747
|
-
}
|
|
748
739
|
}
|
|
749
|
-
function
|
|
740
|
+
function onGeometryChange() {
|
|
750
741
|
if (pendingRaf !== null)
|
|
751
742
|
globalThis.cancelAnimationFrame(pendingRaf);
|
|
752
743
|
if (typeof globalThis.requestAnimationFrame === 'function') {
|
|
@@ -761,64 +752,29 @@ function createVirtualKeyboardObserver() {
|
|
|
761
752
|
});
|
|
762
753
|
}
|
|
763
754
|
}
|
|
764
|
-
function onGeometryChange() {
|
|
765
|
-
var rect = virtualKeyboard.boundingRect;
|
|
766
|
-
if (rect.height === 0) {
|
|
767
|
-
if (pendingStabilize !== null) {
|
|
768
|
-
globalThis.clearTimeout(pendingStabilize);
|
|
769
|
-
pendingStabilize = null;
|
|
770
|
-
}
|
|
771
|
-
emitAfterFrame();
|
|
772
|
-
return;
|
|
773
|
-
}
|
|
774
|
-
if (pendingStabilize !== null)
|
|
775
|
-
globalThis.clearTimeout(pendingStabilize);
|
|
776
|
-
pendingStabilize = globalThis.setTimeout(function () {
|
|
777
|
-
pendingStabilize = null;
|
|
778
|
-
emitAfterFrame();
|
|
779
|
-
}, 100);
|
|
780
|
-
}
|
|
781
|
-
function onResize() {
|
|
782
|
-
var rect = virtualKeyboard.boundingRect;
|
|
783
|
-
if (rect.height === 0) {
|
|
784
|
-
stableInnerHeight = globalThis.innerHeight;
|
|
785
|
-
stableInnerWidth = globalThis.innerWidth;
|
|
786
|
-
}
|
|
787
|
-
else {
|
|
788
|
-
var currentInnerHeight = globalThis.innerHeight;
|
|
789
|
-
if (rect.y + rect.height > currentInnerHeight)
|
|
790
|
-
stableInnerHeight = currentInnerHeight - rect.height;
|
|
791
|
-
else
|
|
792
|
-
stableInnerHeight = currentInnerHeight;
|
|
793
|
-
stableInnerWidth = globalThis.innerWidth;
|
|
794
|
-
}
|
|
795
|
-
}
|
|
796
755
|
function getValue() {
|
|
797
756
|
var rect = virtualKeyboard.boundingRect;
|
|
798
757
|
var width = rect.width;
|
|
799
758
|
var height = rect.height;
|
|
800
|
-
var top
|
|
801
|
-
var
|
|
802
|
-
var
|
|
803
|
-
var right
|
|
759
|
+
var top;
|
|
760
|
+
var left;
|
|
761
|
+
var bottom;
|
|
762
|
+
var right;
|
|
804
763
|
if (height === 0) {
|
|
805
|
-
|
|
806
|
-
|
|
764
|
+
top = 0;
|
|
765
|
+
bottom = 0;
|
|
807
766
|
}
|
|
808
767
|
else {
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
top = stableInnerHeight - height;
|
|
812
|
-
bottom = 0;
|
|
813
|
-
}
|
|
814
|
-
else {
|
|
815
|
-
top = rect.y;
|
|
816
|
-
bottom = Math.max(0, stableInnerHeight - (rect.y + height));
|
|
817
|
-
}
|
|
768
|
+
top = rect.y;
|
|
769
|
+
bottom = Math.max(0, globalThis.innerHeight - rect.y);
|
|
818
770
|
}
|
|
819
|
-
if (width
|
|
820
|
-
left =
|
|
821
|
-
right =
|
|
771
|
+
if (width === 0) {
|
|
772
|
+
left = 0;
|
|
773
|
+
right = 0;
|
|
774
|
+
}
|
|
775
|
+
else {
|
|
776
|
+
left = rect.x;
|
|
777
|
+
right = Math.max(0, globalThis.innerWidth - rect.x);
|
|
822
778
|
}
|
|
823
779
|
return {
|
|
824
780
|
top: top,
|
|
@@ -723,26 +723,17 @@ function createVirtualKeyboardObserver() {
|
|
|
723
723
|
var onChangeSubscriptionManager = createSubscriptionManager(attachOnChange, detachOnChange);
|
|
724
724
|
var virtualKeyboard = globalThis.navigator.virtualKeyboard;
|
|
725
725
|
var pendingRaf = null;
|
|
726
|
-
var pendingStabilize = null;
|
|
727
|
-
var stableInnerHeight = globalThis.innerHeight;
|
|
728
|
-
var stableInnerWidth = globalThis.innerWidth;
|
|
729
726
|
function attachOnChange() {
|
|
730
727
|
EventListener.add(virtualKeyboard, { type: 'geometrychange', callback: onGeometryChange, options: { passive: true } });
|
|
731
|
-
EventListener.add(globalThis, { type: 'resize', callback: onResize, options: { passive: true } });
|
|
732
728
|
}
|
|
733
729
|
function detachOnChange() {
|
|
734
730
|
EventListener.remove(virtualKeyboard, { type: 'geometrychange', callback: onGeometryChange, options: { passive: true } });
|
|
735
|
-
EventListener.remove(globalThis, { type: 'resize', callback: onResize, options: { passive: true } });
|
|
736
731
|
if (pendingRaf !== null) {
|
|
737
732
|
globalThis.cancelAnimationFrame(pendingRaf);
|
|
738
733
|
pendingRaf = null;
|
|
739
734
|
}
|
|
740
|
-
if (pendingStabilize !== null) {
|
|
741
|
-
globalThis.clearTimeout(pendingStabilize);
|
|
742
|
-
pendingStabilize = null;
|
|
743
|
-
}
|
|
744
735
|
}
|
|
745
|
-
function
|
|
736
|
+
function onGeometryChange() {
|
|
746
737
|
if (pendingRaf !== null)
|
|
747
738
|
globalThis.cancelAnimationFrame(pendingRaf);
|
|
748
739
|
if (typeof globalThis.requestAnimationFrame === 'function') {
|
|
@@ -757,64 +748,29 @@ function createVirtualKeyboardObserver() {
|
|
|
757
748
|
});
|
|
758
749
|
}
|
|
759
750
|
}
|
|
760
|
-
function onGeometryChange() {
|
|
761
|
-
var rect = virtualKeyboard.boundingRect;
|
|
762
|
-
if (rect.height === 0) {
|
|
763
|
-
if (pendingStabilize !== null) {
|
|
764
|
-
globalThis.clearTimeout(pendingStabilize);
|
|
765
|
-
pendingStabilize = null;
|
|
766
|
-
}
|
|
767
|
-
emitAfterFrame();
|
|
768
|
-
return;
|
|
769
|
-
}
|
|
770
|
-
if (pendingStabilize !== null)
|
|
771
|
-
globalThis.clearTimeout(pendingStabilize);
|
|
772
|
-
pendingStabilize = globalThis.setTimeout(function () {
|
|
773
|
-
pendingStabilize = null;
|
|
774
|
-
emitAfterFrame();
|
|
775
|
-
}, 100);
|
|
776
|
-
}
|
|
777
|
-
function onResize() {
|
|
778
|
-
var rect = virtualKeyboard.boundingRect;
|
|
779
|
-
if (rect.height === 0) {
|
|
780
|
-
stableInnerHeight = globalThis.innerHeight;
|
|
781
|
-
stableInnerWidth = globalThis.innerWidth;
|
|
782
|
-
}
|
|
783
|
-
else {
|
|
784
|
-
var currentInnerHeight = globalThis.innerHeight;
|
|
785
|
-
if (rect.y + rect.height > currentInnerHeight)
|
|
786
|
-
stableInnerHeight = currentInnerHeight - rect.height;
|
|
787
|
-
else
|
|
788
|
-
stableInnerHeight = currentInnerHeight;
|
|
789
|
-
stableInnerWidth = globalThis.innerWidth;
|
|
790
|
-
}
|
|
791
|
-
}
|
|
792
751
|
function getValue() {
|
|
793
752
|
var rect = virtualKeyboard.boundingRect;
|
|
794
753
|
var width = rect.width;
|
|
795
754
|
var height = rect.height;
|
|
796
|
-
var top
|
|
797
|
-
var
|
|
798
|
-
var
|
|
799
|
-
var right
|
|
755
|
+
var top;
|
|
756
|
+
var left;
|
|
757
|
+
var bottom;
|
|
758
|
+
var right;
|
|
800
759
|
if (height === 0) {
|
|
801
|
-
|
|
802
|
-
|
|
760
|
+
top = 0;
|
|
761
|
+
bottom = 0;
|
|
803
762
|
}
|
|
804
763
|
else {
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
top = stableInnerHeight - height;
|
|
808
|
-
bottom = 0;
|
|
809
|
-
}
|
|
810
|
-
else {
|
|
811
|
-
top = rect.y;
|
|
812
|
-
bottom = Math.max(0, stableInnerHeight - (rect.y + height));
|
|
813
|
-
}
|
|
764
|
+
top = rect.y;
|
|
765
|
+
bottom = Math.max(0, globalThis.innerHeight - rect.y);
|
|
814
766
|
}
|
|
815
|
-
if (width
|
|
816
|
-
left =
|
|
817
|
-
right =
|
|
767
|
+
if (width === 0) {
|
|
768
|
+
left = 0;
|
|
769
|
+
right = 0;
|
|
770
|
+
}
|
|
771
|
+
else {
|
|
772
|
+
left = rect.x;
|
|
773
|
+
right = Math.max(0, globalThis.innerWidth - rect.x);
|
|
818
774
|
}
|
|
819
775
|
return {
|
|
820
776
|
top: top,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "native-fn",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.4",
|
|
4
4
|
"description": "TypeScript library bridging Web APIs to native device capabilities — Picture-in-Picture, Fullscreen, Clipboard, Geolocation, Battery, Notifications, Vibration, Platform detection, and more.",
|
|
5
5
|
"author": "Park Jungyoung <qkrwnss0509@gmail.com> (https://github.com/pjy0509)",
|
|
6
6
|
"type": "module",
|