@necto-react/helpers 2.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Necto
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/index.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";var s=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var y=(t,n)=>{for(var e in n)s(t,e,{get:n[e],enumerable:!0})},p=(t,n,e,a)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of f(n))!m.call(t,o)&&o!==e&&s(t,o,{get:()=>n[o],enumerable:!(a=u(n,o))||a.enumerable});return t};var T=t=>p(s({},"__esModule",{value:!0}),t);var M={};y(M,{isKeyboardFocusEvent:()=>w});module.exports=T(M);var i=require("@necto/dom"),b=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]),v={Tab:!0,Escape:!0};function w(t,n,e){if(!e||!("target"in e)||!e.target)return!1;let a=(0,i.getOwnerDocument)(e.target),o=(0,i.getOwnerWindow)(e.target),E=typeof window<"u"?o.HTMLInputElement:HTMLInputElement,l=typeof window<"u"?o.HTMLTextAreaElement:HTMLTextAreaElement,d=typeof window<"u"?o.HTMLElement:HTMLElement,c=typeof window<"u"?o.KeyboardEvent:KeyboardEvent,r=a.activeElement;return t=t||r instanceof E&&!b.has(r.type)||r instanceof l||r instanceof d&&r.isContentEditable,!(t&&n==="keyboard"&&e instanceof c&&!v[e.key])}0&&(module.exports={isKeyboardFocusEvent});
@@ -0,0 +1,5 @@
1
+ type Modality = 'keyboard' | 'pointer' | 'virtual';
2
+ type HandlerEvent = PointerEvent | MouseEvent | KeyboardEvent | FocusEvent | null;
3
+ declare function isKeyboardFocusEvent(isTextInput: boolean, modality: Modality, e: HandlerEvent): boolean;
4
+
5
+ export { type HandlerEvent, type Modality, isKeyboardFocusEvent };
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Copyright (c) Corinvo, LLC. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * Portions of this code are based on the React Aria Spectrum library by Adobe,
8
+ * licensed under the Apache License, Version 2.0.
9
+ * See: https://github.com/adobe/react-spectrum
10
+ *
11
+ * Modifications have been made to adapt the code for use in this project.
12
+ */
13
+ declare function isVirtualClick(event: MouseEvent | PointerEvent): boolean;
14
+
15
+ /**
16
+ * Copyright (c) Corinvo, LLC. and affiliates.
17
+ *
18
+ * This source code is licensed under the MIT license found in the
19
+ * LICENSE file in the root directory of this source tree.
20
+ *
21
+ * Portions of this code are based on the React Aria Spectrum library by Adobe,
22
+ * licensed under the Apache License, Version 2.0.
23
+ * See: https://github.com/adobe/react-spectrum
24
+ *
25
+ * Modifications have been made to adapt the code for use in this project.
26
+ */
27
+ type Modality = 'keyboard' | 'pointer' | 'virtual';
28
+ type HandlerEvent = PointerEvent | MouseEvent | KeyboardEvent | FocusEvent | null;
29
+ declare function isKeyboardFocusEvent(isTextInput: boolean, modality: Modality, e: HandlerEvent): boolean;
30
+
31
+ export { type HandlerEvent, type Modality, isKeyboardFocusEvent, isVirtualClick };
@@ -0,0 +1 @@
1
+ "use strict";(()=>{function w(t){return typeof window>"u"||window.navigator==null?!1:window.navigator.userAgentData?.brands.some(r=>t.test(r.brand))||t.test(window.navigator.userAgent)}var i=function(){return w(/Android/i)};function g(t){return t.mozInputSource===0&&t.isTrusted?!0:i()&&t.pointerType?t.type==="click"&&t.buttons===1:t.detail===0&&!t.pointerType}var a=t=>t?.ownerDocument??document,s=t=>t&&"window"in t&&t.window===t?t:a(t).defaultView||window;var E=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]),p={Tab:!0,Escape:!0};function M(t,r,e){if(!e||!("target"in e)||!e.target)return!1;let u=a(e.target),o=s(e.target),d=typeof window<"u"?o.HTMLInputElement:HTMLInputElement,c=typeof window<"u"?o.HTMLTextAreaElement:HTMLTextAreaElement,l=typeof window<"u"?o.HTMLElement:HTMLElement,f=typeof window<"u"?o.KeyboardEvent:KeyboardEvent,n=u.activeElement;return t=t||n instanceof d&&!E.has(n.type)||n instanceof c||n instanceof l&&n.isContentEditable,!(t&&r==="keyboard"&&e instanceof f&&!p[e.key])}})();
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ import{isAndroid as E}from"@necto/platform";function y(e){return e.mozInputSource===0&&e.isTrusted?!0:E()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}import{getOwnerDocument as d,getOwnerWindow as c}from"@necto/dom";var p=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]),f={Tab:!0,Escape:!0};function M(e,r,t){if(!t||!("target"in t)||!t.target)return!1;let a=d(t.target),o=c(t.target),i=typeof window<"u"?o.HTMLInputElement:HTMLInputElement,s=typeof window<"u"?o.HTMLTextAreaElement:HTMLTextAreaElement,l=typeof window<"u"?o.HTMLElement:HTMLElement,u=typeof window<"u"?o.KeyboardEvent:KeyboardEvent,n=a.activeElement;return e=e||n instanceof i&&!p.has(n.type)||n instanceof s||n instanceof l&&n.isContentEditable,!(e&&r==="keyboard"&&t instanceof u&&!f[t.key])}export{M as isKeyboardFocusEvent,y as isVirtualClick};
package/package.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "@necto-react/helpers",
3
+ "version": "2.1.0",
4
+ "description": "Necto's library for providing global helpers React applications",
5
+ "type": "module",
6
+ "files": [
7
+ "dist",
8
+ "README.md"
9
+ ],
10
+ "types": "dist/index.d.ts",
11
+ "main": "./dist/index.cjs",
12
+ "module": "./dist/index.js",
13
+ "author": "Corinvo OSS Team",
14
+ "license": "MIT",
15
+ "devDependencies": {
16
+ "tsup": "^8.4.0"
17
+ },
18
+ "peerDependencies": {
19
+ "react": "^19.1.0",
20
+ "react-dom": "^19.1.0"
21
+ },
22
+ "dependencies": {
23
+ "@necto/platform": "1.1.0",
24
+ "@necto/dom": "1.1.0"
25
+ },
26
+ "scripts": {
27
+ "build": "tsup --minify"
28
+ }
29
+ }