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

searchmate-react

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-react - npm Package Compare versions

Comparing version 1.8.0 to 1.9.0

14

dist/searchmate-react.es.js

@@ -87,3 +87,3 @@ import { useEffect as A, useState as q } from "react";

}
function b(t, e) {
function H(t, e) {
const n = e.querySelectorAll(C)[t];

@@ -215,3 +215,3 @@ n && n.classList.remove(m);

);
d || (b(i, c), i += 1);
d || (H(i, c), i += 1);
}

@@ -221,3 +221,3 @@ if (a.key === "ArrowUp") {

return;
b(i, c), i -= 1, y(i, c);
H(i, c), i -= 1, y(i, c);
}

@@ -253,9 +253,9 @@ if (a.key === "Enter") {

"ontouchstart" in window && c.addEventListener("touchstart", M);
function H() {
function b() {
c.removeEventListener("mousemove", x), "ontouchstart" in window && c.removeEventListener("touchstart", M), o.remove(), n && n();
}
s.addEventListener("keydown", (a) => {
a.key === "Escape" && H();
a.key === "Escape" && b();
}), o.addEventListener("click", (a) => {
a.target === o && H();
a.target === o && b();
}), u.focus();

@@ -293,3 +293,3 @@ }

};
}, [t, e, n, r]);
}, [r]);
}

@@ -296,0 +296,0 @@ export {

@@ -24,2 +24,2 @@ (function(f,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],m):(f=typeof globalThis<"u"?globalThis:f||self,m(f["searchmate-react"]={},f.React))})(this,function(f,m){"use strict";const A="https://search-worker.searchmateapp.workers.dev/v1",$="heading",L=".searchmate-result-part",v="searchmate-result-selected",q=`<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor" class="searchmate-search-icon">

</svg>
`;function g(t,e,n){const r=document.createElement(t);return n.forEach(o=>r.classList.add(o)),e.appendChild(r),r}function h(t,e){const n=document.createElement(t);return e&&e.forEach(r=>n.classList.add(r)),n}function P(t,e){const n=h("a",["searchmate-result-part","searchmate-result-path"]),r=h("p",["searchmate-result-path-header"]);r.innerHTML+=j;const o=h("span");o.textContent=`/${t}`,r.appendChild(o),n.appendChild(r);const s=e?`${e}/${t}`:`/${t}`;return n.setAttribute("href",s),n}function _(t,e,n,r){const o=h("a",["searchmate-result-part","searchmate-result-heading"]);o.innerHTML+=B,o.innerHTML+=t;const s=r?`${r}/${e}`:`/${e}`;return o.setAttribute("href",`${s}#${n}`),o}function z(t){const e=h("div",["searchmate-result-other","markdown-body"]);return e.innerHTML+=t,e}function R(t,e){const n=h("div",["searchmate-result"]),r=P(t.path,e);return n.appendChild(r),t.content.forEach(o=>{if(o.type===$){const s=_(o.content,t.path,o.headingId,e);n.appendChild(s)}else{if(o.type==="yaml")return;const s=z(o.content);r.appendChild(s)}}),n}function k(t,e){const n=e.querySelectorAll(L)[t];return n?(n.classList.add(v),n.scrollIntoView({behavior:"smooth",block:"center"}),{end:!1}):{end:!0}}function M(t,e){const n=e.querySelectorAll(L)[t];n&&n.classList.remove(v)}function K(t,e){const n=t.clientX,r=t.clientY,o=e.querySelectorAll(L);let s=-1;for(let l=0;l<o.length;l++){const u=o[l],{top:c,bottom:w,left:p,right:a}=u.getBoundingClientRect();r>=c&&r<=w&&n>=p&&n<=a?(s=l,u.classList.add(v)):o[l].classList.remove(v)}return s}function O(t,e){const n=t.touches[0].clientX,r=t.touches[0].clientY,o=e.querySelectorAll(L);let s=-1;for(let l=0;l<o.length;l++){const u=o[l],{top:c,bottom:w,left:p,right:a}=u.getBoundingClientRect();r>=c&&r<=w&&n>=p&&n<=a?(s=l,u.classList.add(v)):o[l].classList.remove(v)}return s}function U(t){const e=h("div",["searchmate-not-found"]);e.innerHTML+=D;const n=h("p",["searchmate-not-found-text"]);n.textContent="No results found for ";const r=h("span",["searchmate-not-found-query"]);return r.textContent=`"${t}"`,n.appendChild(r),e.appendChild(n),e}function W(){const t=h("div",["searchmate-initial-content"]),e=h("p",["searchmate-initial-content-text"]);return e.textContent="What are you looking for?",t.appendChild(e),t}function X(){const t=h("div",["searchmate-footer"]),e=h("p",["searchmate-footer-text"]);e.textContent="Powered by ";const n=h("a",["searchmate-footer-link"]);return n.textContent="Search Mate",n.setAttribute("href","https://searchmate.app"),e.appendChild(n),t.appendChild(e),t.innerHTML+=I,t}var Y=F;function F(t,e,n){var r=null,o=null,s=function(){r&&(clearTimeout(r),o=null,r=null)},l=function(){var c=o;s(),c&&c()},u=function(){if(!e)return t.apply(this,arguments);var c=this,w=arguments,p=n&&!r;if(s(),o=function(){t.apply(c,w)},r=setTimeout(function(){if(r=null,!p){var a=o;return o=null,a()}},e),p)return o()};return u.cancel=s,u.flush=l,u}function N({appId:t,urlPrefix:e=void 0,onClose:n=void 0}){const r=document.body,o=g("div",r,["searchmate-container"]);o.id="searchmate-docs-search";const s=g("div",o,["searchmate-search-container"]),l=g("div",s,["searchmate-input-container"]);l.innerHTML+=q;const u=g("input",l,["searchmate-search-input"]);u.setAttribute("placeholder","Type to search...");const c=g("div",s,["searchmate-results-container"]),w=X();s.appendChild(w);const p=W();c.appendChild(p);let a=0;function J({query:i,appId:d}){if(i.length<=0)return;const E=new URL(A);E.searchParams.set("query",i),E.searchParams.set("appId",d),fetch(E).then(async y=>{const C=await y.json();if(!y.ok)throw new Error(C.error);return C}).then(y=>{c.innerHTML="",a=0;const C=y.results;if(C.length<=0){const x=U(i);c.appendChild(x);return}C.forEach(x=>{const ee=R(x,e);c.appendChild(ee)}),k(a,c)}).catch(y=>{})}const Q=Y(J,300);u.addEventListener("input",i=>{const d=i.target;Q({appId:t,query:d.value})});function S(i){if(i.key==="ArrowDown"){i.preventDefault();const{end:d}=k(a+1,c);d||(M(a,c),a+=1)}if(i.key==="ArrowUp"){if(i.preventDefault(),a<=0)return;M(a,c),a-=1,k(a,c)}if(i.key==="Enter"){i.preventDefault();const d=c.querySelector(`.${v}`);if(d){if(i.ctrlKey){window.open(d.href,"_blank");return}d.click()}}}u.addEventListener("focus",()=>{document.addEventListener("keydown",S)}),u.addEventListener("blur",()=>{document.removeEventListener("keydown",S)});function T(i){const d=K(i,c);d>=0&&(a=d)}c.addEventListener("mousemove",T);function b(i){const d=O(i,c);d>=0&&(a=d)}"ontouchstart"in window&&c.addEventListener("touchstart",b);function H(){c.removeEventListener("mousemove",T),"ontouchstart"in window&&c.removeEventListener("touchstart",b),o.remove(),n&&n()}s.addEventListener("keydown",i=>{i.key==="Escape"&&H()}),o.addEventListener("click",i=>{i.target===o&&H()}),u.focus()}const te="";function G({appId:t,isOpen:e,urlPrefix:n,onClose:r}){return m.useEffect(()=>{e&&N({appId:t,urlPrefix:n,onClose:r})},[e,t,n]),null}function V(){const[t,e]=m.useState(!1);return{isOpen:t,onOpen:()=>{e(!0)},onClose:()=>{e(!1)}}}function Z({callback:t,key:e,withCtrl:n=!1,isOpen:r}){m.useEffect(()=>{const o=s=>{r||s.key===e&&(n?(s.preventDefault(),s.ctrlKey&&t()):(s.preventDefault(),t()))};return document.addEventListener("keydown",o),()=>{document.removeEventListener("keydown",o)}},[t,e,n,r])}f.Search=G,f.useSearch=V,f.useShortcut=Z,Object.defineProperty(f,Symbol.toStringTag,{value:"Module"})});
`;function g(t,e,n){const r=document.createElement(t);return n.forEach(o=>r.classList.add(o)),e.appendChild(r),r}function h(t,e){const n=document.createElement(t);return e&&e.forEach(r=>n.classList.add(r)),n}function P(t,e){const n=h("a",["searchmate-result-part","searchmate-result-path"]),r=h("p",["searchmate-result-path-header"]);r.innerHTML+=j;const o=h("span");o.textContent=`/${t}`,r.appendChild(o),n.appendChild(r);const s=e?`${e}/${t}`:`/${t}`;return n.setAttribute("href",s),n}function _(t,e,n,r){const o=h("a",["searchmate-result-part","searchmate-result-heading"]);o.innerHTML+=B,o.innerHTML+=t;const s=r?`${r}/${e}`:`/${e}`;return o.setAttribute("href",`${s}#${n}`),o}function z(t){const e=h("div",["searchmate-result-other","markdown-body"]);return e.innerHTML+=t,e}function R(t,e){const n=h("div",["searchmate-result"]),r=P(t.path,e);return n.appendChild(r),t.content.forEach(o=>{if(o.type===$){const s=_(o.content,t.path,o.headingId,e);n.appendChild(s)}else{if(o.type==="yaml")return;const s=z(o.content);r.appendChild(s)}}),n}function k(t,e){const n=e.querySelectorAll(L)[t];return n?(n.classList.add(v),n.scrollIntoView({behavior:"smooth",block:"center"}),{end:!1}):{end:!0}}function M(t,e){const n=e.querySelectorAll(L)[t];n&&n.classList.remove(v)}function K(t,e){const n=t.clientX,r=t.clientY,o=e.querySelectorAll(L);let s=-1;for(let l=0;l<o.length;l++){const u=o[l],{top:c,bottom:w,left:p,right:a}=u.getBoundingClientRect();r>=c&&r<=w&&n>=p&&n<=a?(s=l,u.classList.add(v)):o[l].classList.remove(v)}return s}function O(t,e){const n=t.touches[0].clientX,r=t.touches[0].clientY,o=e.querySelectorAll(L);let s=-1;for(let l=0;l<o.length;l++){const u=o[l],{top:c,bottom:w,left:p,right:a}=u.getBoundingClientRect();r>=c&&r<=w&&n>=p&&n<=a?(s=l,u.classList.add(v)):o[l].classList.remove(v)}return s}function U(t){const e=h("div",["searchmate-not-found"]);e.innerHTML+=D;const n=h("p",["searchmate-not-found-text"]);n.textContent="No results found for ";const r=h("span",["searchmate-not-found-query"]);return r.textContent=`"${t}"`,n.appendChild(r),e.appendChild(n),e}function W(){const t=h("div",["searchmate-initial-content"]),e=h("p",["searchmate-initial-content-text"]);return e.textContent="What are you looking for?",t.appendChild(e),t}function X(){const t=h("div",["searchmate-footer"]),e=h("p",["searchmate-footer-text"]);e.textContent="Powered by ";const n=h("a",["searchmate-footer-link"]);return n.textContent="Search Mate",n.setAttribute("href","https://searchmate.app"),e.appendChild(n),t.appendChild(e),t.innerHTML+=I,t}var Y=F;function F(t,e,n){var r=null,o=null,s=function(){r&&(clearTimeout(r),o=null,r=null)},l=function(){var c=o;s(),c&&c()},u=function(){if(!e)return t.apply(this,arguments);var c=this,w=arguments,p=n&&!r;if(s(),o=function(){t.apply(c,w)},r=setTimeout(function(){if(r=null,!p){var a=o;return o=null,a()}},e),p)return o()};return u.cancel=s,u.flush=l,u}function N({appId:t,urlPrefix:e=void 0,onClose:n=void 0}){const r=document.body,o=g("div",r,["searchmate-container"]);o.id="searchmate-docs-search";const s=g("div",o,["searchmate-search-container"]),l=g("div",s,["searchmate-input-container"]);l.innerHTML+=q;const u=g("input",l,["searchmate-search-input"]);u.setAttribute("placeholder","Type to search...");const c=g("div",s,["searchmate-results-container"]),w=X();s.appendChild(w);const p=W();c.appendChild(p);let a=0;function J({query:i,appId:d}){if(i.length<=0)return;const E=new URL(A);E.searchParams.set("query",i),E.searchParams.set("appId",d),fetch(E).then(async y=>{const C=await y.json();if(!y.ok)throw new Error(C.error);return C}).then(y=>{c.innerHTML="",a=0;const C=y.results;if(C.length<=0){const x=U(i);c.appendChild(x);return}C.forEach(x=>{const ee=R(x,e);c.appendChild(ee)}),k(a,c)}).catch(y=>{})}const Q=Y(J,300);u.addEventListener("input",i=>{const d=i.target;Q({appId:t,query:d.value})});function S(i){if(i.key==="ArrowDown"){i.preventDefault();const{end:d}=k(a+1,c);d||(M(a,c),a+=1)}if(i.key==="ArrowUp"){if(i.preventDefault(),a<=0)return;M(a,c),a-=1,k(a,c)}if(i.key==="Enter"){i.preventDefault();const d=c.querySelector(`.${v}`);if(d){if(i.ctrlKey){window.open(d.href,"_blank");return}d.click()}}}u.addEventListener("focus",()=>{document.addEventListener("keydown",S)}),u.addEventListener("blur",()=>{document.removeEventListener("keydown",S)});function b(i){const d=K(i,c);d>=0&&(a=d)}c.addEventListener("mousemove",b);function T(i){const d=O(i,c);d>=0&&(a=d)}"ontouchstart"in window&&c.addEventListener("touchstart",T);function H(){c.removeEventListener("mousemove",b),"ontouchstart"in window&&c.removeEventListener("touchstart",T),o.remove(),n&&n()}s.addEventListener("keydown",i=>{i.key==="Escape"&&H()}),o.addEventListener("click",i=>{i.target===o&&H()}),u.focus()}const te="";function G({appId:t,isOpen:e,urlPrefix:n,onClose:r}){return m.useEffect(()=>{e&&N({appId:t,urlPrefix:n,onClose:r})},[e,t,n]),null}function V(){const[t,e]=m.useState(!1);return{isOpen:t,onOpen:()=>{e(!0)},onClose:()=>{e(!1)}}}function Z({callback:t,key:e,withCtrl:n=!1,isOpen:r}){m.useEffect(()=>{const o=s=>{r||s.key===e&&(n?(s.preventDefault(),s.ctrlKey&&t()):(s.preventDefault(),t()))};return document.addEventListener("keydown",o),()=>{document.removeEventListener("keydown",o)}},[r])}f.Search=G,f.useSearch=V,f.useShortcut=Z,Object.defineProperty(f,Symbol.toStringTag,{value:"Module"})});
{
"name": "searchmate-react",
"private": false,
"version": "1.8.0",
"version": "1.9.0",
"type": "module",

@@ -26,3 +26,3 @@ "files": [

"react-dom": "^18.2.0",
"searchmate-js": "1.8.0"
"searchmate-js": "1.9.0"
},

@@ -29,0 +29,0 @@ "devDependencies": {

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