@qikbar/qikbar 0.1.0 → 0.2.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 +30 -1
- package/bin/qikbar.mjs +203 -0
- package/dist/ai/embeddings.d.ts +51 -0
- package/dist/ai/index.d.ts +4 -0
- package/dist/ai/mcp.d.ts +84 -0
- package/dist/ai.js +27 -9
- package/dist/chunks/{bar-D5CSPT3U.js → bar-P3SCR4SJ.js} +684 -160
- package/dist/chunks/bar-P3SCR4SJ.js.map +7 -0
- package/dist/chunks/chunk-5FI7DNG7.js +271 -0
- package/dist/chunks/chunk-5FI7DNG7.js.map +7 -0
- package/dist/chunks/{chunk-I77YSUJN.js → chunk-INTEVQYK.js} +7 -3
- package/dist/chunks/{chunk-I77YSUJN.js.map → chunk-INTEVQYK.js.map} +2 -2
- package/dist/chunks/{chunk-VXTYD56F.js → chunk-JHQAIXM7.js} +9 -4
- package/dist/chunks/{chunk-VXTYD56F.js.map → chunk-JHQAIXM7.js.map} +2 -2
- package/dist/chunks/{chunk-2ADXL7KQ.js → chunk-MRHKJ2FZ.js} +63 -2
- package/dist/chunks/{chunk-2ADXL7KQ.js.map → chunk-MRHKJ2FZ.js.map} +3 -3
- package/dist/chunks/{chunk-HBBSETRF.js → chunk-OLXZNYZ4.js} +46 -6
- package/dist/chunks/chunk-OLXZNYZ4.js.map +7 -0
- package/dist/chunks/{chunk-IJ3WUM3T.js → chunk-R2AY6LRL.js} +35 -4
- package/dist/chunks/chunk-R2AY6LRL.js.map +7 -0
- package/dist/chunks/chunk-TIM4VBM4.js +98 -0
- package/dist/chunks/chunk-TIM4VBM4.js.map +7 -0
- package/dist/chunks/launcher-B5MGOPEQ.js +37 -0
- package/dist/chunks/launcher-B5MGOPEQ.js.map +7 -0
- package/dist/core/labels.d.ts +98 -0
- package/dist/core/launcher.d.ts +8 -0
- package/dist/core/lazy.d.ts +12 -0
- package/dist/core/types.d.ts +138 -2
- package/dist/element/index.d.ts +56 -0
- package/dist/element.js +146 -0
- package/dist/element.js.map +7 -0
- package/dist/extensions.js +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +25 -7
- package/dist/locales/index.d.ts +24 -0
- package/dist/locales.js +810 -0
- package/dist/locales.js.map +7 -0
- package/dist/qikbar.global.js +68 -25
- package/dist/qikbar.global.js.map +4 -4
- package/dist/react.js +8 -6
- package/dist/react.js.map +2 -2
- package/dist/server/index.d.ts +19 -0
- package/dist/server.js +38 -2
- package/dist/server.js.map +2 -2
- package/dist/solid/index.d.ts +42 -0
- package/dist/solid.js +93 -0
- package/dist/solid.js.map +7 -0
- package/dist/styles.css +34 -3
- package/dist/svelte/index.d.ts +58 -0
- package/dist/svelte.js +55 -0
- package/dist/svelte.js.map +7 -0
- package/dist/theme.js +1 -1
- package/dist/ui/bar.d.ts +89 -3
- package/dist/ui/icons.d.ts +5 -0
- package/dist/ui/markdown.d.ts +3 -1
- package/dist/ui/views.d.ts +8 -0
- package/dist/ui/webmcp.d.ts +33 -0
- package/dist/utils.js +1 -1
- package/dist/vue/index.d.ts +74 -0
- package/dist/vue.js +122 -0
- package/dist/vue.js.map +7 -0
- package/package.json +45 -4
- package/dist/chunks/bar-D5CSPT3U.js.map +0 -7
- package/dist/chunks/chunk-6TC6G2C5.js +0 -107
- package/dist/chunks/chunk-6TC6G2C5.js.map +0 -7
- package/dist/chunks/chunk-HBBSETRF.js.map +0 -7
- package/dist/chunks/chunk-IJ3WUM3T.js.map +0 -7
package/dist/react.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
createQikbar
|
|
4
|
-
} from "./chunks/chunk-
|
|
5
|
-
import "./chunks/chunk-
|
|
6
|
-
import "./chunks/chunk-2ADXL7KQ.js";
|
|
4
|
+
} from "./chunks/chunk-OLXZNYZ4.js";
|
|
5
|
+
import "./chunks/chunk-5FI7DNG7.js";
|
|
7
6
|
import "./chunks/chunk-N4Y2Z6YD.js";
|
|
8
|
-
import "./chunks/chunk-
|
|
7
|
+
import "./chunks/chunk-MRHKJ2FZ.js";
|
|
8
|
+
import "./chunks/chunk-INTEVQYK.js";
|
|
9
9
|
import "./chunks/chunk-YCVJQ7U3.js";
|
|
10
10
|
import {
|
|
11
11
|
formatHotkey,
|
|
12
12
|
isMac
|
|
13
13
|
} from "./chunks/chunk-PQEHV3D4.js";
|
|
14
|
+
import "./chunks/chunk-TIM4VBM4.js";
|
|
14
15
|
import "./chunks/chunk-MPTP2EWW.js";
|
|
15
16
|
|
|
16
17
|
// src/react/index.tsx
|
|
@@ -19,7 +20,7 @@ var QikbarContext = createContext(null), current = null, waiters = /* @__PURE__
|
|
|
19
20
|
function setCurrent(bar) {
|
|
20
21
|
if (current = bar, bar) for (let w of waiters) w(bar);
|
|
21
22
|
}
|
|
22
|
-
var useIsoLayoutEffect = typeof window > "u" ? useEffect : useLayoutEffect, FUNCTION_KEYS = ["navigate", "onOpen", "onClose", "onRun"];
|
|
23
|
+
var useIsoLayoutEffect = typeof window > "u" ? useEffect : useLayoutEffect, FUNCTION_KEYS = ["navigate", "onOpen", "onClose", "onRun", "onEvent"];
|
|
23
24
|
function Qikbar({ children, inline, className, style, onReady, ...config }) {
|
|
24
25
|
let [bar, setBar] = useState(null), containerRef = useRef(null), latest = useRef(config);
|
|
25
26
|
latest.current = config;
|
|
@@ -27,7 +28,8 @@ function Qikbar({ children, inline, className, style, onReady, ...config }) {
|
|
|
27
28
|
navigate: ((href, opts) => latest.current.navigate?.(href, opts)),
|
|
28
29
|
onOpen: () => latest.current.onOpen?.(),
|
|
29
30
|
onClose: () => latest.current.onClose?.(),
|
|
30
|
-
onRun: ((item, action) => latest.current.onRun?.(item, action))
|
|
31
|
+
onRun: ((item, action) => latest.current.onRun?.(item, action)),
|
|
32
|
+
onEvent: ((event) => latest.current.onEvent?.(event))
|
|
31
33
|
}).current, resolve = (c) => {
|
|
32
34
|
let out = { ...c };
|
|
33
35
|
for (let key of FUNCTION_KEYS) c[key] && (out[key] = stable[key]);
|
package/dist/react.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/react/index.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client'\n\nimport { createContext, createElement, useContext, useEffect, useLayoutEffect, useRef, useState, type CSSProperties, type DependencyList, type ReactNode } from 'react'\nimport { createQikbar } from '../index.js'\nimport { formatHotkey, isMac } from '../core/hotkeys.js'\nimport type { Command, Extension, Navigate, QikbarConfig, QikbarInstance, QikbarState, Source } from '../core/types.js'\n\nconst QikbarContext = createContext<QikbarInstance | null>(null)\n\n// The most recently mounted instance, so hooks work even outside <Qikbar>.\nlet current: QikbarInstance | null = null\nconst waiters = new Set<(bar: QikbarInstance) => void>()\n\nfunction setCurrent(bar: QikbarInstance | null) {\n current = bar\n if (bar) for (const w of waiters) w(bar)\n}\n\nconst useIsoLayoutEffect = typeof window === 'undefined' ? useEffect : useLayoutEffect\n\nconst FUNCTION_KEYS = ['navigate', 'onOpen', 'onClose', 'onRun'] as const\n\nexport interface QikbarProps extends Omit<QikbarConfig, 'inline'> {\n children?: ReactNode\n /** Render the bar inline (always open) where this component is placed. */\n inline?: boolean\n className?: string\n style?: CSSProperties\n /** Receive the instance once created. */\n onReady?: (bar: QikbarInstance) => void\n}\n\n/**\n * Mounts a command bar. Put it once near the root of your app.\n *\n * ```tsx\n * <Qikbar routes={routes} navigate={(href) => router.push(href)} />\n * ```\n */\nexport function Qikbar({ children, inline, className, style, onReady, ...config }: QikbarProps) {\n const [bar, setBar] = useState<QikbarInstance | null>(null)\n const containerRef = useRef<HTMLDivElement>(null)\n const latest = useRef(config)\n latest.current = config\n const applied = useRef<Partial<QikbarConfig>>({})\n\n // Stable wrappers so changing callbacks doesn't reconfigure the bar.\n const stable = useRef({\n navigate: ((href, opts) => latest.current.navigate?.(href, opts)) as Navigate,\n onOpen: () => latest.current.onOpen?.(),\n onClose: () => latest.current.onClose?.(),\n onRun: ((item, action) => latest.current.onRun?.(item, action)) as NonNullable<QikbarConfig['onRun']>,\n }).current\n\n const resolve = (c: Partial<QikbarConfig>) => {\n const out: Partial<QikbarConfig> = { ...c }\n for (const key of FUNCTION_KEYS) if (c[key]) (out as any)[key] = stable[key]\n return out\n }\n\n useIsoLayoutEffect(() => {\n const initial = resolve(latest.current)\n applied.current = initial\n const instance = createQikbar({ ...initial, inline: inline ? (containerRef.current ?? undefined) : undefined })\n setBar(instance)\n setCurrent(instance)\n onReady?.(instance)\n return () => {\n instance.destroy()\n if (current === instance) setCurrent(null)\n }\n }, [inline])\n\n // Push changed props into the running instance.\n useEffect(() => {\n if (!bar) return\n const next = resolve(config)\n const changed: Partial<QikbarConfig> = {}\n let dirty = false\n const keys = new Set([...Object.keys(next), ...Object.keys(applied.current)]) as Set<keyof QikbarConfig>\n for (const key of keys) {\n if (!Object.is(next[key], applied.current[key])) {\n ;(changed as any)[key] = next[key]\n dirty = true\n }\n }\n if (dirty) {\n applied.current = next\n bar.configure(changed)\n }\n })\n\n const content = createElement(QikbarContext.Provider, { value: bar }, children)\n if (!inline) return content\n return createElement('div', { ref: containerRef, className, style }, content)\n}\n\n/** Alias for `<Qikbar>` when used as a provider around your app. */\nexport const QikbarProvider = Qikbar\n\nfunction useInstance(): QikbarInstance | null {\n const fromContext = useContext(QikbarContext)\n const [fallback, setFallback] = useState<QikbarInstance | null>(() => current)\n useEffect(() => {\n if (fromContext) return\n if (current && current !== fallback) setFallback(current)\n const w = (b: QikbarInstance) => setFallback(b)\n waiters.add(w)\n return () => void waiters.delete(w)\n }, [fromContext])\n return fromContext ?? fallback\n}\n\nexport interface UseQikbar extends Omit<QikbarState, 'open'> {\n isOpen: boolean\n bar: QikbarInstance | null\n open: (options?: Parameters<QikbarInstance['open']>[0]) => void\n close: () => void\n toggle: () => void\n ask: (prompt?: string) => void\n}\n\n/** Control the bar and read its state. */\nexport function useQikbar(): UseQikbar {\n const bar = useInstance()\n const [state, setState] = useState<QikbarState>({ open: false, query: '', depth: 0, loading: false })\n useEffect(() => bar?.on('change', setState), [bar])\n const { open: isOpen, ...rest } = state\n return {\n ...rest,\n isOpen,\n bar,\n open: (o) => bar?.open(o),\n close: () => bar?.close(),\n toggle: () => bar?.toggle(),\n ask: (p) => bar?.ask(p),\n }\n}\n\n/**\n * Register commands while a component is mounted \u2014 great for page-specific actions.\n *\n * ```tsx\n * useCommands([{ title: 'Archive project', run: archive }], [archive])\n * ```\n */\nexport function useCommands(commands: Command[] | (() => Command[]), deps?: DependencyList) {\n const bar = useInstance()\n useEffect(() => {\n if (!bar) return\n return bar.register(typeof commands === 'function' ? commands() : commands)\n }, [bar, ...(deps ?? [commands])])\n}\n\n/** Add a dynamic search source while mounted. */\nexport function useSource(source: Source, deps?: DependencyList) {\n const bar = useInstance()\n useEffect(() => {\n if (!bar) return\n return bar.addSource(source)\n }, [bar, ...(deps ?? [source])])\n}\n\n/** Install an extension while mounted. */\nexport function useExtension(extension: Extension, preferences?: Record<string, any>, deps?: DependencyList) {\n const bar = useInstance()\n useEffect(() => {\n if (!bar) return\n return bar.use(extension, preferences)\n }, [bar, extension, ...(deps ?? [])])\n}\n\nexport interface QikbarTriggerProps {\n children?: ReactNode\n className?: string\n style?: CSSProperties\n /** Placeholder text. Default \"Search\u2026\". */\n label?: string\n /** Shortcut shown on the right. Default \"mod+k\". */\n shortcut?: string | false\n}\n\n/** A search-box style button that opens the bar. Unstyled except for a few defaults; pass `className`. */\nexport function QikbarTrigger({ children, className, style, label = 'Search\u2026', shortcut = 'mod+k' }: QikbarTriggerProps) {\n const { open } = useQikbar()\n const [keys, setKeys] = useState('')\n // Format after mount so server and client markup match (\u2318 vs Ctrl).\n useEffect(() => {\n setKeys(shortcut ? formatHotkey(shortcut).map((c) => c.join(isMac ? '' : ' ')).join(' ') : '')\n }, [shortcut])\n return createElement(\n 'button',\n { type: 'button', className, style, onClick: () => open(), 'aria-label': label, 'aria-haspopup': 'dialog' },\n children ?? [createElement('span', { key: 'l' }, label), keys ? createElement('kbd', { key: 'k', style: { marginLeft: 'auto' } }, keys) : null],\n )\n}\n\nexport type { QikbarConfig, QikbarInstance, QikbarState } from '../core/types.js'\n"],
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["'use client'\n\nimport { createContext, createElement, useContext, useEffect, useLayoutEffect, useRef, useState, type CSSProperties, type DependencyList, type ReactNode } from 'react'\nimport { createQikbar } from '../index.js'\nimport { formatHotkey, isMac } from '../core/hotkeys.js'\nimport type { Command, Extension, Navigate, QikbarConfig, QikbarInstance, QikbarState, Source } from '../core/types.js'\n\nconst QikbarContext = createContext<QikbarInstance | null>(null)\n\n// The most recently mounted instance, so hooks work even outside <Qikbar>.\nlet current: QikbarInstance | null = null\nconst waiters = new Set<(bar: QikbarInstance) => void>()\n\nfunction setCurrent(bar: QikbarInstance | null) {\n current = bar\n if (bar) for (const w of waiters) w(bar)\n}\n\nconst useIsoLayoutEffect = typeof window === 'undefined' ? useEffect : useLayoutEffect\n\nconst FUNCTION_KEYS = ['navigate', 'onOpen', 'onClose', 'onRun', 'onEvent'] as const\n\nexport interface QikbarProps extends Omit<QikbarConfig, 'inline'> {\n children?: ReactNode\n /** Render the bar inline (always open) where this component is placed. */\n inline?: boolean\n className?: string\n style?: CSSProperties\n /** Receive the instance once created. */\n onReady?: (bar: QikbarInstance) => void\n}\n\n/**\n * Mounts a command bar. Put it once near the root of your app.\n *\n * ```tsx\n * <Qikbar routes={routes} navigate={(href) => router.push(href)} />\n * ```\n */\nexport function Qikbar({ children, inline, className, style, onReady, ...config }: QikbarProps) {\n const [bar, setBar] = useState<QikbarInstance | null>(null)\n const containerRef = useRef<HTMLDivElement>(null)\n const latest = useRef(config)\n latest.current = config\n const applied = useRef<Partial<QikbarConfig>>({})\n\n // Stable wrappers so changing callbacks doesn't reconfigure the bar.\n const stable = useRef({\n navigate: ((href, opts) => latest.current.navigate?.(href, opts)) as Navigate,\n onOpen: () => latest.current.onOpen?.(),\n onClose: () => latest.current.onClose?.(),\n onRun: ((item, action) => latest.current.onRun?.(item, action)) as NonNullable<QikbarConfig['onRun']>,\n onEvent: ((event) => latest.current.onEvent?.(event)) as NonNullable<QikbarConfig['onEvent']>,\n }).current\n\n const resolve = (c: Partial<QikbarConfig>) => {\n const out: Partial<QikbarConfig> = { ...c }\n for (const key of FUNCTION_KEYS) if (c[key]) (out as any)[key] = stable[key]\n return out\n }\n\n useIsoLayoutEffect(() => {\n const initial = resolve(latest.current)\n applied.current = initial\n const instance = createQikbar({ ...initial, inline: inline ? (containerRef.current ?? undefined) : undefined })\n setBar(instance)\n setCurrent(instance)\n onReady?.(instance)\n return () => {\n instance.destroy()\n if (current === instance) setCurrent(null)\n }\n }, [inline])\n\n // Push changed props into the running instance.\n useEffect(() => {\n if (!bar) return\n const next = resolve(config)\n const changed: Partial<QikbarConfig> = {}\n let dirty = false\n const keys = new Set([...Object.keys(next), ...Object.keys(applied.current)]) as Set<keyof QikbarConfig>\n for (const key of keys) {\n if (!Object.is(next[key], applied.current[key])) {\n ;(changed as any)[key] = next[key]\n dirty = true\n }\n }\n if (dirty) {\n applied.current = next\n bar.configure(changed)\n }\n })\n\n const content = createElement(QikbarContext.Provider, { value: bar }, children)\n if (!inline) return content\n return createElement('div', { ref: containerRef, className, style }, content)\n}\n\n/** Alias for `<Qikbar>` when used as a provider around your app. */\nexport const QikbarProvider = Qikbar\n\nfunction useInstance(): QikbarInstance | null {\n const fromContext = useContext(QikbarContext)\n const [fallback, setFallback] = useState<QikbarInstance | null>(() => current)\n useEffect(() => {\n if (fromContext) return\n if (current && current !== fallback) setFallback(current)\n const w = (b: QikbarInstance) => setFallback(b)\n waiters.add(w)\n return () => void waiters.delete(w)\n }, [fromContext])\n return fromContext ?? fallback\n}\n\nexport interface UseQikbar extends Omit<QikbarState, 'open'> {\n isOpen: boolean\n bar: QikbarInstance | null\n open: (options?: Parameters<QikbarInstance['open']>[0]) => void\n close: () => void\n toggle: () => void\n ask: (prompt?: string) => void\n}\n\n/** Control the bar and read its state. */\nexport function useQikbar(): UseQikbar {\n const bar = useInstance()\n const [state, setState] = useState<QikbarState>({ open: false, query: '', depth: 0, loading: false })\n useEffect(() => bar?.on('change', setState), [bar])\n const { open: isOpen, ...rest } = state\n return {\n ...rest,\n isOpen,\n bar,\n open: (o) => bar?.open(o),\n close: () => bar?.close(),\n toggle: () => bar?.toggle(),\n ask: (p) => bar?.ask(p),\n }\n}\n\n/**\n * Register commands while a component is mounted \u2014 great for page-specific actions.\n *\n * ```tsx\n * useCommands([{ title: 'Archive project', run: archive }], [archive])\n * ```\n */\nexport function useCommands(commands: Command[] | (() => Command[]), deps?: DependencyList) {\n const bar = useInstance()\n useEffect(() => {\n if (!bar) return\n return bar.register(typeof commands === 'function' ? commands() : commands)\n }, [bar, ...(deps ?? [commands])])\n}\n\n/** Add a dynamic search source while mounted. */\nexport function useSource(source: Source, deps?: DependencyList) {\n const bar = useInstance()\n useEffect(() => {\n if (!bar) return\n return bar.addSource(source)\n }, [bar, ...(deps ?? [source])])\n}\n\n/** Install an extension while mounted. */\nexport function useExtension(extension: Extension, preferences?: Record<string, any>, deps?: DependencyList) {\n const bar = useInstance()\n useEffect(() => {\n if (!bar) return\n return bar.use(extension, preferences)\n }, [bar, extension, ...(deps ?? [])])\n}\n\nexport interface QikbarTriggerProps {\n children?: ReactNode\n className?: string\n style?: CSSProperties\n /** Placeholder text. Default \"Search\u2026\". */\n label?: string\n /** Shortcut shown on the right. Default \"mod+k\". */\n shortcut?: string | false\n}\n\n/** A search-box style button that opens the bar. Unstyled except for a few defaults; pass `className`. */\nexport function QikbarTrigger({ children, className, style, label = 'Search\u2026', shortcut = 'mod+k' }: QikbarTriggerProps) {\n const { open } = useQikbar()\n const [keys, setKeys] = useState('')\n // Format after mount so server and client markup match (\u2318 vs Ctrl).\n useEffect(() => {\n setKeys(shortcut ? formatHotkey(shortcut).map((c) => c.join(isMac ? '' : ' ')).join(' ') : '')\n }, [shortcut])\n return createElement(\n 'button',\n { type: 'button', className, style, onClick: () => open(), 'aria-label': label, 'aria-haspopup': 'dialog' },\n children ?? [createElement('span', { key: 'l' }, label), keys ? createElement('kbd', { key: 'k', style: { marginLeft: 'auto' } }, keys) : null],\n )\n}\n\nexport type { QikbarConfig, QikbarInstance, QikbarState } from '../core/types.js'\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAEA,SAAS,eAAe,eAAe,YAAY,WAAW,iBAAiB,QAAQ,gBAAyE;AAKhK,IAAM,gBAAgB,cAAqC,IAAI,GAG3D,UAAiC,MAC/B,UAAU,oBAAI,IAAmC;AAEvD,SAAS,WAAW,KAA4B;AAE9C,MADA,UAAU,KACN,IAAK,UAAW,KAAK,QAAS,GAAE,GAAG;AACzC;AAEA,IAAM,qBAAqB,OAAO,SAAW,MAAc,YAAY,iBAEjE,gBAAgB,CAAC,YAAY,UAAU,WAAW,SAAS,SAAS;AAmBnE,SAAS,OAAO,EAAE,UAAU,QAAQ,WAAW,OAAO,SAAS,GAAG,OAAO,GAAgB;AAC9F,MAAM,CAAC,KAAK,MAAM,IAAI,SAAgC,IAAI,GACpD,eAAe,OAAuB,IAAI,GAC1C,SAAS,OAAO,MAAM;AAC5B,SAAO,UAAU;AACjB,MAAM,UAAU,OAA8B,CAAC,CAAC,GAG1C,SAAS,OAAO;AAAA,IACpB,WAAW,CAAC,MAAM,SAAS,OAAO,QAAQ,WAAW,MAAM,IAAI;AAAA,IAC/D,QAAQ,MAAM,OAAO,QAAQ,SAAS;AAAA,IACtC,SAAS,MAAM,OAAO,QAAQ,UAAU;AAAA,IACxC,QAAQ,CAAC,MAAM,WAAW,OAAO,QAAQ,QAAQ,MAAM,MAAM;AAAA,IAC7D,UAAU,CAAC,UAAU,OAAO,QAAQ,UAAU,KAAK;AAAA,EACrD,CAAC,EAAE,SAEG,UAAU,CAAC,MAA6B;AAC5C,QAAM,MAA6B,EAAE,GAAG,EAAE;AAC1C,aAAW,OAAO,cAAe,CAAI,EAAE,GAA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AAE,UAAU,WAAW,OAAO,QAAQ,gBAAW,WAAW,QAAQ,GAAuB;AACvH,MAAM,EAAE,KAAK,IAAI,UAAU,GACrB,CAAC,MAAM,OAAO,IAAI,SAAS,EAAE;AAEnC,mBAAU,MAAM;AACd,YAAQ,WAAW,aAAa,QAAQ,EAAE,IAAI,CAAC,MAAM,EAAE,KAAK,QAAQ,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,EAAE;AAAA,EAC/F,GAAG,CAAC,QAAQ,CAAC,GACN;AAAA,IACL;AAAA,IACA,EAAE,MAAM,UAAU,WAAW,OAAO,SAAS,MAAM,KAAK,GAAG,cAAc,OAAO,iBAAiB,SAAS;AAAA,IAC1G,YAAY,CAAC,cAAc,QAAQ,EAAE,KAAK,IAAI,GAAG,KAAK,GAAG,OAAO,cAAc,OAAO,EAAE,KAAK,KAAK,OAAO,EAAE,YAAY,OAAO,EAAE,GAAG,IAAI,IAAI,IAAI;AAAA,EAChJ;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/server/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import type { AIProvider } from '../core/types.js';
|
|
10
10
|
export { anthropic, gemini, ollama, openai, openaiCompatible } from '../ai/providers.js';
|
|
11
|
+
export { geminiEmbeddings, ollamaEmbeddings, openaiEmbeddings } from '../ai/embeddings.js';
|
|
11
12
|
export interface HandlerOptions {
|
|
12
13
|
provider: AIProvider;
|
|
13
14
|
/** Server-side system prompt, prepended to the client's. */
|
|
@@ -29,6 +30,24 @@ export interface HandlerOptions {
|
|
|
29
30
|
}
|
|
30
31
|
/** Create a `(request: Request) => Promise<Response>` handler. */
|
|
31
32
|
export declare function createHandler(options: HandlerOptions): (request: Request) => Promise<Response>;
|
|
33
|
+
export interface EmbeddingsHandlerOptions {
|
|
34
|
+
/** Turn texts into vectors, e.g. `openaiEmbeddings({ apiKey: process.env.OPENAI_API_KEY })`. */
|
|
35
|
+
embed: (texts: string[], options: {
|
|
36
|
+
signal: AbortSignal;
|
|
37
|
+
}) => Promise<number[][]>;
|
|
38
|
+
/** Return false (or a Response) to reject a request. */
|
|
39
|
+
authorize?: (request: Request) => boolean | Response | Promise<boolean | Response>;
|
|
40
|
+
/** Max texts per request. Default 256. */
|
|
41
|
+
maxTexts?: number;
|
|
42
|
+
/** Max total characters per request. Default 100 000. */
|
|
43
|
+
maxChars?: number;
|
|
44
|
+
headers?: Record<string, string>;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* A `(request) => Response` endpoint for `proxyEmbeddings()`, so semantic search
|
|
48
|
+
* works without exposing an API key. Accepts `{ texts: string[] }`, returns `{ embeddings }`.
|
|
49
|
+
*/
|
|
50
|
+
export declare function createEmbeddingsHandler(options: EmbeddingsHandlerOptions): (request: Request) => Promise<Response>;
|
|
32
51
|
/** The subset of Node's IncomingMessage used here (kept structural so consumers don't need @types/node). */
|
|
33
52
|
interface NodeReq extends AsyncIterable<Uint8Array | string> {
|
|
34
53
|
method?: string;
|
package/dist/server.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
anthropic,
|
|
3
3
|
gemini,
|
|
4
|
+
geminiEmbeddings,
|
|
4
5
|
ollama,
|
|
6
|
+
ollamaEmbeddings,
|
|
5
7
|
openai,
|
|
6
|
-
openaiCompatible
|
|
7
|
-
|
|
8
|
+
openaiCompatible,
|
|
9
|
+
openaiEmbeddings
|
|
10
|
+
} from "./chunks/chunk-MRHKJ2FZ.js";
|
|
8
11
|
import "./chunks/chunk-MPTP2EWW.js";
|
|
9
12
|
|
|
10
13
|
// src/server/index.ts
|
|
@@ -52,6 +55,35 @@ function createHandler(options) {
|
|
|
52
55
|
});
|
|
53
56
|
};
|
|
54
57
|
}
|
|
58
|
+
function createEmbeddingsHandler(options) {
|
|
59
|
+
let maxTexts = options.maxTexts ?? 256, maxChars = options.maxChars ?? 1e5;
|
|
60
|
+
return async function(request) {
|
|
61
|
+
let headers = options.headers ?? {};
|
|
62
|
+
if (request.method === "OPTIONS") return new Response(null, { status: 204, headers });
|
|
63
|
+
if (request.method !== "POST") return json(405, "Method not allowed", headers);
|
|
64
|
+
if (options.authorize) {
|
|
65
|
+
let ok = await options.authorize(request);
|
|
66
|
+
if (ok instanceof Response) return ok;
|
|
67
|
+
if (!ok) return json(401, "Unauthorized", headers);
|
|
68
|
+
}
|
|
69
|
+
let body;
|
|
70
|
+
try {
|
|
71
|
+
body = await request.json();
|
|
72
|
+
} catch {
|
|
73
|
+
return json(400, "Invalid JSON", headers);
|
|
74
|
+
}
|
|
75
|
+
let texts = body.texts;
|
|
76
|
+
if (!Array.isArray(texts) || !texts.length || texts.some((t) => typeof t != "string")) return json(400, "Expected { texts: string[] }", headers);
|
|
77
|
+
if (texts.length > maxTexts) return json(413, "Too many texts", headers);
|
|
78
|
+
if (texts.reduce((n, t) => n + t.length, 0) > maxChars) return json(413, "Request too large", headers);
|
|
79
|
+
try {
|
|
80
|
+
let embeddings = await options.embed(texts, { signal: request.signal ?? new AbortController().signal });
|
|
81
|
+
return new Response(JSON.stringify({ embeddings }), { headers: { "content-type": "application/json", "cache-control": "no-store", ...headers } });
|
|
82
|
+
} catch (err) {
|
|
83
|
+
return json(502, err instanceof Error ? err.message : "Embedding failed", headers);
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
}
|
|
55
87
|
function toNodeHandler(handler) {
|
|
56
88
|
return async (req, res) => {
|
|
57
89
|
let controller = new AbortController();
|
|
@@ -83,11 +115,15 @@ function toNodeHandler(handler) {
|
|
|
83
115
|
}
|
|
84
116
|
export {
|
|
85
117
|
anthropic,
|
|
118
|
+
createEmbeddingsHandler,
|
|
86
119
|
createHandler,
|
|
87
120
|
gemini,
|
|
121
|
+
geminiEmbeddings,
|
|
88
122
|
ollama,
|
|
123
|
+
ollamaEmbeddings,
|
|
89
124
|
openai,
|
|
90
125
|
openaiCompatible,
|
|
126
|
+
openaiEmbeddings,
|
|
91
127
|
toNodeHandler
|
|
92
128
|
};
|
|
93
129
|
//# sourceMappingURL=server.js.map
|
package/dist/server.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/server/index.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Server-side AI handler. Keeps your API key on the server and streams\n * normalized events to the `proxy()` provider in the browser.\n *\n * Works anywhere with Web `Request`/`Response`: Next.js route handlers,\n * Remix/React Router, SvelteKit, Astro, Hono, Bun, Deno, Cloudflare Workers.\n * Use `toNodeHandler()` for Express or `node:http`.\n */\n\nimport type { AIEvent, AIMessage, AIProvider, AIToolDefinition } from '../core/types.js'\n\nexport { anthropic, gemini, ollama, openai, openaiCompatible } from '../ai/providers.js'\n\nexport interface HandlerOptions {\n provider: AIProvider\n /** Server-side system prompt, prepended to the client's. */\n system?: string\n /** Accept the system prompt sent by the bar (page title, command list\u2026). Default true. */\n allowClientSystem?: boolean\n /** Accept tool definitions from the bar. Default true. */\n allowTools?: boolean\n /** Return false (or a Response) to reject a request \u2014 check sessions, rate limits, etc. */\n authorize?: (request: Request) => boolean | Response | Promise<boolean | Response>\n /** Max messages per request. Default 50. */\n maxMessages?: number\n /** Max total characters per request. Default 200 000. */\n maxChars?: number\n /** Cap on output tokens. */\n maxTokens?: number\n /** Extra response headers (e.g. CORS). */\n headers?: Record<string, string>\n}\n\ninterface Body {\n messages?: AIMessage[]\n system?: string\n tools?: AIToolDefinition[]\n maxTokens?: number\n}\n\nconst json = (status: number, error: string, headers: Record<string, string> = {}) =>\n new Response(JSON.stringify({ error }), { status, headers: { 'content-type': 'application/json', ...headers } })\n\n/** Create a `(request: Request) => Promise<Response>` handler. */\nexport function createHandler(options: HandlerOptions) {\n const maxMessages = options.maxMessages ?? 50\n const maxChars = options.maxChars ?? 200_000\n return async function handler(request: Request): Promise<Response> {\n const headers = options.headers ?? {}\n if (request.method === 'OPTIONS') return new Response(null, { status: 204, headers })\n if (request.method !== 'POST') return json(405, 'Method not allowed', headers)\n if (options.authorize) {\n const ok = await options.authorize(request)\n if (ok instanceof Response) return ok\n if (!ok) return json(401, 'Unauthorized', headers)\n }\n let body: Body\n try {\n body = (await request.json()) as Body\n } catch {\n return json(400, 'Invalid JSON', headers)\n }\n const messages = Array.isArray(body.messages) ? body.messages : []\n if (!messages.length) return json(400, 'No messages', headers)\n if (messages.length > maxMessages) return json(413, 'Too many messages', headers)\n if (JSON.stringify(body).length > maxChars) return json(413, 'Request too large', headers)\n for (const m of messages) {\n if (!m || !['user', 'assistant', 'tool'].includes(m.role) || typeof m.content !== 'string') return json(400, 'Invalid message', headers)\n }\n const system = [options.system, options.allowClientSystem === false ? undefined : body.system].filter(Boolean).join('\\n\\n') || undefined\n const tools = options.allowTools === false ? undefined : body.tools?.slice(0, 64)\n const maxTokens = Math.min(body.maxTokens ?? options.maxTokens ?? 16000, options.maxTokens ?? Number.POSITIVE_INFINITY)\n\n const encoder = new TextEncoder()\n const stream = new ReadableStream<Uint8Array>({\n async start(controller) {\n const send = (event: AIEvent) => controller.enqueue(encoder.encode(`${JSON.stringify(event)}\\n`))\n try {\n for await (const event of options.provider.stream({ messages, system, tools, maxTokens, signal: request.signal })) send(event)\n } catch (err) {\n if (!request.signal?.aborted) send({ type: 'error', error: err instanceof Error ? err.message : 'AI request failed' })\n } finally {\n controller.close()\n }\n },\n })\n return new Response(stream, {\n headers: { 'content-type': 'application/x-ndjson; charset=utf-8', 'cache-control': 'no-store', 'x-accel-buffering': 'no', ...headers },\n })\n }\n}\n\n/** The subset of Node's IncomingMessage used here (kept structural so consumers don't need @types/node). */\ninterface NodeReq extends AsyncIterable<Uint8Array | string> {\n method?: string\n url?: string\n headers: Record<string, string | string[] | undefined>\n body?: unknown\n}\n\n/** The subset of Node's ServerResponse used here. */\ninterface NodeRes {\n on(event: 'close', listener: () => void): unknown\n writeHead(status: number, headers: Record<string, string>): unknown\n write(chunk: Uint8Array): unknown\n end(): unknown\n}\n\n/** Adapt a Web handler to Node's `(req, res)` signature (Express, Fastify raw, node:http). */\nexport function toNodeHandler(handler: (request: Request) => Promise<Response>) {\n return async (req: NodeReq, res: NodeRes) => {\n const controller = new AbortController()\n res.on('close', () => controller.abort())\n let body: string | undefined\n if (req.body !== undefined) body = typeof req.body === 'string' ? req.body : JSON.stringify(req.body)\n else {\n const decoder = new TextDecoder()\n let text = ''\n for await (const chunk of req) text += typeof chunk === 'string' ? chunk : decoder.decode(chunk, { stream: true })\n body = text + decoder.decode()\n }\n const url = `http://${req.headers.host ?? 'localhost'}${req.url ?? '/'}`\n const response = await handler(\n new Request(url, {\n method: req.method,\n headers: Object.entries(req.headers).flatMap(([k, v]) => (v == null ? [] : Array.isArray(v) ? v.map((x) => [k, x] as [string, string]) : [[k, v] as [string, string]])),\n body: req.method === 'GET' || req.method === 'HEAD' ? undefined : body,\n signal: controller.signal,\n }),\n )\n res.writeHead(response.status, Object.fromEntries(response.headers))\n if (!response.body) return res.end()\n const reader = response.body.getReader()\n for (;;) {\n const { value, done } = await reader.read()\n if (done) break\n res.write(value)\n }\n res.end()\n }\n}\n"],
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["/**\n * Server-side AI handler. Keeps your API key on the server and streams\n * normalized events to the `proxy()` provider in the browser.\n *\n * Works anywhere with Web `Request`/`Response`: Next.js route handlers,\n * Remix/React Router, SvelteKit, Astro, Hono, Bun, Deno, Cloudflare Workers.\n * Use `toNodeHandler()` for Express or `node:http`.\n */\n\nimport type { AIEvent, AIMessage, AIProvider, AIToolDefinition } from '../core/types.js'\n\nexport { anthropic, gemini, ollama, openai, openaiCompatible } from '../ai/providers.js'\nexport { geminiEmbeddings, ollamaEmbeddings, openaiEmbeddings } from '../ai/embeddings.js'\n\nexport interface HandlerOptions {\n provider: AIProvider\n /** Server-side system prompt, prepended to the client's. */\n system?: string\n /** Accept the system prompt sent by the bar (page title, command list\u2026). Default true. */\n allowClientSystem?: boolean\n /** Accept tool definitions from the bar. Default true. */\n allowTools?: boolean\n /** Return false (or a Response) to reject a request \u2014 check sessions, rate limits, etc. */\n authorize?: (request: Request) => boolean | Response | Promise<boolean | Response>\n /** Max messages per request. Default 50. */\n maxMessages?: number\n /** Max total characters per request. Default 200 000. */\n maxChars?: number\n /** Cap on output tokens. */\n maxTokens?: number\n /** Extra response headers (e.g. CORS). */\n headers?: Record<string, string>\n}\n\ninterface Body {\n messages?: AIMessage[]\n system?: string\n tools?: AIToolDefinition[]\n maxTokens?: number\n}\n\nconst json = (status: number, error: string, headers: Record<string, string> = {}) =>\n new Response(JSON.stringify({ error }), { status, headers: { 'content-type': 'application/json', ...headers } })\n\n/** Create a `(request: Request) => Promise<Response>` handler. */\nexport function createHandler(options: HandlerOptions) {\n const maxMessages = options.maxMessages ?? 50\n const maxChars = options.maxChars ?? 200_000\n return async function handler(request: Request): Promise<Response> {\n const headers = options.headers ?? {}\n if (request.method === 'OPTIONS') return new Response(null, { status: 204, headers })\n if (request.method !== 'POST') return json(405, 'Method not allowed', headers)\n if (options.authorize) {\n const ok = await options.authorize(request)\n if (ok instanceof Response) return ok\n if (!ok) return json(401, 'Unauthorized', headers)\n }\n let body: Body\n try {\n body = (await request.json()) as Body\n } catch {\n return json(400, 'Invalid JSON', headers)\n }\n const messages = Array.isArray(body.messages) ? body.messages : []\n if (!messages.length) return json(400, 'No messages', headers)\n if (messages.length > maxMessages) return json(413, 'Too many messages', headers)\n if (JSON.stringify(body).length > maxChars) return json(413, 'Request too large', headers)\n for (const m of messages) {\n if (!m || !['user', 'assistant', 'tool'].includes(m.role) || typeof m.content !== 'string') return json(400, 'Invalid message', headers)\n }\n const system = [options.system, options.allowClientSystem === false ? undefined : body.system].filter(Boolean).join('\\n\\n') || undefined\n const tools = options.allowTools === false ? undefined : body.tools?.slice(0, 64)\n const maxTokens = Math.min(body.maxTokens ?? options.maxTokens ?? 16000, options.maxTokens ?? Number.POSITIVE_INFINITY)\n\n const encoder = new TextEncoder()\n const stream = new ReadableStream<Uint8Array>({\n async start(controller) {\n const send = (event: AIEvent) => controller.enqueue(encoder.encode(`${JSON.stringify(event)}\\n`))\n try {\n for await (const event of options.provider.stream({ messages, system, tools, maxTokens, signal: request.signal })) send(event)\n } catch (err) {\n if (!request.signal?.aborted) send({ type: 'error', error: err instanceof Error ? err.message : 'AI request failed' })\n } finally {\n controller.close()\n }\n },\n })\n return new Response(stream, {\n headers: { 'content-type': 'application/x-ndjson; charset=utf-8', 'cache-control': 'no-store', 'x-accel-buffering': 'no', ...headers },\n })\n }\n}\n\nexport interface EmbeddingsHandlerOptions {\n /** Turn texts into vectors, e.g. `openaiEmbeddings({ apiKey: process.env.OPENAI_API_KEY })`. */\n embed: (texts: string[], options: { signal: AbortSignal }) => Promise<number[][]>\n /** Return false (or a Response) to reject a request. */\n authorize?: (request: Request) => boolean | Response | Promise<boolean | Response>\n /** Max texts per request. Default 256. */\n maxTexts?: number\n /** Max total characters per request. Default 100 000. */\n maxChars?: number\n headers?: Record<string, string>\n}\n\n/**\n * A `(request) => Response` endpoint for `proxyEmbeddings()`, so semantic search\n * works without exposing an API key. Accepts `{ texts: string[] }`, returns `{ embeddings }`.\n */\nexport function createEmbeddingsHandler(options: EmbeddingsHandlerOptions) {\n const maxTexts = options.maxTexts ?? 256\n const maxChars = options.maxChars ?? 100_000\n return async function handler(request: Request): Promise<Response> {\n const headers = options.headers ?? {}\n if (request.method === 'OPTIONS') return new Response(null, { status: 204, headers })\n if (request.method !== 'POST') return json(405, 'Method not allowed', headers)\n if (options.authorize) {\n const ok = await options.authorize(request)\n if (ok instanceof Response) return ok\n if (!ok) return json(401, 'Unauthorized', headers)\n }\n let body: { texts?: unknown }\n try {\n body = (await request.json()) as { texts?: unknown }\n } catch {\n return json(400, 'Invalid JSON', headers)\n }\n const texts = body.texts\n if (!Array.isArray(texts) || !texts.length || texts.some((t) => typeof t !== 'string')) return json(400, 'Expected { texts: string[] }', headers)\n if (texts.length > maxTexts) return json(413, 'Too many texts', headers)\n if ((texts as string[]).reduce((n, t) => n + t.length, 0) > maxChars) return json(413, 'Request too large', headers)\n try {\n const embeddings = await options.embed(texts as string[], { signal: request.signal ?? new AbortController().signal })\n return new Response(JSON.stringify({ embeddings }), { headers: { 'content-type': 'application/json', 'cache-control': 'no-store', ...headers } })\n } catch (err) {\n return json(502, err instanceof Error ? err.message : 'Embedding failed', headers)\n }\n }\n}\n\n/** The subset of Node's IncomingMessage used here (kept structural so consumers don't need @types/node). */\ninterface NodeReq extends AsyncIterable<Uint8Array | string> {\n method?: string\n url?: string\n headers: Record<string, string | string[] | undefined>\n body?: unknown\n}\n\n/** The subset of Node's ServerResponse used here. */\ninterface NodeRes {\n on(event: 'close', listener: () => void): unknown\n writeHead(status: number, headers: Record<string, string>): unknown\n write(chunk: Uint8Array): unknown\n end(): unknown\n}\n\n/** Adapt a Web handler to Node's `(req, res)` signature (Express, Fastify raw, node:http). */\nexport function toNodeHandler(handler: (request: Request) => Promise<Response>) {\n return async (req: NodeReq, res: NodeRes) => {\n const controller = new AbortController()\n res.on('close', () => controller.abort())\n let body: string | undefined\n if (req.body !== undefined) body = typeof req.body === 'string' ? req.body : JSON.stringify(req.body)\n else {\n const decoder = new TextDecoder()\n let text = ''\n for await (const chunk of req) text += typeof chunk === 'string' ? chunk : decoder.decode(chunk, { stream: true })\n body = text + decoder.decode()\n }\n const url = `http://${req.headers.host ?? 'localhost'}${req.url ?? '/'}`\n const response = await handler(\n new Request(url, {\n method: req.method,\n headers: Object.entries(req.headers).flatMap(([k, v]) => (v == null ? [] : Array.isArray(v) ? v.map((x) => [k, x] as [string, string]) : [[k, v] as [string, string]])),\n body: req.method === 'GET' || req.method === 'HEAD' ? undefined : body,\n signal: controller.signal,\n }),\n )\n res.writeHead(response.status, Object.fromEntries(response.headers))\n if (!response.body) return res.end()\n const reader = response.body.getReader()\n for (;;) {\n const { value, done } = await reader.read()\n if (done) break\n res.write(value)\n }\n res.end()\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;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
|
|
7
|
+
*
|
|
8
|
+
* <QikbarProvider config={{ routes, navigate: (href) => navigate(href) }}>
|
|
9
|
+
* <App />
|
|
10
|
+
* </QikbarProvider>
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
import { type Accessor, type JSX } from 'solid-js';
|
|
14
|
+
import type { Command, Extension, QikbarConfig, QikbarInstance, QikbarState, Source } from '../core/types.js';
|
|
15
|
+
/**
|
|
16
|
+
* Create a bar owned by the current reactive scope (destroyed on cleanup).
|
|
17
|
+
* Pass an accessor to apply config changes live.
|
|
18
|
+
*/
|
|
19
|
+
export declare function createQikbar(config?: QikbarConfig | Accessor<QikbarConfig>): QikbarInstance;
|
|
20
|
+
/** Provide a bar to the components below. */
|
|
21
|
+
export declare function QikbarProvider(props: {
|
|
22
|
+
config?: QikbarConfig;
|
|
23
|
+
children?: JSX.Element;
|
|
24
|
+
}): JSX.Element;
|
|
25
|
+
/** Read the bar's state reactively and control it. */
|
|
26
|
+
export declare function useQikbar(): {
|
|
27
|
+
bar: Accessor<QikbarInstance | null>;
|
|
28
|
+
state: Accessor<QikbarState>;
|
|
29
|
+
open: (o?: Parameters<QikbarInstance["open"]>[0]) => void | undefined;
|
|
30
|
+
close: () => void | undefined;
|
|
31
|
+
toggle: () => void | undefined;
|
|
32
|
+
ask: (p?: string) => void | undefined;
|
|
33
|
+
};
|
|
34
|
+
/** Register commands while the owner is alive. Pass an accessor to re-register on change. */
|
|
35
|
+
export declare function useCommands(commands: Command[] | Accessor<Command[]>): void;
|
|
36
|
+
/** Add a search source while the owner is alive. */
|
|
37
|
+
export declare function useSource(source: Source): void;
|
|
38
|
+
/** Install an extension while the owner is alive. */
|
|
39
|
+
export declare function useExtension(extension: Extension, preferences?: Record<string, any>): void;
|
|
40
|
+
/** Render an inline bar into an element: `<div ref={inlineQikbar({ commands })} />`. */
|
|
41
|
+
export declare function inlineQikbar(config?: QikbarConfig): (el: HTMLElement) => void;
|
|
42
|
+
export type { QikbarConfig, QikbarInstance, QikbarState } from '../core/types.js';
|
package/dist/solid.js
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createQikbar
|
|
3
|
+
} from "./chunks/chunk-OLXZNYZ4.js";
|
|
4
|
+
import "./chunks/chunk-5FI7DNG7.js";
|
|
5
|
+
import "./chunks/chunk-N4Y2Z6YD.js";
|
|
6
|
+
import "./chunks/chunk-MRHKJ2FZ.js";
|
|
7
|
+
import "./chunks/chunk-INTEVQYK.js";
|
|
8
|
+
import "./chunks/chunk-YCVJQ7U3.js";
|
|
9
|
+
import "./chunks/chunk-PQEHV3D4.js";
|
|
10
|
+
import "./chunks/chunk-TIM4VBM4.js";
|
|
11
|
+
import "./chunks/chunk-MPTP2EWW.js";
|
|
12
|
+
|
|
13
|
+
// src/solid/index.ts
|
|
14
|
+
import { createComponent, createContext, createEffect, createSignal, on, onCleanup, onMount, untrack, useContext } from "solid-js";
|
|
15
|
+
var QikbarContext = createContext(), [current, setCurrent] = createSignal(null);
|
|
16
|
+
function createQikbar2(config = {}) {
|
|
17
|
+
let read = typeof config == "function" ? config : () => config, applied = untrack(read), bar = createQikbar(applied);
|
|
18
|
+
return setCurrent(bar), typeof config == "function" && createEffect(
|
|
19
|
+
on(read, (next) => {
|
|
20
|
+
let changed = {}, dirty = !1;
|
|
21
|
+
for (let key of /* @__PURE__ */ new Set([...Object.keys(next), ...Object.keys(applied)]))
|
|
22
|
+
Object.is(next[key], applied[key]) || (changed[key] = next[key], dirty = !0);
|
|
23
|
+
applied = next, dirty && bar.configure(changed);
|
|
24
|
+
}, { defer: !0 })
|
|
25
|
+
), onCleanup(() => {
|
|
26
|
+
bar.destroy(), current() === bar && setCurrent(null);
|
|
27
|
+
}), bar;
|
|
28
|
+
}
|
|
29
|
+
function QikbarProvider(props) {
|
|
30
|
+
let bar = createQikbar2(() => props.config ?? {});
|
|
31
|
+
return createComponent(QikbarContext.Provider, {
|
|
32
|
+
value: () => bar,
|
|
33
|
+
get children() {
|
|
34
|
+
return props.children;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
function useInstance() {
|
|
39
|
+
return useContext(QikbarContext) ?? current;
|
|
40
|
+
}
|
|
41
|
+
function useQikbar() {
|
|
42
|
+
let bar = useInstance(), [state, setState] = createSignal({ open: !1, query: "", depth: 0, loading: !1 });
|
|
43
|
+
return createEffect(() => {
|
|
44
|
+
let b = bar();
|
|
45
|
+
b && onCleanup(b.on("change", setState));
|
|
46
|
+
}), {
|
|
47
|
+
bar,
|
|
48
|
+
state,
|
|
49
|
+
open: (o) => bar()?.open(o),
|
|
50
|
+
close: () => bar()?.close(),
|
|
51
|
+
toggle: () => bar()?.toggle(),
|
|
52
|
+
ask: (p) => bar()?.ask(p)
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function useCommands(commands) {
|
|
56
|
+
let bar = useInstance();
|
|
57
|
+
createEffect(() => {
|
|
58
|
+
let b = bar(), list = typeof commands == "function" ? commands() : commands;
|
|
59
|
+
b && onCleanup(b.register(list));
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
function useSource(source) {
|
|
63
|
+
let bar = useInstance();
|
|
64
|
+
createEffect(() => {
|
|
65
|
+
let b = bar();
|
|
66
|
+
b && onCleanup(b.addSource(source));
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
function useExtension(extension, preferences) {
|
|
70
|
+
let bar = useInstance();
|
|
71
|
+
createEffect(() => {
|
|
72
|
+
let b = bar();
|
|
73
|
+
b && onCleanup(b.use(extension, preferences));
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
function inlineQikbar(config = {}) {
|
|
77
|
+
return (el) => {
|
|
78
|
+
onMount(() => {
|
|
79
|
+
let bar = createQikbar({ ...config, inline: el });
|
|
80
|
+
onCleanup(() => bar.destroy());
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
export {
|
|
85
|
+
QikbarProvider,
|
|
86
|
+
createQikbar2 as createQikbar,
|
|
87
|
+
inlineQikbar,
|
|
88
|
+
useCommands,
|
|
89
|
+
useExtension,
|
|
90
|
+
useQikbar,
|
|
91
|
+
useSource
|
|
92
|
+
};
|
|
93
|
+
//# sourceMappingURL=solid.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/solid/index.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * SolidJS bindings.\n *\n * ```tsx\n * import { QikbarProvider, useCommands } from '@qikbar/qikbar/solid'\n * import { useNavigate } from '@solidjs/router'\n *\n * <QikbarProvider config={{ routes, navigate: (href) => navigate(href) }}>\n * <App />\n * </QikbarProvider>\n * ```\n */\n\nimport { createComponent, createContext, createEffect, createSignal, on, onCleanup, onMount, untrack, useContext, type Accessor, type JSX } from 'solid-js'\nimport { createQikbar as create } from '../index.js'\nimport type { Command, Extension, QikbarConfig, QikbarInstance, QikbarState, Source } from '../core/types.js'\n\nconst QikbarContext = createContext<Accessor<QikbarInstance | null>>()\n\n// The most recently created instance, for primitives used outside the provider.\nconst [current, setCurrent] = createSignal<QikbarInstance | null>(null)\n\n/**\n * Create a bar owned by the current reactive scope (destroyed on cleanup).\n * Pass an accessor to apply config changes live.\n */\nexport function createQikbar(config: QikbarConfig | Accessor<QikbarConfig> = {}): QikbarInstance {\n const read = typeof config === 'function' ? config : () => config\n let applied = untrack(read)\n const bar = create(applied)\n setCurrent(bar)\n if (typeof config === 'function') {\n createEffect(\n on(read, (next) => {\n const changed: Partial<QikbarConfig> = {}\n let dirty = false\n for (const key of new Set([...Object.keys(next), ...Object.keys(applied)]) as Set<keyof QikbarConfig>) {\n if (!Object.is(next[key], applied[key])) {\n ;(changed as any)[key] = next[key]\n dirty = true\n }\n }\n applied = next\n if (dirty) bar.configure(changed)\n }, { defer: true }),\n )\n }\n onCleanup(() => {\n bar.destroy()\n if (current() === bar) setCurrent(null)\n })\n return bar\n}\n\n/** Provide a bar to the components below. */\nexport function QikbarProvider(props: { config?: QikbarConfig; children?: JSX.Element }): JSX.Element {\n const bar = createQikbar(() => props.config ?? {})\n return createComponent(QikbarContext.Provider, {\n value: () => bar,\n get children() {\n return props.children\n },\n })\n}\n\nfunction useInstance(): Accessor<QikbarInstance | null> {\n return useContext(QikbarContext) ?? current\n}\n\n/** Read the bar's state reactively and control it. */\nexport function useQikbar() {\n const bar = useInstance()\n const [state, setState] = createSignal<QikbarState>({ open: false, query: '', depth: 0, loading: false })\n createEffect(() => {\n const b = bar()\n if (!b) return\n onCleanup(b.on('change', setState))\n })\n return {\n bar,\n state,\n open: (o?: Parameters<QikbarInstance['open']>[0]) => bar()?.open(o),\n close: () => bar()?.close(),\n toggle: () => bar()?.toggle(),\n ask: (p?: string) => bar()?.ask(p),\n }\n}\n\n/** Register commands while the owner is alive. Pass an accessor to re-register on change. */\nexport function useCommands(commands: Command[] | Accessor<Command[]>) {\n const bar = useInstance()\n createEffect(() => {\n const b = bar()\n const list = typeof commands === 'function' ? commands() : commands\n if (b) onCleanup(b.register(list))\n })\n}\n\n/** Add a search source while the owner is alive. */\nexport function useSource(source: Source) {\n const bar = useInstance()\n createEffect(() => {\n const b = bar()\n if (b) onCleanup(b.addSource(source))\n })\n}\n\n/** Install an extension while the owner is alive. */\nexport function useExtension(extension: Extension, preferences?: Record<string, any>) {\n const bar = useInstance()\n createEffect(() => {\n const b = bar()\n if (b) onCleanup(b.use(extension, preferences))\n })\n}\n\n/** Render an inline bar into an element: `<div ref={inlineQikbar({ commands })} />`. */\nexport function inlineQikbar(config: QikbarConfig = {}) {\n return (el: HTMLElement) => {\n onMount(() => {\n const bar = create({ ...config, inline: el })\n onCleanup(() => bar.destroy())\n })\n }\n}\n\nexport type { QikbarConfig, QikbarInstance, QikbarState } from '../core/types.js'\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;AAaA,SAAS,iBAAiB,eAAe,cAAc,cAAc,IAAI,WAAW,SAAS,SAAS,kBAA2C;AAIjJ,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CAAC;AAAA,EACpC,CAAC,GACM;AAAA,IACL;AAAA,IACA;AAAA,IACA,MAAM,CAAC,MAA8C,IAAI,GAAG,KAAK,CAAC;AAAA,IAClE,OAAO,MAAM,IAAI,GAAG,MAAM;AAAA,IAC1B,QAAQ,MAAM,IAAI,GAAG,OAAO;AAAA,IAC5B,KAAK,CAAC,MAAe,IAAI,GAAG,IAAI,CAAC;AAAA,EACnC;AACF;AAGO,SAAS,YAAY,UAA2C;AACrE,MAAM,MAAM,YAAY;AACxB,eAAa,MAAM;AACjB,QAAM,IAAI,IAAI,GACR,OAAO,OAAO,YAAa,aAAa,SAAS,IAAI;AAC3D,IAAI,KAAG,UAAU,EAAE,SAAS,IAAI,CAAC;AAAA,EACnC,CAAC;AACH;AAGO,SAAS,UAAU,QAAgB;AACxC,MAAM,MAAM,YAAY;AACxB,eAAa,MAAM;AACjB,QAAM,IAAI,IAAI;AACd,IAAI,KAAG,UAAU,EAAE,UAAU,MAAM,CAAC;AAAA,EACtC,CAAC;AACH;AAGO,SAAS,aAAa,WAAsB,aAAmC;AACpF,MAAM,MAAM,YAAY;AACxB,eAAa,MAAM;AACjB,QAAM,IAAI,IAAI;AACd,IAAI,KAAG,UAAU,EAAE,IAAI,WAAW,WAAW,CAAC;AAAA,EAChD,CAAC;AACH;AAGO,SAAS,aAAa,SAAuB,CAAC,GAAG;AACtD,SAAO,CAAC,OAAoB;AAC1B,YAAQ,MAAM;AACZ,UAAM,MAAM,aAAO,EAAE,GAAG,QAAQ,QAAQ,GAAG,CAAC;AAC5C,gBAAU,MAAM,IAAI,QAAQ,CAAC;AAAA,IAC/B,CAAC;AAAA,EACH;AACF;",
|
|
6
|
+
"names": ["createQikbar"]
|
|
7
|
+
}
|
package/dist/styles.css
CHANGED
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
.qb-header{position:relative;display:flex;align-items:center;gap:10px;height:var(--qb-input-height);padding:0 16px;border-bottom:1px solid var(--qb-border);flex-shrink:0}
|
|
18
18
|
.qb-header-icon{color:var(--qb-fg-subtle);display:flex}
|
|
19
19
|
.qb-input{flex:1;min-width:0;height:100%;border:0;outline:0;background:transparent;font-size:var(--qb-input-font-size);padding:0;caret-color:var(--qb-accent)}
|
|
20
|
+
.qb-input:focus,.qb-input:focus-visible{outline:0;box-shadow:none}
|
|
20
21
|
.qb-input::placeholder{color:var(--qb-fg-subtle);opacity:1}
|
|
21
22
|
.qb-input::-webkit-search-cancel-button{display:none}
|
|
22
23
|
.qb-back{display:flex;align-items:center;justify-content:center;width:26px;height:26px;border-radius:7px;background:var(--qb-kbd-bg);color:var(--qb-fg-muted);flex-shrink:0;transition:background .1s}
|
|
@@ -194,6 +195,33 @@ textarea.qb-field-input{height:auto;min-height:96px;padding:8px 10px;resize:vert
|
|
|
194
195
|
|
|
195
196
|
.qb-hud{position:fixed;left:50%;bottom:32px;translate:-50% 0;z-index:calc(var(--qb-z) + 2);display:flex;align-items:center;gap:8px;max-width:calc(100vw - 32px);padding:9px 16px 9px 12px;border:1px solid var(--qb-border);border-radius:999px;background:var(--qb-bg-elevated);color:var(--qb-fg);box-shadow:0 12px 32px -8px rgba(0,0,0,.3);font-size:13px;animation:qb-hud .22s var(--qb-ease);pointer-events:none}
|
|
196
197
|
.qb-hud .qb-toast-msg{color:var(--qb-fg-muted)}
|
|
198
|
+
.qb-hud[data-action]{pointer-events:auto;padding-right:6px}
|
|
199
|
+
.qb-toast-action{display:inline-flex;align-items:center;gap:6px;height:24px;margin-left:4px;padding:0 6px 0 9px;border-radius:7px;background:var(--qb-kbd-bg);color:var(--qb-fg);font-size:12.5px;font-weight:500;white-space:nowrap;flex-shrink:0}
|
|
200
|
+
.qb-toast-action:hover{background:var(--qb-hover)}
|
|
201
|
+
.qb-toast-action .qb-kbd{height:18px;min-width:18px;font-size:10.5px}
|
|
202
|
+
.qb-hud .qb-toast-action{border-radius:999px;height:28px;padding:0 8px 0 12px}
|
|
203
|
+
|
|
204
|
+
.qb-alias{display:inline-flex;align-items:center;height:20px;padding:0 7px;border-radius:6px;border:1px solid var(--qb-border);color:var(--qb-fg-muted);font:500 11.5px/1 var(--qb-font-mono,ui-monospace,monospace);flex-shrink:0}
|
|
205
|
+
.qb-pin{display:inline-flex;color:var(--qb-fg-subtle);flex-shrink:0}
|
|
206
|
+
.qb-item[aria-selected=true] .qb-pin{color:inherit;opacity:.7}
|
|
207
|
+
.qb-check{display:inline-grid;place-items:center;width:16px;height:16px;flex-shrink:0;border-radius:5px;border:1.5px solid var(--qb-fg-subtle);color:transparent;transition:background .1s,border-color .1s}
|
|
208
|
+
.qb-check .qb-icon svg{stroke-width:3}
|
|
209
|
+
[data-marked] .qb-check{background:var(--qb-accent);border-color:var(--qb-accent);color:var(--qb-accent-fg)}
|
|
210
|
+
.qb-item[data-marked]{background:color-mix(in srgb,var(--qb-accent) 10%,transparent)}
|
|
211
|
+
.qb-item[data-marked][aria-selected=true]{background:color-mix(in srgb,var(--qb-accent) 18%,var(--qb-selection))}
|
|
212
|
+
.qb-cell .qb-check{position:absolute;top:8px;left:8px;z-index:1;background:var(--qb-bg)}
|
|
213
|
+
.qb-cell[data-marked] .qb-check{background:var(--qb-accent)}
|
|
214
|
+
.qb-cell[data-marked]{outline:2px solid var(--qb-accent);outline-offset:-2px}
|
|
215
|
+
|
|
216
|
+
/* Touch: no keyboard hints, bigger targets, 16px inputs (prevents iOS zoom) */
|
|
217
|
+
.qb-root[data-qb-touch] .qb-item .qb-kbds,.qb-root[data-qb-touch] .qb-footer .qb-kbds,.qb-root[data-qb-touch] .qb-hint .qb-kbds,.qb-root[data-qb-touch] .qb-action .qb-kbds,.qb-root[data-qb-touch] .qb-toast-action .qb-kbd,.qb-root[data-qb-touch] .qb-btn .qb-kbds{display:none}
|
|
218
|
+
.qb-root[data-qb-touch] .qb-item{height:max(var(--qb-row-height),48px)}
|
|
219
|
+
.qb-root[data-qb-touch] .qb-action{min-height:44px}
|
|
220
|
+
.qb-root[data-qb-touch] .qb-footer-btn{height:34px;padding:0 10px}
|
|
221
|
+
.qb-root[data-qb-touch] .qb-input,.qb-root[data-qb-touch] .qb-actions-input,.qb-root[data-qb-touch] .qb-field-input,.qb-root[data-qb-touch] .qb-arg{font-size:max(16px,var(--qb-input-font-size))}
|
|
222
|
+
.qb-root[data-qb-touch] .qb-actions-input,.qb-root[data-qb-touch] .qb-field-input,.qb-root[data-qb-touch] .qb-arg{font-size:16px}
|
|
223
|
+
.qb-root[data-qb-touch] .qb-scroll{-webkit-overflow-scrolling:touch;overscroll-behavior:contain}
|
|
224
|
+
.qb-root[data-qb-touch] .qb-item,.qb-root[data-qb-touch] .qb-cell{-webkit-touch-callout:none}
|
|
197
225
|
|
|
198
226
|
@keyframes qb-fade{from{opacity:0}}
|
|
199
227
|
@keyframes qb-fade-out{to{opacity:0}}
|
|
@@ -207,10 +235,13 @@ textarea.qb-field-input{height:auto;min-height:96px;padding:8px 10px;resize:vert
|
|
|
207
235
|
.qb-root[data-qb-inline] .qb-dialog{animation:none}
|
|
208
236
|
|
|
209
237
|
@media (max-width:640px){
|
|
210
|
-
.qb-dialog{top:8px;width:calc(100vw - 16px)}
|
|
211
|
-
.qb-body{height:min(var(--qb-list-height),
|
|
212
|
-
.qb-
|
|
238
|
+
.qb-dialog{top:max(8px,env(safe-area-inset-top,0px));width:calc(100vw - 16px)}
|
|
239
|
+
.qb-body{height:min(var(--qb-list-height),calc(var(--qb-vvh,100dvh) - 140px - env(safe-area-inset-top,0px)))}
|
|
240
|
+
.qb-root[data-qb-inline] .qb-body{height:var(--qb-list-height)}
|
|
241
|
+
.qb-footer-left>:not(.qb-toast),.qb-hint{display:none}
|
|
213
242
|
.qb-footer{justify-content:flex-end}
|
|
243
|
+
.qb-footer-left:has(.qb-toast){flex:1}
|
|
244
|
+
.qb-hud{bottom:calc(24px + env(safe-area-inset-bottom,0px))}
|
|
214
245
|
.qb-form{grid-template-columns:1fr}
|
|
215
246
|
.qb-form-label{text-align:left;padding:0}
|
|
216
247
|
.qb-meta,.qb-split .qb-detail{display:none}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Svelte bindings (Svelte 4 and 5). No compiler step: a store for state and
|
|
3
|
+
* actions for inline bars.
|
|
4
|
+
*
|
|
5
|
+
* ```svelte
|
|
6
|
+
* <script>
|
|
7
|
+
* import { onDestroy } from 'svelte'
|
|
8
|
+
* import { goto } from '$app/navigation'
|
|
9
|
+
* import { qikbarStore } from '@qikbar/qikbar/svelte'
|
|
10
|
+
*
|
|
11
|
+
* const bar = qikbarStore({ routes, navigate: (href) => goto(href) })
|
|
12
|
+
* onDestroy(bar.destroy)
|
|
13
|
+
* onDestroy(bar.register([{ title: 'Archive', run: archive }]))
|
|
14
|
+
* </script>
|
|
15
|
+
*
|
|
16
|
+
* <button on:click={() => bar.open()}>Search {$bar.query}</button>
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
import type { Command, QikbarConfig, QikbarInstance, QikbarState } from '../core/types.js';
|
|
20
|
+
type Subscriber<T> = (value: T) => void;
|
|
21
|
+
export interface QikbarStore extends QikbarInstance {
|
|
22
|
+
/** Svelte store contract: `$bar` is the current state. */
|
|
23
|
+
subscribe(run: Subscriber<QikbarState>): () => void;
|
|
24
|
+
/** The underlying instance. */
|
|
25
|
+
readonly instance: QikbarInstance;
|
|
26
|
+
}
|
|
27
|
+
/** Create a bar whose state is a Svelte store. Call `destroy()` in `onDestroy`. */
|
|
28
|
+
export declare function qikbarStore(config?: QikbarConfig): QikbarStore;
|
|
29
|
+
/**
|
|
30
|
+
* Action: render an inline (always open) bar inside an element.
|
|
31
|
+
*
|
|
32
|
+
* ```svelte
|
|
33
|
+
* <div use:qikbar={{ commands, placeholder: 'Search docs…' }} />
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare function qikbar(node: HTMLElement, config?: QikbarConfig): {
|
|
37
|
+
update(next?: QikbarConfig): void;
|
|
38
|
+
destroy(): void;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Action: register commands while an element is in the DOM — handy for
|
|
42
|
+
* page-specific commands without touching component lifecycle.
|
|
43
|
+
*
|
|
44
|
+
* ```svelte
|
|
45
|
+
* <section use:commands={{ bar, commands: [{ title: 'Export report', run }] }}>…</section>
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export declare function commands(_node: HTMLElement, params: {
|
|
49
|
+
bar: QikbarInstance;
|
|
50
|
+
commands: Command[];
|
|
51
|
+
}): {
|
|
52
|
+
update(next: {
|
|
53
|
+
bar: QikbarInstance;
|
|
54
|
+
commands: Command[];
|
|
55
|
+
}): void;
|
|
56
|
+
destroy(): void;
|
|
57
|
+
};
|
|
58
|
+
export type { QikbarConfig, QikbarInstance, QikbarState } from '../core/types.js';
|
package/dist/svelte.js
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createQikbar
|
|
3
|
+
} from "./chunks/chunk-OLXZNYZ4.js";
|
|
4
|
+
import "./chunks/chunk-5FI7DNG7.js";
|
|
5
|
+
import "./chunks/chunk-N4Y2Z6YD.js";
|
|
6
|
+
import "./chunks/chunk-MRHKJ2FZ.js";
|
|
7
|
+
import "./chunks/chunk-INTEVQYK.js";
|
|
8
|
+
import "./chunks/chunk-YCVJQ7U3.js";
|
|
9
|
+
import "./chunks/chunk-PQEHV3D4.js";
|
|
10
|
+
import "./chunks/chunk-TIM4VBM4.js";
|
|
11
|
+
import "./chunks/chunk-MPTP2EWW.js";
|
|
12
|
+
|
|
13
|
+
// src/svelte/index.ts
|
|
14
|
+
function qikbarStore(config = {}) {
|
|
15
|
+
let bar = createQikbar(config), state = { open: !1, query: "", depth: 0, loading: !1 }, subs = /* @__PURE__ */ new Set();
|
|
16
|
+
bar.on("change", (s) => {
|
|
17
|
+
state = s;
|
|
18
|
+
for (let fn of subs) fn(s);
|
|
19
|
+
});
|
|
20
|
+
let store = Object.create(bar);
|
|
21
|
+
for (let key of ["open", "close", "toggle", "register", "addSource", "use", "configure", "push", "pop", "setQuery", "toast", "ask", "commands", "on", "preload", "pins", "pin", "aliases", "setAlias", "destroy"])
|
|
22
|
+
store[key] = bar[key].bind(bar);
|
|
23
|
+
return Object.defineProperty(store, "instance", { value: bar }), store.subscribe = (run) => (subs.add(run), run(state), () => subs.delete(run)), store;
|
|
24
|
+
}
|
|
25
|
+
function qikbar(node, config = {}) {
|
|
26
|
+
let bar = createQikbar({ ...config, inline: node }), applied = config;
|
|
27
|
+
return {
|
|
28
|
+
update(next = {}) {
|
|
29
|
+
let changed = {};
|
|
30
|
+
for (let key of /* @__PURE__ */ new Set([...Object.keys(next), ...Object.keys(applied)]))
|
|
31
|
+
Object.is(next[key], applied[key]) || (changed[key] = next[key]);
|
|
32
|
+
applied = next, bar.configure(changed);
|
|
33
|
+
},
|
|
34
|
+
destroy() {
|
|
35
|
+
bar.destroy(), bar = void 0;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function commands(_node, params) {
|
|
40
|
+
let off = params.bar.register(params.commands);
|
|
41
|
+
return {
|
|
42
|
+
update(next) {
|
|
43
|
+
off(), off = next.bar.register(next.commands);
|
|
44
|
+
},
|
|
45
|
+
destroy() {
|
|
46
|
+
off();
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
export {
|
|
51
|
+
commands,
|
|
52
|
+
qikbar,
|
|
53
|
+
qikbarStore
|
|
54
|
+
};
|
|
55
|
+
//# sourceMappingURL=svelte.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/svelte/index.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Svelte bindings (Svelte 4 and 5). No compiler step: a store for state and\n * actions for inline bars.\n *\n * ```svelte\n * <script>\n * import { onDestroy } from 'svelte'\n * import { goto } from '$app/navigation'\n * import { qikbarStore } from '@qikbar/qikbar/svelte'\n *\n * const bar = qikbarStore({ routes, navigate: (href) => goto(href) })\n * onDestroy(bar.destroy)\n * onDestroy(bar.register([{ title: 'Archive', run: archive }]))\n * </script>\n *\n * <button on:click={() => bar.open()}>Search {$bar.query}</button>\n * ```\n */\n\nimport { createQikbar } from '../index.js'\nimport type { Command, QikbarConfig, QikbarInstance, QikbarState } from '../core/types.js'\n\ntype Subscriber<T> = (value: T) => void\n\nexport interface QikbarStore extends QikbarInstance {\n /** Svelte store contract: `$bar` is the current state. */\n subscribe(run: Subscriber<QikbarState>): () => void\n /** The underlying instance. */\n readonly instance: QikbarInstance\n}\n\n/** Create a bar whose state is a Svelte store. Call `destroy()` in `onDestroy`. */\nexport function qikbarStore(config: QikbarConfig = {}): QikbarStore {\n const bar = createQikbar(config)\n let state: QikbarState = { open: false, query: '', depth: 0, loading: false }\n const subs = new Set<Subscriber<QikbarState>>()\n bar.on('change', (s) => {\n state = s\n for (const fn of subs) fn(s)\n })\n // Bind every method so `on:click={bar.open}` and `onDestroy(bar.destroy)` work.\n const store = Object.create(bar) as QikbarStore\n for (const key of ['open', 'close', 'toggle', 'register', 'addSource', 'use', 'configure', 'push', 'pop', 'setQuery', 'toast', 'ask', 'commands', 'on', 'preload', 'pins', 'pin', 'aliases', 'setAlias', 'destroy'] as const) {\n ;(store as any)[key] = (bar[key] as (...a: unknown[]) => unknown).bind(bar)\n }\n Object.defineProperty(store, 'instance', { value: bar })\n store.subscribe = (run) => {\n subs.add(run)\n run(state)\n return () => subs.delete(run)\n }\n return store\n}\n\n/**\n * Action: render an inline (always open) bar inside an element.\n *\n * ```svelte\n * <div use:qikbar={{ commands, placeholder: 'Search docs\u2026' }} />\n * ```\n */\nexport function qikbar(node: HTMLElement, config: QikbarConfig = {}) {\n let bar = createQikbar({ ...config, inline: node })\n let applied = config\n return {\n update(next: QikbarConfig = {}) {\n const changed: Partial<QikbarConfig> = {}\n for (const key of new Set([...Object.keys(next), ...Object.keys(applied)]) as Set<keyof QikbarConfig>) {\n if (!Object.is(next[key], applied[key])) (changed as any)[key] = next[key]\n }\n applied = next\n bar.configure(changed)\n },\n destroy() {\n bar.destroy()\n bar = undefined as unknown as QikbarInstance\n },\n }\n}\n\n/**\n * Action: register commands while an element is in the DOM \u2014 handy for\n * page-specific commands without touching component lifecycle.\n *\n * ```svelte\n * <section use:commands={{ bar, commands: [{ title: 'Export report', run }] }}>\u2026</section>\n * ```\n */\nexport function commands(_node: HTMLElement, params: { bar: QikbarInstance; commands: Command[] }) {\n let off = params.bar.register(params.commands)\n return {\n update(next: { bar: QikbarInstance; commands: Command[] }) {\n off()\n off = next.bar.register(next.commands)\n },\n destroy() {\n off()\n },\n }\n}\n\nexport type { QikbarConfig, QikbarInstance, QikbarState } from '../core/types.js'\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;AAgCO,SAAS,YAAY,SAAuB,CAAC,GAAgB;AAClE,MAAM,MAAM,aAAa,MAAM,GAC3B,QAAqB,EAAE,MAAM,IAAO,OAAO,IAAI,OAAO,GAAG,SAAS,GAAM,GACtE,OAAO,oBAAI,IAA6B;AAC9C,MAAI,GAAG,UAAU,CAAC,MAAM;AACtB,YAAQ;AACR,aAAW,MAAM,KAAM,IAAG,CAAC;AAAA,EAC7B,CAAC;AAED,MAAM,QAAQ,OAAO,OAAO,GAAG;AAC/B,WAAW,OAAO,CAAC,QAAQ,SAAS,UAAU,YAAY,aAAa,OAAO,aAAa,QAAQ,OAAO,YAAY,SAAS,OAAO,YAAY,MAAM,WAAW,QAAQ,OAAO,WAAW,YAAY,SAAS;AAC/M,IAAC,MAAc,GAAG,IAAK,IAAI,GAAG,EAAmC,KAAK,GAAG;AAE5E,gBAAO,eAAe,OAAO,YAAY,EAAE,OAAO,IAAI,CAAC,GACvD,MAAM,YAAY,CAAC,SACjB,KAAK,IAAI,GAAG,GACZ,IAAI,KAAK,GACF,MAAM,KAAK,OAAO,GAAG,IAEvB;AACT;AASO,SAAS,OAAO,MAAmB,SAAuB,CAAC,GAAG;AACnE,MAAI,MAAM,aAAa,EAAE,GAAG,QAAQ,QAAQ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