@esri/calcite-base

中文文档
1.2.0发布于 2019/12/10SEE LICENSE IN README.mdESM + CJS零依赖近 30 天下载 4655

Tokens, mixins, and other Sass utilities for Esri's Calcite Design System

原始使用文档
文档目录6 节
  1. Install
  2. Use
  3. Custom Properties
  4. JavaScript
  5. Licensing
  6. Contributing

Calcite Base

The calcite-base repository holds the variables and mixins used in Calcite Web. This includes resources regarding:

  • motion (easing functions, transitions)
  • type (font stacks, sizing, spacing mixins)
  • reponsive design (breakpoints, respond-to mixins)
  • utilities (clearfix, show/hide, etc)
  • shadow (defined levels of depth)
  • spacing (standardized vertical/horizontal spacing units)

Install

If you use npm, installation is as easy as:

npm install @esri/calcite-base

You can also download the latest release manually.

Use

In a Sass project, simply import calcite-base into your project and use the variables/mixins:

@import "./node_modules/@esri/calcite-base/dist/_index.scss";

.myClass {
  @include font-size(-1);
}

If you only require certain mixins, you can import each section directly as well:

@import "./node_modules/@esri/calcite-base/dist/_type.scss";

.myClass {
  @include avenir-light();
  @include font-size(-1);
  @include leading(2);
  @include tracking(166);
  @include word-spacing(200);
}

Custom Properties

If you are using PostCSS (or standard CSS) there are a series of files which declare the variables utilizing custom properties (CSS Variables). You can use these along with something like the postcss-custom-properties library to utilize the base colors, styles, etc in your postcss project:

@import "./node_modules/@esri/calcite-base/dist/variables.css";

.myClass {
  box-shadow: var(--shadow-1);
}

JavaScript

If you need some of these values and are using a CSS-in-JS approach, you can import them from the JavaScript file using ES6 modules:

import {avenirLight} from "@esri/calcite-base";
console.log(avenirLight); // '"Avenir Next", "Avenir", "Helvetica Neue", sans-serif'

Note when using partial imports like this, the hyphenated variables become camel case.

Licensing

COPYRIGHT © 2019 Esri

All rights reserved under the copyright laws of the United States and applicable international laws, treaties, and conventions.

This material is licensed for use under the Esri Master License Agreement (MLA), and is bound by the terms of that agreement. You may redistribute and use this code without modification, provided you adhere to the terms of the MLA and include this copyright notice.

See use restrictions at http://www.esri.com/legal/pdfs/mla_e204_e300/english

For additional information, contact: Environmental Systems Research Institute, Inc. Attn: Contracts and Legal Services Department 380 New York Street Redlands, California, USA 92373 USA

email: [email protected]

Contributing

Please read the contribute document.

版本与发布记录

@esri/calcite-base 共发布 3 个版本,首次发布于 2019/08/06;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.2.0latest2019/12/106 年前
1.1.02019/08/077 年前
1.0.02019/08/067 年前

关于 @esri/calcite-base 的常见问题

@esri/calcite-base 是什么?

Tokens, mixins, and other Sass utilities for Esri's Calcite Design System

如何安装 @esri/calcite-base?

在项目目录运行 npm install @esri/calcite-base,或使用 pnpm add / yarn add / bun add。

@esri/calcite-base 支持 TypeScript 吗?

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

@esri/calcite-base 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@esri/calcite-base 可以商用吗?

@esri/calcite-base 使用 SEE LICENSE IN README.md 许可。许可条款写在包内的独立文件中,请阅读该文件确认可否商用。以上为概括,不构成法律意见,请以许可原文为准。

@esri/calcite-base 的下载量有多少?

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

@esri/calcite-base 还在维护吗?

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