@pactor-app/app 1.54.2 → 1.54.4

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/index.cjs CHANGED
@@ -50,7 +50,7 @@ var import_layout2 = require("@pactor-app/ui/layout");
50
50
  var import_permission = require("@pactor-app/permission");
51
51
  var import_resource = require("@pactor-app/resource");
52
52
  var import_router2 = require("@pactor-app/router");
53
- var import_runtime4 = require("@pactor-app/runtime");
53
+ var import_runtime6 = require("@pactor-app/runtime");
54
54
  var import_react5 = require("react");
55
55
  var import_client = require("react-dom/client");
56
56
 
@@ -59,11 +59,12 @@ var import_core = require("@pactor-app/core");
59
59
  var import_layout = require("@pactor-app/ui/layout");
60
60
  var import_router = require("@pactor-app/router");
61
61
  var import_react3 = require("@pactor-app/router/react");
62
- var import_runtime2 = require("@pactor-app/runtime");
62
+ var import_runtime4 = require("@pactor-app/runtime");
63
63
  var import_react4 = require("react");
64
64
  var import_react_router_dom = require("react-router-dom");
65
65
 
66
66
  // src/feedback.tsx
67
+ var import_runtime = require("@pactor-app/runtime");
67
68
  var import_jsx_runtime = require("react/jsx-runtime");
68
69
  var centerStyle = {
69
70
  minHeight: "100vh",
@@ -74,6 +75,7 @@ var centerStyle = {
74
75
  function BootstrapSpinner({
75
76
  style
76
77
  }) {
78
+ const { t } = (0, import_runtime.useI18n)();
77
79
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "pactor-app-spin", style: { ...centerStyle, ...style }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
78
80
  "svg",
79
81
  {
@@ -81,7 +83,7 @@ function BootstrapSpinner({
81
83
  height: "32",
82
84
  viewBox: "0 0 32 32",
83
85
  role: "status",
84
- "aria-label": "\u52A0\u8F7D\u4E2D",
86
+ "aria-label": t("pactor.app.loading"),
85
87
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
86
88
  "circle",
87
89
  {
@@ -146,13 +148,14 @@ function PrimaryButton({
146
148
  }
147
149
 
148
150
  // src/page-loader.tsx
149
- var import_runtime = require("@pactor-app/runtime");
151
+ var import_runtime3 = require("@pactor-app/runtime");
150
152
  var import_react2 = require("react");
151
153
 
152
154
  // src/error-boundary.tsx
155
+ var import_runtime2 = require("@pactor-app/runtime");
153
156
  var import_react = require("react");
154
157
  var import_jsx_runtime2 = require("react/jsx-runtime");
155
- var PageErrorBoundary = class extends import_react.Component {
158
+ var PageErrorBoundaryImpl = class extends import_react.Component {
156
159
  constructor() {
157
160
  super(...arguments);
158
161
  this.state = { error: null };
@@ -170,19 +173,31 @@ var PageErrorBoundary = class extends import_react.Component {
170
173
  ResultView,
171
174
  {
172
175
  className: "pactor-app-page-render-error",
173
- title: "\u9875\u9762\u6E32\u67D3\u5F02\u5E38",
176
+ title: this.props.title,
174
177
  subTitle: error.message,
175
- extra: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(PrimaryButton, { onClick: () => this.setState({ error: null }), children: "\u91CD\u8BD5" })
178
+ extra: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(PrimaryButton, { onClick: () => this.setState({ error: null }), children: this.props.retryLabel })
176
179
  }
177
180
  );
178
181
  }
179
182
  return this.props.children;
180
183
  }
181
184
  };
185
+ function PageErrorBoundary({ children }) {
186
+ const { t } = (0, import_runtime2.useI18n)();
187
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
188
+ PageErrorBoundaryImpl,
189
+ {
190
+ title: t("pactor.app.renderError"),
191
+ retryLabel: t("pactor.page.retry"),
192
+ children
193
+ }
194
+ );
195
+ }
182
196
 
183
197
  // src/page-loader.tsx
184
198
  var import_jsx_runtime3 = require("react/jsx-runtime");
185
199
  function DslPageLoader({ app, pageId, route }) {
200
+ const { t } = (0, import_runtime3.useI18n)();
186
201
  const [state, setState] = (0, import_react2.useState)({ status: "loading" });
187
202
  const [retryTick, setRetryTick] = (0, import_react2.useState)(0);
188
203
  (0, import_react2.useEffect)(() => {
@@ -223,14 +238,14 @@ function DslPageLoader({ app, pageId, route }) {
223
238
  ResultView,
224
239
  {
225
240
  className: "pactor-app-page-load-error",
226
- title: "\u9875\u9762\u52A0\u8F7D\u5931\u8D25",
241
+ title: t("pactor.page.loadFailed"),
227
242
  subTitle: state.error.message,
228
- extra: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(PrimaryButton, { onClick: () => setRetryTick((n) => n + 1), children: "\u91CD\u8BD5" })
243
+ extra: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(PrimaryButton, { onClick: () => setRetryTick((n) => n + 1), children: t("pactor.page.retry") })
229
244
  }
230
245
  );
231
246
  }
232
247
  const OverlayHostView = app.interactionKit.OverlayHost;
233
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(PageErrorBoundary, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_runtime.PageRuntimeView, { runtime: state.runtime, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
248
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(PageErrorBoundary, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_runtime3.PageRuntimeView, { runtime: state.runtime, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
234
249
  OverlayHostView,
235
250
  {
236
251
  manager: app.overlayManager,
@@ -242,6 +257,7 @@ function DslPageLoader({ app, pageId, route }) {
242
257
  // src/app-shell.tsx
243
258
  var import_jsx_runtime4 = require("react/jsx-runtime");
244
259
  function Application({ app }) {
260
+ const { t } = (0, import_runtime4.useI18n)();
245
261
  const [state, setState] = (0, import_react4.useState)({ status: "loading" });
246
262
  const [retryTick, setRetryTick] = (0, import_react4.useState)(0);
247
263
  (0, import_react4.useEffect)(() => {
@@ -273,9 +289,9 @@ function Application({ app }) {
273
289
  ResultView,
274
290
  {
275
291
  className: "pactor-app-bootstrap-error",
276
- title: "\u5E94\u7528\u542F\u52A8\u5931\u8D25",
292
+ title: t("pactor.app.startFailed"),
277
293
  subTitle: state.error.message,
278
- extra: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(PrimaryButton, { onClick: () => setRetryTick((n) => n + 1), children: "\u91CD\u8BD5" })
294
+ extra: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(PrimaryButton, { onClick: () => setRetryTick((n) => n + 1), children: t("pactor.page.retry") })
279
295
  }
280
296
  );
281
297
  }
@@ -298,7 +314,7 @@ function AppShell({
298
314
  defaultLocale: session.defaultLocale,
299
315
  messages: session.messages
300
316
  });
301
- const shell = /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_runtime2.I18nContextProvider, { value: i18n, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(InteractionKit, { bridge: app.uiBridge, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ShellLayout, { app, session }) }) });
317
+ const shell = /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_runtime4.I18nContextProvider, { value: i18n, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(InteractionKit, { bridge: app.uiBridge, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ShellLayout, { app, session }) }) });
302
318
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Router, { basename: app.routerOptions.basename, children: [
303
319
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(RouterBridgeSync, { binding: app.navigation }),
304
320
  Providers !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Providers, { children: shell }) : shell
@@ -387,22 +403,24 @@ function pageLoaderKey(pageId, route, i18nVersion) {
387
403
  return `${pageId}|${i18nVersion}|${JSON.stringify(route.params)}|${JSON.stringify(route.query)}`;
388
404
  }
389
405
  function NotFoundPage() {
406
+ const { t } = (0, import_runtime4.useI18n)();
390
407
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
391
408
  ResultView,
392
409
  {
393
410
  className: "pactor-app-not-found",
394
411
  title: "404",
395
- subTitle: "\u9875\u9762\u4E0D\u5B58\u5728\u6216\u5C1A\u672A\u6CE8\u518C"
412
+ subTitle: t("pactor.app.pageNotFound")
396
413
  }
397
414
  );
398
415
  }
399
416
  function ForbiddenPage() {
417
+ const { t } = (0, import_runtime4.useI18n)();
400
418
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
401
419
  ResultView,
402
420
  {
403
421
  className: "pactor-app-forbidden",
404
422
  title: "403",
405
- subTitle: "\u6CA1\u6709\u8BBF\u95EE\u8BE5\u9875\u9762\u7684\u6743\u9650"
423
+ subTitle: t("pactor.app.forbidden")
406
424
  }
407
425
  );
408
426
  }
@@ -411,7 +429,7 @@ function ForbiddenPage() {
411
429
  var import_core2 = require("@pactor-app/core");
412
430
  var import_components = require("@pactor-app/ui/components");
413
431
  var import_interaction = require("@pactor-app/ui/interaction");
414
- var import_runtime3 = require("@pactor-app/runtime");
432
+ var import_runtime5 = require("@pactor-app/runtime");
415
433
  function upsert(registry, name, item) {
416
434
  if (registry.has(name)) {
417
435
  registry.unregister(name);
@@ -424,7 +442,7 @@ function upsertAll(registry, entries) {
424
442
  }
425
443
  }
426
444
  function createRuntimeHttpAdapter(authTokenProvider) {
427
- const base = (0, import_runtime3.createFetchHttpAdapter)();
445
+ const base = (0, import_runtime5.createFetchHttpAdapter)();
428
446
  if (authTokenProvider === void 0) {
429
447
  return base;
430
448
  }
@@ -738,7 +756,7 @@ function createPactorApplication(options) {
738
756
  return session;
739
757
  },
740
758
  createPageRuntime(pageDsl, route) {
741
- return (0, import_runtime4.createPageRuntime)(pageDsl, {
759
+ return (0, import_runtime6.createPageRuntime)(pageDsl, {
742
760
  components,
743
761
  actions,
744
762
  services,
@@ -815,7 +833,7 @@ function createPactorApplication(options) {
815
833
  // src/embedded.tsx
816
834
  var import_core3 = require("@pactor-app/core");
817
835
  var import_permission2 = require("@pactor-app/permission");
818
- var import_runtime5 = require("@pactor-app/runtime");
836
+ var import_runtime7 = require("@pactor-app/runtime");
819
837
  var import_react6 = require("react");
820
838
  var import_jsx_runtime5 = require("react/jsx-runtime");
821
839
  function createPactorPage(options = {}) {
@@ -836,7 +854,7 @@ function createPactorPage(options = {}) {
836
854
  store.setPermissions(options.permissions);
837
855
  permission = (0, import_permission2.createPermissionAdapter)(store);
838
856
  } else {
839
- permission = (0, import_runtime5.createDefaultPermissionAdapter)();
857
+ permission = (0, import_runtime7.createDefaultPermissionAdapter)();
840
858
  }
841
859
  const i18n = (0, import_core3.createI18nContext)({
842
860
  locale: options.locale,
@@ -844,7 +862,7 @@ function createPactorPage(options = {}) {
844
862
  messages: options.messages
845
863
  });
846
864
  function createRuntime(pageDsl, route) {
847
- return (0, import_runtime5.createPageRuntime)(pageDsl, {
865
+ return (0, import_runtime7.createPageRuntime)(pageDsl, {
848
866
  components: assembly.components,
849
867
  actions: assembly.actions,
850
868
  services: assembly.services,
@@ -860,7 +878,7 @@ function createPactorPage(options = {}) {
860
878
  });
861
879
  }
862
880
  return function ConfiguredPactorPage(props) {
863
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_runtime5.I18nContextProvider, { value: i18n, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
881
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_runtime7.I18nContextProvider, { value: i18n, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
864
882
  EmbeddedPage,
865
883
  {
866
884
  assembly,
@@ -897,7 +915,7 @@ function EmbeddedPage({
897
915
  pageDsl,
898
916
  route
899
917
  }) {
900
- const { t } = (0, import_runtime5.useI18n)();
918
+ const { t } = (0, import_runtime7.useI18n)();
901
919
  const [state, setState] = (0, import_react6.useState)({ status: "loading" });
902
920
  const [retryTick, setRetryTick] = (0, import_react6.useState)(0);
903
921
  const onError = options.onError;
@@ -916,7 +934,7 @@ function EmbeddedPage({
916
934
  }
917
935
  resolved = await resolvePage(pageId);
918
936
  } else if ((0, import_core3.isDslSourceRef)(resolved)) {
919
- const resolver = new import_runtime5.DslSourceResolver({
937
+ const resolver = new import_runtime7.DslSourceResolver({
920
938
  services: assembly.services,
921
939
  http: assembly.httpAdapter,
922
940
  getScope: () => ({
@@ -964,7 +982,7 @@ function EmbeddedPage({
964
982
  }
965
983
  );
966
984
  } else {
967
- content = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(PageErrorBoundary, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_runtime5.PageRuntimeView, { runtime: state.runtime, children: resolvePage !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(OverlayHost2, { manager: assembly.overlayManager, resolvePage }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(OverlayHost2, { manager: assembly.overlayManager }) }) });
985
+ content = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(PageErrorBoundary, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_runtime7.PageRuntimeView, { runtime: state.runtime, children: resolvePage !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(OverlayHost2, { manager: assembly.overlayManager, resolvePage }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(OverlayHost2, { manager: assembly.overlayManager }) }) });
968
986
  }
969
987
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(InteractionProvider2, { bridge: assembly.uiBridge, children: content });
970
988
  }
@@ -1011,7 +1029,7 @@ var defaultSitemapActions = {
1011
1029
  // src/sitemap/SitemapApp.tsx
1012
1030
  var import_core4 = require("@pactor-app/core");
1013
1031
  var import_router4 = require("@pactor-app/router");
1014
- var import_runtime6 = require("@pactor-app/runtime");
1032
+ var import_runtime8 = require("@pactor-app/runtime");
1015
1033
  var import_components2 = require("@pactor-app/ui/components");
1016
1034
  var import_react8 = require("react");
1017
1035
 
@@ -1366,10 +1384,10 @@ function SitemapApp(props) {
1366
1384
  }),
1367
1385
  [props.locale, props.defaultLocale, props.messages]
1368
1386
  );
1369
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_runtime6.I18nContextProvider, { value: i18n, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SitemapAppInner, { ...props }) });
1387
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_runtime8.I18nContextProvider, { value: i18n, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SitemapAppInner, { ...props }) });
1370
1388
  }
1371
1389
  function SitemapAppInner(props) {
1372
- const { t } = (0, import_runtime6.useI18n)();
1390
+ const { t } = (0, import_runtime8.useI18n)();
1373
1391
  const { sources, fetcher, baseUrl } = props;
1374
1392
  const browserRoute = useBrowserRoute();
1375
1393
  const pathname = props.pathname ?? browserRoute.pathname;
@@ -1603,7 +1621,7 @@ function LayoutLevel({
1603
1621
  layoutFactory,
1604
1622
  outlet
1605
1623
  }) {
1606
- const { t } = (0, import_runtime6.useI18n)();
1624
+ const { t } = (0, import_runtime8.useI18n)();
1607
1625
  const layoutName = chain[index];
1608
1626
  const layoutDsl = sitemap.layouts[layoutName];
1609
1627
  const layoutPage = (0, import_react8.useMemo)(() => {
package/dist/index.d.cts CHANGED
@@ -6,7 +6,7 @@ import { BootstrapResource, DslResourceLoader } from '@pactor-app/resource';
6
6
  import { NavigationBridge, NavigationLocation, NavigationListener, MenuRegistry, RouteContext, MenuItem } from '@pactor-app/router';
7
7
  import { HttpRequestConfig, ActionHandler, ServiceHandler, HttpAdapter, PageRuntime, PermissionAdapter } from '@pactor-app/runtime';
8
8
  import * as react from 'react';
9
- import { ComponentType, ReactNode, Component, ErrorInfo } from 'react';
9
+ import { ComponentType, ReactNode } from 'react';
10
10
 
11
11
  /** 创建页面运行时 HTTP 出口适配器:注入 Authorization 头 */
12
12
  declare function createRuntimeHttpAdapter(authTokenProvider: AuthTokenProvider | undefined): HttpAdapter;
@@ -339,19 +339,11 @@ declare function DslPageLoader({ app, pageId, route }: DslPageLoaderProps): reac
339
339
  interface PageErrorBoundaryProps {
340
340
  children?: ReactNode;
341
341
  }
342
- interface PageErrorBoundaryState {
343
- error: Error | null;
344
- }
345
342
  /**
346
343
  * PageErrorBoundary(决策 D3):捕获页面 DSL 渲染期异常,
347
344
  * 显示受控错误页(可重试重新渲染),应用外壳不崩溃、不白屏。
348
345
  */
349
- declare class PageErrorBoundary extends Component<PageErrorBoundaryProps, PageErrorBoundaryState> {
350
- state: PageErrorBoundaryState;
351
- static getDerivedStateFromError(error: Error): PageErrorBoundaryState;
352
- componentDidCatch(error: Error, info: ErrorInfo): void;
353
- render(): ReactNode;
354
- }
346
+ declare function PageErrorBoundary({ children }: PageErrorBoundaryProps): ReactNode;
355
347
 
356
348
  /**
357
349
  * 嵌入式页面 props(spec: embedded-page-view):
package/dist/index.d.ts CHANGED
@@ -6,7 +6,7 @@ import { BootstrapResource, DslResourceLoader } from '@pactor-app/resource';
6
6
  import { NavigationBridge, NavigationLocation, NavigationListener, MenuRegistry, RouteContext, MenuItem } from '@pactor-app/router';
7
7
  import { HttpRequestConfig, ActionHandler, ServiceHandler, HttpAdapter, PageRuntime, PermissionAdapter } from '@pactor-app/runtime';
8
8
  import * as react from 'react';
9
- import { ComponentType, ReactNode, Component, ErrorInfo } from 'react';
9
+ import { ComponentType, ReactNode } from 'react';
10
10
 
11
11
  /** 创建页面运行时 HTTP 出口适配器:注入 Authorization 头 */
12
12
  declare function createRuntimeHttpAdapter(authTokenProvider: AuthTokenProvider | undefined): HttpAdapter;
@@ -339,19 +339,11 @@ declare function DslPageLoader({ app, pageId, route }: DslPageLoaderProps): reac
339
339
  interface PageErrorBoundaryProps {
340
340
  children?: ReactNode;
341
341
  }
342
- interface PageErrorBoundaryState {
343
- error: Error | null;
344
- }
345
342
  /**
346
343
  * PageErrorBoundary(决策 D3):捕获页面 DSL 渲染期异常,
347
344
  * 显示受控错误页(可重试重新渲染),应用外壳不崩溃、不白屏。
348
345
  */
349
- declare class PageErrorBoundary extends Component<PageErrorBoundaryProps, PageErrorBoundaryState> {
350
- state: PageErrorBoundaryState;
351
- static getDerivedStateFromError(error: Error): PageErrorBoundaryState;
352
- componentDidCatch(error: Error, info: ErrorInfo): void;
353
- render(): ReactNode;
354
- }
346
+ declare function PageErrorBoundary({ children }: PageErrorBoundaryProps): ReactNode;
355
347
 
356
348
  /**
357
349
  * 嵌入式页面 props(spec: embedded-page-view):
package/dist/index.js CHANGED
@@ -22,7 +22,7 @@ import { createI18nContext } from "@pactor-app/core";
22
22
  import { resolveLayout } from "@pactor-app/ui/layout";
23
23
  import { resolveRoute } from "@pactor-app/router";
24
24
  import { DynamicDslRoute, useReactRouterBridge } from "@pactor-app/router/react";
25
- import { I18nContextProvider } from "@pactor-app/runtime";
25
+ import { I18nContextProvider, useI18n as useI18n4 } from "@pactor-app/runtime";
26
26
  import {
27
27
  useEffect as useEffect2,
28
28
  useState as useState2,
@@ -37,6 +37,7 @@ import {
37
37
  } from "react-router-dom";
38
38
 
39
39
  // src/feedback.tsx
40
+ import { useI18n } from "@pactor-app/runtime";
40
41
  import { jsx, jsxs } from "react/jsx-runtime";
41
42
  var centerStyle = {
42
43
  minHeight: "100vh",
@@ -47,6 +48,7 @@ var centerStyle = {
47
48
  function BootstrapSpinner({
48
49
  style
49
50
  }) {
51
+ const { t } = useI18n();
50
52
  return /* @__PURE__ */ jsx("div", { className: "pactor-app-spin", style: { ...centerStyle, ...style }, children: /* @__PURE__ */ jsx(
51
53
  "svg",
52
54
  {
@@ -54,7 +56,7 @@ function BootstrapSpinner({
54
56
  height: "32",
55
57
  viewBox: "0 0 32 32",
56
58
  role: "status",
57
- "aria-label": "\u52A0\u8F7D\u4E2D",
59
+ "aria-label": t("pactor.app.loading"),
58
60
  children: /* @__PURE__ */ jsx(
59
61
  "circle",
60
62
  {
@@ -119,13 +121,14 @@ function PrimaryButton({
119
121
  }
120
122
 
121
123
  // src/page-loader.tsx
122
- import { PageRuntimeView } from "@pactor-app/runtime";
124
+ import { PageRuntimeView, useI18n as useI18n3 } from "@pactor-app/runtime";
123
125
  import { useEffect, useState } from "react";
124
126
 
125
127
  // src/error-boundary.tsx
128
+ import { useI18n as useI18n2 } from "@pactor-app/runtime";
126
129
  import { Component } from "react";
127
130
  import { jsx as jsx2 } from "react/jsx-runtime";
128
- var PageErrorBoundary = class extends Component {
131
+ var PageErrorBoundaryImpl = class extends Component {
129
132
  constructor() {
130
133
  super(...arguments);
131
134
  this.state = { error: null };
@@ -143,19 +146,31 @@ var PageErrorBoundary = class extends Component {
143
146
  ResultView,
144
147
  {
145
148
  className: "pactor-app-page-render-error",
146
- title: "\u9875\u9762\u6E32\u67D3\u5F02\u5E38",
149
+ title: this.props.title,
147
150
  subTitle: error.message,
148
- extra: /* @__PURE__ */ jsx2(PrimaryButton, { onClick: () => this.setState({ error: null }), children: "\u91CD\u8BD5" })
151
+ extra: /* @__PURE__ */ jsx2(PrimaryButton, { onClick: () => this.setState({ error: null }), children: this.props.retryLabel })
149
152
  }
150
153
  );
151
154
  }
152
155
  return this.props.children;
153
156
  }
154
157
  };
158
+ function PageErrorBoundary({ children }) {
159
+ const { t } = useI18n2();
160
+ return /* @__PURE__ */ jsx2(
161
+ PageErrorBoundaryImpl,
162
+ {
163
+ title: t("pactor.app.renderError"),
164
+ retryLabel: t("pactor.page.retry"),
165
+ children
166
+ }
167
+ );
168
+ }
155
169
 
156
170
  // src/page-loader.tsx
157
171
  import { jsx as jsx3 } from "react/jsx-runtime";
158
172
  function DslPageLoader({ app, pageId, route }) {
173
+ const { t } = useI18n3();
159
174
  const [state, setState] = useState({ status: "loading" });
160
175
  const [retryTick, setRetryTick] = useState(0);
161
176
  useEffect(() => {
@@ -196,9 +211,9 @@ function DslPageLoader({ app, pageId, route }) {
196
211
  ResultView,
197
212
  {
198
213
  className: "pactor-app-page-load-error",
199
- title: "\u9875\u9762\u52A0\u8F7D\u5931\u8D25",
214
+ title: t("pactor.page.loadFailed"),
200
215
  subTitle: state.error.message,
201
- extra: /* @__PURE__ */ jsx3(PrimaryButton, { onClick: () => setRetryTick((n) => n + 1), children: "\u91CD\u8BD5" })
216
+ extra: /* @__PURE__ */ jsx3(PrimaryButton, { onClick: () => setRetryTick((n) => n + 1), children: t("pactor.page.retry") })
202
217
  }
203
218
  );
204
219
  }
@@ -215,6 +230,7 @@ function DslPageLoader({ app, pageId, route }) {
215
230
  // src/app-shell.tsx
216
231
  import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
217
232
  function Application({ app }) {
233
+ const { t } = useI18n4();
218
234
  const [state, setState] = useState2({ status: "loading" });
219
235
  const [retryTick, setRetryTick] = useState2(0);
220
236
  useEffect2(() => {
@@ -246,9 +262,9 @@ function Application({ app }) {
246
262
  ResultView,
247
263
  {
248
264
  className: "pactor-app-bootstrap-error",
249
- title: "\u5E94\u7528\u542F\u52A8\u5931\u8D25",
265
+ title: t("pactor.app.startFailed"),
250
266
  subTitle: state.error.message,
251
- extra: /* @__PURE__ */ jsx4(PrimaryButton, { onClick: () => setRetryTick((n) => n + 1), children: "\u91CD\u8BD5" })
267
+ extra: /* @__PURE__ */ jsx4(PrimaryButton, { onClick: () => setRetryTick((n) => n + 1), children: t("pactor.page.retry") })
252
268
  }
253
269
  );
254
270
  }
@@ -360,22 +376,24 @@ function pageLoaderKey(pageId, route, i18nVersion) {
360
376
  return `${pageId}|${i18nVersion}|${JSON.stringify(route.params)}|${JSON.stringify(route.query)}`;
361
377
  }
362
378
  function NotFoundPage() {
379
+ const { t } = useI18n4();
363
380
  return /* @__PURE__ */ jsx4(
364
381
  ResultView,
365
382
  {
366
383
  className: "pactor-app-not-found",
367
384
  title: "404",
368
- subTitle: "\u9875\u9762\u4E0D\u5B58\u5728\u6216\u5C1A\u672A\u6CE8\u518C"
385
+ subTitle: t("pactor.app.pageNotFound")
369
386
  }
370
387
  );
371
388
  }
372
389
  function ForbiddenPage() {
390
+ const { t } = useI18n4();
373
391
  return /* @__PURE__ */ jsx4(
374
392
  ResultView,
375
393
  {
376
394
  className: "pactor-app-forbidden",
377
395
  title: "403",
378
- subTitle: "\u6CA1\u6709\u8BBF\u95EE\u8BE5\u9875\u9762\u7684\u6743\u9650"
396
+ subTitle: t("pactor.app.forbidden")
379
397
  }
380
398
  );
381
399
  }
@@ -802,7 +820,7 @@ import {
802
820
  DslSourceResolver,
803
821
  I18nContextProvider as I18nContextProvider2,
804
822
  PageRuntimeView as PageRuntimeView2,
805
- useI18n
823
+ useI18n as useI18n5
806
824
  } from "@pactor-app/runtime";
807
825
  import {
808
826
  useEffect as useEffect3,
@@ -889,7 +907,7 @@ function EmbeddedPage({
889
907
  pageDsl,
890
908
  route
891
909
  }) {
892
- const { t } = useI18n();
910
+ const { t } = useI18n5();
893
911
  const [state, setState] = useState3({ status: "loading" });
894
912
  const [retryTick, setRetryTick] = useState3(0);
895
913
  const onError = options.onError;
@@ -1005,7 +1023,7 @@ import { createI18nContext as createI18nContext3 } from "@pactor-app/core";
1005
1023
  import { MenuRegistry as MenuRegistry2 } from "@pactor-app/router";
1006
1024
  import {
1007
1025
  I18nContextProvider as I18nContextProvider3,
1008
- useI18n as useI18n2
1026
+ useI18n as useI18n6
1009
1027
  } from "@pactor-app/runtime";
1010
1028
  import { Menu } from "@pactor-app/ui/components";
1011
1029
  import {
@@ -1370,7 +1388,7 @@ function SitemapApp(props) {
1370
1388
  return /* @__PURE__ */ jsx6(I18nContextProvider3, { value: i18n, children: /* @__PURE__ */ jsx6(SitemapAppInner, { ...props }) });
1371
1389
  }
1372
1390
  function SitemapAppInner(props) {
1373
- const { t } = useI18n2();
1391
+ const { t } = useI18n6();
1374
1392
  const { sources, fetcher, baseUrl } = props;
1375
1393
  const browserRoute = useBrowserRoute();
1376
1394
  const pathname = props.pathname ?? browserRoute.pathname;
@@ -1604,7 +1622,7 @@ function LayoutLevel({
1604
1622
  layoutFactory,
1605
1623
  outlet
1606
1624
  }) {
1607
- const { t } = useI18n2();
1625
+ const { t } = useI18n6();
1608
1626
  const layoutName = chain[index];
1609
1627
  const layoutDsl = sitemap.layouts[layoutName];
1610
1628
  const layoutPage = useMemo2(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pactor-app/app",
3
- "version": "1.54.2",
3
+ "version": "1.54.4",
4
4
  "description": "Pactor application: one-stop composition layer (createPactorApplication) wiring loader, bootstrap, registries, router, layout, interaction and page runtimes",
5
5
  "keywords": [
6
6
  "pactor",
@@ -46,14 +46,14 @@
46
46
  "access": "public"
47
47
  },
48
48
  "dependencies": {
49
- "@pactor-app/core": "1.54.2",
50
- "@pactor-app/permission": "1.54.2",
51
- "@pactor-app/router": "1.54.2",
52
- "@pactor-app/runtime": "1.54.2",
53
- "@pactor-app/expression": "1.54.2",
54
- "@pactor-app/ui": "1.54.2",
55
- "@pactor-app/resource": "1.54.2",
56
- "@pactor-app/schema": "1.54.2"
49
+ "@pactor-app/permission": "1.54.4",
50
+ "@pactor-app/resource": "1.54.4",
51
+ "@pactor-app/schema": "1.54.4",
52
+ "@pactor-app/expression": "1.54.4",
53
+ "@pactor-app/runtime": "1.54.4",
54
+ "@pactor-app/ui": "1.54.4",
55
+ "@pactor-app/router": "1.54.4",
56
+ "@pactor-app/core": "1.54.4"
57
57
  },
58
58
  "peerDependencies": {
59
59
  "react": ">=18",