@anypoint-web-components/anypoint-styles

中文文档
1.0.4发布于 2023/03/28Apache-2.0CommonJS近 30 天下载 3264

任意点样式定义 Web 组件 .

中文使用文档
文档目录7 节
  1. 使用量
  2. 安装
  3. 在 html 文件内
  4. 在一个LitElement中
  5. 发展
  6. 本地运行演示
  7. 运行测试

折旧

此组件已移至 anypoint-web-components/awc。 。 。 .

====

这个 <anypoint-styles> 组件提供了使用任意点 CSS 样式的简单方式 在申请中。 现有进口商品如下:

  1. 颜色.js数字 : 在任意点中定义的颜色的完整列表 调色板

  2. 印刷学.js数字 : 任意点 字体 样式和大小

  3. 主题数字 : 任何点应用程序的默认主题 .

我们建议导入每个文件,并使用样式变量 而不是总和 anypoint-styles.js 整体而言.

说明,打字法不包括字体定义( din-pro.js)档案. 它假设对象已经装入了网络应用程序 。 如果没有,则再导入 din-pro.js 文档.

使用量

安装

npm install --save @anypoint-web-components/anypoint-styles

在 html 文件内

<html>
  <head>
    <script type="module">
      import '@anypoint-web-components/anypoint-styles/default-theme.js';
    </script>
    <style>
    h1 {
      font-size: var(--font-header1-font-size);
      font-weight: var(--font-header1-font-weight);
      letter-spacing: var(--font-header1-letter-spacing);
      margin-bottom: var(--font-header1-margin-bottom);
    }
    </style>
  </head>
  <body>
    <h1>Content title</h1>
  </body>
</html>

在一个LitElement中

import { LitElement, html, css } from 'lit-element';
import '@anypoint-web-components/anypoint-styles/default-theme.js';

class SampleElement extends LitElement {
  static get styles() {
    return css`
    h1 {
      font-size: var(--font-header1-font-size);
      font-weight: var(--font-header1-font-weight);
      letter-spacing: var(--font-header1-letter-spacing);
      margin-bottom: var(--font-header1-margin-bottom);
    }`;
  }

  render() {
    return html`<h1>Content title</h1>`;
  }
}
customElements.define('sample-element', SampleElement);

发展

git clone https://github.com/anypoint-web-components/anypoint-styles
cd anypoint-styles
npm install

本地运行演示

npm start

运行测试

npm test

版本与发布记录

@anypoint-web-components/anypoint-styles 共发布 7 个版本,首次发布于 2019/06/23;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.0.4latest2023/03/283 年前
1.0.32021/10/155 年前
1.0.22021/08/255 年前
1.0.12019/10/177 年前
1.0.02019/09/207 年前
1.0.0-preview.22019/09/037 年前

关于 @anypoint-web-components/anypoint-styles 的常见问题

@anypoint-web-components/anypoint-styles 是什么?

任意点样式定义 Web 组件 .

如何安装 @anypoint-web-components/anypoint-styles?

在项目目录运行 npm install @anypoint-web-components/anypoint-styles,或使用 pnpm add / yarn add / bun add。

@anypoint-web-components/anypoint-styles 支持 TypeScript 吗?

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

@anypoint-web-components/anypoint-styles 支持 ESM 还是 CommonJS?

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

@anypoint-web-components/anypoint-styles 可以商用吗?

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

@anypoint-web-components/anypoint-styles 的下载量有多少?

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

@anypoint-web-components/anypoint-styles 还在维护吗?

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