@advanced-rest-client/arc-overlay-mixin

中文文档
1.2.0发布于 2021/03/21Apache-2.0ESM + CJS近 30 天下载 4724

arc-overlay-mixin is a port of iron-overlay-behavior that works with web components

原始使用文档
文档目录10 节
  1. Usage
  2. Installation
  3. Example
  4. Closing and canceling
  5. Positioning
  6. Backdrop
  7. Limitations
  8. Development
  9. Testing
  10. Demo

ArcOverlayMixin

Published on NPM

Tests and publishing

This mixin is a port of iron-overlay-behavior that works with LitElement.

Use ArcOverlayMixin to implement an element that can be hidden or shown, and displays on top of other content. It includes an optional backdrop, and can be used to implement a variety of UI controls including dialogs and drop downs. Multiple overlays may be displayed at once.

See the demo source code for an example.

Usage

Installation

npm i @advanced-rest-client/arc-overlay-mixin

Example

import { LitElement } from 'lit-element';
import { ArcOverlayMixin } from '@advanced-rest-client/arc-overlay-mixin';

class ArcOverlayImpl extends ArcOverlayMixin(LitElement) {
  static get properties() {
    return {
      myProp: { type: String }
    };
  }
}

Closing and canceling

An overlay may be hidden by closing or canceling. The difference between close and cancel is user intent. Closing generally implies that the user acknowledged the content on the overlay. By default, it will cancel whenever the user taps outside it or presses the escape key. This behavior is configurable with the nocancelonesckey and the nocancelonoutsideclick properties. close() should be called explicitly by the implementer when the user interacts with a control in the overlay element. When the dialog is canceled, the overlay fires an 'iron-overlay-canceled' event. Call preventDefault on this event to prevent the overlay from closing.

Positioning

By default the element is sized and positioned to fit and centered inside the window. You can position and size it manually using CSS. See ArcFitMixin.

Backdrop

Set the withbackdrop attribute to display a backdrop behind the overlay. The backdrop is appended to <body> and is of type <iron-overlay-backdrop>. See its doc page for styling options. In addition, with-backdrop will wrap the focus within the content in the light DOM. Override the _focusableNodes getter to achieve a different behavior.

Limitations

The element is styled to appear on top of other content by setting its z-index property. You must ensure no element has a stacking context with a higher z-index than its parent stacking context. You should place this element as a child of <body> whenever possible.

Development

Testing

npm run test

Demo

npm start

版本与发布记录

@advanced-rest-client/arc-overlay-mixin 共发布 16 个版本,首次发布于 2019/06/09;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.2.0latest2021/03/215 年前
1.2.0-preview1.2-preview2021/03/205 年前
1.1.82021/03/135 年前
1.1.72020/11/265 年前
1.1.62020/10/036 年前
1.1.52020/07/036 年前

关于 @advanced-rest-client/arc-overlay-mixin 的常见问题

@advanced-rest-client/arc-overlay-mixin 是什么?

arc-overlay-mixin is a port of iron-overlay-behavior that works with web components

如何安装 @advanced-rest-client/arc-overlay-mixin?

在项目目录运行 npm install @advanced-rest-client/arc-overlay-mixin,或使用 pnpm add / yarn add / bun add。

@advanced-rest-client/arc-overlay-mixin 支持 TypeScript 吗?

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

@advanced-rest-client/arc-overlay-mixin 支持 ESM 还是 CommonJS?

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

@advanced-rest-client/arc-overlay-mixin 可以商用吗?

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

@advanced-rest-client/arc-overlay-mixin 的下载量有多少?

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

@advanced-rest-client/arc-overlay-mixin 还在维护吗?

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