@aerogel/core 0.0.0-next.97312fd206b83ac5ae520da32b1bb3f12fb55969 → 0.0.0-next.9a02fcd3bcf698211dd7a71d4c48257c96dd7832
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/aerogel-core.cjs.js +1 -1
- package/dist/aerogel-core.cjs.js.map +1 -1
- package/dist/aerogel-core.d.ts +84 -18
- package/dist/aerogel-core.esm.js +1 -1
- package/dist/aerogel-core.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/bootstrap/index.ts +5 -4
- package/src/components/headless/forms/AGHeadlessButton.vue +8 -8
- package/src/components/headless/forms/AGHeadlessInputInput.vue +2 -0
- package/src/components/lib/AGErrorMessage.vue +2 -2
- package/src/errors/Errors.ts +15 -18
- package/src/errors/index.ts +1 -10
- package/src/errors/utils.ts +19 -0
- package/src/jobs/Job.ts +5 -0
- package/src/jobs/index.ts +7 -0
- package/src/lang/Lang.ts +11 -23
- package/src/main.ts +2 -0
- package/src/services/App.state.ts +1 -1
- package/src/services/App.ts +7 -1
- package/src/services/Events.test.ts +39 -0
- package/src/services/Events.ts +100 -30
- package/src/services/Service.ts +29 -5
- package/src/services/index.ts +1 -0
- package/src/services/store.ts +8 -5
- package/src/testing/index.ts +25 -0
- package/src/ui/UI.ts +6 -4
package/src/services/store.ts
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
|
+
import { tap } from '@noeldemartin/utils';
|
|
1
2
|
import { createPinia, defineStore, setActivePinia } from 'pinia';
|
|
2
3
|
import type { DefineStoreOptions, Pinia, StateTree, Store, _GettersTree } from 'pinia';
|
|
3
4
|
|
|
4
5
|
let _store: Pinia | null = null;
|
|
5
6
|
|
|
6
7
|
function initializePiniaStore(): Pinia {
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
return _store ?? resetPiniaStore();
|
|
9
|
+
}
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
export function resetPiniaStore(): Pinia {
|
|
12
|
+
return tap(createPinia(), (store) => {
|
|
13
|
+
_store = store;
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
setActivePinia(store);
|
|
16
|
+
});
|
|
14
17
|
}
|
|
15
18
|
|
|
16
19
|
export function getPiniaStore(): Pinia {
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { GetClosureArgs } from '@noeldemartin/utils';
|
|
2
|
+
|
|
3
|
+
import Events from '@/services/Events';
|
|
4
|
+
import { definePlugin } from '@/plugins';
|
|
5
|
+
|
|
6
|
+
export interface AerogelTestingRuntime {
|
|
7
|
+
on: (typeof Events)['on'];
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export default definePlugin({
|
|
11
|
+
async install() {
|
|
12
|
+
if (import.meta.env.MODE !== 'testing') {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
globalThis.testingRuntime = {
|
|
17
|
+
on: ((...args: GetClosureArgs<(typeof Events)['on']>) => Events.on(...args)) as (typeof Events)['on'],
|
|
18
|
+
};
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
declare global {
|
|
23
|
+
// eslint-disable-next-line no-var
|
|
24
|
+
var testingRuntime: AerogelTestingRuntime | undefined;
|
|
25
|
+
}
|
package/src/ui/UI.ts
CHANGED
|
@@ -167,7 +167,7 @@ export class UIService extends Service {
|
|
|
167
167
|
const snackbar: Snackbar = {
|
|
168
168
|
id: uuid(),
|
|
169
169
|
properties: { message, ...options },
|
|
170
|
-
component: options.component ??
|
|
170
|
+
component: markRaw(options.component ?? this.requireComponent(UIComponents.Snackbar)),
|
|
171
171
|
};
|
|
172
172
|
|
|
173
173
|
this.setState('snackbars', this.snackbars.concat(snackbar));
|
|
@@ -270,14 +270,16 @@ export class UIService extends Service {
|
|
|
270
270
|
|
|
271
271
|
}
|
|
272
272
|
|
|
273
|
-
export default facade(
|
|
273
|
+
export default facade(UIService);
|
|
274
274
|
|
|
275
275
|
declare module '@/services/Events' {
|
|
276
276
|
export interface EventsPayload {
|
|
277
|
-
'modal-will-close': { modal: Modal; result?: unknown };
|
|
278
|
-
'modal-closed': { modal: Modal; result?: unknown };
|
|
279
277
|
'close-modal': { id: string; result?: unknown };
|
|
280
278
|
'hide-modal': { id: string };
|
|
279
|
+
'hide-overlays-backdrop': void;
|
|
280
|
+
'modal-closed': { modal: Modal; result?: unknown };
|
|
281
|
+
'modal-will-close': { modal: Modal; result?: unknown };
|
|
281
282
|
'show-modal': { id: string };
|
|
283
|
+
'show-overlays-backdrop': void;
|
|
282
284
|
}
|
|
283
285
|
}
|