@kong-ui-public/error-boundary 0.0.2-pr.821.e5763850.0 → 0.0.2-pr.821.f0cfb4ef.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,50 +1,60 @@
1
- import { defineComponent as p, inject as c, ref as i, computed as y, unref as m, provide as g, onErrorCaptured as v, renderSlot as d } from "vue";
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
2
  const E = "kong-ui-error-boundary-on-error", f = "kong-ui-error-boundary-tags", O = /* @__PURE__ */ p({
3
3
  __name: "ErrorBoundary",
4
4
  props: {
5
+ /**
6
+ * An optional array of strings to pass along to the context
7
+ */
5
8
  tags: {
6
9
  type: Array,
7
10
  required: !1,
8
- default: () => []
11
+ default: () => [],
12
+ // Ensure the value is an object, not a string
13
+ validator: (e) => typeof e == "object"
9
14
  },
15
+ /**
16
+ * An optional callback function to execute when an error is captured.
17
+ * This prop will take precedence over a plugin-provided onError callback.
18
+ */
10
19
  onError: {
11
20
  type: Function,
12
21
  required: !1,
13
22
  default: void 0
14
23
  }
15
24
  },
16
- setup(t) {
17
- const r = t, u = c(E, r.onError), _ = c(f, []), e = i(), s = y(() => {
25
+ setup(e) {
26
+ const r = e, u = c(E, r.onError), _ = c(f, []), n = i(), s = y(() => {
18
27
  const o = /* @__PURE__ */ new Set();
19
- for (const n of [...m(_), ...r.tags])
20
- o.add(n);
28
+ for (const t of [...m(_), ...r.tags])
29
+ o.add(t);
21
30
  return Array.from(o);
22
31
  });
23
- return g(f, s), v((o, n, a) => {
32
+ return v(f, s), g((o, t, a) => {
24
33
  var l;
25
- return e.value = {
34
+ return n.value = {
26
35
  error: o,
27
36
  context: {
28
- componentName: ((l = n == null ? void 0 : n.$options) == null ? void 0 : l.__name) || "",
37
+ componentName: ((l = t == null ? void 0 : t.$options) == null ? void 0 : l.__name) || "",
29
38
  info: a,
39
+ // See here for codes returned in production: https://github.com/vuejs/core/blob/b8fc18c0b23be9a77b05dc41ed452a87a0becf82/packages/runtime-core/src/errorHandling.ts#L27
30
40
  source: "ErrorBoundary",
31
41
  // The name of this ErrorBoundary component
32
42
  tags: s.value
33
43
  }
34
- }, typeof r.onError == "function" ? r.onError(e.value) : typeof u == "function" && u(e.value), !1;
35
- }), (o, n) => {
44
+ }, typeof r.onError == "function" ? r.onError(n.value) : typeof u == "function" && u(n.value), !1;
45
+ }), (o, t) => {
36
46
  var a;
37
- return (a = e.value) != null && a.error ? d(o.$slots, "fallback", {
47
+ return (a = n.value) != null && a.error ? d(o.$slots, "fallback", {
38
48
  key: 1,
39
- context: e.value.context,
40
- error: e.value.error
49
+ context: n.value.context,
50
+ error: n.value.error
41
51
  }) : d(o.$slots, "default", { key: 0 });
42
52
  };
43
53
  }
44
54
  }), N = {
45
55
  // Customize Vue plugin options as desired
46
- install: (t, r = {}) => {
47
- t.component(r.name || "ErrorBoundary", O), t.provide(E, r.onError);
56
+ install: (e, r = {}) => {
57
+ e.component(r.name || "ErrorBoundary", O), e.provide(E, r.onError);
48
58
  }
49
59
  };
50
60
  export {
@@ -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:()=>[]},onError:{type:Function,required:!1,default:void 0}},setup(a){const o=a,i=r.inject(s,o.onError),E=r.inject(l,[]),t=r.ref(),c=r.computed(()=>{const n=new Set;for(const u of[...r.unref(E),...o.tags])n.add(u);return Array.from(n)});return r.provide(l,c),r.onErrorCaptured((n,u,d)=>{var p;return t.value={error:n,context:{componentName:((p=u==null?void 0:u.$options)==null?void 0:p.__name)||"",info:d,source:"ErrorBoundary",tags:c.value}},typeof o.onError=="function"?o.onError(t.value):typeof i=="function"&&i(t.value),!1}),(n,u)=>{var d;return(d=t.value)!=null&&d.error?r.renderSlot(n.$slots,"fallback",{key:1,context:t.value.context,error:t.value.error}):r.renderSlot(n.$slots,"default",{key:0})}}}),_={install:(a,o={})=>{a.component(o.name||"ErrorBoundary",f),a.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: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,22 +1,38 @@
1
1
  import type { PropType } from 'vue';
2
2
  import type { ErrorBoundaryCallbackParams } from '../types';
3
3
  declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
4
+ /**
5
+ * An optional array of strings to pass along to the context
6
+ */
4
7
  tags: {
5
8
  type: PropType<string[]>;
6
9
  required: false;
7
10
  default: () => never[];
11
+ validator: (value: any) => boolean;
8
12
  };
13
+ /**
14
+ * An optional callback function to execute when an error is captured.
15
+ * This prop will take precedence over a plugin-provided onError callback.
16
+ */
9
17
  onError: {
10
18
  type: PropType<(params: ErrorBoundaryCallbackParams) => void>;
11
19
  required: false;
12
20
  default: undefined;
13
21
  };
14
22
  }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
23
+ /**
24
+ * An optional array of strings to pass along to the context
25
+ */
15
26
  tags: {
16
27
  type: PropType<string[]>;
17
28
  required: false;
18
29
  default: () => never[];
30
+ validator: (value: any) => boolean;
19
31
  };
32
+ /**
33
+ * An optional callback function to execute when an error is captured.
34
+ * This prop will take precedence over a plugin-provided onError callback.
35
+ */
20
36
  onError: {
21
37
  type: PropType<(params: ErrorBoundaryCallbackParams) => void>;
22
38
  required: false;
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmJ3D,wBAA8G;AAE9G,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;;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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kong-ui-public/error-boundary",
3
- "version": "0.0.2-pr.821.e5763850.0",
3
+ "version": "0.0.2-pr.821.f0cfb4ef.0",
4
4
  "type": "module",
5
5
  "main": "./dist/error-boundary.umd.js",
6
6
  "module": "./dist/error-boundary.es.js",