@kong-ui-public/error-boundary 0.1.1 → 0.1.2-pr.848.2caab2bd.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 p, inject as c, ref as i, computed as y, unref as m, provide as v, onErrorCaptured as g, renderSlot as d } from "vue";
2
- const E = "kong-ui-error-boundary-on-error", f = "kong-ui-error-boundary-tags", O = /* @__PURE__ */ p({
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 E = "kong-ui-error-boundary-on-error", f = "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: (e) => typeof e == "object"
13
+ validator: (t) => typeof t == "object"
14
14
  },
15
15
  /**
16
16
  * An optional callback function to execute when an error is captured.
@@ -22,42 +22,43 @@ const E = "kong-ui-error-boundary-on-error", f = "kong-ui-error-boundary-tags",
22
22
  default: void 0
23
23
  }
24
24
  },
25
- setup(e) {
26
- const r = e, u = c(E, r.onError), _ = c(f, []), n = i(), s = y(() => {
27
- const o = /* @__PURE__ */ new Set();
28
- for (const t of [...m(_), ...r.tags])
29
- o.add(t);
30
- return Array.from(o);
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 v(f, s), g((o, t, a) => {
33
- var l;
34
- return n.value = {
35
- error: o,
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: ((l = t == null ? void 0 : t.$options) == null ? void 0 : l.__name) || "",
38
- info: a,
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
+ info: n,
39
40
  // See here for codes returned in production: https://github.com/vuejs/core/blob/b8fc18c0b23be9a77b05dc41ed452a87a0becf82/packages/runtime-core/src/errorHandling.ts#L27
40
41
  source: "ErrorBoundary",
41
42
  // The name of this ErrorBoundary component
42
- tags: s.value
43
+ tags: d.value
43
44
  }
44
- }, typeof r.onError == "function" ? r.onError(n.value) : typeof u == "function" && u(n.value), !1;
45
- }), (o, t) => {
46
- var a;
47
- return (a = n.value) != null && a.error ? d(o.$slots, "fallback", {
45
+ }, typeof o.onError == "function" ? o.onError(a.value) : typeof u == "function" && u(a.value), !1;
46
+ }), (e, r) => {
47
+ var n;
48
+ return (n = a.value) != null && n.error ? c(e.$slots, "fallback", {
48
49
  key: 1,
49
- context: n.value.context,
50
- error: n.value.error
51
- }) : d(o.$slots, "default", { key: 0 });
50
+ context: a.value.context,
51
+ error: a.value.error
52
+ }) : c(e.$slots, "default", { key: 0 });
52
53
  };
53
54
  }
54
- }), N = {
55
+ }), B = {
55
56
  // Customize Vue plugin options as desired
56
- install: (e, r = {}) => {
57
- e.component(r.name || "ErrorBoundary", O), e.provide(E, r.onError);
57
+ install: (t, o = {}) => {
58
+ t.component(o.name || "ErrorBoundary", R), t.provide(_, o.onError);
58
59
  }
59
60
  };
60
61
  export {
61
- O as ErrorBoundary,
62
- N as default
62
+ R as ErrorBoundary,
63
+ B as default
63
64
  };
@@ -1 +1 @@
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:t=>typeof t=="object"},onError:{type:Function,required:!1,default:void 0}},setup(t){const o=t,i=r.inject(s,o.onError),y=r.inject(l,[]),u=r.ref(),c=r.computed(()=>{const n=new Set;for(const a of[...r.unref(y),...o.tags])n.add(a);return Array.from(n)});return r.provide(l,c),r.onErrorCaptured((n,a,d)=>{var p;return u.value={error:n,context:{componentName:((p=a==null?void 0:a.$options)==null?void 0:p.__name)||"",info:d,source:"ErrorBoundary",tags:c.value}},typeof o.onError=="function"?o.onError(u.value):typeof i=="function"&&i(u.value),!1}),(n,a)=>{var d;return(d=u.value)!=null&&d.error?r.renderSlot(n.$slots,"fallback",{key:1,context:u.value.context,error:u.value.error}):r.renderSlot(n.$slots,"default",{key:0})}}}),_={install:(t,o={})=>{t.component(o.name||"ErrorBoundary",f),t.provide(s,o.onError)}};e.ErrorBoundary=f,e.default=_,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
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;;IAkKzD;;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"}
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"}
@@ -1,5 +1,6 @@
1
1
  export interface ErrorBoundaryContext {
2
2
  componentName: string;
3
+ dataTestid: string;
3
4
  info: string;
4
5
  source: string;
5
6
  tags: string[];
@@ -10,6 +11,6 @@ export interface ErrorBoundaryCallbackParams {
10
11
  }
11
12
  export interface ErrorBoundaryPluginOptions {
12
13
  name?: string;
13
- onError?: ({ error, context: { componentName, info, source, tags } }: ErrorBoundaryCallbackParams) => void;
14
+ onError?: ({ error, context: { componentName, dataTestid, info, source, tags } }: ErrorBoundaryCallbackParams) => void;
14
15
  }
15
16
  //# sourceMappingURL=error-boundary.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"error-boundary.d.ts","sourceRoot":"","sources":["../../../src/types/error-boundary.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,oBAAoB;IACnC,aAAa,EAAE,MAAM,CAAA;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,EAAE,CAAA;CACf;AAED,MAAM,WAAW,2BAA2B;IAC1C,KAAK,EAAE,OAAO,CAAA;IACd,OAAO,EAAE,oBAAoB,CAAA;CAC9B;AAED,MAAM,WAAW,0BAA0B;IACzC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,2BAA2B,KAAK,IAAI,CAAA;CAC3G"}
1
+ {"version":3,"file":"error-boundary.d.ts","sourceRoot":"","sources":["../../../src/types/error-boundary.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,oBAAoB;IACnC,aAAa,EAAE,MAAM,CAAA;IACrB,UAAU,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,EAAE,CAAA;CACf;AAED,MAAM,WAAW,2BAA2B;IAC1C,KAAK,EAAE,OAAO,CAAA;IACd,OAAO,EAAE,oBAAoB,CAAA;CAC9B;AAED,MAAM,WAAW,0BAA0B;IACzC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,aAAa,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,2BAA2B,KAAK,IAAI,CAAA;CACvH"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kong-ui-public/error-boundary",
3
- "version": "0.1.1",
3
+ "version": "0.1.2-pr.848.2caab2bd.0",
4
4
  "type": "module",
5
5
  "main": "./dist/error-boundary.umd.js",
6
6
  "module": "./dist/error-boundary.es.js",
@@ -44,7 +44,7 @@
44
44
  "vue": "^3.3.4"
45
45
  },
46
46
  "dependencies": {
47
- "@kong/icons": "^1.7.4"
47
+ "@kong/icons": "^1.7.6"
48
48
  },
49
49
  "scripts": {
50
50
  "dev": "cross-env USE_SANDBOX=true vite",