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
toggle-group.svelte.js162 linesDownload Raw Back to toggle-group
1import { attachRef, } from "svelte-toolbelt";2import { Context } from "runed";3import { createBitsAttrs, getAriaChecked, boolToStr, boolToEmptyStrOrUndef, boolToTrueOrUndef, } from "../../internal/attrs.js";4import { kbd } from "../../internal/kbd.js";5import { RovingFocusGroup } from "../../internal/roving-focus-group.js";6export const toggleGroupAttrs = createBitsAttrs({7    component: "toggle-group",8    parts: ["root", "item"],9});10const ToggleGroupRootContext = new Context("ToggleGroup.Root");11class ToggleGroupBaseState {12    opts;13    rovingFocusGroup;14    attachment;15    constructor(opts) {16        this.opts = opts;17        this.attachment = attachRef(this.opts.ref);18        this.rovingFocusGroup = new RovingFocusGroup({19            candidateAttr: toggleGroupAttrs.item,20            rootNode: opts.ref,21            loop: opts.loop,22            orientation: opts.orientation,23        });24    }25    props = $derived.by(() => ({26        id: this.opts.id.current,27        [toggleGroupAttrs.root]: "",28        role: "group",29        "data-orientation": this.opts.orientation.current,30        "data-disabled": boolToEmptyStrOrUndef(this.opts.disabled.current),31        ...this.attachment,32    }));33}34class ToggleGroupSingleState extends ToggleGroupBaseState {35    opts;36    isMulti = false;37    anyPressed = $derived.by(() => this.opts.value.current !== "");38    constructor(opts) {39        super(opts);40        this.opts = opts;41    }42    includesItem(item) {43        return this.opts.value.current === item;44    }45    toggleItem(item, id) {46        if (this.includesItem(item)) {47            this.opts.value.current = "";48        }49        else {50            this.opts.value.current = item;51            this.rovingFocusGroup.setCurrentTabStopId(id);52        }53    }54}55class ToggleGroupMultipleState extends ToggleGroupBaseState {56    opts;57    isMulti = true;58    anyPressed = $derived.by(() => this.opts.value.current.length > 0);59    constructor(opts) {60        super(opts);61        this.opts = opts;62    }63    includesItem(item) {64        return this.opts.value.current.includes(item);65    }66    toggleItem(item, id) {67        if (this.includesItem(item)) {68            this.opts.value.current = this.opts.value.current.filter((v) => v !== item);69        }70        else {71            this.opts.value.current = [...this.opts.value.current, item];72            this.rovingFocusGroup.setCurrentTabStopId(id);73        }74    }75}76export class ToggleGroupRootState {77    static create(opts) {78        const { type, ...rest } = opts;79        const rootState = type === "single"80            ? new ToggleGroupSingleState(rest)81            : new ToggleGroupMultipleState(rest);82        return ToggleGroupRootContext.set(rootState);83    }84}85export class ToggleGroupItemState {86    static create(opts) {87        return new ToggleGroupItemState(opts, ToggleGroupRootContext.get());88    }89    opts;90    root;91    attachment;92    #isDisabled = $derived.by(() => this.opts.disabled.current || this.root.opts.disabled.current);93    isPressed = $derived.by(() => this.root.includesItem(this.opts.value.current));94    #ariaChecked = $derived.by(() => {95        return this.root.isMulti ? undefined : getAriaChecked(this.isPressed, false);96    });97    #ariaPressed = $derived.by(() => {98        return this.root.isMulti ? boolToStr(this.isPressed) : undefined;99    });100    constructor(opts, root) {101        this.opts = opts;102        this.root = root;103        this.attachment = attachRef(this.opts.ref);104        $effect(() => {105            if (!this.root.opts.rovingFocus.current) {106                this.#tabIndex = 0;107            }108            else {109                this.#tabIndex = this.root.rovingFocusGroup.getTabIndex(this.opts.ref.current);110            }111        });112        this.onclick = this.onclick.bind(this);113        this.onkeydown = this.onkeydown.bind(this);114    }115    #toggleItem() {116        if (this.#isDisabled)117            return;118        this.root.toggleItem(this.opts.value.current, this.opts.id.current);119    }120    onclick(_) {121        if (this.#isDisabled)122            return;123        this.root.toggleItem(this.opts.value.current, this.opts.id.current);124    }125    onkeydown(e) {126        if (this.#isDisabled)127            return;128        if (e.key === kbd.ENTER || e.key === kbd.SPACE) {129            e.preventDefault();130            this.#toggleItem();131            return;132        }133        if (!this.root.opts.rovingFocus.current)134            return;135        this.root.rovingFocusGroup.handleKeydown(this.opts.ref.current, e);136    }137    #tabIndex = $state(0);138    snippetProps = $derived.by(() => ({139        pressed: this.isPressed,140    }));141    props = $derived.by(() => ({142        id: this.opts.id.current,143        role: this.root.isMulti ? undefined : "radio",144        tabindex: this.#tabIndex,145        "data-orientation": this.root.opts.orientation.current,146        "data-disabled": boolToEmptyStrOrUndef(this.#isDisabled),147        "data-state": getToggleItemDataState(this.isPressed),148        "data-value": this.opts.value.current,149        "aria-pressed": this.#ariaPressed,150        "aria-checked": this.#ariaChecked,151        disabled: boolToTrueOrUndef(this.#isDisabled),152        [toggleGroupAttrs.item]: "",153        //154        onclick: this.onclick,155        onkeydown: this.onkeydown,156        ...this.attachment,157    }));158}159function getToggleItemDataState(condition) {160    return condition ? "on" : "off";161}162 
Brunobkr/llama.cpp_AlgMor24_github · Team Ai