@nosto/search-js 2.4.0 → 2.5.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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../isEqual-DQXR__da.cjs"),e=require("../unique-BCAEb4ek.cjs"),i=require("../logger-DbHGgDgO.cjs"),u=require("../parseNumber-FsZ8w61u.cjs"),s=require("../pick-rYi1lc2m.cjs");exports.deepMerge=r.deepMerge;exports.isEqual=r.isEqual;exports.isPlainObject=r.isPlainObject;exports.isBot=e.isBot;exports.measure=e.measure;exports.mergeArrays=e.mergeArrays;exports.unique=e.unique;exports.logger=i.logger;exports.parseNumber=u.parseNumber;exports.pick=s.pick;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("../isEqual-DQXR__da.cjs"),c=require("../unique-BCAEb4ek.cjs"),q=require("../logger-DbHGgDgO.cjs"),b=require("../parseNumber-FsZ8w61u.cjs"),k=require("../pick-rYi1lc2m.cjs");function n(i){i.setAttribute("autocomplete","off")}function E(i,{onClick:f,onFocus:t,onInput:d,onKeyDown:s,onSubmit:u},{form:a=i.form??void 0}={}){const o=[];function r(e,l,v){e.addEventListener(l,v),o.push(()=>e.removeEventListener(l,v))}return(s||u)&&r(i,"keydown",e=>{s==null||s(i.value,e.key),s&&(e.key==="ArrowDown"||e.key==="ArrowUp")?e.preventDefault():u&&e.key==="Enter"&&(i.value!==""&&!e.repeat&&u(i.value),e.preventDefault())}),u&&a&&(r(a,"submit",e=>{e.preventDefault(),u(i.value)}),a.querySelectorAll("[type=submit]").forEach(e=>{r(e,"click",l=>{l.preventDefault(),u(i.value)})})),f&&r(i,"click",()=>f(i.value)),t&&r(i,"focus",()=>t(i.value)),d&&r(i,"input",()=>d(i.value)),{destroy(){o.forEach(e=>e())}}}exports.deepMerge=p.deepMerge;exports.isEqual=p.isEqual;exports.isPlainObject=p.isPlainObject;exports.isBot=c.isBot;exports.measure=c.measure;exports.mergeArrays=c.mergeArrays;exports.unique=c.unique;exports.logger=q.logger;exports.parseNumber=b.parseNumber;exports.pick=k.pick;exports.bindInput=E;exports.disableNativeAutocomplete=n;
@@ -1,4 +1,5 @@
1
1
  /** @module utils */
2
+ export { bindInput, disableNativeAutocomplete, type InputBindingCallbacks } from './src/bindInput';
2
3
  export { deepMerge, type MergeTests } from './src/deepMerge';
3
4
  export { isBot } from './src/isBot';
4
5
  export { isEqual } from './src/isEqual';
@@ -1,17 +1,41 @@
1
- import { d as a, i as s, a as o } from "../isEqual-BzZ3d1JM.js";
2
- import { i as m, a as i, m as t, u } from "../unique-CyAMhegX.js";
3
- import { l as x } from "../logger-DW5RVLX8.js";
4
- import { p as l } from "../parseNumber-QA48nJLp.js";
5
- import { p as c } from "../pick-DReBictn.js";
1
+ import { d as t, i as x, a as A } from "../isEqual-BzZ3d1JM.js";
2
+ import { i as q, a as y, m as L, u as h } from "../unique-CyAMhegX.js";
3
+ import { l as j } from "../logger-DW5RVLX8.js";
4
+ import { p as M } from "../parseNumber-QA48nJLp.js";
5
+ import { p as P } from "../pick-DReBictn.js";
6
+ function d(s) {
7
+ s.setAttribute("autocomplete", "off");
8
+ }
9
+ function m(s, { onClick: l, onFocus: p, onInput: c, onKeyDown: u, onSubmit: i }, { form: a = s.form ?? void 0 } = {}) {
10
+ const o = [];
11
+ function r(e, f, v) {
12
+ e.addEventListener(f, v), o.push(() => e.removeEventListener(f, v));
13
+ }
14
+ return (u || i) && r(s, "keydown", (e) => {
15
+ u == null || u(s.value, e.key), u && (e.key === "ArrowDown" || e.key === "ArrowUp") ? e.preventDefault() : i && e.key === "Enter" && (s.value !== "" && !e.repeat && i(s.value), e.preventDefault());
16
+ }), i && a && (r(a, "submit", (e) => {
17
+ e.preventDefault(), i(s.value);
18
+ }), a.querySelectorAll("[type=submit]").forEach((e) => {
19
+ r(e, "click", (f) => {
20
+ f.preventDefault(), i(s.value);
21
+ });
22
+ })), l && r(s, "click", () => l(s.value)), p && r(s, "focus", () => p(s.value)), c && r(s, "input", () => c(s.value)), {
23
+ destroy() {
24
+ o.forEach((e) => e());
25
+ }
26
+ };
27
+ }
6
28
  export {
7
- a as deepMerge,
8
- m as isBot,
9
- s as isEqual,
10
- o as isPlainObject,
11
- x as logger,
12
- i as measure,
13
- t as mergeArrays,
14
- l as parseNumber,
15
- c as pick,
16
- u as unique
29
+ m as bindInput,
30
+ t as deepMerge,
31
+ d as disableNativeAutocomplete,
32
+ q as isBot,
33
+ x as isEqual,
34
+ A as isPlainObject,
35
+ j as logger,
36
+ y as measure,
37
+ L as mergeArrays,
38
+ M as parseNumber,
39
+ P as pick,
40
+ h as unique
17
41
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nosto/search-js",
3
- "version": "2.4.0",
3
+ "version": "2.5.0",
4
4
  "license": "ISC",
5
5
  "type": "module",
6
6
  "files": [
@@ -90,10 +90,10 @@
90
90
  "@types/node": "^22.15.3",
91
91
  "concurrently": "^9.1.2",
92
92
  "copyfiles": "^2.4.1",
93
- "eslint": "^9.25.1",
93
+ "eslint": "^9.26.0",
94
94
  "eslint-config-prettier": "^10.1.2",
95
95
  "eslint-plugin-barrel-files": "^3.0.1",
96
- "eslint-plugin-prettier": "^5.2.6",
96
+ "eslint-plugin-prettier": "^5.4.0",
97
97
  "eslint-plugin-react": "^7.37.5",
98
98
  "eslint-plugin-react-hooks": "^5.2.0",
99
99
  "eslint-plugin-simple-import-sort": "^12.1.1",
@@ -102,12 +102,12 @@
102
102
  "isbot": "^5.1.27",
103
103
  "jsdom": "^26.1.0",
104
104
  "prettier": "^3.5.3",
105
- "typedoc": "^0.28.3",
105
+ "typedoc": "^0.28.4",
106
106
  "typescript": "^5.8.3",
107
- "typescript-eslint": "^8.31.0",
108
- "vite": "^6.3.3",
107
+ "typescript-eslint": "^8.31.1",
108
+ "vite": "^6.3.5",
109
109
  "vite-plugin-dts": "^4.5.3",
110
- "vitest": "^3.1.2",
110
+ "vitest": "^3.1.3",
111
111
  "@commitlint/cli": "^19.8.0",
112
112
  "@commitlint/config-conventional": "^19.8.0"
113
113
  },