@kong-ui-public/error-boundary 2.5.21 → 2.5.22-pr.4063.bf809a10e.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/dist/error-boundary.es.js +41 -57
- package/dist/error-boundary.umd.js +1 -1
- package/package.json +2 -2
|
@@ -1,57 +1,41 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
}, typeof r.onError == "function" ? r.onError(t.value) : typeof a == "function" && a(t.value), !1)), (o, n) => t.value?.error ? d(o.$slots, "fallback", {
|
|
44
|
-
context: t.value.context,
|
|
45
|
-
error: t.value.error
|
|
46
|
-
}, void 0, void 0, 1) : d(o.$slots, "default", {}, void 0, void 0, 0);
|
|
47
|
-
}
|
|
48
|
-
}), R = {
|
|
49
|
-
// Customize Vue plugin options as desired
|
|
50
|
-
install: (e, r = {}) => {
|
|
51
|
-
e.component(r.name || "ErrorBoundary", m), e.provide(l, r.onError);
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
export {
|
|
55
|
-
m as ErrorBoundary,
|
|
56
|
-
R as default
|
|
57
|
-
};
|
|
1
|
+
import { computed as e, defineComponent as t, inject as n, onErrorCaptured as r, provide as i, ref as a, renderSlot as o, unref as s } from "vue";
|
|
2
|
+
// src/constants.ts
|
|
3
|
+
var c = "kong-ui-error-boundary-on-error", l = "kong-ui-error-boundary-tags", u = /* @__PURE__ */ t({
|
|
4
|
+
__name: "ErrorBoundary",
|
|
5
|
+
props: {
|
|
6
|
+
tags: {
|
|
7
|
+
type: Array,
|
|
8
|
+
required: !1,
|
|
9
|
+
default: () => [],
|
|
10
|
+
validator: (e) => typeof e == "object"
|
|
11
|
+
},
|
|
12
|
+
onError: {
|
|
13
|
+
type: Function,
|
|
14
|
+
required: !1,
|
|
15
|
+
default: void 0
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
setup(t) {
|
|
19
|
+
let u = t, d = n(c, u.onError), f = n(l, []), p = a(), m = e(() => {
|
|
20
|
+
let e = /* @__PURE__ */ new Set();
|
|
21
|
+
for (let t of [...s(f), ...u.tags]) e.add(t);
|
|
22
|
+
return Array.from(e);
|
|
23
|
+
});
|
|
24
|
+
return i(l, m), r((e, t, n) => (p.value = {
|
|
25
|
+
error: e,
|
|
26
|
+
context: {
|
|
27
|
+
componentName: t?.$options?.__name || "",
|
|
28
|
+
dataTestid: String(t?.$attrs?.["data-testid"] || "") || "",
|
|
29
|
+
info: n,
|
|
30
|
+
source: "ErrorBoundary",
|
|
31
|
+
tags: m.value
|
|
32
|
+
}
|
|
33
|
+
}, typeof u.onError == "function" ? u.onError(p.value) : typeof d == "function" && d(p.value), !1)), (e, t) => p.value?.error ? o(e.$slots, "fallback", {
|
|
34
|
+
context: p.value.context,
|
|
35
|
+
error: p.value.error
|
|
36
|
+
}, void 0, void 0, 1) : o(e.$slots, "default", {}, void 0, void 0, 0);
|
|
37
|
+
}
|
|
38
|
+
}), d = { install: (e, t = {}) => {
|
|
39
|
+
e.component(t.name || "ErrorBoundary", u), e.provide(c, t.onError);
|
|
40
|
+
} };
|
|
41
|
+
export { u as ErrorBoundary, d as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("vue")):typeof define==`function`&&define.amd?define([`exports`,`vue`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e[`kong-ui-public-error-boundary`]={},e.Vue))})(this,function(e,t){Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});var n=`kong-ui-error-boundary-on-error`,r=`kong-ui-error-boundary-tags`,i=(0,t.defineComponent)({__name:`ErrorBoundary`,props:{tags:{type:Array,required:!1,default:()=>[],validator:e=>typeof e==`object`},onError:{type:Function,required:!1,default:void 0}},setup(e){let i=e,a=(0,t.inject)(n,i.onError),o=(0,t.inject)(r,[]),s=(0,t.ref)(),c=(0,t.computed)(()=>{let e=new Set;for(let n of[...(0,t.unref)(o),...i.tags])e.add(n);return Array.from(e)});return(0,t.provide)(r,c),(0,t.onErrorCaptured)((e,t,n)=>(s.value={error:e,context:{componentName:t?.$options?.__name||``,dataTestid:String(t?.$attrs?.[`data-testid`]||``)||``,info:n,source:`ErrorBoundary`,tags:c.value}},typeof i.onError==`function`?i.onError(s.value):typeof a==`function`&&a(s.value),!1)),(e,n)=>s.value?.error?(0,t.renderSlot)(e.$slots,`fallback`,{context:s.value.context,error:s.value.error},void 0,void 0,1):(0,t.renderSlot)(e.$slots,`default`,{},void 0,void 0,0)}});e.ErrorBoundary=i,e.default={install:(e,t={})=>{e.component(t.name||`ErrorBoundary`,i),e.provide(n,t.onError)}}});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kong-ui-public/error-boundary",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.22-pr.4063.bf809a10e.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/error-boundary.umd.js",
|
|
6
6
|
"module": "./dist/error-boundary.es.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@kong/design-tokens": "3.5.1",
|
|
25
25
|
"@kong/icons": "^1.64.0",
|
|
26
|
-
"vue": "^3.5.
|
|
26
|
+
"vue": "^3.5.44"
|
|
27
27
|
},
|
|
28
28
|
"repository": {
|
|
29
29
|
"type": "git",
|