@splunk/visualization-context 26.4.0 → 27.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BaseRegistry.js +227 -495
- package/BaseRegistry.js.map +7 -1
- package/DataSourceContext.js +55 -125
- package/DataSourceContext.js.map +7 -1
- package/EventsContext.js +54 -121
- package/EventsContext.js.map +7 -1
- package/FeatureFlagContext.js +55 -120
- package/FeatureFlagContext.js.map +7 -1
- package/FeatureFlags.js +27 -107
- package/FeatureFlags.js.map +7 -1
- package/GeoContext.js +55 -120
- package/GeoContext.js.map +7 -1
- package/GeoJsonProvider.js +26712 -303
- package/GeoJsonProvider.js.map +7 -1
- package/GeoRegistry.js +280 -691
- package/GeoRegistry.js.map +7 -1
- package/IconContext.js +55 -120
- package/IconContext.js.map +7 -1
- package/IconRegistry.js +256 -654
- package/IconRegistry.js.map +7 -1
- package/ImageContext.js +55 -120
- package/ImageContext.js.map +7 -1
- package/ImageRegistry.js +265 -660
- package/ImageRegistry.js.map +7 -1
- package/LocalIconProvider.js +206 -470
- package/LocalIconProvider.js.map +7 -1
- package/LocalImageProvider.js +143 -366
- package/LocalImageProvider.js.map +7 -1
- package/MapContext.js +103 -164
- package/MapContext.js.map +7 -1
- package/MessageContext.js +54 -121
- package/MessageContext.js.map +7 -1
- package/MockedProvider.js +146 -376
- package/MockedProvider.js.map +7 -1
- package/Provider.js +87 -276
- package/Provider.js.map +7 -1
- package/TimezoneContext.js +55 -122
- package/TimezoneContext.js.map +7 -1
- package/package.json +7 -14
- package/testDataURIs.js +37 -106
- package/testDataURIs.js.map +7 -1
- package/testSVG.js +27 -104
- package/testSVG.js.map +7 -1
- package/babel.config.js +0 -3
package/LocalIconProvider.js
CHANGED
|
@@ -1,485 +1,221 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
/******/ };
|
|
24
|
-
/******/
|
|
25
|
-
/******/ // Execute the module function
|
|
26
|
-
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
27
|
-
/******/
|
|
28
|
-
/******/ // Flag the module as loaded
|
|
29
|
-
/******/ module.l = true;
|
|
30
|
-
/******/
|
|
31
|
-
/******/ // Return the exports of the module
|
|
32
|
-
/******/ return module.exports;
|
|
33
|
-
/******/ }
|
|
34
|
-
/******/
|
|
35
|
-
/******/
|
|
36
|
-
/******/ // expose the modules object (__webpack_modules__)
|
|
37
|
-
/******/ __webpack_require__.m = modules;
|
|
38
|
-
/******/
|
|
39
|
-
/******/ // expose the module cache
|
|
40
|
-
/******/ __webpack_require__.c = installedModules;
|
|
41
|
-
/******/
|
|
42
|
-
/******/ // define getter function for harmony exports
|
|
43
|
-
/******/ __webpack_require__.d = function(exports, name, getter) {
|
|
44
|
-
/******/ if(!__webpack_require__.o(exports, name)) {
|
|
45
|
-
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
|
46
|
-
/******/ }
|
|
47
|
-
/******/ };
|
|
48
|
-
/******/
|
|
49
|
-
/******/ // define __esModule on exports
|
|
50
|
-
/******/ __webpack_require__.r = function(exports) {
|
|
51
|
-
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
52
|
-
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
53
|
-
/******/ }
|
|
54
|
-
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
55
|
-
/******/ };
|
|
56
|
-
/******/
|
|
57
|
-
/******/ // create a fake namespace object
|
|
58
|
-
/******/ // mode & 1: value is a module id, require it
|
|
59
|
-
/******/ // mode & 2: merge all properties of value into the ns
|
|
60
|
-
/******/ // mode & 4: return value when already ns object
|
|
61
|
-
/******/ // mode & 8|1: behave like require
|
|
62
|
-
/******/ __webpack_require__.t = function(value, mode) {
|
|
63
|
-
/******/ if(mode & 1) value = __webpack_require__(value);
|
|
64
|
-
/******/ if(mode & 8) return value;
|
|
65
|
-
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
|
66
|
-
/******/ var ns = Object.create(null);
|
|
67
|
-
/******/ __webpack_require__.r(ns);
|
|
68
|
-
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
|
69
|
-
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
|
70
|
-
/******/ return ns;
|
|
71
|
-
/******/ };
|
|
72
|
-
/******/
|
|
73
|
-
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
74
|
-
/******/ __webpack_require__.n = function(module) {
|
|
75
|
-
/******/ var getter = module && module.__esModule ?
|
|
76
|
-
/******/ function getDefault() { return module['default']; } :
|
|
77
|
-
/******/ function getModuleExports() { return module; };
|
|
78
|
-
/******/ __webpack_require__.d(getter, 'a', getter);
|
|
79
|
-
/******/ return getter;
|
|
80
|
-
/******/ };
|
|
81
|
-
/******/
|
|
82
|
-
/******/ // Object.prototype.hasOwnProperty.call
|
|
83
|
-
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
|
84
|
-
/******/
|
|
85
|
-
/******/ // __webpack_public_path__
|
|
86
|
-
/******/ __webpack_require__.p = "";
|
|
87
|
-
/******/
|
|
88
|
-
/******/
|
|
89
|
-
/******/ // Load entry module and return exports
|
|
90
|
-
/******/ return __webpack_require__(__webpack_require__.s = 28);
|
|
91
|
-
/******/ })
|
|
92
|
-
/************************************************************************/
|
|
93
|
-
/******/ ([
|
|
94
|
-
/* 0 */
|
|
95
|
-
/***/ (function(module, exports) {
|
|
96
|
-
|
|
97
|
-
module.exports = require("@splunk/ui-utils/i18n");
|
|
98
|
-
|
|
99
|
-
/***/ }),
|
|
100
|
-
/* 1 */
|
|
101
|
-
/***/ (function(module, exports) {
|
|
102
|
-
|
|
103
|
-
module.exports = require("@babel/runtime/regenerator");
|
|
104
|
-
|
|
105
|
-
/***/ }),
|
|
106
|
-
/* 2 */
|
|
107
|
-
/***/ (function(module, exports) {
|
|
108
|
-
|
|
109
|
-
module.exports = require("@babel/runtime/helpers/classCallCheck");
|
|
110
|
-
|
|
111
|
-
/***/ }),
|
|
112
|
-
/* 3 */
|
|
113
|
-
/***/ (function(module, exports) {
|
|
114
|
-
|
|
115
|
-
module.exports = require("@babel/runtime/helpers/createClass");
|
|
116
|
-
|
|
117
|
-
/***/ }),
|
|
118
|
-
/* 4 */
|
|
119
|
-
/***/ (function(module, exports) {
|
|
120
|
-
|
|
121
|
-
module.exports = require("@babel/runtime/helpers/asyncToGenerator");
|
|
122
|
-
|
|
123
|
-
/***/ }),
|
|
124
|
-
/* 5 */
|
|
125
|
-
/***/ (function(module, exports) {
|
|
126
|
-
|
|
127
|
-
module.exports = require("@babel/runtime/helpers/getPrototypeOf");
|
|
128
|
-
|
|
129
|
-
/***/ }),
|
|
130
|
-
/* 6 */
|
|
131
|
-
/***/ (function(module, exports) {
|
|
132
|
-
|
|
133
|
-
module.exports = require("@splunk/visualization-context/Provider");
|
|
134
|
-
|
|
135
|
-
/***/ }),
|
|
136
|
-
/* 7 */,
|
|
137
|
-
/* 8 */
|
|
138
|
-
/***/ (function(module, exports) {
|
|
139
|
-
|
|
140
|
-
module.exports = require("@babel/runtime/helpers/inherits");
|
|
141
|
-
|
|
142
|
-
/***/ }),
|
|
143
|
-
/* 9 */
|
|
144
|
-
/***/ (function(module, exports) {
|
|
145
|
-
|
|
146
|
-
module.exports = require("@babel/runtime/helpers/possibleConstructorReturn");
|
|
147
|
-
|
|
148
|
-
/***/ }),
|
|
149
|
-
/* 10 */
|
|
150
|
-
/***/ (function(module, exports) {
|
|
151
|
-
|
|
152
|
-
module.exports = require("@babel/runtime/helpers/defineProperty");
|
|
153
|
-
|
|
154
|
-
/***/ }),
|
|
155
|
-
/* 11 */,
|
|
156
|
-
/* 12 */,
|
|
157
|
-
/* 13 */,
|
|
158
|
-
/* 14 */
|
|
159
|
-
/***/ (function(module, exports) {
|
|
160
|
-
|
|
161
|
-
module.exports = require("uuid-v4");
|
|
162
|
-
|
|
163
|
-
/***/ }),
|
|
164
|
-
/* 15 */,
|
|
165
|
-
/* 16 */,
|
|
166
|
-
/* 17 */,
|
|
167
|
-
/* 18 */,
|
|
168
|
-
/* 19 */,
|
|
169
|
-
/* 20 */,
|
|
170
|
-
/* 21 */,
|
|
171
|
-
/* 22 */,
|
|
172
|
-
/* 23 */,
|
|
173
|
-
/* 24 */,
|
|
174
|
-
/* 25 */,
|
|
175
|
-
/* 26 */,
|
|
176
|
-
/* 27 */,
|
|
177
|
-
/* 28 */
|
|
178
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
179
|
-
|
|
180
|
-
"use strict";
|
|
181
|
-
__webpack_require__.r(__webpack_exports__);
|
|
182
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b64EncodeUnicode", function() { return b64EncodeUnicode; });
|
|
183
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "KEY", function() { return KEY; });
|
|
184
|
-
/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(10);
|
|
185
|
-
/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__);
|
|
186
|
-
/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4);
|
|
187
|
-
/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__);
|
|
188
|
-
/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2);
|
|
189
|
-
/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2__);
|
|
190
|
-
/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(3);
|
|
191
|
-
/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3__);
|
|
192
|
-
/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(8);
|
|
193
|
-
/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_4__);
|
|
194
|
-
/* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(9);
|
|
195
|
-
/* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_5__);
|
|
196
|
-
/* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(5);
|
|
197
|
-
/* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6__);
|
|
198
|
-
/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(1);
|
|
199
|
-
/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_7__);
|
|
200
|
-
/* harmony import */ var uuid_v4__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(14);
|
|
201
|
-
/* harmony import */ var uuid_v4__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(uuid_v4__WEBPACK_IMPORTED_MODULE_8__);
|
|
202
|
-
/* harmony import */ var _splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(0);
|
|
203
|
-
/* harmony import */ var _splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(_splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_9__);
|
|
204
|
-
/* harmony import */ var _splunk_visualization_context_Provider__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(6);
|
|
205
|
-
/* harmony import */ var _splunk_visualization_context_Provider__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(_splunk_visualization_context_Provider__WEBPACK_IMPORTED_MODULE_10__);
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
function ownKeys(object, enumerableOnly) {
|
|
216
|
-
var keys = Object.keys(object);
|
|
217
|
-
|
|
218
|
-
if (Object.getOwnPropertySymbols) {
|
|
219
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
220
|
-
if (enumerableOnly) symbols = symbols.filter(function (sym) {
|
|
221
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
222
|
-
});
|
|
223
|
-
keys.push.apply(keys, symbols);
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
return keys;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
function _objectSpread(target) {
|
|
230
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
231
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
232
|
-
|
|
233
|
-
if (i % 2) {
|
|
234
|
-
ownKeys(Object(source), true).forEach(function (key) {
|
|
235
|
-
_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(target, key, source[key]);
|
|
236
|
-
});
|
|
237
|
-
} else if (Object.getOwnPropertyDescriptors) {
|
|
238
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
239
|
-
} else {
|
|
240
|
-
ownKeys(Object(source)).forEach(function (key) {
|
|
241
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
242
|
-
});
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
return target;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
function _createSuper(Derived) {
|
|
250
|
-
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
251
|
-
|
|
252
|
-
return function _createSuperInternal() {
|
|
253
|
-
var Super = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default()(Derived),
|
|
254
|
-
result;
|
|
255
|
-
|
|
256
|
-
if (hasNativeReflectConstruct) {
|
|
257
|
-
var NewTarget = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default()(this).constructor;
|
|
258
|
-
|
|
259
|
-
result = Reflect.construct(Super, arguments, NewTarget);
|
|
260
|
-
} else {
|
|
261
|
-
result = Super.apply(this, arguments);
|
|
1
|
+
/* Copyright © 2020 Splunk Inc.
|
|
2
|
+
SPLUNK CONFIDENTIAL – Use or disclosure of this material in whole or
|
|
3
|
+
in part without a valid written license from Splunk Inc. is PROHIBITED. */
|
|
4
|
+
var __create = Object.create;
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __defProps = Object.defineProperties;
|
|
7
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
8
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
9
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
10
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
11
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
12
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
13
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
14
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
15
|
+
var __spreadValues = (a, b) => {
|
|
16
|
+
for (var prop in b || (b = {}))
|
|
17
|
+
if (__hasOwnProp.call(b, prop))
|
|
18
|
+
__defNormalProp(a, prop, b[prop]);
|
|
19
|
+
if (__getOwnPropSymbols)
|
|
20
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
21
|
+
if (__propIsEnum.call(b, prop))
|
|
22
|
+
__defNormalProp(a, prop, b[prop]);
|
|
262
23
|
}
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
if (typeof
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
return true;
|
|
276
|
-
} catch (e) {
|
|
277
|
-
return false;
|
|
24
|
+
return a;
|
|
25
|
+
};
|
|
26
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
27
|
+
var __export = (target, all) => {
|
|
28
|
+
for (var name in all)
|
|
29
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
30
|
+
};
|
|
31
|
+
var __copyProps = (to, from, except, desc) => {
|
|
32
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
33
|
+
for (let key of __getOwnPropNames(from))
|
|
34
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
35
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
278
36
|
}
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
37
|
+
return to;
|
|
38
|
+
};
|
|
39
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
40
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
41
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
42
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
43
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
44
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
45
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
46
|
+
mod
|
|
47
|
+
));
|
|
48
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
49
|
+
var __async = (__this, __arguments, generator) => {
|
|
50
|
+
return new Promise((resolve, reject) => {
|
|
51
|
+
var fulfilled = (value) => {
|
|
52
|
+
try {
|
|
53
|
+
step(generator.next(value));
|
|
54
|
+
} catch (e) {
|
|
55
|
+
reject(e);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
var rejected = (value) => {
|
|
59
|
+
try {
|
|
60
|
+
step(generator.throw(value));
|
|
61
|
+
} catch (e) {
|
|
62
|
+
reject(e);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
66
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
67
|
+
});
|
|
294
68
|
};
|
|
295
|
-
var KEY = '__icons__';
|
|
296
|
-
/**
|
|
297
|
-
* a local icon provider
|
|
298
|
-
*/
|
|
299
|
-
|
|
300
|
-
var LocalIconProvider = /*#__PURE__*/function (_Provider) {
|
|
301
|
-
_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_4___default()(LocalIconProvider, _Provider);
|
|
302
|
-
|
|
303
|
-
var _super = _createSuper(LocalIconProvider);
|
|
304
|
-
|
|
305
|
-
function LocalIconProvider() {
|
|
306
|
-
_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default()(this, LocalIconProvider);
|
|
307
69
|
|
|
308
|
-
|
|
70
|
+
// src/LocalIconProvider.js
|
|
71
|
+
var LocalIconProvider_exports = {};
|
|
72
|
+
__export(LocalIconProvider_exports, {
|
|
73
|
+
KEY: () => KEY,
|
|
74
|
+
b64EncodeUnicode: () => b64EncodeUnicode,
|
|
75
|
+
default: () => LocalIconProvider_default
|
|
76
|
+
});
|
|
77
|
+
module.exports = __toCommonJS(LocalIconProvider_exports);
|
|
78
|
+
|
|
79
|
+
// esm-externals:uuid-v4
|
|
80
|
+
var uuid_v4_exports = {};
|
|
81
|
+
__export(uuid_v4_exports, {
|
|
82
|
+
default: () => uuid_v4_default
|
|
83
|
+
});
|
|
84
|
+
var defaultImport = __toESM(require("uuid-v4"));
|
|
85
|
+
__reExport(uuid_v4_exports, require("uuid-v4"));
|
|
86
|
+
var uuid_v4_default = "default" in defaultImport ? defaultImport.default : defaultImport;
|
|
87
|
+
|
|
88
|
+
// esm-externals:@splunk/ui-utils/i18n
|
|
89
|
+
var i18n_exports = {};
|
|
90
|
+
__export(i18n_exports, {
|
|
91
|
+
default: () => i18n_default
|
|
92
|
+
});
|
|
93
|
+
var defaultImport2 = __toESM(require("@splunk/ui-utils/i18n"));
|
|
94
|
+
__reExport(i18n_exports, require("@splunk/ui-utils/i18n"));
|
|
95
|
+
var i18n_default = "default" in defaultImport2 ? defaultImport2.default : defaultImport2;
|
|
96
|
+
|
|
97
|
+
// esm-externals:@splunk/visualization-context/Provider
|
|
98
|
+
var Provider_exports = {};
|
|
99
|
+
__export(Provider_exports, {
|
|
100
|
+
default: () => Provider_default
|
|
101
|
+
});
|
|
102
|
+
var defaultImport3 = __toESM(require("@splunk/visualization-context/Provider"));
|
|
103
|
+
__reExport(Provider_exports, require("@splunk/visualization-context/Provider"));
|
|
104
|
+
var Provider_default = "default" in defaultImport3 ? defaultImport3.default : defaultImport3;
|
|
105
|
+
|
|
106
|
+
// src/LocalIconProvider.js
|
|
107
|
+
var b64EncodeUnicode = (str) => (
|
|
108
|
+
// first we use encodeURIComponent to get percent-encoded UTF-8,
|
|
109
|
+
// then we convert the percent encodings into raw bytes which
|
|
110
|
+
// can be fed into btoa.
|
|
111
|
+
btoa(
|
|
112
|
+
encodeURIComponent(str).replace(
|
|
113
|
+
/%([0-9A-F]{2})/g,
|
|
114
|
+
(match, p1) => String.fromCharCode(parseInt(`0x${p1}`, 16))
|
|
115
|
+
)
|
|
116
|
+
)
|
|
117
|
+
);
|
|
118
|
+
var KEY = "__icons__";
|
|
119
|
+
var LocalIconProvider = class extends Provider_default {
|
|
120
|
+
constructor() {
|
|
121
|
+
super();
|
|
309
122
|
}
|
|
310
123
|
/**
|
|
311
124
|
* return provider type
|
|
312
125
|
* @return {String} 'local'
|
|
313
126
|
*/
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
var response, text, parser, xmlDoc, svg, serializer, svgStr, iconDataURI, icon, id, icons;
|
|
330
|
-
return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_7___default.a.wrap(function _callee$(_context) {
|
|
331
|
-
while (1) {
|
|
332
|
-
switch (_context.prev = _context.next) {
|
|
333
|
-
case 0:
|
|
334
|
-
_context.next = 2;
|
|
335
|
-
return fetch(dataURI);
|
|
336
|
-
|
|
337
|
-
case 2:
|
|
338
|
-
response = _context.sent;
|
|
339
|
-
_context.next = 5;
|
|
340
|
-
return response.text();
|
|
341
|
-
|
|
342
|
-
case 5:
|
|
343
|
-
text = _context.sent;
|
|
344
|
-
parser = new DOMParser();
|
|
345
|
-
xmlDoc = parser.parseFromString(text, 'text/xml');
|
|
346
|
-
svg = xmlDoc.getElementsByTagName('svg')[0];
|
|
347
|
-
|
|
348
|
-
if (svg.getAttribute('viewBox')) {
|
|
349
|
-
_context.next = 11;
|
|
350
|
-
break;
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
throw new Error(Object(_splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_9__["_"])('Please upload a valid svg with viewBox attribute.'));
|
|
354
|
-
|
|
355
|
-
case 11:
|
|
356
|
-
// reset svg attributes
|
|
357
|
-
svg.setAttribute('preserveAspectRatio', 'none'); // convert back to dataURI
|
|
358
|
-
|
|
359
|
-
serializer = new XMLSerializer();
|
|
360
|
-
svgStr = b64EncodeUnicode(serializer.serializeToString(svg));
|
|
361
|
-
iconDataURI = "data:image/svg+xml;base64,".concat(svgStr); // save to localStorage
|
|
362
|
-
|
|
363
|
-
_context.prev = 15;
|
|
364
|
-
icon = {
|
|
365
|
-
dataURI: iconDataURI,
|
|
366
|
-
metaData: metaData
|
|
367
|
-
};
|
|
368
|
-
id = uuid_v4__WEBPACK_IMPORTED_MODULE_8___default()();
|
|
369
|
-
icons = JSON.parse(localStorage.getItem(KEY) || '{}');
|
|
370
|
-
icons = _objectSpread(_objectSpread({}, icons), {}, _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()({}, id, icon));
|
|
371
|
-
localStorage.setItem(KEY, JSON.stringify(icons));
|
|
372
|
-
return _context.abrupt("return", id);
|
|
373
|
-
|
|
374
|
-
case 24:
|
|
375
|
-
_context.prev = 24;
|
|
376
|
-
_context.t0 = _context["catch"](15);
|
|
377
|
-
throw new Error(Object(_splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_9__["_"])('The icon cannot be uploaded. Please check whether your localStorage is full.'));
|
|
378
|
-
|
|
379
|
-
case 27:
|
|
380
|
-
case "end":
|
|
381
|
-
return _context.stop();
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
}, _callee, null, [[15, 24]]);
|
|
385
|
-
}));
|
|
386
|
-
|
|
387
|
-
function upload(_x, _x2) {
|
|
388
|
-
return _upload.apply(this, arguments);
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
return upload;
|
|
392
|
-
}()
|
|
393
|
-
/**
|
|
394
|
-
* get one icon by icon id
|
|
395
|
-
*/
|
|
396
|
-
|
|
397
|
-
}, {
|
|
398
|
-
key: "getById",
|
|
399
|
-
value: function getById(id) {
|
|
400
|
-
var icons = JSON.parse(localStorage.getItem(KEY) || '{}');
|
|
401
|
-
|
|
402
|
-
if (icons[id]) {
|
|
403
|
-
return icons[id];
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
throw new Error(Object(_splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_9__["_"])('The icon is not found.'));
|
|
407
|
-
}
|
|
408
|
-
/**
|
|
409
|
-
* get all icon ids
|
|
410
|
-
* @params options
|
|
411
|
-
* @params options.meta a list of meta data attribute that would be returned with each id
|
|
412
|
-
* @params options.search a search string to filter the returned icons
|
|
413
|
-
*/
|
|
414
|
-
|
|
415
|
-
}, {
|
|
416
|
-
key: "listIds",
|
|
417
|
-
value: function listIds(_ref) {
|
|
418
|
-
var _ref$offset = _ref.offset,
|
|
419
|
-
offset = _ref$offset === void 0 ? 0 : _ref$offset,
|
|
420
|
-
_ref$count = _ref.count,
|
|
421
|
-
count = _ref$count === void 0 ? 100 : _ref$count,
|
|
422
|
-
_ref$meta = _ref.meta,
|
|
423
|
-
meta = _ref$meta === void 0 ? [] : _ref$meta,
|
|
424
|
-
_ref$search = _ref.search,
|
|
425
|
-
search = _ref$search === void 0 ? null : _ref$search;
|
|
426
|
-
|
|
427
|
-
try {
|
|
428
|
-
var icons = JSON.parse(localStorage.getItem(KEY) || '{}');
|
|
429
|
-
var results = [];
|
|
430
|
-
Object.keys(icons).slice(offset, count).forEach(function (id) {
|
|
431
|
-
var icon = {
|
|
432
|
-
id: id
|
|
433
|
-
};
|
|
434
|
-
var iconMeta = icons[id].metaData || {}; // If search is a valid string, return the icon with matched meta data
|
|
435
|
-
|
|
436
|
-
var isSearchedIcon = search != null && Object.keys(iconMeta).some(function (attr) {
|
|
437
|
-
var iconMetaValue = iconMeta[attr].toLowerCase();
|
|
438
|
-
return iconMetaValue.indexOf(search.toLowerCase()) > -1;
|
|
439
|
-
});
|
|
440
|
-
|
|
441
|
-
if (search == null || isSearchedIcon) {
|
|
442
|
-
if (meta && meta.length) {
|
|
443
|
-
icon.metaData = {};
|
|
444
|
-
meta.forEach(function (attr) {
|
|
445
|
-
if (iconMeta[attr] != null) {
|
|
446
|
-
icon.metaData[attr] = iconMeta[attr];
|
|
447
|
-
}
|
|
448
|
-
});
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
results.push(icon);
|
|
452
|
-
}
|
|
453
|
-
});
|
|
454
|
-
return results;
|
|
455
|
-
} catch (error) {
|
|
456
|
-
throw new Error(Object(_splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_9__["_"])('The icon ids cannot be listed.'));
|
|
127
|
+
getType() {
|
|
128
|
+
return "local";
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* upload one new icon
|
|
132
|
+
*/
|
|
133
|
+
upload(dataURI, metaData) {
|
|
134
|
+
return __async(this, null, function* () {
|
|
135
|
+
const response = yield fetch(dataURI);
|
|
136
|
+
const text = yield response.text();
|
|
137
|
+
const parser = new DOMParser();
|
|
138
|
+
const xmlDoc = parser.parseFromString(text, "text/xml");
|
|
139
|
+
const svg = xmlDoc.getElementsByTagName("svg")[0];
|
|
140
|
+
if (!svg.getAttribute("viewBox")) {
|
|
141
|
+
throw new Error((0, i18n_exports._)("Please upload a valid svg with viewBox attribute."));
|
|
457
142
|
}
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
}, {
|
|
464
|
-
key: "deleteById",
|
|
465
|
-
value: function deleteById(id) {
|
|
143
|
+
svg.setAttribute("preserveAspectRatio", "none");
|
|
144
|
+
const serializer = new XMLSerializer();
|
|
145
|
+
const svgStr = b64EncodeUnicode(serializer.serializeToString(svg));
|
|
146
|
+
const iconDataURI = `data:image/svg+xml;base64,${svgStr}`;
|
|
466
147
|
try {
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
148
|
+
const icon = { dataURI: iconDataURI, metaData };
|
|
149
|
+
const id = uuid_v4_default();
|
|
150
|
+
let icons = JSON.parse(localStorage.getItem(KEY) || "{}");
|
|
151
|
+
icons = __spreadProps(__spreadValues({}, icons), { [id]: icon });
|
|
470
152
|
localStorage.setItem(KEY, JSON.stringify(icons));
|
|
471
|
-
return
|
|
153
|
+
return id;
|
|
472
154
|
} catch (error) {
|
|
473
|
-
throw new Error(
|
|
155
|
+
throw new Error(
|
|
156
|
+
(0, i18n_exports._)("The icon cannot be uploaded. Please check whether your localStorage is full.")
|
|
157
|
+
);
|
|
474
158
|
}
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* get one icon by icon id
|
|
163
|
+
*/
|
|
164
|
+
getById(id) {
|
|
165
|
+
const icons = JSON.parse(localStorage.getItem(KEY) || "{}");
|
|
166
|
+
if (icons[id]) {
|
|
167
|
+
return icons[id];
|
|
475
168
|
}
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
169
|
+
throw new Error((0, i18n_exports._)("The icon is not found."));
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* get all icon ids
|
|
173
|
+
* @params options
|
|
174
|
+
* @params options.meta a list of meta data attribute that would be returned with each id
|
|
175
|
+
* @params options.search a search string to filter the returned icons
|
|
176
|
+
*/
|
|
177
|
+
listIds({ offset = 0, count = 100, meta = [], search = null }) {
|
|
178
|
+
try {
|
|
179
|
+
const icons = JSON.parse(localStorage.getItem(KEY) || "{}");
|
|
180
|
+
const results = [];
|
|
181
|
+
Object.keys(icons).slice(offset, count).forEach((id) => {
|
|
182
|
+
const icon = { id };
|
|
183
|
+
const iconMeta = icons[id].metaData || {};
|
|
184
|
+
const isSearchedIcon = search != null && Object.keys(iconMeta).some((attr) => {
|
|
185
|
+
const iconMetaValue = iconMeta[attr].toLowerCase();
|
|
186
|
+
return iconMetaValue.indexOf(search.toLowerCase()) > -1;
|
|
187
|
+
});
|
|
188
|
+
if (search == null || isSearchedIcon) {
|
|
189
|
+
if (meta && meta.length) {
|
|
190
|
+
icon.metaData = {};
|
|
191
|
+
meta.forEach((attr) => {
|
|
192
|
+
if (iconMeta[attr] != null) {
|
|
193
|
+
icon.metaData[attr] = iconMeta[attr];
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
results.push(icon);
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
return results;
|
|
201
|
+
} catch (error) {
|
|
202
|
+
throw new Error((0, i18n_exports._)("The icon ids cannot be listed."));
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* delete an icon by icon id
|
|
207
|
+
*/
|
|
208
|
+
deleteById(id) {
|
|
209
|
+
try {
|
|
210
|
+
const icon = this.getById(id);
|
|
211
|
+
const icons = JSON.parse(localStorage.getItem(KEY));
|
|
212
|
+
delete icons[id];
|
|
213
|
+
localStorage.setItem(KEY, JSON.stringify(icons));
|
|
214
|
+
return icon;
|
|
215
|
+
} catch (error) {
|
|
216
|
+
throw new Error((0, i18n_exports._)("The icon cannot be deleted."));
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
var LocalIconProvider_default = LocalIconProvider;
|
|
221
|
+
//# sourceMappingURL=LocalIconProvider.js.map
|