coldwired 0.18.0 → 0.18.1
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/react.d.mts +1 -6
- package/dist/react.mjs +2 -112
- package/package.json +3 -4
package/dist/react.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { S as Plugin } from "./actions-CQVSvZlC.mjs";
|
|
2
2
|
import { ComponentType, FunctionComponent, ReactNode } from "react";
|
|
3
|
+
import { FallbackProps } from "react-error-boundary";
|
|
3
4
|
|
|
4
5
|
//#region src/react/tree-builder.react.d.ts
|
|
5
6
|
type Child = string | ReactElement | ReactComponent;
|
|
@@ -69,12 +70,6 @@ declare function createReactPlugin(root: Root): Plugin;
|
|
|
69
70
|
//#region src/react/preload.d.ts
|
|
70
71
|
declare function preload(documentOrFragment: Document | DocumentFragmentLike, loader: (names: string[]) => Promise<Manifest>, schema?: Partial<Schema$1>): Promise<Manifest>;
|
|
71
72
|
//#endregion
|
|
72
|
-
//#region node_modules/react-error-boundary/dist/react-error-boundary.d.ts
|
|
73
|
-
declare type FallbackProps = {
|
|
74
|
-
error: unknown;
|
|
75
|
-
resetErrorBoundary: (...args: unknown[]) => void;
|
|
76
|
-
};
|
|
77
|
-
//#endregion
|
|
78
73
|
//#region src/react/root.react.d.ts
|
|
79
74
|
type LayoutProps = {
|
|
80
75
|
children: ReactNode;
|
package/dist/react.mjs
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import { _ as isElement, z as parseHTMLFragment } from "./utils-C2S0wWJJ.mjs";
|
|
2
|
-
import { createRequire } from "node:module";
|
|
3
2
|
import { createPortal } from "react-dom";
|
|
4
3
|
import { createRoot as createRoot$1 } from "react-dom/client";
|
|
5
4
|
import { Fragment, StrictMode, createElement, useEffect, useSyncExternalStore } from "react";
|
|
5
|
+
import { ErrorBoundary } from "react-error-boundary";
|
|
6
6
|
import { Fragment as Fragment$1, jsx } from "react/jsx-runtime";
|
|
7
7
|
import { decode } from "html-entities";
|
|
8
|
-
//#region \0rolldown/runtime.js
|
|
9
|
-
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
10
|
-
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
11
|
-
//#endregion
|
|
12
8
|
//#region src/react/plugin.ts
|
|
13
9
|
function createReactPlugin(root) {
|
|
14
10
|
const pending = /* @__PURE__ */ new Set();
|
|
@@ -72,112 +68,6 @@ function preload(documentOrFragment, loader, schema) {
|
|
|
72
68
|
}
|
|
73
69
|
//#endregion
|
|
74
70
|
//#region src/react/tree-builder.react.ts
|
|
75
|
-
var import_react_error_boundary = (/* @__PURE__ */ __commonJSMin(((exports) => {
|
|
76
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
77
|
-
const s = __require("react"), c = s.createContext(null), u = {
|
|
78
|
-
didCatch: !1,
|
|
79
|
-
error: null
|
|
80
|
-
};
|
|
81
|
-
var y = class extends s.Component {
|
|
82
|
-
constructor(e) {
|
|
83
|
-
super(e), this.resetErrorBoundary = this.resetErrorBoundary.bind(this), this.state = u;
|
|
84
|
-
}
|
|
85
|
-
static getDerivedStateFromError(e) {
|
|
86
|
-
return {
|
|
87
|
-
didCatch: !0,
|
|
88
|
-
error: e
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
resetErrorBoundary(...e) {
|
|
92
|
-
const { error: t } = this.state;
|
|
93
|
-
t !== null && (this.props.onReset?.({
|
|
94
|
-
args: e,
|
|
95
|
-
reason: "imperative-api"
|
|
96
|
-
}), this.setState(u));
|
|
97
|
-
}
|
|
98
|
-
componentDidCatch(e, t) {
|
|
99
|
-
this.props.onError?.(e, t);
|
|
100
|
-
}
|
|
101
|
-
componentDidUpdate(e, t) {
|
|
102
|
-
const { didCatch: o } = this.state, { resetKeys: n } = this.props;
|
|
103
|
-
o && t.error !== null && h(e.resetKeys, n) && (this.props.onReset?.({
|
|
104
|
-
next: n,
|
|
105
|
-
prev: e.resetKeys,
|
|
106
|
-
reason: "keys"
|
|
107
|
-
}), this.setState(u));
|
|
108
|
-
}
|
|
109
|
-
render() {
|
|
110
|
-
const { children: e, fallbackRender: t, FallbackComponent: o, fallback: n } = this.props, { didCatch: a, error: i } = this.state;
|
|
111
|
-
let d = e;
|
|
112
|
-
if (a) {
|
|
113
|
-
const l = {
|
|
114
|
-
error: i,
|
|
115
|
-
resetErrorBoundary: this.resetErrorBoundary
|
|
116
|
-
};
|
|
117
|
-
if (typeof t == "function") d = t(l);
|
|
118
|
-
else if (o) d = s.createElement(o, l);
|
|
119
|
-
else if (n !== void 0) d = n;
|
|
120
|
-
else throw i;
|
|
121
|
-
}
|
|
122
|
-
return s.createElement(c.Provider, { value: {
|
|
123
|
-
didCatch: a,
|
|
124
|
-
error: i,
|
|
125
|
-
resetErrorBoundary: this.resetErrorBoundary
|
|
126
|
-
} }, d);
|
|
127
|
-
}
|
|
128
|
-
};
|
|
129
|
-
function h(r = [], e = []) {
|
|
130
|
-
return r.length !== e.length || r.some((t, o) => !Object.is(t, e[o]));
|
|
131
|
-
}
|
|
132
|
-
function E(r) {
|
|
133
|
-
return r !== null && typeof r == "object" && "didCatch" in r && typeof r.didCatch == "boolean" && "error" in r && "resetErrorBoundary" in r && typeof r.resetErrorBoundary == "function";
|
|
134
|
-
}
|
|
135
|
-
function f(r) {
|
|
136
|
-
if (!E(r)) throw new Error("ErrorBoundaryContext not found");
|
|
137
|
-
}
|
|
138
|
-
function p() {
|
|
139
|
-
const r = s.useContext(c);
|
|
140
|
-
f(r);
|
|
141
|
-
const { error: e, resetErrorBoundary: t } = r, [o, n] = s.useState({
|
|
142
|
-
error: null,
|
|
143
|
-
hasError: !1
|
|
144
|
-
}), a = s.useMemo(() => ({
|
|
145
|
-
error: e,
|
|
146
|
-
resetBoundary: () => {
|
|
147
|
-
t(), n({
|
|
148
|
-
error: null,
|
|
149
|
-
hasError: !1
|
|
150
|
-
});
|
|
151
|
-
},
|
|
152
|
-
showBoundary: (i) => n({
|
|
153
|
-
error: i,
|
|
154
|
-
hasError: !0
|
|
155
|
-
})
|
|
156
|
-
}), [e, t]);
|
|
157
|
-
if (o.hasError) throw o.error;
|
|
158
|
-
return a;
|
|
159
|
-
}
|
|
160
|
-
function B(r) {
|
|
161
|
-
switch (typeof r) {
|
|
162
|
-
case "object":
|
|
163
|
-
if (r !== null && "message" in r && typeof r.message == "string") return r.message;
|
|
164
|
-
break;
|
|
165
|
-
case "string": return r;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
function m(r, e) {
|
|
169
|
-
const t = s.forwardRef((n, a) => s.createElement(y, e, s.createElement(r, {
|
|
170
|
-
...n,
|
|
171
|
-
ref: a
|
|
172
|
-
})));
|
|
173
|
-
return t.displayName = `withErrorBoundary(${r.displayName || r.name || "Unknown"})`, t;
|
|
174
|
-
}
|
|
175
|
-
exports.ErrorBoundary = y;
|
|
176
|
-
exports.ErrorBoundaryContext = c;
|
|
177
|
-
exports.getErrorMessage = B;
|
|
178
|
-
exports.useErrorBoundary = p;
|
|
179
|
-
exports.withErrorBoundary = m;
|
|
180
|
-
})))();
|
|
181
71
|
function isReactElement(node) {
|
|
182
72
|
return !!(node && typeof node == "object" && "tagName" in node && "attributes" in node);
|
|
183
73
|
}
|
|
@@ -416,7 +306,7 @@ const DefaultErrorBoundaryFallbackComponent = ({ error, element }) => {
|
|
|
416
306
|
function RootProvider({ subscribe, getSnapshot, onMounted, ErrorBoundaryFallback }) {
|
|
417
307
|
useEffect(onMounted, []);
|
|
418
308
|
const cache = useSyncExternalStore(subscribe, getSnapshot);
|
|
419
|
-
return /* @__PURE__ */ jsx(Fragment$1, { children: [...Array.from(cache).map(([element, content]) => createPortal(/* @__PURE__ */ jsx(
|
|
309
|
+
return /* @__PURE__ */ jsx(Fragment$1, { children: [...Array.from(cache).map(([element, content]) => createPortal(/* @__PURE__ */ jsx(ErrorBoundary, {
|
|
420
310
|
fallbackRender: (props) => /* @__PURE__ */ jsx(ErrorBoundaryFallback, {
|
|
421
311
|
element,
|
|
422
312
|
...props
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "coldwired",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.1",
|
|
4
4
|
"description": "DOM manipulation actions based on morphdom",
|
|
5
5
|
"homepage": "https://github.com/tchak/coldwired#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -37,7 +37,8 @@
|
|
|
37
37
|
"html-entities": "^2.6.0",
|
|
38
38
|
"morphdom": "^2.7.8",
|
|
39
39
|
"react": "^19.2.4",
|
|
40
|
-
"react-dom": "^19.2.4"
|
|
40
|
+
"react-dom": "^19.2.4",
|
|
41
|
+
"react-error-boundary": "^6.1.1"
|
|
41
42
|
},
|
|
42
43
|
"devDependencies": {
|
|
43
44
|
"@arethetypeswrong/core": "^0.18.2",
|
|
@@ -52,7 +53,6 @@
|
|
|
52
53
|
"playwright": "^1.59.1",
|
|
53
54
|
"publint": "^0.3.18",
|
|
54
55
|
"react-aria-components": "^1.16.0",
|
|
55
|
-
"react-error-boundary": "^6.1.1",
|
|
56
56
|
"tiny-invariant": "^1.3.3",
|
|
57
57
|
"typescript": "^6.0.2",
|
|
58
58
|
"vite-plus": "^0.1.14",
|
|
@@ -66,7 +66,6 @@
|
|
|
66
66
|
"inlinedDependencies": {
|
|
67
67
|
"just-debounce-it": "3.2.0",
|
|
68
68
|
"just-throttle": "4.2.0",
|
|
69
|
-
"react-error-boundary": "6.1.1",
|
|
70
69
|
"tiny-invariant": "1.3.3"
|
|
71
70
|
}
|
|
72
71
|
}
|