Skip to content

@lh-ui/share

The single framework-agnostic shared layer of the lh-ui family — 56 core component pure functions, 12 shared-kernel modules, a Chinese-style theme system, pure-emitter internationalization, and 58 component style sources. One logic, feeding every port: Vue3 / Vue2 / React / uniapp.

Core pure functions

Class-name computation, state machines, and accessibility attribute packs for 56 components — all zero-dependency pure functions. The framework layer only wires them up; the logic has a single source and a single test suite.

Shared kernel

The popper positioning engine, virtual scrolling, focus trap, keyboard navigation, sx style props, and number sanitizing — 12 modules reused directly by every port.

Chinese-style themes

Five built-in presets (cerblue / songhua / zhusha / shuimo / golden), CSS variables + dark mode + a pattern system, guarded by an AA-contrast script.

Pure-emitter i18n

LhLocale is a pure event emitter carrying no framework reactivity; each port subscribes to its version with its own signaling mechanism.

Single source of styles

styles/ is the only source of component BEM styles for the whole family; three transition mixins unify the Vue2 / Vue3 / React differences.

Zero framework dependencies

Bundled with external: [] — fully dependency-free — and gated by verify:dts so no framework import ever appears in the output.

  • Developers of the UI libraries (lh-ui-plus / lh-ui-vue2 / lh-ui-react / lh-ui-uniapp): look up every pure function’s signature, return value, and edge cases, and how to override style tokens.
  • Standalone developers using share directly: your project wants the accessibility baseline and the theme tokens without pulling in any UI library.
  • Contributors: understand the directory responsibilities, the red lines, and the verification and release process.
- `src/core/<component>/` —— pure-function logic (logic.ts / types.ts), zero framework imports
- `src/core/shared/` —— cross-component shared kernel (popper / virtual / sx / keyboard …)
- `src/theme/` —— theme TS side: types + five presets + runtime primitives
- `styles/` —— the single source of component BEM styles + theme/common/*.scss tokens
- `src/{constants,locales,types,utils}/` —— constants / language packs / types / utilities

Next: Getting started to install the package and import styles; or go straight to entry points and subpaths to see how to import on demand.

Copyright © 2024-2026 FengMo WenXue