@gluhar/core

中文文档
6.4.1发布于 2026/11/16TypeScriptES Module近 30 天下载 3324

Gluhar Core packages.

原始使用文档

My Module

npm version npm downloads License Nuxt

My new Nuxt module for doing amazing things.

Shared composables and utils, installed by @gluhar/app. Installs @nuxtjs/device.

useResponsive()

The one breakpoint composable for every gluhar project. It replaces the project-level useMobile copies.

For behaviour only — event handlers, GSAP/ScrollTrigger setup, measuring. Responsive layout is Tailwind variants in the template; never put a width flag in v-if / :class.

const { isMobileDevice, mounted, mobile, tablet, desktop, touch, up, down, between } =
  useResponsive();

const nav = up("nav"); // any --breakpoint-* the project declares
onMounted(() => {
  if (desktop.value) initParallax(); // already correct here
});
SourceOn the serverSafe in markup
isMobileDeviceuser agentreal valueyes — but it's a device guess, not a width
mobile tablet desktop wide touch tabletExact desktopExact up() down() between()viewport widthfalseno
  • Width flags stay false through the first hydration so server and client renders agree, then switch on in the composable's own onMounted — before any onMounted you register after calling it. Components created after hydration get live values immediately.
  • Breakpoints are the project's --breakpoint-* CSS values (read by @gluhar/theme), defaulting to tablet 768 / desktop 1200 / wide 2000.
  • >= comparisons, like CSS min-width: tablet and tablet: agree at every width, including exactly 768.
  • mobile = below tablet; touch = below desktop (a width, not touch capability).

Development

# Install dependencies
npm install

# Generate type stubs
npm run dev:prepare

# Develop with the playground
npm run dev

# Build the playground
npm run dev:build

# Run ESLint
npm run lint

# Run Vitest
npm run test
npm run test:watch

# Release new version
npm run release

版本与发布记录

@gluhar/core 共发布 27 个版本,首次发布于 2025/01/22;过去 12 个月发布了 24 个版本。

版本发布日期距今
6.4.1latest2026/11/16今天
6.4.02026/11/161 天前
6.3.22026/11/161 天前
6.3.12026/11/151 天前
6.3.02026/11/151 天前
6.2.02026/11/151 天前

其他发布通道:next → 6.0.0-next.12。

关于 @gluhar/core 的常见问题

@gluhar/core 是什么?

Gluhar Core packages.

如何安装 @gluhar/core?

在项目目录运行 npm install @gluhar/core,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:nuxt(^4.6.2)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@gluhar/core 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@gluhar/core 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@gluhar/core 可以商用吗?

@gluhar/core 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

@gluhar/core 的下载量有多少?

根据 npm 官方下载统计,@gluhar/core 在 2026/10/17 – 2026/11/15 这 30 天内被下载 3,324 次,日均约 111 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@gluhar/core 还在维护吗?

最新版本 6.4.1 发布于 2026/11/16(今天);至今共发布 27 个版本,其中过去 12 个月发布了 24 个;首次发布于 2025/01/22。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。