veltra-utils
Generated files
Run in the root directory bun run sync-veltra-utils or bun run sync-skills to regenerate generated/。
Import conventions
import {
bem,
addClass,
removeClass,
getScrollParents,
scrollIntoContainerView,
withUnit,
setStyles,
removeStyles,
zIndex,
getHighlightChunks,
Validator,
makeBEM,
createIncrease,
createToggle,
Tween,
nextFrame,
shallowComputed,
isTextNode,
isFragment,
isComment,
isTemplate,
extractNormalVNodes,
middleProxy
} from '@veltra/utils'
import { NAME_SPACE, CLS_PREFIX, FORM_EMPTY_CONTENT } from '@veltra/utils/shared'
Just import on demand; there is no default export. Shared constants and some types can also be referenced from @veltra/utils/shared .
Quick reference for functions by directory
DOM
| Symbol |
Purpose |
addClass / removeClass |
Add/remove element class |
getScrollParents |
Scrollable ancestor chain |
scrollIntoContainerView |
Scroll into view within a container |
withUnit |
Add units to numeric values |
setStyles / removeStyles |
Batch set/clear inline styles |
zIndex |
Global z-index stack |
getHighlightChunks |
Text highlight fragments |
bem |
Default u- BEM factory with prefix (see bem-guide.md) |
Form validation
| Symbol |
Purpose |
Validator |
Form validator |
Helpers
| Symbol |
Purpose |
makeBEM |
Custom-prefix BEM factory |
createIncrease / createToggle |
Incrementing id, boolean toggle |
Tween |
Tween |
nextFrame |
requestAnimationFrame wrapper |
shallowComputed |
Shallow computed helper |
Vue helpers
| Symbol |
Purpose |
isTextNode / isFragment / isComment / isTemplate |
Node type checking |
extractNormalVNodes |
Normalize vnode lists |
Reactivity
| Symbol |
Purpose |
middleProxy |
Middleware proxy utility |
Constants (@veltra/utils/shared)
| Symbol |
Purpose |
NAME_SPACE / CLS_PREFIX |
Class prefix |
FORM_EMPTY_CONTENT |
Read-only placeholder display for forms |
Shared type quick reference
Common type definitions are in types/ mirrored in shared-types.md, for example:
ComponentSize、ColorType(see types/component-common.ts)
FormComponentProps and form context types (see types/form-context.ts , etc.)
Specific fields are subject to the source code in the generated files.