add lisp packages
This commit is contained in:
19
lisp/emacs-application-framework/app/terminal/node_modules/xterm-addon-web-links/LICENSE
generated
vendored
Normal file
19
lisp/emacs-application-framework/app/terminal/node_modules/xterm-addon-web-links/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
Copyright (c) 2017, The xterm.js authors (https://github.com/xtermjs/xterm.js)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
21
lisp/emacs-application-framework/app/terminal/node_modules/xterm-addon-web-links/README.md
generated
vendored
Normal file
21
lisp/emacs-application-framework/app/terminal/node_modules/xterm-addon-web-links/README.md
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
## xterm-addon-web-links
|
||||
|
||||
An addon for [xterm.js](https://github.com/xtermjs/xterm.js) that enables web links. This addon requires xterm.js v4+.
|
||||
|
||||
### Install
|
||||
|
||||
```bash
|
||||
npm install --save xterm-addon-web-links
|
||||
```
|
||||
|
||||
### Usage
|
||||
|
||||
```ts
|
||||
import { Terminal } from 'xterm';
|
||||
import { WebLinksAddon } from 'xterm-addon-web-links';
|
||||
|
||||
const terminal = new Terminal();
|
||||
terminal.loadAddon(new WebLinksAddon());
|
||||
```
|
||||
|
||||
See the full [API](https://github.com/xtermjs/xterm.js/blob/master/addons/xterm-addon-web-links/typings/xterm-addon-web-links.d.ts) for more advanced usage.
|
||||
2
lisp/emacs-application-framework/app/terminal/node_modules/xterm-addon-web-links/lib/xterm-addon-web-links.js
generated
vendored
Normal file
2
lisp/emacs-application-framework/app/terminal/node_modules/xterm-addon-web-links/lib/xterm-addon-web-links.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.WebLinksAddon=t():e.WebLinksAddon=t()}(window,function(){return function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=new RegExp("(?:^|[^\\da-z\\.-]+)((https?:\\/\\/)((([\\da-z\\.-]+)\\.([a-z\\.]{2,6}))|((\\d{1,3}\\.){3}\\d{1,3})|(localhost))(:\\d{1,5})?((\\/[\\/\\w\\.\\-%~:+]*)*([^:\"'\\s]))?(\\?[0-9\\w\\[\\]\\(\\)\\/\\?\\!#@$%&'*+,:;~\\=\\.\\-]*)?(#[0-9\\w\\[\\]\\(\\)\\/\\?\\!#@$%&'*+,:;~\\=\\.\\-]*)?)($|[^\\/\\w\\.\\-%]+)");function r(e,t){window.open(t,"_blank")}var i=function(){function e(e,t){void 0===e&&(e=r),void 0===t&&(t={}),this._handler=e,this._options=t,this._options.matchIndex=1}return e.prototype.activate=function(e){this._terminal=e,this._linkMatcherId=this._terminal.registerLinkMatcher(o,this._handler,this._options)},e.prototype.dispose=function(){void 0!==this._linkMatcherId&&void 0!==this._terminal&&this._terminal.deregisterLinkMatcher(this._linkMatcherId)},e}();t.WebLinksAddon=i}])});
|
||||
//# sourceMappingURL=xterm-addon-web-links.js.map
|
||||
1
lisp/emacs-application-framework/app/terminal/node_modules/xterm-addon-web-links/lib/xterm-addon-web-links.js.map
generated
vendored
Normal file
1
lisp/emacs-application-framework/app/terminal/node_modules/xterm-addon-web-links/lib/xterm-addon-web-links.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
lisp/emacs-application-framework/app/terminal/node_modules/xterm-addon-web-links/out/WebLinksAddon.api.js.map
generated
vendored
Normal file
1
lisp/emacs-application-framework/app/terminal/node_modules/xterm-addon-web-links/out/WebLinksAddon.api.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"WebLinksAddon.api.js","sourceRoot":"","sources":["../src/WebLinksAddon.api.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,iBAoFA;;AApFA,qCAAuC;AACvC,6BAA8B;AAG9B,IAAM,GAAG,GAAG,4BAA4B,CAAC;AAEzC,IAAI,OAA0B,CAAC;AAC/B,IAAI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AAG,CAAC;oBACvD,WAAM,IAAI,CAAC,KAAK,CAAI,WAAW,sBAAiB,GAAG,MAAG,CAAC,EAAA;;oBAAvD,SAAuD,CAAC;oBACjD,WAAM,IAAI,CAAC,QAAQ,CAAC,4DAA0D,WAAW,wDAAqD,CAAC,EAAA;wBAAtJ,WAAO,SAA+I,EAAC;;;;CACxJ"}
|
||||
45
lisp/emacs-application-framework/app/terminal/node_modules/xterm-addon-web-links/out/WebLinksAddon.js
generated
vendored
Normal file
45
lisp/emacs-application-framework/app/terminal/node_modules/xterm-addon-web-links/out/WebLinksAddon.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var protocolClause = '(https?:\\/\\/)';
|
||||
var domainCharacterSet = '[\\da-z\\.-]+';
|
||||
var negatedDomainCharacterSet = '[^\\da-z\\.-]+';
|
||||
var domainBodyClause = '(' + domainCharacterSet + ')';
|
||||
var tldClause = '([a-z\\.]{2,6})';
|
||||
var ipClause = '((\\d{1,3}\\.){3}\\d{1,3})';
|
||||
var localHostClause = '(localhost)';
|
||||
var portClause = '(:\\d{1,5})';
|
||||
var hostClause = '((' + domainBodyClause + '\\.' + tldClause + ')|' + ipClause + '|' + localHostClause + ')' + portClause + '?';
|
||||
var pathCharacterSet = '(\\/[\\/\\w\\.\\-%~:+]*)*([^:"\'\\s])';
|
||||
var pathClause = '(' + pathCharacterSet + ')?';
|
||||
var queryStringHashFragmentCharacterSet = '[0-9\\w\\[\\]\\(\\)\\/\\?\\!#@$%&\'*+,:;~\\=\\.\\-]*';
|
||||
var queryStringClause = '(\\?' + queryStringHashFragmentCharacterSet + ')?';
|
||||
var hashFragmentClause = '(#' + queryStringHashFragmentCharacterSet + ')?';
|
||||
var negatedPathCharacterSet = '[^\\/\\w\\.\\-%]+';
|
||||
var bodyClause = hostClause + pathClause + queryStringClause + hashFragmentClause;
|
||||
var start = '(?:^|' + negatedDomainCharacterSet + ')(';
|
||||
var end = ')($|' + negatedPathCharacterSet + ')';
|
||||
var strictUrlRegex = new RegExp(start + protocolClause + bodyClause + end);
|
||||
function handleLink(event, uri) {
|
||||
window.open(uri, '_blank');
|
||||
}
|
||||
var WebLinksAddon = (function () {
|
||||
function WebLinksAddon(_handler, _options) {
|
||||
if (_handler === void 0) { _handler = handleLink; }
|
||||
if (_options === void 0) { _options = {}; }
|
||||
this._handler = _handler;
|
||||
this._options = _options;
|
||||
this._options.matchIndex = 1;
|
||||
}
|
||||
WebLinksAddon.prototype.activate = function (terminal) {
|
||||
this._terminal = terminal;
|
||||
this._linkMatcherId = this._terminal.registerLinkMatcher(strictUrlRegex, this._handler, this._options);
|
||||
};
|
||||
WebLinksAddon.prototype.dispose = function () {
|
||||
if (this._linkMatcherId !== undefined && this._terminal !== undefined) {
|
||||
this._terminal.deregisterLinkMatcher(this._linkMatcherId);
|
||||
}
|
||||
};
|
||||
return WebLinksAddon;
|
||||
}());
|
||||
exports.WebLinksAddon = WebLinksAddon;
|
||||
//# sourceMappingURL=WebLinksAddon.js.map
|
||||
1
lisp/emacs-application-framework/app/terminal/node_modules/xterm-addon-web-links/out/WebLinksAddon.js.map
generated
vendored
Normal file
1
lisp/emacs-application-framework/app/terminal/node_modules/xterm-addon-web-links/out/WebLinksAddon.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"WebLinksAddon.js","sourceRoot":"","sources":["../src/WebLinksAddon.ts"],"names":[],"mappings":";;AAOA,IAAM,cAAc,GAAG,iBAAiB,CAAC;AACzC,IAAM,kBAAkB,GAAG,eAAe,CAAC;AAC3C,IAAM,yBAAyB,GAAG,gBAAgB,CAAC;AACnD,IAAM,gBAAgB,GAAG,GAAG,GAAG,kBAAkB,GAAG,GAAG,CAAC;AACxD,IAAM,SAAS,GAAG,iBAAiB,CAAC;AACpC,IAAM,QAAQ,GAAG,4BAA4B,CAAC;AAC9C,IAAM,eAAe,GAAG,aAAa,CAAC;AACtC,IAAM,UAA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,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,SAAS,CAAC,mBAAmB,CAAC,cAAc,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IACzG,CAAC;IAEM,+BAAO,GAAd;QACE,IAAI,IAAI,CAAC,cAAc,KAAK,SAAS,IAAI,IAAI,CAAC,SAAS,KAAK,SAAS,EAAE;YACrE,IAAI,CAAC,SAAS,CAAC,qBAAqB,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;SAC3D;IACH,CAAC;IACH,oBAAC;AAAD,CAAC,AArBD,IAqBC;AArBY,sCAAa"}
|
||||
24
lisp/emacs-application-framework/app/terminal/node_modules/xterm-addon-web-links/package.json
generated
vendored
Normal file
24
lisp/emacs-application-framework/app/terminal/node_modules/xterm-addon-web-links/package.json
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"name": "xterm-addon-web-links",
|
||||
"version": "0.2.1",
|
||||
"author": {
|
||||
"name": "The xterm.js authors",
|
||||
"url": "https://xtermjs.org/"
|
||||
},
|
||||
"main": "lib/xterm-addon-web-links.js",
|
||||
"types": "typings/xterm-addon-web-links.d.ts",
|
||||
"repository": "https://github.com/xtermjs/xterm.js",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"build": "../../node_modules/.bin/tsc -p src",
|
||||
"prepackage": "npm run build",
|
||||
"package": "../../node_modules/.bin/webpack",
|
||||
"prepublishOnly": "npm run package"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"xterm": "^4.0.0"
|
||||
},
|
||||
"__npminstall_done": "Sun Apr 05 2020 17:06:03 GMT+0800 (中国标准时间)",
|
||||
"_from": "xterm-addon-web-links@0.2.1",
|
||||
"_resolved": "https://registry.npm.taobao.org/xterm-addon-web-links/download/xterm-addon-web-links-0.2.1.tgz"
|
||||
}
|
||||
53
lisp/emacs-application-framework/app/terminal/node_modules/xterm-addon-web-links/src/WebLinksAddon.ts
generated
vendored
Normal file
53
lisp/emacs-application-framework/app/terminal/node_modules/xterm-addon-web-links/src/WebLinksAddon.ts
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
/**
|
||||
* Copyright (c) 2017 The xterm.js authors. All rights reserved.
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
import { Terminal, ILinkMatcherOptions, ITerminalAddon } from 'xterm';
|
||||
|
||||
const protocolClause = '(https?:\\/\\/)';
|
||||
const domainCharacterSet = '[\\da-z\\.-]+';
|
||||
const negatedDomainCharacterSet = '[^\\da-z\\.-]+';
|
||||
const domainBodyClause = '(' + domainCharacterSet + ')';
|
||||
const tldClause = '([a-z\\.]{2,6})';
|
||||
const ipClause = '((\\d{1,3}\\.){3}\\d{1,3})';
|
||||
const localHostClause = '(localhost)';
|
||||
const portClause = '(:\\d{1,5})';
|
||||
const hostClause = '((' + domainBodyClause + '\\.' + tldClause + ')|' + ipClause + '|' + localHostClause + ')' + portClause + '?';
|
||||
const pathCharacterSet = '(\\/[\\/\\w\\.\\-%~:+]*)*([^:"\'\\s])';
|
||||
const pathClause = '(' + pathCharacterSet + ')?';
|
||||
const queryStringHashFragmentCharacterSet = '[0-9\\w\\[\\]\\(\\)\\/\\?\\!#@$%&\'*+,:;~\\=\\.\\-]*';
|
||||
const queryStringClause = '(\\?' + queryStringHashFragmentCharacterSet + ')?';
|
||||
const hashFragmentClause = '(#' + queryStringHashFragmentCharacterSet + ')?';
|
||||
const negatedPathCharacterSet = '[^\\/\\w\\.\\-%]+';
|
||||
const bodyClause = hostClause + pathClause + queryStringClause + hashFragmentClause;
|
||||
const start = '(?:^|' + negatedDomainCharacterSet + ')(';
|
||||
const end = ')($|' + negatedPathCharacterSet + ')';
|
||||
const strictUrlRegex = new RegExp(start + protocolClause + bodyClause + end);
|
||||
|
||||
function handleLink(event: MouseEvent, uri: string): void {
|
||||
window.open(uri, '_blank');
|
||||
}
|
||||
|
||||
export class WebLinksAddon implements ITerminalAddon {
|
||||
private _linkMatcherId: number | undefined;
|
||||
private _terminal: Terminal | undefined;
|
||||
|
||||
constructor(
|
||||
private _handler: (event: MouseEvent, uri: string) => void = handleLink,
|
||||
private _options: ILinkMatcherOptions = {}
|
||||
) {
|
||||
this._options.matchIndex = 1;
|
||||
}
|
||||
|
||||
public activate(terminal: Terminal): void {
|
||||
this._terminal = terminal;
|
||||
this._linkMatcherId = this._terminal.registerLinkMatcher(strictUrlRegex, this._handler, this._options);
|
||||
}
|
||||
|
||||
public dispose(): void {
|
||||
if (this._linkMatcherId !== undefined && this._terminal !== undefined) {
|
||||
this._terminal.deregisterLinkMatcher(this._linkMatcherId);
|
||||
}
|
||||
}
|
||||
}
|
||||
32
lisp/emacs-application-framework/app/terminal/node_modules/xterm-addon-web-links/typings/xterm-addon-web-links.d.ts
generated
vendored
Normal file
32
lisp/emacs-application-framework/app/terminal/node_modules/xterm-addon-web-links/typings/xterm-addon-web-links.d.ts
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* Copyright (c) 2017 The xterm.js authors. All rights reserved.
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
|
||||
import { Terminal, ILinkMatcherOptions, ITerminalAddon } from 'xterm';
|
||||
|
||||
declare module 'xterm-addon-web-links' {
|
||||
/**
|
||||
* An xterm.js addon that enables web links.
|
||||
*/
|
||||
export class WebLinksAddon implements ITerminalAddon {
|
||||
/**
|
||||
* Creates a new web links addon.
|
||||
* @param handler The callback when the link is called.
|
||||
* @param options Options for the link matcher.
|
||||
*/
|
||||
constructor(handler?: (event: MouseEvent, uri: string) => void, options?: ILinkMatcherOptions);
|
||||
|
||||
/**
|
||||
* Activates the addon
|
||||
* @param terminal The terminal the addon is being loaded in.
|
||||
*/
|
||||
public activate(terminal: Terminal): void;
|
||||
|
||||
/**
|
||||
* Disposes the addon.
|
||||
*/
|
||||
public dispose(): void;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user