mtxuilib 0.0.345 → 0.0.349

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.
Files changed (61) hide show
  1. package/dist/demos/bigcode/BigCode.cjs +37 -0
  2. package/dist/demos/suspense-ssr/ExampleLazyComponent.cjs +47 -0
  3. package/dist/demos/suspense-ssr/ExampleOg.cjs +44 -0
  4. package/dist/demos/suspense-ssr/ExamplePage.cjs +62 -0
  5. package/dist/demos/suspense-ssr/ExampleProviderProviders.cjs +36 -0
  6. package/dist/demos/suspense-ssr/ExampleWorkerService.cjs +72 -0
  7. package/dist/demos/suspense-ssr/ReadMe.cjs +49 -0
  8. package/dist/demos/suspense-ssr/examples.cjs +95 -0
  9. package/dist/demos/suspense-ssr/examplesPostDetail.cjs +50 -0
  10. package/dist/demos/suspense-ssr/examplesPosts.cjs +59 -0
  11. package/dist/demos/suspense-ssr/lib.cjs +58 -0
  12. package/dist/esm/demos/bigcode/BigCode.d.ts +4 -0
  13. package/dist/esm/demos/bigcode/BigCode.js +1 -0
  14. package/dist/esm/demos/suspense-ssr/ExampleLazyComponent.d.ts +2 -0
  15. package/dist/esm/demos/suspense-ssr/ExampleLazyComponent.js +1 -0
  16. package/dist/esm/demos/suspense-ssr/ExampleOg.d.ts +4 -0
  17. package/dist/esm/demos/suspense-ssr/ExampleOg.js +1 -0
  18. package/dist/esm/demos/suspense-ssr/ExamplePage.d.ts +2 -0
  19. package/dist/esm/demos/suspense-ssr/ExamplePage.js +1 -0
  20. package/dist/esm/demos/suspense-ssr/ExampleProviderProviders.d.ts +4 -0
  21. package/dist/esm/demos/suspense-ssr/ExampleProviderProviders.js +1 -0
  22. package/dist/esm/demos/suspense-ssr/ExampleWorkerService.d.ts +4 -0
  23. package/dist/esm/demos/suspense-ssr/ExampleWorkerService.js +1 -0
  24. package/dist/esm/demos/suspense-ssr/ReadMe.d.ts +2 -0
  25. package/dist/esm/demos/suspense-ssr/ReadMe.js +1 -0
  26. package/dist/esm/demos/suspense-ssr/examples.d.ts +5 -0
  27. package/dist/esm/demos/suspense-ssr/examples.js +1 -0
  28. package/dist/esm/demos/suspense-ssr/examplesPostDetail.d.ts +4 -0
  29. package/dist/esm/demos/suspense-ssr/examplesPostDetail.js +1 -0
  30. package/dist/esm/demos/suspense-ssr/examplesPosts.d.ts +2 -0
  31. package/dist/esm/demos/suspense-ssr/examplesPosts.js +1 -0
  32. package/dist/esm/demos/suspense-ssr/lib.d.ts +3 -0
  33. package/dist/esm/demos/suspense-ssr/lib.js +1 -0
  34. package/dist/esm/form/EditFormToolbar.d.ts +1 -0
  35. package/dist/esm/form/EditFormToolbar.js +1 -1
  36. package/dist/esm/form/MtFormPopupHolder.js +1 -1
  37. package/dist/esm/form/MtFormV3.js +1 -1
  38. package/dist/esm/form/SchemaFormViewV2.js +1 -1
  39. package/dist/esm/form/deleteConform.js +1 -1
  40. package/dist/esm/misc/CustomErrorRetry.d.ts +5 -0
  41. package/dist/esm/misc/CustomErrorRetry.js +1 -0
  42. package/dist/esm/misc/MtErrorBoundary.d.ts +17 -0
  43. package/dist/esm/misc/MtErrorBoundary.js +1 -0
  44. package/dist/esm/misc/MtErrorBoundary.stories.d.ts +15 -0
  45. package/dist/esm/misc/MtErrorBoundary.stories.js +1 -0
  46. package/dist/esm/misc/MtErrorBoundaryV2.d.ts +2 -0
  47. package/dist/esm/misc/MtErrorBoundaryV2.js +1 -0
  48. package/dist/esm/misc/MtErrorBoundaryV2.stories.d.ts +17 -0
  49. package/dist/esm/misc/MtErrorBoundaryV2.stories.js +1 -0
  50. package/dist/form/EditFormToolbar.cjs +13 -6
  51. package/dist/form/MtFormPopupHolder.cjs +1 -1
  52. package/dist/form/MtFormV3.cjs +2 -3
  53. package/dist/form/SchemaFormViewV2.cjs +5 -16
  54. package/dist/form/deleteConform.cjs +8 -7
  55. package/dist/misc/CustomErrorRetry.cjs +39 -0
  56. package/dist/misc/MtErrorBoundary.cjs +72 -0
  57. package/dist/misc/MtErrorBoundary.stories.cjs +76 -0
  58. package/dist/misc/MtErrorBoundaryV2.cjs +47 -0
  59. package/dist/misc/MtErrorBoundaryV2.stories.cjs +57 -0
  60. package/dist/tsconfig.type.tsbuildinfo +1 -1
  61. package/package.json +10 -4
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ "use client";
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+ var BigCode_exports = {};
21
+ __export(BigCode_exports, {
22
+ BigCode: () => BigCode
23
+ });
24
+ module.exports = __toCommonJS(BigCode_exports);
25
+ var import_jsx_runtime = require("react/jsx-runtime");
26
+ var import_mt_video_player = require("../../video-player/mt-video-player");
27
+ console.log("<BigCode/> loaded");
28
+ function BigCode({ children }) {
29
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "bg-red-600 p-2", children: [
30
+ children,
31
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_mt_video_player.MtVideoPlayer, { videoSrc: "4444222" })
32
+ ] });
33
+ }
34
+ // Annotate the CommonJS export names for ESM import in node:
35
+ 0 && (module.exports = {
36
+ BigCode
37
+ });
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ "use client";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all)
11
+ __defProp(target, name, { get: all[name], enumerable: true });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+ var ExampleLazyComponent_exports = {};
31
+ __export(ExampleLazyComponent_exports, {
32
+ ExampleLazyComponent: () => ExampleLazyComponent
33
+ });
34
+ module.exports = __toCommonJS(ExampleLazyComponent_exports);
35
+ var import_jsx_runtime = require("react/jsx-runtime");
36
+ var import_dynamic = __toESM(require("next/dynamic"), 1);
37
+ const LzBigCode = (0, import_dynamic.default)(() => import("../bigcode/BigCode").then((x) => x.BigCode), {});
38
+ const ExampleLazyComponent = () => {
39
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "bg-slate-300 p-2", children: [
40
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h1", { children: "ComponentB(lazy)" }),
41
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LzBigCode, {})
42
+ ] });
43
+ };
44
+ // Annotate the CommonJS export names for ESM import in node:
45
+ 0 && (module.exports = {
46
+ ExampleLazyComponent
47
+ });
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ "use client";
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+ var ExampleOg_exports = {};
21
+ __export(ExampleOg_exports, {
22
+ ExampleOg: () => ExampleOg
23
+ });
24
+ module.exports = __toCommonJS(ExampleOg_exports);
25
+ var import_jsx_runtime = require("react/jsx-runtime");
26
+ var import_card = require("../../ui/card");
27
+ var import_MtImage = require("../../common/MtImage");
28
+ function ExampleOg({ children }) {
29
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_card.Card, { children: [
30
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_card.CardTitle, { children: "\u56FE\u7247\u76F8\u5173" }),
31
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_card.CardContent, { children: [
32
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { children: "og" }),
33
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_MtImage.MtImage, { src: "/api.v1/og", alt: "og-example", width: 100, height: 100 }),
34
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { children: "\u9ED8\u8BA4\u4E0D\u5B58\u5728\u56FE\u7247" }),
35
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_MtImage.MtImage, { src: "/any-image-not-exists.jpg", alt: "og-example", width: 100, height: 100 }),
36
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { children: "\u5916\u7AD9\u56FE\u7247" }),
37
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_MtImage.MtImage, { src: "https://th.bing.com/th/id/R.0f70474ecd1ee9757981b82381476ec3?rik=FOxDfiUEZWxcfA&pid=ImgRaw&r=0", alt: "og-example", width: 100, height: 100 })
38
+ ] })
39
+ ] });
40
+ }
41
+ // Annotate the CommonJS export names for ESM import in node:
42
+ 0 && (module.exports = {
43
+ ExampleOg
44
+ });
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ "use client";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all)
11
+ __defProp(target, name, { get: all[name], enumerable: true });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+ var ExamplePage_exports = {};
31
+ __export(ExamplePage_exports, {
32
+ ExamplePage: () => ExamplePage
33
+ });
34
+ module.exports = __toCommonJS(ExamplePage_exports);
35
+ var import_jsx_runtime = require("react/jsx-runtime");
36
+ var import_dynamic = __toESM(require("next/dynamic"), 1);
37
+ var import_card = require("../../ui/card");
38
+ var import_ExampleOg = require("./ExampleOg");
39
+ var import_ExampleWorkerService = require("./ExampleWorkerService");
40
+ var import_examples = require("./examples");
41
+ const LzExampleLazyComponent = (0, import_dynamic.default)(() => import("./ExampleLazyComponent").then((x) => x.ExampleLazyComponent), {});
42
+ const ExamplePage = () => {
43
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
44
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_examples.DemoUserDetail, { userId: "5", randomError: true }),
45
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_examples.DemoUserDetail, { userId: "6", randomError: true }),
46
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { children: "with AutoSuspense" }),
47
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_card.Card, { children: [
48
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_card.CardTitle, { children: "lazy example" }),
49
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_card.CardContent, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_examples.DemoUserDetail, { userId: "7", randomError: true }) })
50
+ ] }),
51
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_card.Card, { children: [
52
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_card.CardTitle, { children: "lazy example" }),
53
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_card.CardContent, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LzExampleLazyComponent, {}) })
54
+ ] }),
55
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ExampleOg.ExampleOg, {}),
56
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ExampleWorkerService.ExampleWorkerService, {})
57
+ ] });
58
+ };
59
+ // Annotate the CommonJS export names for ESM import in node:
60
+ 0 && (module.exports = {
61
+ ExamplePage
62
+ });
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ "use client";
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+ var ExampleProviderProviders_exports = {};
21
+ __export(ExampleProviderProviders_exports, {
22
+ ExampleProviderProviders: () => ExampleProviderProviders
23
+ });
24
+ module.exports = __toCommonJS(ExampleProviderProviders_exports);
25
+ var import_jsx_runtime = require("react/jsx-runtime");
26
+ var import_react_query = require("@tanstack/react-query");
27
+ var import_react_query_next_experimental = require("@tanstack/react-query-next-experimental");
28
+ var import_react = require("react");
29
+ function ExampleProviderProviders({ children }) {
30
+ const [queryClient] = (0, import_react.useState)(() => new import_react_query.QueryClient());
31
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_query.QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_query_next_experimental.ReactQueryStreamedHydration, { children }) });
32
+ }
33
+ // Annotate the CommonJS export names for ESM import in node:
34
+ 0 && (module.exports = {
35
+ ExampleProviderProviders
36
+ });
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ "use client";
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+ var __async = (__this, __arguments, generator) => {
21
+ return new Promise((resolve, reject) => {
22
+ var fulfilled = (value) => {
23
+ try {
24
+ step(generator.next(value));
25
+ } catch (e) {
26
+ reject(e);
27
+ }
28
+ };
29
+ var rejected = (value) => {
30
+ try {
31
+ step(generator.throw(value));
32
+ } catch (e) {
33
+ reject(e);
34
+ }
35
+ };
36
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
37
+ step((generator = generator.apply(__this, __arguments)).next());
38
+ });
39
+ };
40
+ var ExampleWorkerService_exports = {};
41
+ __export(ExampleWorkerService_exports, {
42
+ ExampleWorkerService: () => ExampleWorkerService
43
+ });
44
+ module.exports = __toCommonJS(ExampleWorkerService_exports);
45
+ var import_jsx_runtime = require("react/jsx-runtime");
46
+ var import_connect = require("@connectrpc/connect");
47
+ var import_connect_web = require("@connectrpc/connect-web");
48
+ var import_react = require("react");
49
+ var import_mtm_connect = require("../../lib/mtmclient/mtm/sppb/mtm_connect");
50
+ var import_card = require("../../ui/card");
51
+ var import_Button = require("../../ui/ui-mt/Button");
52
+ function ExampleWorkerService({ children }) {
53
+ const [responseData, setResponseData] = (0, import_react.useState)();
54
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_card.Card, { children: [
55
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_card.CardTitle, { children: "\u8C03\u7528 \u6709 js \u5B9E\u73B0\u7684 connect \u670D\u52A1" }),
56
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_card.CardContent, { children: [
57
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Button.MtButton, { onClick: () => __async(this, null, function* () {
58
+ const client = (0, import_connect.createPromiseClient)(
59
+ import_mtm_connect.MtmService,
60
+ (0, import_connect_web.createConnectTransport)({
61
+ baseUrl: "/api.v1/connect"
62
+ })
63
+ );
64
+ }), children: "req" }),
65
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", { children: JSON.stringify(responseData, null, 2) })
66
+ ] })
67
+ ] });
68
+ }
69
+ // Annotate the CommonJS export names for ESM import in node:
70
+ 0 && (module.exports = {
71
+ ExampleWorkerService
72
+ });
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ "use client";
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+ var ReadMe_exports = {};
21
+ __export(ReadMe_exports, {
22
+ ReadMe: () => ReadMe
23
+ });
24
+ module.exports = __toCommonJS(ReadMe_exports);
25
+ var import_jsx_runtime = require("react/jsx-runtime");
26
+ var import_mtlink = require("../../common/mtlink");
27
+ const ReadMe = () => {
28
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: " p-2", children: [
29
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h1", { children: "\u4F7F\u7528 suspense \u7684\u65B9\u5F0F \u5B9E\u73B0ssrs" }),
30
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "\u53EA\u8981 suspense \u5185\u90E8\u4E0D\u51FA\u73B0 throw error \u7684\u60C5\u51B5\uFF0C ReactQueryStreamedHydration + suspenseQuery \u7684\u65B9\u5F0F\u5B9E\u73B0SSR\uFF0C\u662F\u975E\u5E38\u597D\u7684\u65B9\u5F0F\u3002 \u53EA\u8981\u786E\u4FDD fetch \u8BF7\u6C42\u5916\u90E8\u6570\u636E\u65F6\uFF0C\u786E\u4FDDcatch\u4E86\u6240\u6709\u5F02\u5E38\uFF0C \u4F7F\u7528 custom error code\u5305\u88C5\u3002 \u6E32\u67D3\u65F6\uFF0C\u5224\u65AD code \uFF0C\u5982\u679C\u662F\u8BF7\u6C42\u6570\u636E\u5931\u8D25\uFF0C\u5219\u663E\u793A\u81EA\u5B9A\u4E49\u7684retry\u7EC4\u4EF6\uFF0C\u5373\u53EF\u3002" }),
31
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { children: "\u6CE8\u610F" }),
32
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ol", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: "\u4E1A\u52A1\u7EC4\u4EF6\u4E0D\u8981\u76F4\u63A5\u4F7F\u7528 \u4E0D\u8981QueryErrorResetBoundary \u548C ErrorBoundary\uFF0C \u8FD9\u4E24\u4E2A\u7EC4\u4EF6\u5E94\u8BE5\u4F5C\u4E3A\u515C\u5E95\u5904\u7406\u3002" }) }),
33
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { children: "\u57511" }),
34
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ol", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("li", { children: [
35
+ "\u5F53\u51FA\u73B0\u524D\u7AEF\u4E0D\u505C\u7684 fetch\u8BF7\u6C42\u65F6\uFF0C \u5148\u786E\u4FDD console \u4E2D\u6CA1\u6709\u8F93\u51FA\u4EFB\u4F55\u9519\u8BEF\u4FE1\u606F\uFF0C\u7279\u522B\u662F hydrate error\u76F8\u5173\u7684\uFF0C \u7279\u522B\u662F\u4E00\u4E9B\u4E0D\u8D77\u773C\u7684\u95EE\u9898",
36
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: "\u4F8B\u5982\uFF1A\u201Ch3 cannot appear as a descendant of p\u201D \u4E4B\u7C7B\u7684 html\u8BED\u6CD5\u9519\u8BEF\uFF0C\u90FD\u6709\u53EF\u80FD\u5BFC\u81F4 hydrate \u51FA\u73B0\u95EE\u9898\u3002" }),
37
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "\u7279\u522B\u662F\uFF1A \u201DHydration failed because the initial UI does not match what was rendered on the server.\u201C" }),
38
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "\u539F\u56E0\u5206\u6790\uFF1A query.isRefetching \u8FD9\u4E2A\u5B57\u6BB5\u9700\u8981\u6CE8\u610F\uFF0C\u7ECF\u5E38\u4F1A\u5BFC\u81F4 hydrate\u5931\u8D25\u3002\u539F\u56E0\u5728\u4E8E\u5982\u679C\u662F\u5904\u4E8E\u540E\u7AEF \u6570\u636E\u8F6C\u5230\u524D\u7AEF\u5F0F\uFF0C\u72B6\u6001\u5F80\u5F80\u4F1A\u53D8\u5316\u3002 \u800C\uFF0C \u5982\u679Chtml \u5143\u7D20\u6E32\u67D3\u4F9D\u8D56\u4E86\u8FD9\u4E2A\u503C\uFF0C\u5219\u5BFC\u81F4\u524D\u540E\u7AEF\u7684 html \u4E0D\u4E00\u81F4\uFF0C\u81F4\u4F7F hydrate \u5931\u8D25\u3002" })
39
+ ] }) }),
40
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { children: "\u57512" }),
41
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ol", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: "\u7531\u4E8E\u5B58\u5728 hydrate \u7684\u8FC7\u7A0B\uFF0C\u5FC5\u987B\u4FDD\u8BC1\u4F20\u9012\u7684\u5BF9\u8C61\u662F PlainObject\u3002" }) }),
42
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { children: "\u53C2\u8003" }),
43
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_mtlink.MtLink, { href: "https://codesandbox.io/p/devbox/react-query-next-streamed-hydration-broken-example-forked-try2hl", children: "codesandbox" }) }) })
44
+ ] }) });
45
+ };
46
+ // Annotate the CommonJS export names for ESM import in node:
47
+ 0 && (module.exports = {
48
+ ReadMe
49
+ });
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+ "use client";
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+ var __async = (__this, __arguments, generator) => {
21
+ return new Promise((resolve, reject) => {
22
+ var fulfilled = (value) => {
23
+ try {
24
+ step(generator.next(value));
25
+ } catch (e) {
26
+ reject(e);
27
+ }
28
+ };
29
+ var rejected = (value) => {
30
+ try {
31
+ step(generator.throw(value));
32
+ } catch (e) {
33
+ reject(e);
34
+ }
35
+ };
36
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
37
+ step((generator = generator.apply(__this, __arguments)).next());
38
+ });
39
+ };
40
+ var examples_exports = {};
41
+ __export(examples_exports, {
42
+ DemoUserDetail: () => DemoUserDetail
43
+ });
44
+ module.exports = __toCommonJS(examples_exports);
45
+ var import_jsx_runtime = require("react/jsx-runtime");
46
+ var import_react_query = require("@tanstack/react-query");
47
+ var import_Button = require("../../ui/ui-mt/Button");
48
+ var import_lib = require("./lib");
49
+ const fetchWrapWithBizResponse = (userId, ramdomError) => __async(void 0, null, function* () {
50
+ try {
51
+ const data = yield (0, import_lib.fakeFetchUser)(userId, ramdomError);
52
+ return {
53
+ code: "",
54
+ data
55
+ };
56
+ } catch (e) {
57
+ return {
58
+ code: "some_error_code",
59
+ data: null
60
+ };
61
+ }
62
+ });
63
+ function DemoUserDetail(props) {
64
+ var _a, _b, _c, _d, _e, _f;
65
+ const { userId, randomError } = props;
66
+ const query = (0, import_react_query.useSuspenseQuery)({
67
+ queryKey: ["userId", userId],
68
+ queryFn: () => __async(this, null, function* () {
69
+ return fetchWrapWithBizResponse(userId, randomError);
70
+ })
71
+ });
72
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "border-spacing-1 border p-2", children: [
73
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center justify-end", children: [
74
+ randomError && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "border", children: "with ramdom error" }),
75
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Button.MtButton, { onClick: () => {
76
+ query.refetch();
77
+ }, children: "refetch" })
78
+ ] }),
79
+ query.data && ((_a = query.data) == null ? void 0 : _a.code) ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "mx-auto", children: [
80
+ "ERROR: ",
81
+ (_b = query.data) == null ? void 0 : _b.code,
82
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Button.MtButton, { onClick: () => {
83
+ query.refetch();
84
+ }, children: "Retry" })
85
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("pre", { children: [
86
+ (_d = (_c = query.data) == null ? void 0 : _c.data) == null ? void 0 : _d.id,
87
+ ",",
88
+ JSON.stringify((_f = (_e = query.data) == null ? void 0 : _e.data) == null ? void 0 : _f.id, null, 2)
89
+ ] })
90
+ ] });
91
+ }
92
+ // Annotate the CommonJS export names for ESM import in node:
93
+ 0 && (module.exports = {
94
+ DemoUserDetail
95
+ });
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ "use client";
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+ var examplesPostDetail_exports = {};
21
+ __export(examplesPostDetail_exports, {
22
+ ExamplePostDetail: () => ExamplePostDetail
23
+ });
24
+ module.exports = __toCommonJS(examplesPostDetail_exports);
25
+ var import_jsx_runtime = require("react/jsx-runtime");
26
+ var import_react_query = require("@tanstack/react-query");
27
+ var import_lib = require("./lib");
28
+ const ExamplePostDetail = (props) => {
29
+ const { postId } = props;
30
+ const post = (0, import_react_query.useSuspenseQuery)({
31
+ queryKey: ["examples", "post", postId],
32
+ queryFn: () => {
33
+ return (0, import_lib.fetchPost)(postId);
34
+ }
35
+ });
36
+ if (!post.data) {
37
+ return null;
38
+ }
39
+ if (post.error) {
40
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: "post error" });
41
+ }
42
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "prose dark:prose-invert m-4 border p-2 shadow-md", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
43
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { children: post.data.title }),
44
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("article", { children: post.data.body })
45
+ ] }) });
46
+ };
47
+ // Annotate the CommonJS export names for ESM import in node:
48
+ 0 && (module.exports = {
49
+ ExamplePostDetail
50
+ });
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ "use client";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all)
11
+ __defProp(target, name, { get: all[name], enumerable: true });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+ var examplesPosts_exports = {};
31
+ __export(examplesPosts_exports, {
32
+ ExamplePosts: () => ExamplePosts
33
+ });
34
+ module.exports = __toCommonJS(examplesPosts_exports);
35
+ var import_jsx_runtime = require("react/jsx-runtime");
36
+ var import_react_query = require("@tanstack/react-query");
37
+ var import_link = __toESM(require("next/link"), 1);
38
+ var import_lib = require("./lib");
39
+ var import_mtlink = require("../../common/mtlink");
40
+ const ExamplePosts = () => {
41
+ var _a;
42
+ const postList = (0, import_react_query.useSuspenseQuery)({
43
+ queryKey: ["examples", "posts"],
44
+ queryFn: () => {
45
+ return (0, import_lib.fetchPosts)();
46
+ }
47
+ });
48
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
49
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { children: " examples posts " }),
50
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_mtlink.MtLink, { variant: "ghost", href: "/demo/hydrate-demo", children: "to post list" }),
51
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: (_a = postList == null ? void 0 : postList.data) == null ? void 0 : _a.map((post) => {
52
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_link.default, { href: `/demo/hydrate-demo/${post.id}`, children: post.title }) }, post.id);
53
+ }) })
54
+ ] });
55
+ };
56
+ // Annotate the CommonJS export names for ESM import in node:
57
+ 0 && (module.exports = {
58
+ ExamplePosts
59
+ });
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var lib_exports = {};
20
+ __export(lib_exports, {
21
+ fakeFetchUser: () => fakeFetchUser,
22
+ fetchPost: () => fetchPost,
23
+ fetchPosts: () => fetchPosts
24
+ });
25
+ module.exports = __toCommonJS(lib_exports);
26
+ const fakeFetchUser = (userId, noError = false) => {
27
+ const ramdonNum = Math.random();
28
+ if (!noError && ramdonNum > 0.5) {
29
+ throw new Error("\u968F\u673A\u51FA\u9519\u3002\u3002\u3002" + ramdonNum);
30
+ } else {
31
+ console.log("ramdonNum", ramdonNum);
32
+ return fetch(`https://jsonplaceholder.typicode.com/users/${userId}?_delay=2000`, {
33
+ // next: {
34
+ // revalidate: 0
35
+ // }
36
+ }).then((x) => x.json());
37
+ }
38
+ };
39
+ const fetchPosts = () => {
40
+ return fetch(`https://jsonplaceholder.typicode.com/posts`, {
41
+ // next: {
42
+ // revalidate: 0
43
+ // },
44
+ }).then((x) => x.json());
45
+ };
46
+ const fetchPost = (postId) => {
47
+ return fetch(`https://jsonplaceholder.typicode.com/posts/${postId}`, {
48
+ // next: {
49
+ // revalidate: 0
50
+ // }
51
+ }).then((x) => x.json());
52
+ };
53
+ // Annotate the CommonJS export names for ESM import in node:
54
+ 0 && (module.exports = {
55
+ fakeFetchUser,
56
+ fetchPost,
57
+ fetchPosts
58
+ });
@@ -0,0 +1,4 @@
1
+ import { ReactNode } from 'react';
2
+ export declare function BigCode({ children }: {
3
+ children?: ReactNode;
4
+ }): import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ "use client";import{jsx as d,jsxs as i}from"react/jsx-runtime";import{MtVideoPlayer as o}from"../../video-player/mt-video-player";console.log("<BigCode/> loaded");function c({children:e}){return i("div",{className:"bg-red-600 p-2",children:[e,d(o,{videoSrc:"4444222"})]})}export{c as BigCode};
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const ExampleLazyComponent: () => import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ "use client";import{jsx as o,jsxs as i}from"react/jsx-runtime";import n from"next/dynamic";const t=n(()=>import("../bigcode/BigCode").then(e=>e.BigCode),{}),p=()=>i("div",{className:"bg-slate-300 p-2",children:[o("h1",{children:"ComponentB(lazy)"}),o(t,{})]});export{p as ExampleLazyComponent};
@@ -0,0 +1,4 @@
1
+ import { ReactNode } from 'react';
2
+ export declare function ExampleOg({ children }: {
3
+ children?: ReactNode;
4
+ }): import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ "use client";import{jsx as e,jsxs as a}from"react/jsx-runtime";import{Card as i,CardContent as h,CardTitle as r}from"../../ui/card";import{MtImage as t}from"../../common/MtImage";function l({children:o}){return a(i,{children:[e(r,{children:"\u56FE\u7247\u76F8\u5173"}),a(h,{children:[e("h2",{children:"og"}),e(t,{src:"/api.v1/og",alt:"og-example",width:100,height:100}),e("h2",{children:"\u9ED8\u8BA4\u4E0D\u5B58\u5728\u56FE\u7247"}),e(t,{src:"/any-image-not-exists.jpg",alt:"og-example",width:100,height:100}),e("h2",{children:"\u5916\u7AD9\u56FE\u7247"}),e(t,{src:"https://th.bing.com/th/id/R.0f70474ecd1ee9757981b82381476ec3?rik=FOxDfiUEZWxcfA&pid=ImgRaw&r=0",alt:"og-example",width:100,height:100})]})]})}export{l as ExampleOg};
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const ExamplePage: () => import("react").JSX.Element;