@kong-ui-public/error-boundary 2.2.11-pr.2751.7a3f18384.0 → 2.2.12-pr.2694.d983d66d0.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/package.json +1 -1
- package/dist/error-boundary.es.js +0 -64
- package/dist/error-boundary.umd.js +0 -1
- package/dist/types/components/ErrorBoundary.vue.d.ts +0 -62
- package/dist/types/components/ErrorBoundary.vue.d.ts.map +0 -1
- package/dist/types/constants.d.ts +0 -5
- package/dist/types/constants.d.ts.map +0 -1
- package/dist/types/index.d.ts +0 -10
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/types/error-boundary.d.ts +0 -16
- package/dist/types/types/error-boundary.d.ts.map +0 -1
- package/dist/types/types/index.d.ts +0 -2
- package/dist/types/types/index.d.ts.map +0 -1
package/package.json
CHANGED
|
@@ -1,64 +0,0 @@
|
|
|
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
|
-
__name: "ErrorBoundary",
|
|
4
|
-
props: {
|
|
5
|
-
/**
|
|
6
|
-
* An optional array of strings to pass along to the context
|
|
7
|
-
*/
|
|
8
|
-
tags: {
|
|
9
|
-
type: Array,
|
|
10
|
-
required: !1,
|
|
11
|
-
default: () => [],
|
|
12
|
-
// Ensure the value is an object, not a string
|
|
13
|
-
validator: (t) => typeof t == "object"
|
|
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
|
-
*/
|
|
19
|
-
onError: {
|
|
20
|
-
type: Function,
|
|
21
|
-
required: !1,
|
|
22
|
-
default: void 0
|
|
23
|
-
}
|
|
24
|
-
},
|
|
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
|
-
});
|
|
32
|
-
return v(E, d), O((e, r, n) => {
|
|
33
|
-
var s, l;
|
|
34
|
-
return a.value = {
|
|
35
|
-
error: e,
|
|
36
|
-
context: {
|
|
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,
|
|
40
|
-
// See here for codes returned in production: https://github.com/vuejs/core/blob/b8fc18c0b23be9a77b05dc41ed452a87a0becf82/packages/runtime-core/src/errorHandling.ts#L27
|
|
41
|
-
source: "ErrorBoundary",
|
|
42
|
-
// The name of this ErrorBoundary component
|
|
43
|
-
tags: d.value
|
|
44
|
-
}
|
|
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", {
|
|
49
|
-
key: 1,
|
|
50
|
-
context: a.value.context,
|
|
51
|
-
error: a.value.error
|
|
52
|
-
}) : c(e.$slots, "default", { key: 0 });
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
}), B = {
|
|
56
|
-
// Customize Vue plugin options as desired
|
|
57
|
-
install: (t, o = {}) => {
|
|
58
|
-
t.component(o.name || "ErrorBoundary", R), t.provide(_, o.onError);
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
export {
|
|
62
|
-
R as ErrorBoundary,
|
|
63
|
-
B as default
|
|
64
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
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,62 +0,0 @@
|
|
|
1
|
-
import type { PropType } from 'vue';
|
|
2
|
-
import type { ErrorBoundaryCallbackParams } from '../types';
|
|
3
|
-
declare var __VLS_1: {}, __VLS_3: {
|
|
4
|
-
context: import("..").ErrorBoundaryContext;
|
|
5
|
-
error: {};
|
|
6
|
-
};
|
|
7
|
-
type __VLS_Slots = {} & {
|
|
8
|
-
default?: (props: typeof __VLS_1) => any;
|
|
9
|
-
} & {
|
|
10
|
-
fallback?: (props: typeof __VLS_3) => any;
|
|
11
|
-
};
|
|
12
|
-
declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
13
|
-
/**
|
|
14
|
-
* An optional array of strings to pass along to the context
|
|
15
|
-
*/
|
|
16
|
-
tags: {
|
|
17
|
-
type: PropType<string[]>;
|
|
18
|
-
required: false;
|
|
19
|
-
default: () => never[];
|
|
20
|
-
validator: (value: any) => boolean;
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* An optional callback function to execute when an error is captured.
|
|
24
|
-
* This prop will take precedence over a plugin-provided onError callback.
|
|
25
|
-
*/
|
|
26
|
-
onError: {
|
|
27
|
-
type: PropType<(params: ErrorBoundaryCallbackParams) => void>;
|
|
28
|
-
required: false;
|
|
29
|
-
default: undefined;
|
|
30
|
-
};
|
|
31
|
-
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
32
|
-
/**
|
|
33
|
-
* An optional array of strings to pass along to the context
|
|
34
|
-
*/
|
|
35
|
-
tags: {
|
|
36
|
-
type: PropType<string[]>;
|
|
37
|
-
required: false;
|
|
38
|
-
default: () => never[];
|
|
39
|
-
validator: (value: any) => boolean;
|
|
40
|
-
};
|
|
41
|
-
/**
|
|
42
|
-
* An optional callback function to execute when an error is captured.
|
|
43
|
-
* This prop will take precedence over a plugin-provided onError callback.
|
|
44
|
-
*/
|
|
45
|
-
onError: {
|
|
46
|
-
type: PropType<(params: ErrorBoundaryCallbackParams) => void>;
|
|
47
|
-
required: false;
|
|
48
|
-
default: undefined;
|
|
49
|
-
};
|
|
50
|
-
}>> & Readonly<{}>, {
|
|
51
|
-
tags: string[];
|
|
52
|
-
onError: (params: ErrorBoundaryCallbackParams) => void;
|
|
53
|
-
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
54
|
-
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
55
|
-
declare const _default: typeof __VLS_export;
|
|
56
|
-
export default _default;
|
|
57
|
-
type __VLS_WithSlots<T, S> = T & {
|
|
58
|
-
new (): {
|
|
59
|
-
$slots: S;
|
|
60
|
-
};
|
|
61
|
-
};
|
|
62
|
-
//# sourceMappingURL=ErrorBoundary.vue.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorBoundary.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ErrorBoundary.vue"],"names":[],"mappings":"AAmGA,OAAO,KAAK,EAA2B,QAAQ,EAAE,MAAM,KAAK,CAAA;AAK5D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAA;AAsG3D,QAAA,IAAI,OAAO,IAAU,EAAE,OAAO;;;CAAW,CAAE;AAC3C,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,GAC5C;IAAE,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,CAAC;AAGhD,QAAA,MAAM,UAAU;IAEd;;OAEG;;cAEc,QAAQ,CAAC,MAAM,EAAE,CAAC;;;2BAId,GAAG,KAAG,OAAO;;IAElC;;;OAGG;;cAEiB,QAAQ,CAAC,CAAC,MAAM,EAAE,2BAA2B,KAAK,IAAI,CAAC;;;;;IAf3E;;OAEG;;cAEc,QAAQ,CAAC,MAAM,EAAE,CAAC;;;2BAId,GAAG,KAAG,OAAO;;IAElC;;;OAGG;;cAEiB,QAAQ,CAAC,CAAC,MAAM,EAAE,2BAA2B,KAAK,IAAI,CAAC;;;;;;sBAArC,2BAA2B,KAAK,IAAI;4EAK1E,CAAC;AACH,QAAA,MAAM,YAAY,EAAS,eAAe,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,CAAC;wBACtD,OAAO,YAAY;AAAxC,wBAAyC;AACzC,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/** The provide/inject injection key used for the Vue plugin option `onError` callback */
|
|
2
|
-
export declare const KONG_UI_ERROR_BOUNDARY_ON_ERROR_INJECTION_KEY = "kong-ui-error-boundary-on-error";
|
|
3
|
-
/** The provide/inject injection key used for injecting tags from parent ErrorBoundary components */
|
|
4
|
-
export declare const KONG_UI_ERROR_BOUNDARY_TAGS_INJECTION_KEY = "kong-ui-error-boundary-tags";
|
|
5
|
-
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,eAAO,MAAM,6CAA6C,oCAAoC,CAAA;AAE9F,oGAAoG;AACpG,eAAO,MAAM,yCAAyC,gCAAgC,CAAA"}
|
package/dist/types/index.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { App } from 'vue';
|
|
2
|
-
import ErrorBoundary from './components/ErrorBoundary.vue';
|
|
3
|
-
import type { ErrorBoundaryPluginOptions } from './types';
|
|
4
|
-
declare const _default: {
|
|
5
|
-
install: (app: App, options?: ErrorBoundaryPluginOptions) => void;
|
|
6
|
-
};
|
|
7
|
-
export default _default;
|
|
8
|
-
export { ErrorBoundary };
|
|
9
|
-
export * from './types';
|
|
10
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC9B,OAAO,aAAa,MAAM,gCAAgC,CAAA;AAE1D,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAA;;mBAKxC,GAAG,YAAW,0BAA0B,KAAQ,IAAI;;AAFrE,wBAMC;AAED,OAAO,EAAE,aAAa,EAAE,CAAA;AAExB,cAAc,SAAS,CAAA"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export interface ErrorBoundaryContext {
|
|
2
|
-
componentName: string;
|
|
3
|
-
dataTestid: string;
|
|
4
|
-
info: string;
|
|
5
|
-
source: string;
|
|
6
|
-
tags: string[];
|
|
7
|
-
}
|
|
8
|
-
export interface ErrorBoundaryCallbackParams {
|
|
9
|
-
error: unknown;
|
|
10
|
-
context: ErrorBoundaryContext;
|
|
11
|
-
}
|
|
12
|
-
export interface ErrorBoundaryPluginOptions {
|
|
13
|
-
name?: string;
|
|
14
|
-
onError?: ({ error, context: { componentName, dataTestid, info, source, tags } }: ErrorBoundaryCallbackParams) => void;
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=error-boundary.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAIA,cAAc,kBAAkB,CAAA"}
|