@financial-times/o-normalise

中文文档
3.3.3发布于 2026/02/26MITES Module零依赖近 30 天下载 1.4万

Provides base styles and resets for stylesheets. Includes standardised utilities, such as visually hiding components or adding a consistent focus state.

原始使用文档
文档目录8 节
  1. Usage
  2. Sass
  3. Other Mixins
  4. Focus States
  5. Contributing
  6. Migration guide
  7. Contact
  8. Licence

⚠️ NOTE: o-normalise has been replaced with o3-foundation. Please see Migration Guide for steps to upgrade.

o-normalise MIT licensed

Foundation styles and standardised utilities

Usage

Check out how to include Origami components in your project to get started with o-normalise.

Sass

To output all default o-normalise styles call the mixin oNormalise:

@include oNormalise();

To include features of o-normalise granularly, pass an $opts map. E.g. to output all styles except for the css helper classes o-normalise-visually-hidden and o-normalise-clearfix:

@include oNormalise($opts: (
    'elements': ('forms', 'images', 'text', 'links'),
    'body': ('font-smoothing', 'focus', 'reduce-motion')
));

Options include:

FeatureDescriptionValues
elementsElement types to apply normalising styles to.'forms', 'images', 'text', 'links'
bodyFeatures which apply to html, body, main elements and all elements with a :focus state.'font-smoothing', 'focus'
helpersClasses which may be applied to elements manually.'clearfix', 'visually-hidden'

Other Mixins

Focus States

o-normalise provides default focus states using the :focus-visible pseudo-class. This applies while an element matches the :focus pseudo-class and the user-agent determines that the focus should be specially indicated.

Browser support is now good so we no longer recommend the focus-visible polyfill, this should be removed from your project. :focus is used as a fallback where needed in older browsers.

Contributing

If you think there is something that could be added to o-normalise, either raise an issue to discuss or create a Pull Request with the changes to be reviewed by the Origami team.

If you think of any JavaScript functions or utilities that would be useful to have in a module like this, please raise an issue on o-utils.

Migration guide

StateMajor VersionLast Minor ReleaseMigration guide
✨ activeo3N/Amigrate to Origami 3
⚠ maintained3N/Amigrate to v3
╳ deprecated22.0migrate to v2
11.7N/A

Contact

If you have any questions or comments about this component, or need help using it, please either raise an issue, visit #origami-support or email Origami Support.


Licence

This software is published by the Financial Times under the MIT licence.

版本与发布记录

@financial-times/o-normalise 共发布 34 个版本,首次发布于 2019/02/13;过去 12 个月发布了 1 个版本。

版本发布日期距今
3.3.3latest2026/02/268 个月前
3.3.22023/10/273 年前
3.3.12023/04/283 年前
3.3.02022/12/153 年前
3.2.22022/01/134 年前
3.2.12021/12/244 年前

其他发布通道:prerelease → 3.0.0-beta.0,tag--v2.0.8 → 2.0.8。

关于 @financial-times/o-normalise 的常见问题

@financial-times/o-normalise 是什么?

Provides base styles and resets for stylesheets. Includes standardised utilities, such as visually hiding components or adding a consistent focus state.

如何安装 @financial-times/o-normalise?

在项目目录运行 npm install @financial-times/o-normalise,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@financial-times/sass-mq(^5.0.2)、@financial-times/o-colors(^6.7.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@financial-times/o-normalise 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/financial-times__o-normalise 是否存在。

@financial-times/o-normalise 支持 ESM 还是 CommonJS?

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

@financial-times/o-normalise 可以商用吗?

@financial-times/o-normalise 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@financial-times/o-normalise 的下载量有多少?

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

@financial-times/o-normalise 还在维护吗?

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