Team Ai
Datasetpublic

Brunobkr/llama.cpp_AlgMor24_github

ΩFFFΣLLIa • llama.cpp • AlgMor24 ██████╗ ███████╗███████╗███████╗██╗ ██╗ ██╗ █████╗ ██╔═══██╗██╔════╝██╔════╝██╔════╝██║ ██║ ██║██╔══██╗ ██║ ██║█████╗ █████╗ █████╗ ██║ ██║ ██║███████║ ██║ ██║██╔══╝ ██╔══╝ ██╔══╝ ██║ ██║ ██║██╔══██║ ╚██████╔╝██║ ██║ ███████╗███████╗███████╗██║██║ ██║ ╚═════╝ ╚═╝ ╚═╝ ╚══════╝╚══════╝╚══════╝╚═╝╚═╝ ╚═╝ High-Performance LLM / VLM Inference & Autonomous Agentic Ecosystem… See the full description on the dataset page: https://huggingface.co/datasets/Brunobkr/llama.cpp_AlgMor24_github.

sourceHugging Faceupdated 2mo agoView on Hugging Face
0likes3.1kdownloads
link-preview.svelte.js242 linesDownload Raw Back to link-preview
1import { afterSleep, onDestroyEffect, attachRef, DOMContext, boxWith, } from "svelte-toolbelt";2import { Context, watch } from "runed";3import { on } from "svelte/events";4import { createBitsAttrs, boolToStr, getDataOpenClosed, getDataTransitionAttrs, } from "../../internal/attrs.js";5import { isElement, isFocusVisible, isTouch } from "../../internal/is.js";6import { getTabbableCandidates } from "../../internal/focus.js";7import { SafePolygon } from "../../internal/safe-polygon.svelte.js";8import { PresenceManager } from "../../internal/presence-manager.svelte.js";9const linkPreviewAttrs = createBitsAttrs({10    component: "link-preview",11    parts: ["content", "trigger"],12});13const LinkPreviewRootContext = new Context("LinkPreview.Root");14export class LinkPreviewRootState {15    static create(opts) {16        return LinkPreviewRootContext.set(new LinkPreviewRootState(opts));17    }18    opts;19    hasSelection = $state(false);20    isPointerDownOnContent = $state(false);21    containsSelection = $state(false);22    timeout = null;23    contentNode = $state(null);24    contentMounted = $state(false);25    contentPresence;26    triggerNode = $state(null);27    isOpening = false;28    domContext = new DOMContext(() => null);29    constructor(opts) {30        this.opts = opts;31        this.contentPresence = new PresenceManager({32            ref: boxWith(() => this.contentNode),33            open: this.opts.open,34            onComplete: () => {35                this.opts.onOpenChangeComplete.current(this.opts.open.current);36            },37        });38        watch(() => this.opts.open.current, (isOpen) => {39            if (!isOpen) {40                this.hasSelection = false;41                return;42            }43            if (!this.domContext)44                return;45            const handlePointerUp = () => {46                this.containsSelection = false;47                this.isPointerDownOnContent = false;48                afterSleep(1, () => {49                    const isSelection = this.domContext.getDocument().getSelection()?.toString() !== "";50                    if (isSelection) {51                        this.hasSelection = true;52                    }53                    else {54                        this.hasSelection = false;55                    }56                });57            };58            const unsubListener = on(this.domContext.getDocument(), "pointerup", handlePointerUp);59            if (!this.contentNode)60                return;61            const tabCandidates = getTabbableCandidates(this.contentNode);62            for (const candidate of tabCandidates) {63                candidate.setAttribute("tabindex", "-1");64            }65            return () => {66                unsubListener();67                this.hasSelection = false;68                this.isPointerDownOnContent = false;69            };70        });71    }72    clearTimeout() {73        if (this.timeout) {74            this.domContext.clearTimeout(this.timeout);75            this.timeout = null;76        }77    }78    handleOpen() {79        this.clearTimeout();80        if (this.opts.open.current || this.opts.disabled.current)81            return;82        this.isOpening = true;83        this.timeout = this.domContext.setTimeout(() => {84            if (this.isOpening) {85                this.opts.open.current = true;86                this.isOpening = false;87            }88        }, this.opts.openDelay.current);89    }90    immediateClose() {91        this.clearTimeout();92        this.isOpening = false;93        this.opts.open.current = false;94    }95    handleClose() {96        this.isOpening = false;97        this.clearTimeout();98        if (!this.isPointerDownOnContent && !this.hasSelection) {99            this.timeout = this.domContext.setTimeout(() => {100                this.opts.open.current = false;101            }, this.opts.closeDelay.current);102        }103    }104}105export class LinkPreviewTriggerState {106    static create(opts) {107        return new LinkPreviewTriggerState(opts, LinkPreviewRootContext.get());108    }109    opts;110    root;111    attachment;112    constructor(opts, root) {113        this.opts = opts;114        this.root = root;115        this.attachment = attachRef(this.opts.ref, (v) => (this.root.triggerNode = v));116        this.root.domContext = new DOMContext(opts.ref);117        this.onpointerenter = this.onpointerenter.bind(this);118        this.onpointerleave = this.onpointerleave.bind(this);119        this.onfocus = this.onfocus.bind(this);120        this.onblur = this.onblur.bind(this);121    }122    onpointerenter(e) {123        if (isTouch(e))124            return;125        this.root.handleOpen();126    }127    onpointerleave(e) {128        if (isTouch(e))129            return;130        if (!this.root.contentMounted || !this.root.opts.open.current) {131            this.root.immediateClose();132        }133    }134    onfocus(e) {135        if (!isFocusVisible(e.currentTarget))136            return;137        this.root.handleOpen();138    }139    onblur(_) {140        this.root.handleClose();141    }142    props = $derived.by(() => ({143        id: this.opts.id.current,144        "aria-haspopup": "dialog",145        "aria-expanded": boolToStr(this.root.opts.open.current),146        "data-state": getDataOpenClosed(this.root.opts.open.current),147        "aria-controls": this.root.contentNode?.id,148        role: "button",149        [linkPreviewAttrs.trigger]: "",150        onpointerenter: this.onpointerenter,151        onfocus: this.onfocus,152        onblur: this.onblur,153        onpointerleave: this.onpointerleave,154        ...this.attachment,155    }));156}157export class LinkPreviewContentState {158    static create(opts) {159        return new LinkPreviewContentState(opts, LinkPreviewRootContext.get());160    }161    opts;162    root;163    attachment;164    constructor(opts, root) {165        this.opts = opts;166        this.root = root;167        this.attachment = attachRef(this.opts.ref, (v) => (this.root.contentNode = v));168        this.root.domContext = new DOMContext(opts.ref);169        this.onpointerdown = this.onpointerdown.bind(this);170        this.onpointerenter = this.onpointerenter.bind(this);171        this.onfocusout = this.onfocusout.bind(this);172        new SafePolygon({173            triggerNode: () => this.root.triggerNode,174            contentNode: () => this.opts.ref.current,175            enabled: () => this.root.opts.open.current,176            onPointerExit: () => {177                this.root.handleClose();178            },179        });180        onDestroyEffect(() => {181            this.root.clearTimeout();182        });183    }184    onpointerdown(e) {185        const target = e.target;186        if (!isElement(target))187            return;188        if (e.currentTarget.contains(target)) {189            this.root.containsSelection = true;190        }191        this.root.hasSelection = true;192        this.root.isPointerDownOnContent = true;193    }194    onpointerenter(e) {195        if (isTouch(e))196            return;197        this.root.handleOpen();198    }199    onfocusout(e) {200        e.preventDefault();201    }202    onInteractOutside = (e) => {203        this.opts.onInteractOutside.current(e);204        if (e.defaultPrevented)205            return;206        this.root.handleClose();207    };208    onEscapeKeydown = (e) => {209        this.opts.onEscapeKeydown.current?.(e);210        if (e.defaultPrevented)211            return;212        this.root.handleClose();213    };214    onOpenAutoFocus = (e) => {215        e.preventDefault();216    };217    onCloseAutoFocus = (e) => {218        e.preventDefault();219    };220    get shouldRender() {221        return this.root.contentPresence.shouldRender;222    }223    snippetProps = $derived.by(() => ({ open: this.root.opts.open.current }));224    props = $derived.by(() => ({225        id: this.opts.id.current,226        tabindex: -1,227        "data-state": getDataOpenClosed(this.root.opts.open.current),228        ...getDataTransitionAttrs(this.root.contentPresence.transitionStatus),229        [linkPreviewAttrs.content]: "",230        onpointerdown: this.onpointerdown,231        onpointerenter: this.onpointerenter,232        onfocusout: this.onfocusout,233        ...this.attachment,234    }));235    popperProps = {236        onInteractOutside: this.onInteractOutside,237        onEscapeKeydown: this.onEscapeKeydown,238        onOpenAutoFocus: this.onOpenAutoFocus,239        onCloseAutoFocus: this.onCloseAutoFocus,240    };241}242