New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

searchmate-js

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

searchmate-js - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

146

dist/index.js

@@ -1,2 +0,2 @@

const R = "https://search-worker.searchmateapp.workers.dev/v1", q = "heading", k = ".searchmate-result-part", v = "searchmate-result-selected", B = `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor" class="searchmate-search-icon">
const R = "https://search-worker.searchmateapp.workers.dev/v1", q = "heading", x = ".searchmate-result-part", g = "searchmate-result-selected", B = `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor" class="searchmate-search-icon">
<path strokeLinecap="round" class strokeLinejoin="round" d="M21 21l-5.197-5.197m0 0A7.5 7.5 0 105.196 5.196a7.5 7.5 0 0010.607 10.607z" />

@@ -25,3 +25,3 @@ </svg>

`;
function L(n, t, r) {
function k(n, t, r) {
const e = document.createElement(n);

@@ -34,3 +34,3 @@ return r.forEach((o) => e.classList.add(o)), t.appendChild(e), e;

}
function Y(n, t) {
function K(n, t) {
const r = d("a", [

@@ -46,3 +46,3 @@ "searchmate-result-part",

}
function j(n, t, r, e) {
function Y(n, t, r, e) {
const o = d("a", [

@@ -56,3 +56,3 @@ "searchmate-result-part",

}
function K(n) {
function j(n) {
const t = d("div", [

@@ -65,6 +65,6 @@ "searchmate-result-other",

function W(n, t) {
const r = d("div", ["searchmate-result"]), e = Y(n.path, t);
const r = d("div", ["searchmate-result"]), e = K(n.path, t);
return r.appendChild(e), n.content.forEach((i) => {
if (i.type === q) {
const c = j(
const c = Y(
i.content,

@@ -79,3 +79,3 @@ n.path,

return;
const c = K(i.content);
const c = j(i.content);
e.appendChild(c);

@@ -85,5 +85,5 @@ }

}
function y(n, t) {
const e = t.querySelectorAll(k)[n];
return e ? (e.classList.add(v), e.scrollIntoView({
function S(n, t) {
const e = t.querySelectorAll(x)[n];
return e ? (e.classList.add(g), e.scrollIntoView({
behavior: "smooth",

@@ -94,11 +94,11 @@ block: "center"

function A(n, t) {
const e = t.querySelectorAll(k)[n];
e && e.classList.remove(v);
const e = t.querySelectorAll(x)[n];
e && e.classList.remove(g);
}
function z(n, t) {
const r = n.clientX, e = n.clientY, o = t.querySelectorAll(k);
const r = n.clientX, e = n.clientY, o = t.querySelectorAll(x);
let i = -1;
for (let c = 0; c < o.length; c++) {
const u = o[c], { top: h, bottom: f, left: s, right: m } = u.getBoundingClientRect();
e >= h && e <= f && r >= s && r <= m ? (i = c, u.classList.add(v)) : o[c].classList.remove(v);
const h = o[c], { top: u, bottom: f, left: s, right: w } = h.getBoundingClientRect();
e >= u && e <= f && r >= s && r <= w ? (i = c, h.classList.add(g)) : o[c].classList.remove(g);
}

@@ -108,7 +108,7 @@ return i;

function X(n, t) {
const r = n.touches[0].clientX, e = n.touches[0].clientY, o = t.querySelectorAll(k);
const r = n.touches[0].clientX, e = n.touches[0].clientY, o = t.querySelectorAll(x);
let i = -1;
for (let c = 0; c < o.length; c++) {
const u = o[c], { top: h, bottom: f, left: s, right: m } = u.getBoundingClientRect();
e >= h && e <= f && r >= s && r <= m ? (i = c, u.classList.add(v)) : o[c].classList.remove(v);
const h = o[c], { top: u, bottom: f, left: s, right: w } = h.getBoundingClientRect();
e >= u && e <= f && r >= s && r <= w ? (i = c, h.classList.add(g)) : o[c].classList.remove(g);
}

@@ -142,14 +142,14 @@ return i;

}, c = function() {
var h = o;
i(), h && h();
}, u = function() {
var u = o;
i(), u && u();
}, h = function() {
if (!t)
return n.apply(this, arguments);
var h = this, f = arguments, s = r && !e;
var u = this, f = arguments, s = r && !e;
if (i(), o = function() {
n.apply(h, f);
n.apply(u, f);
}, e = setTimeout(function() {
if (e = null, !s) {
var m = o;
return o = null, m();
var w = o;
return o = null, w();
}

@@ -159,3 +159,3 @@ }, t), s)

};
return u.cancel = i, u.flush = c, u;
return h.cancel = i, h.flush = c, h;
}

@@ -171,20 +171,20 @@ function J({

return;
const c = L("div", o, [
const c = k("div", o, [
"searchmate-container"
]);
c.id = "searchmate-docs-search";
const u = L("div", c, [
const h = k("div", c, [
"searchmate-search-container"
]), h = L("div", u, [
]), u = k("div", h, [
"searchmate-input-container"
]);
h.innerHTML += B;
const f = L("input", h, [
u.innerHTML += B;
const f = k("input", u, [
"searchmate-search-input"
]);
f.setAttribute("placeholder", "Type to search...");
const s = L("div", u, [
const s = k("div", h, [
"searchmate-results-container"
]), m = Q();
u.appendChild(m);
]), w = Q();
h.appendChild(w);
const H = O();

@@ -196,25 +196,33 @@ s.appendChild(H);

return;
const x = new URL(R);
x.searchParams.set("query", a), x.searchParams.set("appId", l), fetch(x).then(async (g) => {
const C = await g.json();
if (!g.ok)
throw new Error(C.error);
return C;
}).then((g) => {
const y = new URL(R);
y.searchParams.set("query", a), y.searchParams.set("appId", l), fetch(y).then(async (C) => {
const L = await C.json();
if (!C.ok)
throw new Error(L.error);
return L;
}).then((C) => {
s.innerHTML = "", p = 0;
const C = g.results;
if (C.length <= 0) {
const w = G(a);
s.appendChild(w);
const L = C.results;
if (L.length <= 0) {
const v = G(a);
s.appendChild(v);
return;
}
C.forEach((w) => {
const E = W(w, t);
L.forEach((v) => {
const E = W(v, t);
s.appendChild(E);
}), y(p, s), e && s.querySelectorAll("a").forEach((w) => {
w.addEventListener("click", (E) => {
E.preventDefault(), e(w.href, E.ctrlKey);
}), S(p, s), s.querySelectorAll("a").forEach((v) => {
v.addEventListener("click", (E) => {
if (E.preventDefault(), e)
e(v.href, E.ctrlKey), m();
else {
if (E.ctrlKey) {
window.open(v.href, "_blank"), m();
return;
}
location.href = v.href, m();
}
});
});
}).catch((g) => {
}).catch((C) => {
});

@@ -227,6 +235,6 @@ }

});
function S(a) {
function M(a) {
if (a.key === "ArrowDown") {
a.preventDefault();
const { end: l } = y(
const { end: l } = S(
p + 1,

@@ -240,3 +248,3 @@ s

return;
A(p, s), p -= 1, y(p, s);
A(p, s), p -= 1, S(p, s);
}

@@ -246,3 +254,3 @@ if (a.key === "Enter") {

const l = s.querySelector(
`.${v}`
`.${g}`
);

@@ -252,9 +260,9 @@ if (!l)

if (e)
e(l.href, a.ctrlKey);
e(l.href, a.ctrlKey), m();
else {
if (a.ctrlKey) {
window.open(l.href, "_blank");
window.open(l.href, "_blank"), m();
return;
}
l.click();
l.click(), m();
}

@@ -264,24 +272,24 @@ }

f.addEventListener("focus", () => {
document.addEventListener("keydown", S);
document.addEventListener("keydown", M);
}), f.addEventListener("blur", () => {
document.removeEventListener("keydown", S);
document.removeEventListener("keydown", M);
});
function M(a) {
function b(a) {
const l = z(a, s);
l >= 0 && (p = l);
}
s.addEventListener("mousemove", M);
function b(a) {
s.addEventListener("mousemove", b);
function I(a) {
const l = X(a, s);
l >= 0 && (p = l);
}
"ontouchstart" in window && s.addEventListener("touchstart", b);
function I() {
s.removeEventListener("mousemove", M), "ontouchstart" in window && s.removeEventListener("touchstart", b), c.remove(), r && r();
"ontouchstart" in window && s.addEventListener("touchstart", I);
function m() {
s.removeEventListener("mousemove", b), "ontouchstart" in window && s.removeEventListener("touchstart", I), c.remove(), r && r();
}
const T = (a) => {
a.key === "Escape" && (I(), document.removeEventListener("keydown", T));
a.key === "Escape" && (m(), document.removeEventListener("keydown", T));
};
document.addEventListener("keydown", T), c.addEventListener("click", (a) => {
a.target === c && I();
a.target === c && m();
}), f.focus();

@@ -288,0 +296,0 @@ }

{
"name": "searchmate-js",
"private": false,
"version": "2.0.0",
"version": "2.1.0",
"type": "module",

@@ -6,0 +6,0 @@ "files": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc