@pactor-app/app 1.1.0 → 1.3.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/README.md +1 -1
- package/dist/index.cjs +23 -10
- package/dist/index.d.cts +14 -35
- package/dist/index.d.ts +14 -35
- package/dist/index.js +27 -14
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ npm install @pactor-app/app @pactor-app/ui react react-dom react-router-dom
|
|
|
10
10
|
pnpm add @pactor-app/app @pactor-app/ui react react-dom react-router-dom
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
`react >= 18`、`react-dom >= 18`、`react-router-dom >= 6` 为 peer dependency(开发基准为 react-router-dom v7
|
|
13
|
+
`react >= 18`、`react-dom >= 18`、`react-router-dom >= 6` 为 peer dependency(开发基准为 react-router-dom v7)。内置默认 UI 为 `@pactor-app/ui`(shadcn 风格,传递依赖),需导入其预建样式表 `import '@pactor-app/ui/styles.css'`。
|
|
14
14
|
|
|
15
15
|
## 一站式用法
|
|
16
16
|
|
package/dist/index.cjs
CHANGED
|
@@ -349,6 +349,20 @@ function ShellLayout({
|
|
|
349
349
|
}
|
|
350
350
|
);
|
|
351
351
|
}
|
|
352
|
+
if (session.layoutType === "chat") {
|
|
353
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
354
|
+
LayoutComponent,
|
|
355
|
+
{
|
|
356
|
+
brand: session.brand,
|
|
357
|
+
registry: session.menuRegistry,
|
|
358
|
+
bridge: app.navigation,
|
|
359
|
+
route: route ?? void 0,
|
|
360
|
+
permissionChecker: app.permissionStore,
|
|
361
|
+
collapsible: session.layoutConfig.collapsible,
|
|
362
|
+
children: outlet
|
|
363
|
+
}
|
|
364
|
+
);
|
|
365
|
+
}
|
|
352
366
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(LayoutComponent, { brand: session.brand, children: outlet });
|
|
353
367
|
}
|
|
354
368
|
function pageLoaderKey(pageId, route) {
|
|
@@ -424,11 +438,11 @@ function wrapHttpAdapter(base, hooks) {
|
|
|
424
438
|
function createPactorAssembly(options) {
|
|
425
439
|
const overlayManager = new import_interaction.OverlayManager();
|
|
426
440
|
const uiBridge = (0, import_interaction.createUiBridge)();
|
|
427
|
-
const interactionKit = options.interactionKit ??
|
|
428
|
-
Provider: import_interaction.
|
|
429
|
-
OverlayHost: import_interaction.
|
|
441
|
+
const interactionKit = options.interactionKit ?? {
|
|
442
|
+
Provider: import_interaction.InteractionProvider,
|
|
443
|
+
OverlayHost: import_interaction.OverlayHost
|
|
430
444
|
};
|
|
431
|
-
const components =
|
|
445
|
+
const components = options.componentRegistry?.() ?? (0, import_components.createComponentRegistry)();
|
|
432
446
|
upsertAll(components, options.components);
|
|
433
447
|
const actions = new import_core2.Registry("ActionRegistry");
|
|
434
448
|
(0, import_interaction.registerInteractionActions)(actions, overlayManager, uiBridge);
|
|
@@ -581,11 +595,10 @@ function createPactorApplication(options) {
|
|
|
581
595
|
const { appId } = options;
|
|
582
596
|
const routerOptions = options.router ?? {};
|
|
583
597
|
const permissionStore = new import_permission.PermissionStore();
|
|
584
|
-
const layoutRegistry =
|
|
598
|
+
const layoutRegistry = options.layoutRegistry?.() ?? (0, import_layout2.createLayoutRegistry)();
|
|
585
599
|
const navigation = new ReactRouterBinding();
|
|
586
600
|
const assembly = createPactorAssembly({
|
|
587
601
|
componentRegistry: options.componentRegistry,
|
|
588
|
-
ui: options.ui,
|
|
589
602
|
interactionKit: options.interactionKit,
|
|
590
603
|
components: options.components,
|
|
591
604
|
actions: options.actions,
|
|
@@ -843,8 +856,8 @@ function EmbeddedPage({
|
|
|
843
856
|
}
|
|
844
857
|
};
|
|
845
858
|
}, [pageId, pageDsl, retryTick]);
|
|
846
|
-
const
|
|
847
|
-
const
|
|
859
|
+
const InteractionProvider2 = assembly.interactionKit.Provider;
|
|
860
|
+
const OverlayHost2 = assembly.interactionKit.OverlayHost;
|
|
848
861
|
let content;
|
|
849
862
|
if (state.status === "loading") {
|
|
850
863
|
content = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "pactor-app-page-loading", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(BootstrapSpinner, { style: { minHeight: 0, padding: 48 } }) });
|
|
@@ -859,9 +872,9 @@ function EmbeddedPage({
|
|
|
859
872
|
}
|
|
860
873
|
);
|
|
861
874
|
} else {
|
|
862
|
-
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)(
|
|
875
|
+
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 }) }) });
|
|
863
876
|
}
|
|
864
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_runtime5.I18nContextProvider, { value: i18n, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
877
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_runtime5.I18nContextProvider, { value: i18n, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(InteractionProvider2, { bridge: assembly.uiBridge, children: content }) });
|
|
865
878
|
}
|
|
866
879
|
// Annotate the CommonJS export names for ESM import in node:
|
|
867
880
|
0 && (module.exports = {
|
package/dist/index.d.cts
CHANGED
|
@@ -28,11 +28,9 @@ declare function wrapHttpAdapter(base: HttpAdapter, hooks: PactorHttpHooks | und
|
|
|
28
28
|
* 整应用模式与嵌入模式共享的装配输入。
|
|
29
29
|
*/
|
|
30
30
|
interface PactorAssemblyOptions {
|
|
31
|
-
/**
|
|
31
|
+
/** 组件注册表工厂(自定义覆盖点,缺省内置实现) */
|
|
32
32
|
componentRegistry?: () => Registry<unknown>;
|
|
33
|
-
/**
|
|
34
|
-
ui?: UiKit;
|
|
35
|
-
/** 交互层组件对(缺省 shadcn 版) */
|
|
33
|
+
/** 交互层组件对(自定义覆盖点,缺省内置实现) */
|
|
36
34
|
interactionKit?: {
|
|
37
35
|
Provider: ComponentType<InteractionProviderProps>;
|
|
38
36
|
OverlayHost: ComponentType<OverlayHostProps>;
|
|
@@ -87,38 +85,31 @@ interface PactorApplicationOptions {
|
|
|
87
85
|
/** 业务组件扩展(写入应用级共享 registry,可覆盖同名内置组件) */
|
|
88
86
|
components?: Record<string, unknown>;
|
|
89
87
|
/**
|
|
90
|
-
*
|
|
91
|
-
*
|
|
88
|
+
* 自定义组件注册表覆盖点(设计决策 D4,ui-kit-selection spec):
|
|
89
|
+
* 组件注册表工厂,缺省 createComponentRegistry(@pactor-app/ui 内置
|
|
92
90
|
* 实现);传入自定义工厂可整体替换。
|
|
93
91
|
* options.components 与运行期 registerComponent 叠加在所选注册表之上。
|
|
94
92
|
* 注意:默认路径需导入 `@pactor-app/ui/styles.css`。
|
|
95
93
|
*/
|
|
96
94
|
componentRegistry?: () => Registry<unknown>;
|
|
97
95
|
/**
|
|
98
|
-
*
|
|
99
|
-
*
|
|
96
|
+
* 自定义布局注册表覆盖点(shell-ui-kit-selection spec):
|
|
97
|
+
* 布局注册表工厂,缺省 createLayoutRegistry(@pactor-app/ui 内置
|
|
100
98
|
* 实现);传入自定义工厂可整体替换外壳布局。
|
|
101
99
|
* bootstrap 的 layout.type 解析逻辑不变。
|
|
102
100
|
*/
|
|
103
101
|
layoutRegistry?: () => LayoutRegistry;
|
|
104
102
|
/**
|
|
105
|
-
*
|
|
106
|
-
* 缺省
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
103
|
+
* 自定义交互层覆盖点(shell-ui-kit-selection spec):交互层组件对,
|
|
104
|
+
* 缺省 @pactor-app/ui 内置的 InteractionProvider / OverlayHost;
|
|
105
|
+
* 传入自定义组件对可替换 overlay / message / confirm 链路。
|
|
106
|
+
* props 类型为 @pactor-app/ui/interaction 的
|
|
107
|
+
* InteractionProviderProps / OverlayHostProps。
|
|
110
108
|
*/
|
|
111
109
|
interactionKit?: {
|
|
112
110
|
Provider: ComponentType<InteractionProviderProps>;
|
|
113
111
|
OverlayHost: ComponentType<OverlayHostProps>;
|
|
114
112
|
};
|
|
115
|
-
/**
|
|
116
|
-
* UI kit 预设(ui-kit-preset spec):一次性提供三个 UI 库切换槽位
|
|
117
|
-
* (内置预设为 @pactor-app/ui 的 shadcnUiKit)。
|
|
118
|
-
* 每个槽位独立合并,优先级:显式细粒度选项 > ui 预设 > 内置
|
|
119
|
-
* shadcn 默认。
|
|
120
|
-
*/
|
|
121
|
-
ui?: UiKit;
|
|
122
113
|
/** 业务动作扩展(可覆盖同名内置/交互动作) */
|
|
123
114
|
actions?: Record<string, ActionHandler>;
|
|
124
115
|
/** 业务服务扩展 */
|
|
@@ -146,18 +137,6 @@ interface PactorApplicationOptions {
|
|
|
146
137
|
/** 翻译消息表(优先级高于 bootstrap.messages) */
|
|
147
138
|
messages?: I18nMessages;
|
|
148
139
|
}
|
|
149
|
-
/**
|
|
150
|
-
* UI kit 预设对象(ui-kit-preset spec):三个槽位的字段类型直接复用
|
|
151
|
-
* PactorApplicationOptions 既有选项的类型(结构一致,天然向第三方 kit 开放)。
|
|
152
|
-
*/
|
|
153
|
-
interface UiKit {
|
|
154
|
-
/** 组件注册表工厂(同 options.componentRegistry) */
|
|
155
|
-
componentRegistry?: PactorApplicationOptions['componentRegistry'];
|
|
156
|
-
/** 布局注册表工厂(同 options.layoutRegistry) */
|
|
157
|
-
layoutRegistry?: PactorApplicationOptions['layoutRegistry'];
|
|
158
|
-
/** 交互层组件对(同 options.interactionKit) */
|
|
159
|
-
interactionKit?: PactorApplicationOptions['interactionKit'];
|
|
160
|
-
}
|
|
161
140
|
/**
|
|
162
141
|
* bootstrap 会话(设计决策 D1/D2):启动编排的产物,
|
|
163
142
|
* React 组合层据以渲染布局、菜单与动态路由。
|
|
@@ -215,7 +194,7 @@ interface PactorApplicationHandle {
|
|
|
215
194
|
readonly uiBridge: UiBridge;
|
|
216
195
|
readonly permissionStore: PermissionStore;
|
|
217
196
|
readonly layoutRegistry: LayoutRegistry;
|
|
218
|
-
/**
|
|
197
|
+
/** 交互层组件对(Provider / OverlayHost,缺省内置实现) */
|
|
219
198
|
readonly interactionKit: {
|
|
220
199
|
Provider: ComponentType<InteractionProviderProps>;
|
|
221
200
|
OverlayHost: ComponentType<OverlayHostProps>;
|
|
@@ -301,7 +280,7 @@ interface DslPageLoaderProps {
|
|
|
301
280
|
* key 变化即整体重建:旧运行时 destroy,新页面重新加载(V1 无 keepAlive);
|
|
302
281
|
* - 加载中渲染 loading 态;加载/校验失败渲染含重试的受控错误页;
|
|
303
282
|
* - PageRuntimeView 经 PageErrorBoundary 包裹,渲染异常不白屏;
|
|
304
|
-
* - OverlayHost(app.interactionKit
|
|
283
|
+
* - OverlayHost(app.interactionKit 所选实现,缺省内置实现)作为
|
|
305
284
|
* PageRuntimeView children(共享当前页面 Renderer 上下文;page overlay
|
|
306
285
|
* 经 resolvePage 接 loader,子运行时共享应用级 registries——由
|
|
307
286
|
* interaction host 内部实现)。
|
|
@@ -379,4 +358,4 @@ declare function createPactorPage(options?: PactorPageOptions): ComponentType<Pa
|
|
|
379
358
|
*/
|
|
380
359
|
declare function PactorPage(props: PactorPageProps & PactorPageOptions): react.JSX.Element;
|
|
381
360
|
|
|
382
|
-
export { Application, type ApplicationProps, type AuthTokenProvider, DslPageLoader, type DslPageLoaderProps, type PactorAppSession, type PactorApplication, type PactorApplicationHandle, type PactorApplicationOptions, type PactorHttpHooks, PactorPage, type PactorPageOptions, type PactorPageProps, type PactorRouterOptions, PageErrorBoundary, ReactRouterBinding,
|
|
361
|
+
export { Application, type ApplicationProps, type AuthTokenProvider, DslPageLoader, type DslPageLoaderProps, type PactorAppSession, type PactorApplication, type PactorApplicationHandle, type PactorApplicationOptions, type PactorHttpHooks, PactorPage, type PactorPageOptions, type PactorPageProps, type PactorRouterOptions, PageErrorBoundary, ReactRouterBinding, createPactorApplication, createPactorPage, createRuntimeHttpAdapter, wrapHttpAdapter };
|
package/dist/index.d.ts
CHANGED
|
@@ -28,11 +28,9 @@ declare function wrapHttpAdapter(base: HttpAdapter, hooks: PactorHttpHooks | und
|
|
|
28
28
|
* 整应用模式与嵌入模式共享的装配输入。
|
|
29
29
|
*/
|
|
30
30
|
interface PactorAssemblyOptions {
|
|
31
|
-
/**
|
|
31
|
+
/** 组件注册表工厂(自定义覆盖点,缺省内置实现) */
|
|
32
32
|
componentRegistry?: () => Registry<unknown>;
|
|
33
|
-
/**
|
|
34
|
-
ui?: UiKit;
|
|
35
|
-
/** 交互层组件对(缺省 shadcn 版) */
|
|
33
|
+
/** 交互层组件对(自定义覆盖点,缺省内置实现) */
|
|
36
34
|
interactionKit?: {
|
|
37
35
|
Provider: ComponentType<InteractionProviderProps>;
|
|
38
36
|
OverlayHost: ComponentType<OverlayHostProps>;
|
|
@@ -87,38 +85,31 @@ interface PactorApplicationOptions {
|
|
|
87
85
|
/** 业务组件扩展(写入应用级共享 registry,可覆盖同名内置组件) */
|
|
88
86
|
components?: Record<string, unknown>;
|
|
89
87
|
/**
|
|
90
|
-
*
|
|
91
|
-
*
|
|
88
|
+
* 自定义组件注册表覆盖点(设计决策 D4,ui-kit-selection spec):
|
|
89
|
+
* 组件注册表工厂,缺省 createComponentRegistry(@pactor-app/ui 内置
|
|
92
90
|
* 实现);传入自定义工厂可整体替换。
|
|
93
91
|
* options.components 与运行期 registerComponent 叠加在所选注册表之上。
|
|
94
92
|
* 注意:默认路径需导入 `@pactor-app/ui/styles.css`。
|
|
95
93
|
*/
|
|
96
94
|
componentRegistry?: () => Registry<unknown>;
|
|
97
95
|
/**
|
|
98
|
-
*
|
|
99
|
-
*
|
|
96
|
+
* 自定义布局注册表覆盖点(shell-ui-kit-selection spec):
|
|
97
|
+
* 布局注册表工厂,缺省 createLayoutRegistry(@pactor-app/ui 内置
|
|
100
98
|
* 实现);传入自定义工厂可整体替换外壳布局。
|
|
101
99
|
* bootstrap 的 layout.type 解析逻辑不变。
|
|
102
100
|
*/
|
|
103
101
|
layoutRegistry?: () => LayoutRegistry;
|
|
104
102
|
/**
|
|
105
|
-
*
|
|
106
|
-
* 缺省
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
103
|
+
* 自定义交互层覆盖点(shell-ui-kit-selection spec):交互层组件对,
|
|
104
|
+
* 缺省 @pactor-app/ui 内置的 InteractionProvider / OverlayHost;
|
|
105
|
+
* 传入自定义组件对可替换 overlay / message / confirm 链路。
|
|
106
|
+
* props 类型为 @pactor-app/ui/interaction 的
|
|
107
|
+
* InteractionProviderProps / OverlayHostProps。
|
|
110
108
|
*/
|
|
111
109
|
interactionKit?: {
|
|
112
110
|
Provider: ComponentType<InteractionProviderProps>;
|
|
113
111
|
OverlayHost: ComponentType<OverlayHostProps>;
|
|
114
112
|
};
|
|
115
|
-
/**
|
|
116
|
-
* UI kit 预设(ui-kit-preset spec):一次性提供三个 UI 库切换槽位
|
|
117
|
-
* (内置预设为 @pactor-app/ui 的 shadcnUiKit)。
|
|
118
|
-
* 每个槽位独立合并,优先级:显式细粒度选项 > ui 预设 > 内置
|
|
119
|
-
* shadcn 默认。
|
|
120
|
-
*/
|
|
121
|
-
ui?: UiKit;
|
|
122
113
|
/** 业务动作扩展(可覆盖同名内置/交互动作) */
|
|
123
114
|
actions?: Record<string, ActionHandler>;
|
|
124
115
|
/** 业务服务扩展 */
|
|
@@ -146,18 +137,6 @@ interface PactorApplicationOptions {
|
|
|
146
137
|
/** 翻译消息表(优先级高于 bootstrap.messages) */
|
|
147
138
|
messages?: I18nMessages;
|
|
148
139
|
}
|
|
149
|
-
/**
|
|
150
|
-
* UI kit 预设对象(ui-kit-preset spec):三个槽位的字段类型直接复用
|
|
151
|
-
* PactorApplicationOptions 既有选项的类型(结构一致,天然向第三方 kit 开放)。
|
|
152
|
-
*/
|
|
153
|
-
interface UiKit {
|
|
154
|
-
/** 组件注册表工厂(同 options.componentRegistry) */
|
|
155
|
-
componentRegistry?: PactorApplicationOptions['componentRegistry'];
|
|
156
|
-
/** 布局注册表工厂(同 options.layoutRegistry) */
|
|
157
|
-
layoutRegistry?: PactorApplicationOptions['layoutRegistry'];
|
|
158
|
-
/** 交互层组件对(同 options.interactionKit) */
|
|
159
|
-
interactionKit?: PactorApplicationOptions['interactionKit'];
|
|
160
|
-
}
|
|
161
140
|
/**
|
|
162
141
|
* bootstrap 会话(设计决策 D1/D2):启动编排的产物,
|
|
163
142
|
* React 组合层据以渲染布局、菜单与动态路由。
|
|
@@ -215,7 +194,7 @@ interface PactorApplicationHandle {
|
|
|
215
194
|
readonly uiBridge: UiBridge;
|
|
216
195
|
readonly permissionStore: PermissionStore;
|
|
217
196
|
readonly layoutRegistry: LayoutRegistry;
|
|
218
|
-
/**
|
|
197
|
+
/** 交互层组件对(Provider / OverlayHost,缺省内置实现) */
|
|
219
198
|
readonly interactionKit: {
|
|
220
199
|
Provider: ComponentType<InteractionProviderProps>;
|
|
221
200
|
OverlayHost: ComponentType<OverlayHostProps>;
|
|
@@ -301,7 +280,7 @@ interface DslPageLoaderProps {
|
|
|
301
280
|
* key 变化即整体重建:旧运行时 destroy,新页面重新加载(V1 无 keepAlive);
|
|
302
281
|
* - 加载中渲染 loading 态;加载/校验失败渲染含重试的受控错误页;
|
|
303
282
|
* - PageRuntimeView 经 PageErrorBoundary 包裹,渲染异常不白屏;
|
|
304
|
-
* - OverlayHost(app.interactionKit
|
|
283
|
+
* - OverlayHost(app.interactionKit 所选实现,缺省内置实现)作为
|
|
305
284
|
* PageRuntimeView children(共享当前页面 Renderer 上下文;page overlay
|
|
306
285
|
* 经 resolvePage 接 loader,子运行时共享应用级 registries——由
|
|
307
286
|
* interaction host 内部实现)。
|
|
@@ -379,4 +358,4 @@ declare function createPactorPage(options?: PactorPageOptions): ComponentType<Pa
|
|
|
379
358
|
*/
|
|
380
359
|
declare function PactorPage(props: PactorPageProps & PactorPageOptions): react.JSX.Element;
|
|
381
360
|
|
|
382
|
-
export { Application, type ApplicationProps, type AuthTokenProvider, DslPageLoader, type DslPageLoaderProps, type PactorAppSession, type PactorApplication, type PactorApplicationHandle, type PactorApplicationOptions, type PactorHttpHooks, PactorPage, type PactorPageOptions, type PactorPageProps, type PactorRouterOptions, PageErrorBoundary, ReactRouterBinding,
|
|
361
|
+
export { Application, type ApplicationProps, type AuthTokenProvider, DslPageLoader, type DslPageLoaderProps, type PactorAppSession, type PactorApplication, type PactorApplicationHandle, type PactorApplicationOptions, type PactorHttpHooks, PactorPage, type PactorPageOptions, type PactorPageProps, type PactorRouterOptions, PageErrorBoundary, ReactRouterBinding, createPactorApplication, createPactorPage, createRuntimeHttpAdapter, wrapHttpAdapter };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/application.ts
|
|
2
2
|
import {
|
|
3
|
-
|
|
3
|
+
createLayoutRegistry
|
|
4
4
|
} from "@pactor-app/ui/layout";
|
|
5
5
|
import { createPermissionAdapter, PermissionStore } from "@pactor-app/permission";
|
|
6
6
|
import {
|
|
@@ -331,6 +331,20 @@ function ShellLayout({
|
|
|
331
331
|
}
|
|
332
332
|
);
|
|
333
333
|
}
|
|
334
|
+
if (session.layoutType === "chat") {
|
|
335
|
+
return /* @__PURE__ */ jsx4(
|
|
336
|
+
LayoutComponent,
|
|
337
|
+
{
|
|
338
|
+
brand: session.brand,
|
|
339
|
+
registry: session.menuRegistry,
|
|
340
|
+
bridge: app.navigation,
|
|
341
|
+
route: route ?? void 0,
|
|
342
|
+
permissionChecker: app.permissionStore,
|
|
343
|
+
collapsible: session.layoutConfig.collapsible,
|
|
344
|
+
children: outlet
|
|
345
|
+
}
|
|
346
|
+
);
|
|
347
|
+
}
|
|
334
348
|
return /* @__PURE__ */ jsx4(LayoutComponent, { brand: session.brand, children: outlet });
|
|
335
349
|
}
|
|
336
350
|
function pageLoaderKey(pageId, route) {
|
|
@@ -359,13 +373,13 @@ function ForbiddenPage() {
|
|
|
359
373
|
|
|
360
374
|
// src/assembly.ts
|
|
361
375
|
import { Registry } from "@pactor-app/core";
|
|
362
|
-
import {
|
|
376
|
+
import { createComponentRegistry } from "@pactor-app/ui/components";
|
|
363
377
|
import {
|
|
364
378
|
createUiBridge,
|
|
365
379
|
OverlayManager,
|
|
366
380
|
registerInteractionActions,
|
|
367
|
-
|
|
368
|
-
|
|
381
|
+
InteractionProvider,
|
|
382
|
+
OverlayHost
|
|
369
383
|
} from "@pactor-app/ui/interaction";
|
|
370
384
|
import {
|
|
371
385
|
createFetchHttpAdapter
|
|
@@ -414,11 +428,11 @@ function wrapHttpAdapter(base, hooks) {
|
|
|
414
428
|
function createPactorAssembly(options) {
|
|
415
429
|
const overlayManager = new OverlayManager();
|
|
416
430
|
const uiBridge = createUiBridge();
|
|
417
|
-
const interactionKit = options.interactionKit ??
|
|
418
|
-
Provider:
|
|
419
|
-
OverlayHost
|
|
431
|
+
const interactionKit = options.interactionKit ?? {
|
|
432
|
+
Provider: InteractionProvider,
|
|
433
|
+
OverlayHost
|
|
420
434
|
};
|
|
421
|
-
const components =
|
|
435
|
+
const components = options.componentRegistry?.() ?? createComponentRegistry();
|
|
422
436
|
upsertAll(components, options.components);
|
|
423
437
|
const actions = new Registry("ActionRegistry");
|
|
424
438
|
registerInteractionActions(actions, overlayManager, uiBridge);
|
|
@@ -571,11 +585,10 @@ function createPactorApplication(options) {
|
|
|
571
585
|
const { appId } = options;
|
|
572
586
|
const routerOptions = options.router ?? {};
|
|
573
587
|
const permissionStore = new PermissionStore();
|
|
574
|
-
const layoutRegistry =
|
|
588
|
+
const layoutRegistry = options.layoutRegistry?.() ?? createLayoutRegistry();
|
|
575
589
|
const navigation = new ReactRouterBinding();
|
|
576
590
|
const assembly = createPactorAssembly({
|
|
577
591
|
componentRegistry: options.componentRegistry,
|
|
578
|
-
ui: options.ui,
|
|
579
592
|
interactionKit: options.interactionKit,
|
|
580
593
|
components: options.components,
|
|
581
594
|
actions: options.actions,
|
|
@@ -843,8 +856,8 @@ function EmbeddedPage({
|
|
|
843
856
|
}
|
|
844
857
|
};
|
|
845
858
|
}, [pageId, pageDsl, retryTick]);
|
|
846
|
-
const
|
|
847
|
-
const
|
|
859
|
+
const InteractionProvider2 = assembly.interactionKit.Provider;
|
|
860
|
+
const OverlayHost2 = assembly.interactionKit.OverlayHost;
|
|
848
861
|
let content;
|
|
849
862
|
if (state.status === "loading") {
|
|
850
863
|
content = /* @__PURE__ */ jsx5("div", { className: "pactor-app-page-loading", children: /* @__PURE__ */ jsx5(BootstrapSpinner, { style: { minHeight: 0, padding: 48 } }) });
|
|
@@ -859,9 +872,9 @@ function EmbeddedPage({
|
|
|
859
872
|
}
|
|
860
873
|
);
|
|
861
874
|
} else {
|
|
862
|
-
content = /* @__PURE__ */ jsx5(PageErrorBoundary, { children: /* @__PURE__ */ jsx5(PageRuntimeView2, { runtime: state.runtime, children: resolvePage !== void 0 ? /* @__PURE__ */ jsx5(
|
|
875
|
+
content = /* @__PURE__ */ jsx5(PageErrorBoundary, { children: /* @__PURE__ */ jsx5(PageRuntimeView2, { runtime: state.runtime, children: resolvePage !== void 0 ? /* @__PURE__ */ jsx5(OverlayHost2, { manager: assembly.overlayManager, resolvePage }) : /* @__PURE__ */ jsx5(OverlayHost2, { manager: assembly.overlayManager }) }) });
|
|
863
876
|
}
|
|
864
|
-
return /* @__PURE__ */ jsx5(I18nContextProvider2, { value: i18n, children: /* @__PURE__ */ jsx5(
|
|
877
|
+
return /* @__PURE__ */ jsx5(I18nContextProvider2, { value: i18n, children: /* @__PURE__ */ jsx5(InteractionProvider2, { bridge: assembly.uiBridge, children: content }) });
|
|
865
878
|
}
|
|
866
879
|
export {
|
|
867
880
|
Application,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pactor-app/app",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
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.
|
|
50
|
-
"@pactor-app/expression": "1.
|
|
51
|
-
"@pactor-app/
|
|
52
|
-
"@pactor-app/
|
|
53
|
-
"@pactor-app/
|
|
54
|
-
"@pactor-app/resource": "1.
|
|
55
|
-
"@pactor-app/
|
|
56
|
-
"@pactor-app/
|
|
49
|
+
"@pactor-app/core": "1.3.0",
|
|
50
|
+
"@pactor-app/expression": "1.3.0",
|
|
51
|
+
"@pactor-app/router": "1.3.0",
|
|
52
|
+
"@pactor-app/permission": "1.3.0",
|
|
53
|
+
"@pactor-app/runtime": "1.3.0",
|
|
54
|
+
"@pactor-app/resource": "1.3.0",
|
|
55
|
+
"@pactor-app/schema": "1.3.0",
|
|
56
|
+
"@pactor-app/ui": "1.3.0"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
59
|
"react": ">=18",
|