New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@antv/l7-utils

Package Overview
Dependencies
Maintainers
64
Versions
533
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@antv/l7-utils - npm Package Compare versions

Comparing version 2.17.8 to 2.17.9

es/config.d.ts

10

es/ajax.d.ts

@@ -0,1 +1,2 @@

export declare const getProtocolAction: (url: string) => import("./config").IProtocolHandler;
export interface ITileBand {

@@ -5,2 +6,5 @@ url: string;

}
export type Cancelable = {
cancel: () => void;
};
export type RequestParameters = {

@@ -44,7 +48,7 @@ url: string | string[] | ITileBand[];

export declare function makeXMLHttpRequestPromise(requestParameters: RequestParameters): Promise<IXhrRequestResult>;
export declare const getJSON: (requestParameters: RequestParameters, callback: ResponseCallback<any>) => any;
export declare const getArrayBuffer: (requestParameters: RequestParameters, callback: ResponseCallback<ArrayBuffer>) => any;
export declare const getJSON: (requestParameters: RequestParameters, callback: ResponseCallback<any>) => Cancelable;
export declare const getArrayBuffer: (requestParameters: RequestParameters, callback: ResponseCallback<ArrayBuffer>) => Cancelable;
export declare const postData: (requestParameters: RequestParameters, callback: ResponseCallback<string>) => any;
export declare function sameOrigin(url: string): boolean;
export declare const getImage: (requestParameters: RequestParameters, callback: ResponseCallback<HTMLImageElement | ImageBitmap | null>, transformResponse?: ((response: object) => any) | undefined) => any;
export declare const getImage: (requestParameters: RequestParameters, callback: ResponseCallback<HTMLImageElement | ImageBitmap | null>, transformResponse?: ((response: object) => any) | undefined) => Cancelable;
export declare const formatImage: (imgData: ArrayBuffer, callback: ResponseCallback<HTMLImageElement | ImageBitmap | null>) => void;

@@ -10,3 +10,7 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";

function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
import { SceneConifg } from "./config";
import { $window, $XMLHttpRequest } from "./mini-adapter";
export var getProtocolAction = function getProtocolAction(url) {
return SceneConifg.REGISTERED_PROTOCOLS[url.substring(0, url.indexOf('://'))];
};
export var AJAXError = /*#__PURE__*/function (_Error) {

@@ -82,2 +86,3 @@ _inherits(AJAXError, _Error);

};
xhr.cancel = xhr.abort;
xhr.send(requestParameters.body);

@@ -114,3 +119,4 @@ return xhr;

export var getJSON = function getJSON(requestParameters, callback) {
return makeRequest(_objectSpread(_objectSpread({}, requestParameters), {}, {
var action = getProtocolAction(requestParameters.url) || makeRequest;
return action(_objectSpread(_objectSpread({}, requestParameters), {}, {
type: 'json'

@@ -120,3 +126,4 @@ }), callback);

export var getArrayBuffer = function getArrayBuffer(requestParameters, callback) {
return makeRequest(_objectSpread(_objectSpread({}, requestParameters), {}, {
var action = getProtocolAction(requestParameters.url) || makeRequest;
return action(_objectSpread(_objectSpread({}, requestParameters), {}, {
type: 'arrayBuffer'

@@ -123,0 +130,0 @@ }), callback);

export * from './ajax';
export * from './anchor';
export * from './color';
export * from './config';
export * from './cull';

@@ -5,0 +6,0 @@ export * as DOM from './dom';

@@ -5,2 +5,3 @@ // @ts-ignore

export * from "./color";
export * from "./config";
export * from "./cull";

@@ -7,0 +8,0 @@ import * as _DOM from "./dom";

@@ -24,24 +24,2 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";

var _super = _createSuper(SourceTile);
// 瓦片索引
// 循环加载瓦片
// 瓦片大小
// 是否可以见
// 是否是当前层级的瓦片
// 是否可以见发生变化
// 瓦片的父级瓦片
// 瓦片的子级瓦片
// 瓦片数据
// 瓦片属性
// 瓦片序号
function SourceTile(options) {

@@ -51,5 +29,11 @@ var _this;

_this = _super.call(this);
// 瓦片索引
// 循环加载瓦片
// 瓦片大小
_defineProperty(_assertThisInitialized(_this), "tileSize", 256);
// 是否可以见
_defineProperty(_assertThisInitialized(_this), "isVisible", false);
// 是否是当前层级的瓦片
_defineProperty(_assertThisInitialized(_this), "isCurrent", false);
// 是否可以见发生变化
_defineProperty(_assertThisInitialized(_this), "isVisibleChange", false);

@@ -60,6 +44,11 @@ _defineProperty(_assertThisInitialized(_this), "loadedLayers", 0);

_defineProperty(_assertThisInitialized(_this), "isChildLoad", false);
// 瓦片的父级瓦片
_defineProperty(_assertThisInitialized(_this), "parent", null);
// 瓦片的子级瓦片
_defineProperty(_assertThisInitialized(_this), "children", []);
// 瓦片数据
_defineProperty(_assertThisInitialized(_this), "data", null);
// 瓦片属性
_defineProperty(_assertThisInitialized(_this), "properties", {});
// 瓦片序号
_defineProperty(_assertThisInitialized(_this), "loadDataId", 0);

@@ -66,0 +55,0 @@ var x = options.x,

@@ -38,2 +38,4 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";

var _super = _createSuper(TilesetManager);
// 上一次视野状态
function TilesetManager(options) {

@@ -43,3 +45,5 @@ var _this;

_this = _super.call(this);
// 当前层级的瓦片
_defineProperty(_assertThisInitialized(_this), "currentTiles", []);
// 缓存的瓦片,key 为 {z}-{x}-{y}
_defineProperty(_assertThisInitialized(_this), "cacheTiles", new Map());

@@ -49,2 +53,3 @@ _defineProperty(_assertThisInitialized(_this), "throttleUpdate", throttle(function (zoom, latLonBounds) {

}, 16));
// 瓦片加载成功回调
_defineProperty(_assertThisInitialized(_this), "onTileLoad", function (tile) {

@@ -55,2 +60,3 @@ _this.emit(TileEventType.TileLoaded, tile);

});
// 瓦片加载失败回调
_defineProperty(_assertThisInitialized(_this), "onTileError", function (error, tile) {

@@ -64,2 +70,3 @@ _this.emit(TileEventType.TileError, {

});
// 瓦片被删除回调
_defineProperty(_assertThisInitialized(_this), "onTileUnload", function (tile) {

@@ -102,3 +109,2 @@ _this.emit(TileEventType.TileUnload, tile);

}
// 当前层级的瓦片
}, {

@@ -396,4 +402,2 @@ key: "updateOptions",

}
// 瓦片加载成功回调
}, {

@@ -400,0 +404,0 @@ key: "getTileId",

@@ -0,1 +1,2 @@

import { getProtocolAction } from "../../ajax";
import { tileToBounds } from "./lonlat-tile";

@@ -6,3 +7,3 @@ /*

export function isURLTemplate(s) {
return /(?=.*{z})(?=.*{x})(?=.*({y}|{-y}))/.test(s);
return /(?=.*{box})(?=.*{z})(?=.*{x})(?=.*({y}|{-y}))/.test(s);
}

@@ -53,3 +54,4 @@

var index = Math.abs(x + y) % urls.length;
var url = urls[index];
// 兼容其他协议的 URL 模版
var url = getProtocolAction(urls[index]) ? "".concat(urls[index], "/{z}/{x}/{y}") : urls[index];
return url.replace(/\{x\}/g, x.toString()).replace(/\{y\}/g, y.toString()).replace(/\{z\}/g, z.toString()).replace(/\{bbox\}/g, tileToBounds(x, y, z).join(',')).replace(/\{-y\}/g, (Math.pow(2, z) - y - 1).toString());

@@ -56,0 +58,0 @@ }

@@ -27,2 +27,3 @@ var __defProp = Object.defineProperty;

getJSON: () => getJSON,
getProtocolAction: () => getProtocolAction,
makeXMLHttpRequestPromise: () => makeXMLHttpRequestPromise,

@@ -33,3 +34,5 @@ postData: () => postData,

module.exports = __toCommonJS(ajax_exports);
var import_config = require("./config");
var import_mini_adapter = require("./mini-adapter");
var getProtocolAction = (url) => import_config.SceneConifg.REGISTERED_PROTOCOLS[url.substring(0, url.indexOf("://"))];
var AJAXError = class extends Error {

@@ -88,2 +91,3 @@ constructor(status, statusText, url, body) {

};
xhr.cancel = xhr.abort;
xhr.send(requestParameters.body);

@@ -120,6 +124,8 @@ return xhr;

var getJSON = (requestParameters, callback) => {
return makeRequest({ ...requestParameters, type: "json" }, callback);
const action = getProtocolAction(requestParameters.url) || makeRequest;
return action({ ...requestParameters, type: "json" }, callback);
};
var getArrayBuffer = (requestParameters, callback) => {
return makeRequest({ ...requestParameters, type: "arrayBuffer" }, callback);
const action = getProtocolAction(requestParameters.url) || makeRequest;
return action({ ...requestParameters, type: "arrayBuffer" }, callback);
};

@@ -202,2 +208,3 @@ var postData = (requestParameters, callback) => {

getJSON,
getProtocolAction,
makeXMLHttpRequestPromise,

@@ -204,0 +211,0 @@ postData,

@@ -43,2 +43,3 @@ var __create = Object.create;

__reExport(src_exports, require("./color"), module.exports);
__reExport(src_exports, require("./config"), module.exports);
__reExport(src_exports, require("./cull"), module.exports);

@@ -67,2 +68,3 @@ var DOM = __toESM(require("./dom"));

...require("./color"),
...require("./config"),
...require("./cull"),

@@ -69,0 +71,0 @@ ...require("./env"),

@@ -28,5 +28,6 @@ var __defProp = Object.defineProperty;

module.exports = __toCommonJS(tile_url_exports);
var import_ajax = require("../../ajax");
var import_lonlat_tile = require("./lonlat-tile");
function isURLTemplate(s) {
return /(?=.*{z})(?=.*{x})(?=.*({y}|{-y}))/.test(s);
return /(?=.*{box})(?=.*{z})(?=.*{x})(?=.*({y}|{-y}))/.test(s);
}

@@ -63,3 +64,3 @@ function expandUrl(url) {

const index = Math.abs(x + y) % urls.length;
const url = urls[index];
const url = (0, import_ajax.getProtocolAction)(urls[index]) ? `${urls[index]}/{z}/{x}/{y}` : urls[index];
return url.replace(/\{x\}/g, x.toString()).replace(/\{y\}/g, y.toString()).replace(/\{z\}/g, z.toString()).replace(/\{bbox\}/g, (0, import_lonlat_tile.tileToBounds)(x, y, z).join(",")).replace(/\{-y\}/g, (Math.pow(2, z) - y - 1).toString());

@@ -66,0 +67,0 @@ }

{
"name": "@antv/l7-utils",
"version": "2.17.8",
"version": "2.17.9",
"description": "",

@@ -42,3 +42,3 @@ "main": "lib/index.js",

},
"gitHead": "f14e94a0dd40cba30d7aa51eb05b5ba6449cf766",
"gitHead": "f4cfc6238306e5ac9b77bff5481c6adad6b3c73b",
"publishConfig": {

@@ -45,0 +45,0 @@ "access": "public"

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc