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.
03.1k
1import { AnyConfig, ParsedClassName } from './types'2 3export const IMPORTANT_MODIFIER = '!'4 5const MODIFIER_SEPARATOR = ':'6const EMPTY_MODIFIERS: string[] = []7 8// Pre-allocated result object shape for consistency9const createResultObject = (10 modifiers: string[],11 hasImportantModifier: boolean,12 baseClassName: string,13 maybePostfixModifierPosition?: number,14 isExternal?: boolean,15): ParsedClassName => ({16 modifiers,17 hasImportantModifier,18 baseClassName,19 maybePostfixModifierPosition,20 isExternal,21})22 23export const createParseClassName = (config: AnyConfig) => {24 const { prefix, experimentalParseClassName } = config25 26 /**27 * Parse class name into parts.28 *29 * Inspired by `splitAtTopLevelOnly` used in Tailwind CSS30 * @see https://github.com/tailwindlabs/tailwindcss/blob/v3.2.2/src/util/splitAtTopLevelOnly.js31 */32 let parseClassName = (className: string): ParsedClassName => {33 // Use simple array with push for better performance34 const modifiers: string[] = []35 36 let bracketDepth = 037 let parenDepth = 038 let modifierStart = 039 let postfixModifierPosition: number | undefined40 41 const len = className.length42 for (let index = 0; index < len; index++) {43 const currentCharacter = className[index]!44 45 if (bracketDepth === 0 && parenDepth === 0) {46 if (currentCharacter === MODIFIER_SEPARATOR) {47 modifiers.push(className.slice(modifierStart, index))48 modifierStart = index + 149 continue50 }51 52 if (currentCharacter === '/') {53 postfixModifierPosition = index54 continue55 }56 }57 58 if (currentCharacter === '[') bracketDepth++59 else if (currentCharacter === ']') bracketDepth--60 else if (currentCharacter === '(') parenDepth++61 else if (currentCharacter === ')') parenDepth--62 }63 64 const baseClassNameWithImportantModifier =65 modifiers.length === 0 ? className : className.slice(modifierStart)66 67 // Inline important modifier check68 let baseClassName = baseClassNameWithImportantModifier69 let hasImportantModifier = false70 71 if (baseClassNameWithImportantModifier.endsWith(IMPORTANT_MODIFIER)) {72 baseClassName = baseClassNameWithImportantModifier.slice(0, -1)73 hasImportantModifier = true74 } else if (75 /**76 * In Tailwind CSS v3 the important modifier was at the start of the base class name. This is still supported for legacy reasons.77 * @see https://github.com/dcastil/tailwind-merge/issues/513#issuecomment-261402986478 */79 baseClassNameWithImportantModifier.startsWith(IMPORTANT_MODIFIER)80 ) {81 baseClassName = baseClassNameWithImportantModifier.slice(1)82 hasImportantModifier = true83 }84 85 const maybePostfixModifierPosition =86 postfixModifierPosition && postfixModifierPosition > modifierStart87 ? postfixModifierPosition - modifierStart88 : undefined89 90 return createResultObject(91 modifiers,92 hasImportantModifier,93 baseClassName,94 maybePostfixModifierPosition,95 )96 }97 98 if (prefix) {99 const fullPrefix = prefix + MODIFIER_SEPARATOR100 const parseClassNameOriginal = parseClassName101 parseClassName = (className: string) =>102 className.startsWith(fullPrefix)103 ? parseClassNameOriginal(className.slice(fullPrefix.length))104 : createResultObject(EMPTY_MODIFIERS, false, className, undefined, true)105 }106 107 if (experimentalParseClassName) {108 const parseClassNameOriginal = parseClassName109 parseClassName = (className: string) =>110 experimentalParseClassName({ className, parseClassName: parseClassNameOriginal })111 }112 113 return parseClassName114}115 