spotlight-omni-search 1.0.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/README.md +391 -0
- package/dist/Spotlight.d.ts +2 -0
- package/dist/actions/commonActions.d.ts +31 -0
- package/dist/adapters/routes.d.ts +23 -0
- package/dist/adapters/useReactRouterItems.d.ts +37 -0
- package/dist/hooks/useRecentItems.d.ts +36 -0
- package/dist/hooks/useSpotlight.d.ts +47 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.mjs +3035 -0
- package/dist/index.umd.js +6 -0
- package/dist/lib/fuzzySearch.d.ts +26 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/spotlight-omni-search.css +1 -0
- package/dist/types.d.ts +60 -0
- package/package.json +51 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
(function(_,x){typeof exports=="object"&&typeof module<"u"?x(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],x):(_=typeof globalThis<"u"?globalThis:_||self,x(_.AuraSpotlight={},_.React))})(this,(function(_,x){"use strict";var ne={exports:{}},Z={};var fe;function _e(){if(fe)return Z;fe=1;var e=Symbol.for("react.transitional.element"),r=Symbol.for("react.fragment");function o(t,s,a){var l=null;if(a!==void 0&&(l=""+a),s.key!==void 0&&(l=""+s.key),"key"in s){a={};for(var i in s)i!=="key"&&(a[i]=s[i])}else a=s;return s=a.ref,{$$typeof:e,type:t,key:l,ref:s!==void 0?s:null,props:a}}return Z.Fragment=r,Z.jsx=o,Z.jsxs=o,Z}var Q={};var me;function ze(){return me||(me=1,process.env.NODE_ENV!=="production"&&(function(){function e(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===ee?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case w:return"Fragment";case E:return"Profiler";case b:return"StrictMode";case I:return"Suspense";case z:return"SuspenseList";case U:return"Activity"}if(typeof n=="object")switch(typeof n.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),n.$$typeof){case k:return"Portal";case d:return n.displayName||"Context";case P:return(n._context.displayName||"Context")+".Consumer";case y:var f=n.render;return n=n.displayName,n||(n=f.displayName||f.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case B:return f=n.displayName||null,f!==null?f:e(n.type)||"Memo";case O:f=n._payload,n=n._init;try{return e(n(f))}catch{}}return null}function r(n){return""+n}function o(n){try{r(n);var f=!1}catch{f=!0}if(f){f=console;var C=f.error,N=typeof Symbol=="function"&&Symbol.toStringTag&&n[Symbol.toStringTag]||n.constructor.name||"Object";return C.call(f,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",N),r(n)}}function t(n){if(n===w)return"<>";if(typeof n=="object"&&n!==null&&n.$$typeof===O)return"<...>";try{var f=e(n);return f?"<"+f+">":"<...>"}catch{return"<...>"}}function s(){var n=v.A;return n===null?null:n.getOwner()}function a(){return Error("react-stack-top-frame")}function l(n){if(te.call(n,"key")){var f=Object.getOwnPropertyDescriptor(n,"key").get;if(f&&f.isReactWarning)return!1}return n.key!==void 0}function i(n,f){function C(){V||(V=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",f))}C.isReactWarning=!0,Object.defineProperty(n,"key",{get:C,configurable:!0})}function c(){var n=e(this.type);return re[n]||(re[n]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),n=this.props.ref,n!==void 0?n:null}function m(n,f,C,N,se,ue){var T=C.ref;return n={$$typeof:j,type:n,key:f,props:C,_owner:N},(T!==void 0?T:null)!==null?Object.defineProperty(n,"ref",{enumerable:!1,get:c}):Object.defineProperty(n,"ref",{enumerable:!1,value:null}),n._store={},Object.defineProperty(n._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(n,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(n,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:se}),Object.defineProperty(n,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:ue}),Object.freeze&&(Object.freeze(n.props),Object.freeze(n)),n}function u(n,f,C,N,se,ue){var T=f.children;if(T!==void 0)if(N)if(K(T)){for(N=0;N<T.length;N++)h(T[N]);Object.freeze&&Object.freeze(T)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else h(T);if(te.call(f,"key")){T=e(n);var H=Object.keys(f).filter(function(_t){return _t!=="key"});N=0<H.length?"{key: someKey, "+H.join(": ..., ")+": ...}":"{key: someKey}",oe[T+N]||(H=0<H.length?"{"+H.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
2
|
+
let props = %s;
|
|
3
|
+
<%s {...props} />
|
|
4
|
+
React keys must be passed directly to JSX without using spread:
|
|
5
|
+
let props = %s;
|
|
6
|
+
<%s key={someKey} {...props} />`,N,T,H,T),oe[T+N]=!0)}if(T=null,C!==void 0&&(o(C),T=""+C),l(f)&&(o(f.key),T=""+f.key),"key"in f){C={};for(var pe in f)pe!=="key"&&(C[pe]=f[pe])}else C=f;return T&&i(C,typeof n=="function"?n.displayName||n.name||"Unknown":n),m(n,T,C,s(),se,ue)}function h(n){S(n)?n._store&&(n._store.validated=1):typeof n=="object"&&n!==null&&n.$$typeof===O&&(n._payload.status==="fulfilled"?S(n._payload.value)&&n._payload.value._store&&(n._payload.value._store.validated=1):n._store&&(n._store.validated=1))}function S(n){return typeof n=="object"&&n!==null&&n.$$typeof===j}var A=x,j=Symbol.for("react.transitional.element"),k=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),b=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),P=Symbol.for("react.consumer"),d=Symbol.for("react.context"),y=Symbol.for("react.forward_ref"),I=Symbol.for("react.suspense"),z=Symbol.for("react.suspense_list"),B=Symbol.for("react.memo"),O=Symbol.for("react.lazy"),U=Symbol.for("react.activity"),ee=Symbol.for("react.client.reference"),v=A.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,te=Object.prototype.hasOwnProperty,K=Array.isArray,J=console.createTask?console.createTask:function(){return null};A={react_stack_bottom_frame:function(n){return n()}};var V,re={},X=A.react_stack_bottom_frame.bind(A,a)(),W=J(t(a)),oe={};Q.Fragment=w,Q.jsx=function(n,f,C){var N=1e4>v.recentlyCreatedOwnerStacks++;return u(n,f,C,!1,N?Error("react-stack-top-frame"):X,N?J(t(n)):W)},Q.jsxs=function(n,f,C){var N=1e4>v.recentlyCreatedOwnerStacks++;return u(n,f,C,!0,N?Error("react-stack-top-frame"):X,N?J(t(n)):W)}})()),Q}var ge;function Me(){return ge||(ge=1,process.env.NODE_ENV==="production"?ne.exports=_e():ne.exports=ze()),ne.exports}var g=Me();const Pe=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),he=(...e)=>e.filter((r,o,t)=>!!r&&r.trim()!==""&&t.indexOf(r)===o).join(" ").trim();var Ie={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const Oe=x.forwardRef(({color:e="currentColor",size:r=24,strokeWidth:o=2,absoluteStrokeWidth:t,className:s="",children:a,iconNode:l,...i},c)=>x.createElement("svg",{ref:c,...Ie,width:r,height:r,stroke:e,strokeWidth:t?Number(o)*24/Number(r):o,className:he("lucide",s),...i},[...l.map(([m,u])=>x.createElement(m,u)),...Array.isArray(a)?a:[a]]));const M=(e,r)=>{const o=x.forwardRef(({className:t,...s},a)=>x.createElement(Oe,{ref:a,iconNode:r,className:he(`lucide-${Pe(e)}`,t),...s}));return o.displayName=`${e}`,o};const Le=M("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);const Ge=M("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);const Fe=M("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);const Ue=M("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);const We=M("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);const Ve=M("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);const Ye=M("Printer",[["path",{d:"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2",key:"143wyd"}],["path",{d:"M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6",key:"1itne7"}],["rect",{x:"6",y:"14",width:"12",height:"8",rx:"1",key:"1ue0tg"}]]);const De=M("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]);const be=M("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);const Be=M("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);const Ke=M("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function ye(e){var r,o,t="";if(typeof e=="string"||typeof e=="number")t+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(r=0;r<s;r++)e[r]&&(o=ye(e[r]))&&(t&&(t+=" "),t+=o)}else for(o in e)e[o]&&(t&&(t+=" "),t+=o);return t}function Je(){for(var e,r,o=0,t="",s=arguments.length;o<s;o++)(e=arguments[o])&&(r=ye(e))&&(t&&(t+=" "),t+=r);return t}const ae="-",Xe=e=>{const r=Ze(e),{conflictingClassGroups:o,conflictingClassGroupModifiers:t}=e;return{getClassGroupId:l=>{const i=l.split(ae);return i[0]===""&&i.length!==1&&i.shift(),xe(i,r)||He(l)},getConflictingClassGroupIds:(l,i)=>{const c=o[l]||[];return i&&t[l]?[...c,...t[l]]:c}}},xe=(e,r)=>{if(e.length===0)return r.classGroupId;const o=e[0],t=r.nextPart.get(o),s=t?xe(e.slice(1),t):void 0;if(s)return s;if(r.validators.length===0)return;const a=e.join(ae);return r.validators.find(({validator:l})=>l(a))?.classGroupId},we=/^\[(.+)\]$/,He=e=>{if(we.test(e)){const r=we.exec(e)[1],o=r?.substring(0,r.indexOf(":"));if(o)return"arbitrary.."+o}},Ze=e=>{const{theme:r,prefix:o}=e,t={nextPart:new Map,validators:[]};return qe(Object.entries(e.classGroups),o).forEach(([a,l])=>{le(l,t,a,r)}),t},le=(e,r,o,t)=>{e.forEach(s=>{if(typeof s=="string"){const a=s===""?r:ve(r,s);a.classGroupId=o;return}if(typeof s=="function"){if(Qe(s)){le(s(t),r,o,t);return}r.validators.push({validator:s,classGroupId:o});return}Object.entries(s).forEach(([a,l])=>{le(l,ve(r,a),o,t)})})},ve=(e,r)=>{let o=e;return r.split(ae).forEach(t=>{o.nextPart.has(t)||o.nextPart.set(t,{nextPart:new Map,validators:[]}),o=o.nextPart.get(t)}),o},Qe=e=>e.isThemeGetter,qe=(e,r)=>r?e.map(([o,t])=>{const s=t.map(a=>typeof a=="string"?r+a:typeof a=="object"?Object.fromEntries(Object.entries(a).map(([l,i])=>[r+l,i])):a);return[o,s]}):e,$e=e=>{if(e<1)return{get:()=>{},set:()=>{}};let r=0,o=new Map,t=new Map;const s=(a,l)=>{o.set(a,l),r++,r>e&&(r=0,t=o,o=new Map)};return{get(a){let l=o.get(a);if(l!==void 0)return l;if((l=t.get(a))!==void 0)return s(a,l),l},set(a,l){o.has(a)?o.set(a,l):s(a,l)}}},ke="!",et=e=>{const{separator:r,experimentalParseClassName:o}=e,t=r.length===1,s=r[0],a=r.length,l=i=>{const c=[];let m=0,u=0,h;for(let w=0;w<i.length;w++){let b=i[w];if(m===0){if(b===s&&(t||i.slice(w,w+a)===r)){c.push(i.slice(u,w)),u=w+a;continue}if(b==="/"){h=w;continue}}b==="["?m++:b==="]"&&m--}const S=c.length===0?i:i.substring(u),A=S.startsWith(ke),j=A?S.substring(1):S,k=h&&h>u?h-u:void 0;return{modifiers:c,hasImportantModifier:A,baseClassName:j,maybePostfixModifierPosition:k}};return o?i=>o({className:i,parseClassName:l}):l},tt=e=>{if(e.length<=1)return e;const r=[];let o=[];return e.forEach(t=>{t[0]==="["?(r.push(...o.sort(),t),o=[]):o.push(t)}),r.push(...o.sort()),r},rt=e=>({cache:$e(e.cacheSize),parseClassName:et(e),...Xe(e)}),ot=/\s+/,nt=(e,r)=>{const{parseClassName:o,getClassGroupId:t,getConflictingClassGroupIds:s}=r,a=[],l=e.trim().split(ot);let i="";for(let c=l.length-1;c>=0;c-=1){const m=l[c],{modifiers:u,hasImportantModifier:h,baseClassName:S,maybePostfixModifierPosition:A}=o(m);let j=!!A,k=t(j?S.substring(0,A):S);if(!k){if(!j){i=m+(i.length>0?" "+i:i);continue}if(k=t(S),!k){i=m+(i.length>0?" "+i:i);continue}j=!1}const w=tt(u).join(":"),b=h?w+ke:w,E=b+k;if(a.includes(E))continue;a.push(E);const P=s(k,j);for(let d=0;d<P.length;++d){const y=P[d];a.push(b+y)}i=m+(i.length>0?" "+i:i)}return i};function st(){let e=0,r,o,t="";for(;e<arguments.length;)(r=arguments[e++])&&(o=Re(r))&&(t&&(t+=" "),t+=o);return t}const Re=e=>{if(typeof e=="string")return e;let r,o="";for(let t=0;t<e.length;t++)e[t]&&(r=Re(e[t]))&&(o&&(o+=" "),o+=r);return o};function at(e,...r){let o,t,s,a=l;function l(c){const m=r.reduce((u,h)=>h(u),e());return o=rt(m),t=o.cache.get,s=o.cache.set,a=i,i(c)}function i(c){const m=t(c);if(m)return m;const u=nt(c,o);return s(c,u),u}return function(){return a(st.apply(null,arguments))}}const R=e=>{const r=o=>o[e]||[];return r.isThemeGetter=!0,r},Se=/^\[(?:([a-z-]+):)?(.+)\]$/i,lt=/^\d+\/\d+$/,it=new Set(["px","full","screen"]),ct=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,dt=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,ut=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,pt=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,ft=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,L=e=>Y(e)||it.has(e)||lt.test(e),G=e=>D(e,"length",vt),Y=e=>!!e&&!Number.isNaN(Number(e)),ie=e=>D(e,"number",Y),q=e=>!!e&&Number.isInteger(Number(e)),mt=e=>e.endsWith("%")&&Y(e.slice(0,-1)),p=e=>Se.test(e),F=e=>ct.test(e),gt=new Set(["length","size","percentage"]),ht=e=>D(e,gt,Ce),bt=e=>D(e,"position",Ce),yt=new Set(["image","url"]),xt=e=>D(e,yt,Rt),wt=e=>D(e,"",kt),$=()=>!0,D=(e,r,o)=>{const t=Se.exec(e);return t?t[1]?typeof r=="string"?t[1]===r:r.has(t[1]):o(t[2]):!1},vt=e=>dt.test(e)&&!ut.test(e),Ce=()=>!1,kt=e=>pt.test(e),Rt=e=>ft.test(e),St=at(()=>{const e=R("colors"),r=R("spacing"),o=R("blur"),t=R("brightness"),s=R("borderColor"),a=R("borderRadius"),l=R("borderSpacing"),i=R("borderWidth"),c=R("contrast"),m=R("grayscale"),u=R("hueRotate"),h=R("invert"),S=R("gap"),A=R("gradientColorStops"),j=R("gradientColorStopPositions"),k=R("inset"),w=R("margin"),b=R("opacity"),E=R("padding"),P=R("saturate"),d=R("scale"),y=R("sepia"),I=R("skew"),z=R("space"),B=R("translate"),O=()=>["auto","contain","none"],U=()=>["auto","hidden","clip","visible","scroll"],ee=()=>["auto",p,r],v=()=>[p,r],te=()=>["",L,G],K=()=>["auto",Y,p],J=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],V=()=>["solid","dashed","dotted","double","none"],re=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],X=()=>["start","end","center","between","around","evenly","stretch"],W=()=>["","0",p],oe=()=>["auto","avoid","all","avoid-page","page","left","right","column"],n=()=>[Y,p];return{cacheSize:500,separator:":",theme:{colors:[$],spacing:[L,G],blur:["none","",F,p],brightness:n(),borderColor:[e],borderRadius:["none","","full",F,p],borderSpacing:v(),borderWidth:te(),contrast:n(),grayscale:W(),hueRotate:n(),invert:W(),gap:v(),gradientColorStops:[e],gradientColorStopPositions:[mt,G],inset:ee(),margin:ee(),opacity:n(),padding:v(),saturate:n(),scale:n(),sepia:W(),skew:n(),space:v(),translate:v()},classGroups:{aspect:[{aspect:["auto","square","video",p]}],container:["container"],columns:[{columns:[F]}],"break-after":[{"break-after":oe()}],"break-before":[{"break-before":oe()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...J(),p]}],overflow:[{overflow:U()}],"overflow-x":[{"overflow-x":U()}],"overflow-y":[{"overflow-y":U()}],overscroll:[{overscroll:O()}],"overscroll-x":[{"overscroll-x":O()}],"overscroll-y":[{"overscroll-y":O()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[k]}],"inset-x":[{"inset-x":[k]}],"inset-y":[{"inset-y":[k]}],start:[{start:[k]}],end:[{end:[k]}],top:[{top:[k]}],right:[{right:[k]}],bottom:[{bottom:[k]}],left:[{left:[k]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",q,p]}],basis:[{basis:ee()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",p]}],grow:[{grow:W()}],shrink:[{shrink:W()}],order:[{order:["first","last","none",q,p]}],"grid-cols":[{"grid-cols":[$]}],"col-start-end":[{col:["auto",{span:["full",q,p]},p]}],"col-start":[{"col-start":K()}],"col-end":[{"col-end":K()}],"grid-rows":[{"grid-rows":[$]}],"row-start-end":[{row:["auto",{span:[q,p]},p]}],"row-start":[{"row-start":K()}],"row-end":[{"row-end":K()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",p]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",p]}],gap:[{gap:[S]}],"gap-x":[{"gap-x":[S]}],"gap-y":[{"gap-y":[S]}],"justify-content":[{justify:["normal",...X()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...X(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...X(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[E]}],px:[{px:[E]}],py:[{py:[E]}],ps:[{ps:[E]}],pe:[{pe:[E]}],pt:[{pt:[E]}],pr:[{pr:[E]}],pb:[{pb:[E]}],pl:[{pl:[E]}],m:[{m:[w]}],mx:[{mx:[w]}],my:[{my:[w]}],ms:[{ms:[w]}],me:[{me:[w]}],mt:[{mt:[w]}],mr:[{mr:[w]}],mb:[{mb:[w]}],ml:[{ml:[w]}],"space-x":[{"space-x":[z]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[z]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",p,r]}],"min-w":[{"min-w":[p,r,"min","max","fit"]}],"max-w":[{"max-w":[p,r,"none","full","min","max","fit","prose",{screen:[F]},F]}],h:[{h:[p,r,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[p,r,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[p,r,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[p,r,"auto","min","max","fit"]}],"font-size":[{text:["base",F,G]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",ie]}],"font-family":[{font:[$]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",p]}],"line-clamp":[{"line-clamp":["none",Y,ie]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",L,p]}],"list-image":[{"list-image":["none",p]}],"list-style-type":[{list:["none","disc","decimal",p]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[b]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[b]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...V(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",L,G]}],"underline-offset":[{"underline-offset":["auto",L,p]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:v()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",p]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",p]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[b]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...J(),bt]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",ht]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},xt]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[j]}],"gradient-via-pos":[{via:[j]}],"gradient-to-pos":[{to:[j]}],"gradient-from":[{from:[A]}],"gradient-via":[{via:[A]}],"gradient-to":[{to:[A]}],rounded:[{rounded:[a]}],"rounded-s":[{"rounded-s":[a]}],"rounded-e":[{"rounded-e":[a]}],"rounded-t":[{"rounded-t":[a]}],"rounded-r":[{"rounded-r":[a]}],"rounded-b":[{"rounded-b":[a]}],"rounded-l":[{"rounded-l":[a]}],"rounded-ss":[{"rounded-ss":[a]}],"rounded-se":[{"rounded-se":[a]}],"rounded-ee":[{"rounded-ee":[a]}],"rounded-es":[{"rounded-es":[a]}],"rounded-tl":[{"rounded-tl":[a]}],"rounded-tr":[{"rounded-tr":[a]}],"rounded-br":[{"rounded-br":[a]}],"rounded-bl":[{"rounded-bl":[a]}],"border-w":[{border:[i]}],"border-w-x":[{"border-x":[i]}],"border-w-y":[{"border-y":[i]}],"border-w-s":[{"border-s":[i]}],"border-w-e":[{"border-e":[i]}],"border-w-t":[{"border-t":[i]}],"border-w-r":[{"border-r":[i]}],"border-w-b":[{"border-b":[i]}],"border-w-l":[{"border-l":[i]}],"border-opacity":[{"border-opacity":[b]}],"border-style":[{border:[...V(),"hidden"]}],"divide-x":[{"divide-x":[i]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[i]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[b]}],"divide-style":[{divide:V()}],"border-color":[{border:[s]}],"border-color-x":[{"border-x":[s]}],"border-color-y":[{"border-y":[s]}],"border-color-s":[{"border-s":[s]}],"border-color-e":[{"border-e":[s]}],"border-color-t":[{"border-t":[s]}],"border-color-r":[{"border-r":[s]}],"border-color-b":[{"border-b":[s]}],"border-color-l":[{"border-l":[s]}],"divide-color":[{divide:[s]}],"outline-style":[{outline:["",...V()]}],"outline-offset":[{"outline-offset":[L,p]}],"outline-w":[{outline:[L,G]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:te()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[b]}],"ring-offset-w":[{"ring-offset":[L,G]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",F,wt]}],"shadow-color":[{shadow:[$]}],opacity:[{opacity:[b]}],"mix-blend":[{"mix-blend":[...re(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":re()}],filter:[{filter:["","none"]}],blur:[{blur:[o]}],brightness:[{brightness:[t]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",F,p]}],grayscale:[{grayscale:[m]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[h]}],saturate:[{saturate:[P]}],sepia:[{sepia:[y]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[o]}],"backdrop-brightness":[{"backdrop-brightness":[t]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[m]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[h]}],"backdrop-opacity":[{"backdrop-opacity":[b]}],"backdrop-saturate":[{"backdrop-saturate":[P]}],"backdrop-sepia":[{"backdrop-sepia":[y]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[l]}],"border-spacing-x":[{"border-spacing-x":[l]}],"border-spacing-y":[{"border-spacing-y":[l]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",p]}],duration:[{duration:n()}],ease:[{ease:["linear","in","out","in-out",p]}],delay:[{delay:n()}],animate:[{animate:["none","spin","ping","pulse","bounce",p]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[d]}],"scale-x":[{"scale-x":[d]}],"scale-y":[{"scale-y":[d]}],rotate:[{rotate:[q,p]}],"translate-x":[{"translate-x":[B]}],"translate-y":[{"translate-y":[B]}],"skew-x":[{"skew-x":[I]}],"skew-y":[{"skew-y":[I]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",p]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",p]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":v()}],"scroll-mx":[{"scroll-mx":v()}],"scroll-my":[{"scroll-my":v()}],"scroll-ms":[{"scroll-ms":v()}],"scroll-me":[{"scroll-me":v()}],"scroll-mt":[{"scroll-mt":v()}],"scroll-mr":[{"scroll-mr":v()}],"scroll-mb":[{"scroll-mb":v()}],"scroll-ml":[{"scroll-ml":v()}],"scroll-p":[{"scroll-p":v()}],"scroll-px":[{"scroll-px":v()}],"scroll-py":[{"scroll-py":v()}],"scroll-ps":[{"scroll-ps":v()}],"scroll-pe":[{"scroll-pe":v()}],"scroll-pt":[{"scroll-pt":v()}],"scroll-pr":[{"scroll-pr":v()}],"scroll-pb":[{"scroll-pb":v()}],"scroll-pl":[{"scroll-pl":v()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",p]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[L,G,ie]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}});function ce(...e){return St(Je(e))}function Ct(e,r){if(!e||!r)return null;const o=e.toLowerCase(),t=r.toLowerCase();let s=0,a=0;const l=[];let i=0;for(let c=0;c<t.length&&a<o.length;c++)t[c]===o[a]&&(l.push(c),s+=1,l.length>1&&l[l.length-1]===l[l.length-2]+1?(i+=5,s+=i):i=0,(c===0||/[\s\-_]/.test(t[c-1]))&&(s+=10),s+=Math.max(0,10-c),a++);return a!==o.length?null:{score:s,matches:l}}function Et(e,r){const o=[{text:e.label,weight:3},{text:e.description||"",weight:1},{text:e.group||"",weight:1},...(e.keywords||[]).map(s=>({text:s,weight:2}))];let t=null;for(const s of o){const a=Ct(r,s.text);if(a){const l=a.score*s.weight;(!t||l>t.score)&&(t={...a,score:l})}}return t}function At(e,r){if(!r.trim())return e;const o=[];for(const t of e){const s=Et(t,r);s&&o.push({item:t,score:s.score,matches:s.matches})}return o.sort((t,s)=>{if(s.score!==t.score)return s.score-t.score;const a=t.item.group||"Other",l=s.item.group||"Other";return a.localeCompare(l)}),o.map(t=>t.item)}function Ee(e={}){const{storageKey:r="spotlight-recent-items",maxItems:o=10,enabled:t=!0}=e,[s,a]=x.useState([]);x.useEffect(()=>{if(t)try{const c=localStorage.getItem(r);if(c){const m=JSON.parse(c);a(Array.isArray(m)?m:[])}}catch(c){console.warn("Failed to load recent items from localStorage:",c)}},[r,t]),x.useEffect(()=>{if(t)try{localStorage.setItem(r,JSON.stringify(s))}catch(c){console.warn("Failed to save recent items to localStorage:",c)}},[s,r,t]);const l=x.useCallback(c=>{t&&a(m=>{const u=m.filter(S=>S.id!==c.id);return[c,...u].slice(0,o)})},[t,o]),i=x.useCallback(()=>{a([]);try{localStorage.removeItem(r)}catch(c){console.warn("Failed to clear recent items from localStorage:",c)}},[r]);return{recentItems:t?s:[],addRecentItem:l,clearRecent:i}}function jt({isOpen:e,onClose:r,items:o,onNavigate:t,searchPlaceholder:s="Search pages, actions, commands...",enableRecent:a=!0,maxRecentItems:l=10,isLoading:i=!1,renderItem:c}){const[m,u]=x.useState(""),[h,S]=x.useState(0),A=x.useRef(null),j=x.useRef(null),{recentItems:k,addRecentItem:w}=Ee({enabled:a,maxItems:l}),b=x.useMemo(()=>{if(!m.trim()){if(a&&k.length>0){const d=new Set(k.map(z=>z.id)),I=o.filter(z=>!d.has(z.id)).sort((z,B)=>{const O=z.group||"Other",U=B.group||"Other";return O===U?0:O.localeCompare(U)});return[...k,...I]}return o.sort((d,y)=>{const I=d.group||"Other",z=y.group||"Other";return I===z?0:I.localeCompare(z)})}return At(o,m)},[m,o,a,k]);x.useEffect(()=>{e&&(u(""),S(0),setTimeout(()=>A.current?.focus(),50))},[e]),x.useEffect(()=>{S(0)},[b]);const E=d=>{w(d),d.action?(d.action(),r()):d.route&&(t(d.route),r())},P=d=>{d.key==="ArrowDown"?(d.preventDefault(),S(y=>y<b.length-1?y+1:y)):d.key==="ArrowUp"?(d.preventDefault(),S(y=>y>0?y-1:0)):d.key==="Enter"?(d.preventDefault(),b[h]&&E(b[h])):d.key==="Escape"&&r()};return x.useEffect(()=>{if(j.current&&b.length>0){const y=j.current.querySelectorAll("button[data-spotlight-item]")[h];y&&y.scrollIntoView({block:"nearest"})}},[h,b]),e?g.jsxs("div",{className:"fixed inset-0 z-[9999] flex items-start justify-center pt-2 sm:pt-[10vh] lg:pt-[15vh]",children:[g.jsx("div",{className:"absolute inset-0 bg-background/80 backdrop-blur-sm transition-opacity",onClick:r}),g.jsxs("div",{className:"relative w-full max-w-[96vw] sm:max-w-xl lg:max-w-2xl xl:max-w-3xl bg-popover text-foreground rounded-xl shadow-2xl border border-border overflow-hidden animate-in fade-in zoom-in-95 duration-200",children:[g.jsxs("div",{className:"flex items-center px-4 border-b border-border h-14",children:[g.jsx(be,{className:"w-5 h-5 text-muted-foreground mr-3"}),g.jsx("input",{ref:A,type:"text",className:"flex-1 h-full bg-transparent border-none outline-none text-foreground placeholder-muted-foreground text-sm",placeholder:s,value:m,onChange:d=>u(d.target.value),onKeyDown:P}),g.jsxs("div",{className:"flex items-center gap-2",children:[m&&g.jsx("button",{onClick:()=>u(""),className:"text-muted-foreground hover:text-foreground",children:g.jsx(Ke,{size:16})}),g.jsx("kbd",{className:"hidden sm:inline-flex h-5 select-none items-center gap-1 rounded border border-border bg-muted px-1.5 font-mono text-[10px] font-medium text-muted-foreground opacity-100",children:"ESC"})]})]}),g.jsx("div",{ref:j,className:"max-h-[65vh] sm:max-h-[60vh] overflow-y-auto p-2",children:i?g.jsx("div",{className:"space-y-2",children:[...Array(5)].map((d,y)=>g.jsxs("div",{className:"flex items-center rounded-sm px-3 py-2.5",children:[g.jsx("div",{className:"h-8 w-8 rounded-md bg-muted animate-pulse mr-3"}),g.jsxs("div",{className:"flex-1 space-y-2",children:[g.jsx("div",{className:"h-4 bg-muted rounded animate-pulse w-3/4"}),g.jsx("div",{className:"h-3 bg-muted rounded animate-pulse w-1/2"})]})]},y))}):b.length===0?g.jsx("div",{className:"py-12 text-center text-sm text-muted-foreground",children:"No results found."}):b.map((d,y)=>{const I=y===0||d.group!==b[y-1].group;return g.jsxs(x.Fragment,{children:[I&&d.group&&g.jsx("div",{className:"px-3 py-2 text-xs font-semibold text-muted-foreground uppercase tracking-wider sticky top-0 bg-popover z-10",children:d.group}),c?g.jsx("div",{"data-spotlight-item":!0,onClick:()=>E(d),className:ce("cursor-pointer",y===h&&"bg-accent"),children:c(d,y===h)}):g.jsxs("button",{"data-spotlight-item":!0,onClick:()=>E(d),className:ce("relative flex cursor-pointer select-none items-center rounded-sm px-3 py-2.5 text-sm outline-none w-full text-left transition-colors",y===h?"bg-accent text-accent-foreground":"hover:bg-muted/50"),children:[g.jsx("div",{className:ce("flex h-8 w-8 items-center justify-center rounded-md border border-border mr-3",y===h?"bg-background":"bg-muted"),children:d.icon||g.jsx(be,{size:14})}),g.jsxs("div",{className:"flex-1 overflow-hidden",children:[g.jsx("div",{className:"truncate font-medium",children:d.label}),d.description&&g.jsx("div",{className:"truncate text-xs text-muted-foreground",children:d.description})]}),g.jsxs("div",{className:"flex items-center gap-2 ml-auto",children:[d.shortcut&&g.jsx("kbd",{className:"hidden sm:inline-flex h-5 select-none items-center gap-1 rounded border border-border bg-muted px-1.5 font-mono text-[10px] font-medium text-muted-foreground",children:d.shortcut}),d.type&&g.jsx("span",{className:"text-[10px] uppercase text-muted-foreground bg-muted px-1.5 py-0.5 rounded",children:d.type})]})]})]},d.id)})}),g.jsx("div",{className:"h-10 border-t border-border bg-muted/30 px-4 flex items-center justify-between text-[10px] text-muted-foreground",children:g.jsxs("div",{className:"flex gap-2",children:[g.jsx("span",{children:"Use arrow keys to navigate"}),g.jsx("span",{children:"Enter to select"})]})})]})]}):null}function de(e,r="",o="Pages"){const t=[];return e.forEach(s=>{const a=s.path.startsWith("/")?s.path:`${r}/${s.path}`.replace(/\/+/g,"/"),l=s.label||s.name||s.title||a;if(s.hidden){s.children&&t.push(...de(s.children,a,o));return}l&&!s.children&&t.push({id:`route-${a}`,label:l,description:s.description||`Navigate to ${l}`,route:a,type:"page",group:o,icon:s.icon,keywords:[l,a]}),s.children&&t.push(...de(s.children,a,o))}),t}function Nt(e={}){const{defaultOpen:r=!1,shortcut:o="cmd+k",enableShortcut:t=!0}=e,[s,a]=x.useState(r),l=x.useCallback(()=>a(!0),[]),i=x.useCallback(()=>a(!1),[]),c=x.useCallback(()=>a(m=>!m),[]);return x.useEffect(()=>{if(!t)return;const m=u=>{const h=o.toLowerCase().split("+"),S=h[h.length-1],A=h.includes("cmd")||h.includes("meta"),j=h.includes("ctrl"),k=h.includes("shift"),w=h.includes("alt"),b=A?u.metaKey||u.ctrlKey:!u.metaKey,E=j?u.ctrlKey:!0,P=k?u.shiftKey:!u.shiftKey,d=w?u.altKey:!u.altKey,y=u.key.toLowerCase()===S;o==="cmd+k"?u.key.toLowerCase()==="k"&&(u.metaKey||u.ctrlKey)&&!u.shiftKey&&!u.altKey&&(u.preventDefault(),c()):b&&E&&P&&d&&y&&(u.preventDefault(),c())};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[t,o,c]),{isOpen:s,open:l,close:i,toggle:c}}function Ae(e={}){const{onToggle:r,currentTheme:o="light"}=e;return[{id:"action-theme-toggle",label:o==="light"?"Switch to Dark Mode":"Switch to Light Mode",description:"Toggle between light and dark theme",icon:o==="light"?Ve({size:20}):Be({size:20}),type:"action",group:"Theme",keywords:["theme","dark","light","mode"],action:()=>{r?.(o==="light"?"dark":"light")}}]}function je(){return[{id:"action-nav-back",label:"Go Back",description:"Navigate to previous page",icon:Ge({size:20}),type:"action",group:"Navigation",keywords:["back","previous","history"],action:()=>window.history.back()},{id:"action-nav-forward",label:"Go Forward",description:"Navigate to next page",icon:Fe({size:20}),type:"action",group:"Navigation",keywords:["forward","next","history"],action:()=>window.history.forward()}]}function Ne(){return[{id:"action-scroll-top",label:"Scroll to Top",description:"Scroll to the top of the page",icon:Ue({size:20}),type:"action",group:"Navigation",keywords:["scroll","top","up"],action:()=>window.scrollTo({top:0,behavior:"smooth"})},{id:"action-scroll-bottom",label:"Scroll to Bottom",description:"Scroll to the bottom of the page",icon:Le({size:20}),type:"action",group:"Navigation",keywords:["scroll","bottom","down"],action:()=>window.scrollTo({top:document.body.scrollHeight,behavior:"smooth"})}]}function Te(){return[{id:"action-copy-url",label:"Copy Current URL",description:"Copy the current page URL to clipboard",icon:We({size:20}),type:"action",group:"Utilities",keywords:["copy","url","link","clipboard"],action:async()=>{try{await navigator.clipboard.writeText(window.location.href)}catch(e){console.error("Failed to copy URL:",e)}}},{id:"action-print",label:"Print Page",description:"Print the current page",icon:Ye({size:20}),type:"action",group:"Utilities",keywords:["print","pdf"],action:()=>window.print()},{id:"action-reload",label:"Reload Page",description:"Reload the current page",icon:De({size:20}),type:"action",group:"Utilities",keywords:["reload","refresh","restart"],action:()=>window.location.reload()}]}function Tt(e){return[...Ae(e),...je(),...Ne(),...Te()]}_.Spotlight=jt,_.createCommonActions=Tt,_.createNavigationActions=je,_.createScrollActions=Ne,_.createThemeActions=Ae,_.createUtilityActions=Te,_.getSpotlightItemsFromRoutes=de,_.useRecentItems=Ee,_.useSpotlight=Nt,Object.defineProperty(_,Symbol.toStringTag,{value:"Module"})}));
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { SpotlightItem } from '../types';
|
|
2
|
+
export interface FuzzyMatchResult {
|
|
3
|
+
score: number;
|
|
4
|
+
matches: number[];
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Performs fuzzy matching on a string
|
|
8
|
+
* Returns a score and the positions of matched characters
|
|
9
|
+
*
|
|
10
|
+
* Algorithm:
|
|
11
|
+
* - Sequential character matching (characters must appear in order)
|
|
12
|
+
* - Bonus for consecutive matches
|
|
13
|
+
* - Bonus for matches at word boundaries
|
|
14
|
+
* - Case-insensitive
|
|
15
|
+
*/
|
|
16
|
+
export declare function fuzzyMatch(query: string, text: string): FuzzyMatchResult | null;
|
|
17
|
+
export interface ScoredItem {
|
|
18
|
+
item: SpotlightItem;
|
|
19
|
+
score: number;
|
|
20
|
+
matches: number[];
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Filters and sorts items using fuzzy search
|
|
24
|
+
* Returns items sorted by relevance score
|
|
25
|
+
*/
|
|
26
|
+
export declare function fuzzyFilter(items: SpotlightItem[], query: string): SpotlightItem[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
:root{--spotlight-background: #ffffff;--spotlight-foreground: #020817;--spotlight-muted: #f1f5f9;--spotlight-muted-foreground: #64748b;--spotlight-popover: #ffffff;--spotlight-border: #e2e8f0;--spotlight-accent: #f1f5f9;--spotlight-accent-foreground: #0f172a;--spotlight-ring: #94a3b8;--spotlight-primary: #0f172a}.dark{--spotlight-background: #020817;--spotlight-foreground: #f8fafc;--spotlight-muted: #1e293b;--spotlight-muted-foreground: #94a3b8;--spotlight-popover: #020817;--spotlight-border: #1e293b;--spotlight-accent: #1e293b;--spotlight-accent-foreground: #f8fafc;--spotlight-ring: #1e293b;--spotlight-primary: #f8fafc}@media(prefers-color-scheme:dark){:root:not(.light){--spotlight-background: #020817;--spotlight-foreground: #f8fafc;--spotlight-muted: #1e293b;--spotlight-muted-foreground: #94a3b8;--spotlight-popover: #020817;--spotlight-border: #1e293b;--spotlight-accent: #1e293b;--spotlight-accent-foreground: #f8fafc;--spotlight-ring: #1e293b;--spotlight-primary: #f8fafc}}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
export type SpotlightItemType = "page" | "action" | "user" | "tenant" | string;
|
|
3
|
+
export interface SpotlightItem {
|
|
4
|
+
id: string;
|
|
5
|
+
label: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
icon?: ReactNode;
|
|
8
|
+
type: SpotlightItemType;
|
|
9
|
+
/**
|
|
10
|
+
* Group identifier for sectioning results (e.g., "Pages", "Actions")
|
|
11
|
+
*/
|
|
12
|
+
group?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Keywords for fuzzy search
|
|
15
|
+
*/
|
|
16
|
+
keywords?: string[];
|
|
17
|
+
/**
|
|
18
|
+
* For navigation items
|
|
19
|
+
*/
|
|
20
|
+
route?: string;
|
|
21
|
+
/**
|
|
22
|
+
* For executable items
|
|
23
|
+
*/
|
|
24
|
+
action?: () => void;
|
|
25
|
+
/**
|
|
26
|
+
* Keyboard shortcut hint (e.g., "⌘K", "Ctrl+S")
|
|
27
|
+
*/
|
|
28
|
+
shortcut?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface SpotlightProps {
|
|
31
|
+
isOpen: boolean;
|
|
32
|
+
onClose: () => void;
|
|
33
|
+
items: SpotlightItem[];
|
|
34
|
+
/**
|
|
35
|
+
* Callback to handle navigation.
|
|
36
|
+
* This bridges the gap between different routers (Next, React Router).
|
|
37
|
+
*/
|
|
38
|
+
onNavigate: (path: string) => void;
|
|
39
|
+
searchPlaceholder?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Enable recent items tracking and display
|
|
42
|
+
* @default true
|
|
43
|
+
*/
|
|
44
|
+
enableRecent?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Maximum number of recent items to track
|
|
47
|
+
* @default 10
|
|
48
|
+
*/
|
|
49
|
+
maxRecentItems?: number;
|
|
50
|
+
/**
|
|
51
|
+
* Show loading state
|
|
52
|
+
* @default false
|
|
53
|
+
*/
|
|
54
|
+
isLoading?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Custom render function for items
|
|
57
|
+
* If provided, this will be used instead of the default item rendering
|
|
58
|
+
*/
|
|
59
|
+
renderItem?: (item: SpotlightItem, isSelected: boolean) => ReactNode;
|
|
60
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "spotlight-omni-search",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Universal Command Palette & Global Search for React",
|
|
6
|
+
"main": "./dist/index.umd.js",
|
|
7
|
+
"module": "./dist/index.mjs",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"files": [
|
|
10
|
+
"dist",
|
|
11
|
+
"README.md"
|
|
12
|
+
],
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"import": "./dist/index.mjs",
|
|
17
|
+
"require": "./dist/index.umd.js"
|
|
18
|
+
},
|
|
19
|
+
"./style.css": "./dist/style.css"
|
|
20
|
+
},
|
|
21
|
+
"scripts": {
|
|
22
|
+
"dev": "vite",
|
|
23
|
+
"build": "vite build && tsc --emitDeclarationOnly",
|
|
24
|
+
"preview": "vite preview"
|
|
25
|
+
},
|
|
26
|
+
"peerDependencies": {
|
|
27
|
+
"react": ">=18",
|
|
28
|
+
"react-dom": ">=18"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"clsx": "^2.1.1",
|
|
32
|
+
"framer-motion": "^11.12.0",
|
|
33
|
+
"lucide-react": "^0.469.0",
|
|
34
|
+
"tailwind-merge": "^2.6.0"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@types/react": "^19.0.0",
|
|
38
|
+
"@types/react-dom": "^19.0.0",
|
|
39
|
+
"@types/react-router-dom": "^5.3.3",
|
|
40
|
+
"@vitejs/plugin-react": "^5.1.2",
|
|
41
|
+
"autoprefixer": "^10.4.0",
|
|
42
|
+
"postcss": "^8.4.0",
|
|
43
|
+
"react": "^19.2.3",
|
|
44
|
+
"react-dom": "^19.2.3",
|
|
45
|
+
"react-router-dom": "^7.12.0",
|
|
46
|
+
"tailwindcss": "^3.4.0",
|
|
47
|
+
"tailwindcss-animate": "^1.0.7",
|
|
48
|
+
"typescript": "^5.0.0",
|
|
49
|
+
"vite": "^7.3.1"
|
|
50
|
+
}
|
|
51
|
+
}
|