@anypoint-web-components/anypoint-control-mixins

中文文档
1.2.0发布于 2021/05/11Apache-2.0ESM + CJS近 30 天下载 3313

在各种控制中执行的组合符对用户输入的反应

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

网络组件的任意点控制状态混合器

一组将控制状态反映为属性和/或属性的组件. 它可以根据用户输入来控制一个控制的行为.

包含控制 :

  • hoverable-mixin.js - 反映鼠标状态的混合 hovered 属性.
  • button-state-mixin.js - 反映按钮状态的混合 active, (中文(简体) ), pressed, (中文(简体) ), pointerDown,或 receivedFocusFromKeyboard。 。 。 .
  • control-state-mixin.js - 混合反应 focused 状态和交接 disabled 控制状态.

它们旨在处理各种状态组合中的aria属性和状态管理. 用于设计自定义按钮和其他接受用户输入的形式元素.

Published on NPM

tests

使用量

安装

npm install @anypoint-web-components/anypoint-control-mixins --save

在一个LitElement中

import { LitElement, html } from 'lit-element';
import { ButtonStateMixin, ControlStateMixin } from '@anypoint-web-components/anypoint-control-mixins';

class SimpleButton extends ControlStateMixin(ButtonStateMixin(LitElement)) {
  static get styles() {
    return css`
    :host {
      display: inline-block;
      background-color: #4285F4;
      color: #fff;
      min-height: 8px;
      min-width: 8px;
      padding: 16px;
      text-transform: uppercase;
      border-radius: 3px;
      user-select: none;
      cursor: pointer;
    }

    :host([disabled]) {
      opacity: 0.3;
      pointer-events: none;
    }

    :host([active]),
    :host([pressed]) {
      background-color: #3367D6;
      box-shadow: inset 0 3px 5px rgba(0,0,0,.2);
    }

    :host([focused]) {
      box-shadow: 0 16px 24px 2px rgba(0, 0, 0, 0.14),
                  0  6px 30px 5px rgba(0, 0, 0, 0.12),
                  0  8px 10px -5px rgba(0, 0, 0, 0.4);
    }`;
  }

  render() {
    return html`<slot></slot>`;
  }
}
window.customElements.define('simple-button', SimpleButton);

发展

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

本地运行演示

npm start

运行测试

npm test

版本与发布记录

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

版本发布日期距今
1.2.0latest2021/05/115 年前
1.1.32020/10/056 年前
1.1.22020/09/226 年前
1.1.12020/05/066 年前
1.1.02020/05/066 年前
1.0.32019/12/226 年前

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

@anypoint-web-components/anypoint-control-mixins 是什么?

在各种控制中执行的组合符对用户输入的反应

如何安装 @anypoint-web-components/anypoint-control-mixins?

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

@anypoint-web-components/anypoint-control-mixins 支持 TypeScript 吗?

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

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

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

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

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

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

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

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

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