@rive-app/canvas-single 2.4.2 → 2.4.3
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/package.json +1 -1
- package/rive.js +62 -4
- package/rive.js.map +1 -1
package/package.json
CHANGED
package/rive.js
CHANGED
|
@@ -131,7 +131,7 @@ if(m.preInit)for("function"==typeof m.preInit&&(m.preInit=[m.preInit]);0<m.preIn
|
|
|
131
131
|
/* 2 */
|
|
132
132
|
/***/ ((module) => {
|
|
133
133
|
|
|
134
|
-
module.exports = JSON.parse('{"name":"@rive-app/canvas-single","version":"2.4.
|
|
134
|
+
module.exports = JSON.parse('{"name":"@rive-app/canvas-single","version":"2.4.3","description":"Rive\'s high-level canvas based web api all in one js file.","main":"rive.js","homepage":"https://rive.app","repository":{"type":"git","url":"https://github.com/rive-app/rive-wasm/tree/master/js"},"keywords":["rive","animation"],"author":"Rive","contributors":["Luigi Rosso <luigi@rive.app> (https://rive.app)","Maxwell Talbot <max@rive.app> (https://rive.app)","Arthur Vivian <arthur@rive.app> (https://rive.app)","Umberto Sonnino <umberto@rive.app> (https://rive.app)","Matthew Sullivan <matt.j.sullivan@gmail.com> (mailto:matt.j.sullivan@gmail.com)"],"license":"MIT","files":["rive.js","rive.js.map","rive.d.ts","rive_advanced.mjs.d.ts"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
|
|
135
135
|
|
|
136
136
|
/***/ }),
|
|
137
137
|
/* 3 */
|
|
@@ -139,9 +139,13 @@ module.exports = JSON.parse('{"name":"@rive-app/canvas-single","version":"2.4.2"
|
|
|
139
139
|
|
|
140
140
|
__webpack_require__.r(__webpack_exports__);
|
|
141
141
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
142
|
-
/* harmony export */
|
|
142
|
+
/* harmony export */ BLANK_URL: () => (/* reexport safe */ _sanitizeUrl__WEBPACK_IMPORTED_MODULE_1__.BLANK_URL),
|
|
143
|
+
/* harmony export */ registerTouchInteractions: () => (/* reexport safe */ _registerTouchInteractions__WEBPACK_IMPORTED_MODULE_0__.registerTouchInteractions),
|
|
144
|
+
/* harmony export */ sanitizeUrl: () => (/* reexport safe */ _sanitizeUrl__WEBPACK_IMPORTED_MODULE_1__.sanitizeUrl)
|
|
143
145
|
/* harmony export */ });
|
|
144
146
|
/* harmony import */ var _registerTouchInteractions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4);
|
|
147
|
+
/* harmony import */ var _sanitizeUrl__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5);
|
|
148
|
+
|
|
145
149
|
|
|
146
150
|
|
|
147
151
|
|
|
@@ -278,6 +282,59 @@ var registerTouchInteractions = function (_a) {
|
|
|
278
282
|
};
|
|
279
283
|
|
|
280
284
|
|
|
285
|
+
/***/ }),
|
|
286
|
+
/* 5 */
|
|
287
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
288
|
+
|
|
289
|
+
__webpack_require__.r(__webpack_exports__);
|
|
290
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
291
|
+
/* harmony export */ BLANK_URL: () => (/* binding */ BLANK_URL),
|
|
292
|
+
/* harmony export */ sanitizeUrl: () => (/* binding */ sanitizeUrl)
|
|
293
|
+
/* harmony export */ });
|
|
294
|
+
// Reference: https://github.com/braintree/sanitize-url/tree/main
|
|
295
|
+
var invalidProtocolRegex = /^([^\w]*)(javascript|data|vbscript)/im;
|
|
296
|
+
var htmlEntitiesRegex = /&#(\w+)(^\w|;)?/g;
|
|
297
|
+
var htmlCtrlEntityRegex = /&(newline|tab);/gi;
|
|
298
|
+
var ctrlCharactersRegex = /[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/gim;
|
|
299
|
+
var urlSchemeRegex = /^.+(:|:)/gim;
|
|
300
|
+
var relativeFirstCharacters = [".", "/"];
|
|
301
|
+
var BLANK_URL = "about:blank";
|
|
302
|
+
function isRelativeUrlWithoutProtocol(url) {
|
|
303
|
+
return relativeFirstCharacters.indexOf(url[0]) > -1;
|
|
304
|
+
}
|
|
305
|
+
// adapted from https://stackoverflow.com/a/29824550/2601552
|
|
306
|
+
function decodeHtmlCharacters(str) {
|
|
307
|
+
var removedNullByte = str.replace(ctrlCharactersRegex, "");
|
|
308
|
+
return removedNullByte.replace(htmlEntitiesRegex, function (match, dec) {
|
|
309
|
+
return String.fromCharCode(dec);
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
function sanitizeUrl(url) {
|
|
313
|
+
if (!url) {
|
|
314
|
+
return BLANK_URL;
|
|
315
|
+
}
|
|
316
|
+
var sanitizedUrl = decodeHtmlCharacters(url)
|
|
317
|
+
.replace(htmlCtrlEntityRegex, "")
|
|
318
|
+
.replace(ctrlCharactersRegex, "")
|
|
319
|
+
.trim();
|
|
320
|
+
if (!sanitizedUrl) {
|
|
321
|
+
return BLANK_URL;
|
|
322
|
+
}
|
|
323
|
+
if (isRelativeUrlWithoutProtocol(sanitizedUrl)) {
|
|
324
|
+
return sanitizedUrl;
|
|
325
|
+
}
|
|
326
|
+
var urlSchemeParseResults = sanitizedUrl.match(urlSchemeRegex);
|
|
327
|
+
if (!urlSchemeParseResults) {
|
|
328
|
+
return sanitizedUrl;
|
|
329
|
+
}
|
|
330
|
+
var urlScheme = urlSchemeParseResults[0];
|
|
331
|
+
if (invalidProtocolRegex.test(urlScheme)) {
|
|
332
|
+
return BLANK_URL;
|
|
333
|
+
}
|
|
334
|
+
return sanitizedUrl;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
|
|
281
338
|
/***/ })
|
|
282
339
|
/******/ ]);
|
|
283
340
|
/************************************************************************/
|
|
@@ -1521,9 +1578,10 @@ var Rive = /** @class */ (function () {
|
|
|
1521
1578
|
if (this.automaticallyHandleEvents) {
|
|
1522
1579
|
var newAnchorTag = document.createElement("a");
|
|
1523
1580
|
var _b = event_1, url = _b.url, target = _b.target;
|
|
1524
|
-
|
|
1581
|
+
var sanitizedUrl = (0,_utils__WEBPACK_IMPORTED_MODULE_2__.sanitizeUrl)(url);
|
|
1582
|
+
url && newAnchorTag.setAttribute("href", sanitizedUrl);
|
|
1525
1583
|
target && newAnchorTag.setAttribute("target", target);
|
|
1526
|
-
if (
|
|
1584
|
+
if (sanitizedUrl && sanitizedUrl !== _utils__WEBPACK_IMPORTED_MODULE_2__.BLANK_URL) {
|
|
1527
1585
|
newAnchorTag.click();
|
|
1528
1586
|
}
|
|
1529
1587
|
}
|