@advanced-rest-client/arc-url

中文文档
0.2.2发布于 2021/08/19Apache-2.0ESM + CJS近 30 天下载 3229

A module with logic an UI regions to support URL processing in Advanced REST Client application. It contains a logic to safely parse url with variables, build a URL input, or to enter any arbitrary URL with autosuggestions.

原始使用文档
文档目录7 节
  1. Usage
  2. Installation
  3. UrlParser class
  4. web-url-input
  5. url-input-editor
  6. Development
  7. Running the tests

ARC URL

A module with logic an UI regions to support URL processing in Advanced REST Client application. It contains a logic to safely parse url with variables, build a URL input, or to enter any arbitrary URL with autosuggestions.

Build Status

Usage

Installation

npm install --save @advanced-rest-client/arc-url

UrlParser class

A URL parsing library for Advanced REST Client.

It provides an interface similar to the URL class but it is more relax in terms of input validity. It means that it won't throw an error when the URL is invalid. This allows to use the library in request editors.

Example

import { UrlParser } from '@advanced-rest-client/arc-url';
const parser = new UrlParser('https:///path-with-missing-host?qury=value#string');
console.log(parser.protocol);
console.log(parser.host);
console.log(parser.path);
console.log(parser.searchParams);
console.log(parser.anchor);

web-url-input

An element to render a dialog to enter an URL with auto hints.

Examples

<html>
  <head>
    <script type="module">
      import '@advanced-rest-client/arc-url/web-url-input.js';
      import '@advanced-rest-client/arc-models/url-history-model.js';
    </script>
  </head>
  <body>
    <url-history-model></url-history-model>
    <web-url-input></web-url-input>
  </body>
</html>
import { LitElement, html } from 'lit-element';
import '@advanced-rest-client/arc-url/web-url-input.js';
import '@advanced-rest-client/arc-models/url-history-model.js';

class SampleElement extends LitElement {
  render() {
    return html`
    <url-history-model></url-history-model>
    <web-url-input @open="${this.openHandler}"></web-url-input>
    `;
  }

  openHandler(e) {
    console.log(e.target.value);
  }
}
customElements.define('sample-element', SampleElement);

url-input-editor

A HTTP request URL editor for a HTTP request editor.

URL editor example

import { LitElement, html } from 'lit-element';
import '@advanced-rest-client/arc-url/url-input-editor.js';
import '@advanced-rest-client/arc-models/url-history-model.js';

class SampleElement extends LitElement {
  render() {
    return html`
    <url-history-model></url-history-model>
    <url-input-editor
      .value="${this.url}"
      @change="${this.valueChanged}"
    ></url-input-editor>
    `;
  }

  valueChanged(e) {
    this.url = e.target.value;
  }
}
customElements.define('sample-element', SampleElement);

Development

git clone https://github.com/advanced-rest-client/arc-url
cd arc-url
npm install

Running the tests

npm test

版本与发布记录

@advanced-rest-client/arc-url 共发布 10 个版本,首次发布于 2020/10/04;过去 12 个月发布了 0 个版本。

版本发布日期距今
0.2.2latest2021/08/195 年前
0.2.12021/07/255 年前
0.2.02021/06/045 年前
0.1.72021/02/165 年前
0.1.62021/02/165 年前
0.1.52021/02/165 年前

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

@advanced-rest-client/arc-url 是什么?

A module with logic an UI regions to support URL processing in Advanced REST Client application. It contains a logic to safely parse url with variables, build a URL input, or to enter any arbitrary URL with autosuggestions.

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

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

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

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

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

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

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

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

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

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

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

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