@kong-ui-public/error-boundary 0.2.8-pr.904.b2f7e967.0 → 1.0.1-pr.880.2a1e3fc6.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.
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
const
|
|
1
|
+
import { defineComponent as y, inject as f, ref as i, computed as g, unref as m, provide as v, onErrorCaptured as O, renderSlot as c } from "vue";
|
|
2
|
+
const _ = "kong-ui-error-boundary-on-error", E = "kong-ui-error-boundary-tags", R = /* @__PURE__ */ y({
|
|
3
3
|
__name: "ErrorBoundary",
|
|
4
4
|
props: {
|
|
5
5
|
/**
|
|
@@ -10,7 +10,7 @@ const p = "kong-ui-error-boundary-on-error", E = "kong-ui-error-boundary-tags",
|
|
|
10
10
|
required: !1,
|
|
11
11
|
default: () => [],
|
|
12
12
|
// Ensure the value is an object, not a string
|
|
13
|
-
validator: (
|
|
13
|
+
validator: (t) => typeof t == "object"
|
|
14
14
|
},
|
|
15
15
|
/**
|
|
16
16
|
* An optional callback function to execute when an error is captured.
|
|
@@ -22,43 +22,43 @@ const p = "kong-ui-error-boundary-on-error", E = "kong-ui-error-boundary-tags",
|
|
|
22
22
|
default: void 0
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
|
-
setup(
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
for (const
|
|
29
|
-
|
|
30
|
-
return Array.from(
|
|
25
|
+
setup(t) {
|
|
26
|
+
const o = t, u = f(_, o.onError), p = f(E, []), a = i(), d = g(() => {
|
|
27
|
+
const e = /* @__PURE__ */ new Set();
|
|
28
|
+
for (const r of [...m(p), ...o.tags])
|
|
29
|
+
e.add(r);
|
|
30
|
+
return Array.from(e);
|
|
31
31
|
});
|
|
32
|
-
return
|
|
33
|
-
var
|
|
34
|
-
return
|
|
35
|
-
error:
|
|
32
|
+
return v(E, d), O((e, r, n) => {
|
|
33
|
+
var s, l;
|
|
34
|
+
return a.value = {
|
|
35
|
+
error: e,
|
|
36
36
|
context: {
|
|
37
|
-
componentName: ((
|
|
38
|
-
dataTestid: String(((
|
|
37
|
+
componentName: ((s = r == null ? void 0 : r.$options) == null ? void 0 : s.__name) || "",
|
|
38
|
+
dataTestid: String(((l = r == null ? void 0 : r.$attrs) == null ? void 0 : l["data-testid"]) || "") || "",
|
|
39
39
|
info: n,
|
|
40
40
|
// See here for codes returned in production: https://github.com/vuejs/core/blob/b8fc18c0b23be9a77b05dc41ed452a87a0becf82/packages/runtime-core/src/errorHandling.ts#L27
|
|
41
41
|
source: "ErrorBoundary",
|
|
42
42
|
// The name of this ErrorBoundary component
|
|
43
43
|
tags: d.value
|
|
44
44
|
}
|
|
45
|
-
},
|
|
46
|
-
}), (
|
|
45
|
+
}, typeof o.onError == "function" ? o.onError(a.value) : typeof u == "function" && u(a.value), !1;
|
|
46
|
+
}), (e, r) => {
|
|
47
47
|
var n;
|
|
48
|
-
return (n =
|
|
48
|
+
return (n = a.value) != null && n.error ? c(e.$slots, "fallback", {
|
|
49
49
|
key: 1,
|
|
50
|
-
context:
|
|
51
|
-
error:
|
|
52
|
-
}) :
|
|
50
|
+
context: a.value.context,
|
|
51
|
+
error: a.value.error
|
|
52
|
+
}) : c(e.$slots, "default", { key: 0 });
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
55
|
}), B = {
|
|
56
56
|
// Customize Vue plugin options as desired
|
|
57
|
-
install: (
|
|
58
|
-
|
|
57
|
+
install: (t, o = {}) => {
|
|
58
|
+
t.component(o.name || "ErrorBoundary", R), t.provide(_, o.onError);
|
|
59
59
|
}
|
|
60
60
|
};
|
|
61
61
|
export {
|
|
62
|
-
|
|
62
|
+
R as ErrorBoundary,
|
|
63
63
|
B as default
|
|
64
64
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(e,r){typeof exports=="object"&&typeof module<"u"?r(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],r):(e=typeof globalThis<"u"?globalThis:e||self,r(e["kong-ui-public-error-boundary"]={},e.Vue))})(this,function(e,r){"use strict";const s="kong-ui-error-boundary-on-error",l="kong-ui-error-boundary-tags",f=r.defineComponent({__name:"ErrorBoundary",props:{tags:{type:Array,required:!1,default:()=>[],validator:u=>typeof u=="object"},onError:{type:Function,required:!1,default:void 0}},setup(u){const t=u,i=r.inject(s,t.onError),E=r.inject(l,[]),a=r.ref(),c=r.computed(()=>{const n=new Set;for(const o of[...r.unref(E),...t.tags])n.add(o);return Array.from(n)});return r.provide(l,c),r.onErrorCaptured((n,o,d)=>{var p,_;return a.value={error:n,context:{componentName:((p=o==null?void 0:o.$options)==null?void 0:p.__name)||"",dataTestid:String(((_=o==null?void 0:o.$attrs)==null?void 0:_["data-testid"])||"")||"",info:d,source:"ErrorBoundary",tags:c.value}},typeof t.onError=="function"?t.onError(a.value):typeof i=="function"&&i(a.value),!1}),(n,o)=>{var d;return(d=a.value)!=null&&d.error?r.renderSlot(n.$slots,"fallback",{key:1,context:a.value.context,error:a.value.error}):r.renderSlot(n.$slots,"default",{key:0})}}}),y={install:(u,t={})=>{u.component(t.name||"ErrorBoundary",f),u.provide(s,t.onError)}};e.ErrorBoundary=f,e.default=y,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorBoundary.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ErrorBoundary.vue.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAA2B,QAAQ,EAAE,MAAM,KAAK,CAAA;AAK5D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAA;;
|
|
1
|
+
{"version":3,"file":"ErrorBoundary.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ErrorBoundary.vue.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAA2B,QAAQ,EAAE,MAAM,KAAK,CAAA;AAK5D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAA;;IAmKzD;;OAEG;;;;;;;IAQH;;;OAGG;;;;;;;IAbH;;OAEG;;;;;;;IAQH;;;OAGG;;;;;;;;;;;;;;;;AAaL,wBAAwG;AAGxG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAAE,QAAO;QAClD,MAAM,EAAE,CAAC,CAAC;KACT,CAAA;CAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kong-ui-public/error-boundary",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.1-pr.880.2a1e3fc6.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/error-boundary.umd.js",
|
|
6
6
|
"module": "./dist/error-boundary.es.js",
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@kong/design-tokens": "^1.11.9",
|
|
24
|
+
"@kong/icons": "^1.7.8",
|
|
24
25
|
"vue": "^3.3.4"
|
|
25
26
|
},
|
|
26
27
|
"repository": {
|
|
@@ -43,9 +44,6 @@
|
|
|
43
44
|
"peerDependencies": {
|
|
44
45
|
"vue": "^3.3.4"
|
|
45
46
|
},
|
|
46
|
-
"dependencies": {
|
|
47
|
-
"@kong/icons": "^1.8.0"
|
|
48
|
-
},
|
|
49
47
|
"scripts": {
|
|
50
48
|
"dev": "cross-env USE_SANDBOX=true vite",
|
|
51
49
|
"build": "run-s typecheck build:package build:types",
|