@uxland/primary-shell 7.46.3 → 7.46.5
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/{component-Cubb3jxz.js → component-k6kJh8kr.js} +2 -2
- package/dist/{component-Cubb3jxz.js.map → component-k6kJh8kr.js.map} +1 -1
- package/dist/{index-DtHjM8k5.js → index-s-pcmNUD.js} +14922 -22485
- package/dist/index-s-pcmNUD.js.map +1 -0
- package/dist/index.js +9 -9
- package/dist/index.umd.cjs +964 -964
- package/dist/index.umd.cjs.map +1 -1
- package/dist/plugin-B_mTXVZ2.js +7591 -0
- package/dist/plugin-B_mTXVZ2.js.map +1 -0
- package/dist/primary/shell/src/api/interaction-service/interaction-service-impl.d.ts +1 -0
- package/package.json +1 -1
- package/src/api/interaction-service/interaction-service-impl.tsx +22 -5
- package/src/handle-plugins.ts +5 -9
- package/dist/index-DtHjM8k5.js.map +0 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ConfirmationOptions, ConfirmationResult, ConfirmComponentUI, PrimariaInteractionService } from './interaction-service';
|
|
2
2
|
export declare class ParimariaInteractionServiceImpl extends PrimariaInteractionService {
|
|
3
|
+
private readonly openDialogCancellers;
|
|
3
4
|
confirm<TData = undefined, TResult = undefined>(data: TData | undefined, componentUI: ConfirmComponentUI<TData, TResult>, options?: ConfirmationOptions | undefined): Promise<ConfirmationResult<TResult | undefined>>;
|
|
4
5
|
confirmMessage(message: string, options?: ConfirmationOptions | undefined): Promise<ConfirmationResult>;
|
|
5
6
|
dispose(): void;
|
package/package.json
CHANGED
|
@@ -23,13 +23,17 @@ const defaultOptions: ConfirmationOptions = {
|
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
export class ParimariaInteractionServiceImpl extends PrimariaInteractionService {
|
|
26
|
+
private readonly openDialogCancellers = new Set<() => void>();
|
|
27
|
+
|
|
26
28
|
confirm<TData = undefined, TResult = undefined>(
|
|
27
29
|
data: TData | undefined,
|
|
28
30
|
componentUI: ConfirmComponentUI<TData, TResult>,
|
|
29
31
|
options?: ConfirmationOptions | undefined
|
|
30
32
|
): Promise<ConfirmationResult<TResult | undefined>> {
|
|
31
33
|
const finalOptions: ConfirmationOptions = { ...defaultOptions, ...(options || {}) };
|
|
34
|
+
const { openDialogCancellers } = this;
|
|
32
35
|
return new Promise((resolve) => {
|
|
36
|
+
let isClosing = false;
|
|
33
37
|
const div = document.createElement("div");
|
|
34
38
|
document.body.appendChild(div);
|
|
35
39
|
const wrapperHeadStyles = document.createElement("style");
|
|
@@ -56,6 +60,18 @@ export class ParimariaInteractionServiceImpl extends PrimariaInteractionService
|
|
|
56
60
|
|
|
57
61
|
useEffect(() => {
|
|
58
62
|
window.addEventListener('keydown', handleKeydown);
|
|
63
|
+
|
|
64
|
+
return () => window.removeEventListener('keydown', handleKeydown);
|
|
65
|
+
}, []);
|
|
66
|
+
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
const cancelDialog = () => handleClose(false);
|
|
69
|
+
|
|
70
|
+
openDialogCancellers.add(cancelDialog);
|
|
71
|
+
|
|
72
|
+
return () => {
|
|
73
|
+
openDialogCancellers.delete(cancelDialog);
|
|
74
|
+
};
|
|
59
75
|
}, []);
|
|
60
76
|
|
|
61
77
|
const handleKeydown = (event: KeyboardEvent) => {
|
|
@@ -104,17 +120,20 @@ export class ParimariaInteractionServiceImpl extends PrimariaInteractionService
|
|
|
104
120
|
};
|
|
105
121
|
|
|
106
122
|
const resolvePromise = (finalResult: TResult, confirmed: boolean) => {
|
|
123
|
+
if (isClosing) return;
|
|
124
|
+
|
|
125
|
+
isClosing = true;
|
|
107
126
|
setTimeout(() => {
|
|
108
127
|
const confirmationResult = {
|
|
109
128
|
result: confirmed ? finalResult : undefined,
|
|
110
129
|
confirmed: confirmed,
|
|
111
130
|
};
|
|
112
131
|
resolve(confirmationResult);
|
|
132
|
+
root.unmount();
|
|
113
133
|
document.body.removeChild(div);
|
|
114
134
|
document.head.removeChild(wrapperHeadStyles);
|
|
115
135
|
if (DialogComponentStyles)
|
|
116
136
|
document.head.removeChild(componentHeadStyles);
|
|
117
|
-
window.removeEventListener('keydown', handleKeydown);
|
|
118
137
|
}, 300);
|
|
119
138
|
};
|
|
120
139
|
|
|
@@ -233,10 +252,8 @@ export class ParimariaInteractionServiceImpl extends PrimariaInteractionService
|
|
|
233
252
|
}
|
|
234
253
|
|
|
235
254
|
dispose(): void {
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
for (const modal of modals) {
|
|
239
|
-
modal.remove();
|
|
255
|
+
for (const cancelDialog of [...this.openDialogCancellers]) {
|
|
256
|
+
cancelDialog();
|
|
240
257
|
}
|
|
241
258
|
}
|
|
242
259
|
}
|
package/src/handle-plugins.ts
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import type { BootstrappedPlugin, PluginDefinition, Plugin as PluginType } from "@uxland/harmonix";
|
|
2
2
|
import { bootstrapPlugins as pluginBootstrapper } from "@uxland/harmonix";
|
|
3
|
-
import {
|
|
4
|
-
dispose as activityHistoryDispose,
|
|
5
|
-
initialize as activityHistoryInitialize,
|
|
6
|
-
} from "../../../plugins/activity-history/src/plugin";
|
|
7
3
|
import { PrimariaApi, primariaApiFactory } from "./api/api";
|
|
8
4
|
export type { PluginDefinition, PluginInfo } from "@uxland/harmonix";
|
|
9
5
|
|
|
@@ -29,13 +25,13 @@ const CORE_FIRST_ID = "activity-history";
|
|
|
29
25
|
// from the plugin store (versioned/uploadable) like any other plugin; this
|
|
30
26
|
// bundled copy is the fallback used when the caller does not provide it — e.g.
|
|
31
27
|
// third-party sandboxes that install primary-shell without a plugin store.
|
|
28
|
+
//
|
|
29
|
+
// The import stays inside the importer on purpose: importing it statically would
|
|
30
|
+
// evaluate the plugin's modules on shell load and register its custom elements,
|
|
31
|
+
// so the copy coming from the store would fail to define them again.
|
|
32
32
|
const bundledActivityHistory: PluginDefinition = {
|
|
33
33
|
pluginId: CORE_FIRST_ID,
|
|
34
|
-
importer: () =>
|
|
35
|
-
Promise.resolve({
|
|
36
|
-
initialize: activityHistoryInitialize,
|
|
37
|
-
dispose: activityHistoryDispose,
|
|
38
|
-
}),
|
|
34
|
+
importer: () => import("../../../plugins/activity-history/src/plugin"),
|
|
39
35
|
};
|
|
40
36
|
|
|
41
37
|
export const bootstrapPlugins = async (plugins: PluginDefinition[], startup?: PrimariaStartupPlugin) => {
|