@enact/spotlight

中文文档
5.6.0发布于 2026/09/02Apache-2.0TypeScriptCommonJS近 30 天下载 2.7万

A focus management library

原始使用文档
文档目录4 节
  1. Usage
  2. Additional Information
  3. Acknowledgments
  4. Copyright and License Information

@enact/spotlight npm (scoped)

An extensible library for 5-way navigation and focus control.

An extensible utility that enables users to navigate applications using a keyboard or television remote control. Responding to input from the UP, DOWN, LEFT, RIGHT, and RETURN keys, Spotlight provides a navigation experience that compares favorably to that of a computer-with-mouse.

Usage

import kind from '@enact/core/kind';
import SpotlightRootDecorator from '@enact/spotlight/SpotlightRootDecorator'
import Spottable from '@enact/spotlight/Spottable'

const MySpottableComponent = Spottable('div');

const MyApp = kind({
    name: 'MyApp',
    render: () => (<MySpottableComponent>Hello, Enact!</MySpottableComponent>)
});
const MySpotlightApp = SpotlightRootDecorator(MyApp);

export default MySpotlightApp;

See the docs for more information.

Additional Information

When using @enact/sandstone, the SpotlightRootDecorator is applied automatically by @enact/sandstone/ThemeDecorator.

Acknowledgments

Spotlight is based on a fork of JavaScript SpatialNavigation (c) 2016 Luke Chang, under the terms of the Mozilla Public License.

Unless otherwise specified, all content, including all source code files and documentation files in this repository are:

Copyright (c) 2012-2024 LG Electronics

Unless otherwise specified or set forth in the NOTICE file, all content, including all source code files and documentation files in this repository are: Licensed under the Apache License, Version 2.0 (the "License"); you may not use this content except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

版本与发布记录

@enact/spotlight 共发布 241 个版本,首次发布于 2016/10/20;过去 12 个月发布了 9 个版本。

版本发布日期距今
5.6.0latest2026/09/022 个月前
5.5.22026/07/084 个月前
5.5.12026/06/015 个月前
5.4.42026/05/225 个月前
5.5.02026/05/086 个月前
5.4.32026/02/268 个月前

其他发布通道:agate → 2.2.0-alpha.1,experimental-latest → 3.4.9-experimental-7,mr-3.2 → 3.2.7,production → 4.0.13,latest-4.5 → 4.5.6,latest-4.0 → 4.0.15。

关于 @enact/spotlight 的常见问题

@enact/spotlight 是什么?

A focus management library

如何安装 @enact/spotlight?

在项目目录运行 npm install @enact/spotlight,或使用 pnpm add / yarn add / bun add。

@enact/spotlight 支持 TypeScript 吗?

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

@enact/spotlight 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@enact/spotlight 可以商用吗?

@enact/spotlight 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@enact/spotlight 的下载量有多少?

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

@enact/spotlight 还在维护吗?

最新版本 5.6.0 发布于 2026/09/02(2 个月前);至今共发布 241 个版本,其中过去 12 个月发布了 9 个;首次发布于 2016/10/20。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。