@omerdlw/base-framework 1.0.0 → 1.0.2
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/LICENSE +1 -1
- package/README.md +121 -52
- package/dist/atoms/index.d.ts +0 -1
- package/dist/atoms/index.d.ts.map +1 -1
- package/dist/atoms/index.js +1 -64
- package/dist/atoms/index.js.map +1 -1
- package/dist/error/index.js +22 -25
- package/dist/error/index.js.map +1 -1
- package/dist/hooks/index.d.ts +2 -9
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +97 -540
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/types.d.ts +3 -45
- package/dist/hooks/types.d.ts.map +1 -1
- package/dist/hooks/use-controllable-state.d.ts +1 -1
- package/dist/hooks/use-controllable-state.d.ts.map +1 -1
- package/dist/hooks/use-global-event.d.ts +0 -2
- package/dist/hooks/use-global-event.d.ts.map +1 -1
- package/dist/hooks/use-hotkey.d.ts +1 -1
- package/dist/hooks/use-hotkey.d.ts.map +1 -1
- package/dist/index.js +11283 -11772
- package/dist/index.js.map +1 -1
- package/dist/kernel/adapters.d.ts.map +1 -1
- package/dist/kernel/index.d.ts +1 -0
- package/dist/kernel/index.d.ts.map +1 -1
- package/dist/kernel/index.js +10 -81
- package/dist/kernel/index.js.map +1 -1
- package/dist/kernel/installed.d.ts.map +1 -1
- package/dist/kernel/page-controller.d.ts.map +1 -1
- package/dist/kernel/provider.d.ts.map +1 -1
- package/dist/modules/ambient/constants.d.ts +1 -1
- package/dist/modules/ambient/constants.d.ts.map +1 -1
- package/dist/modules/ambient/index.js +180 -326
- package/dist/modules/ambient/index.js.map +1 -1
- package/dist/modules/ambient/module.d.ts.map +1 -1
- package/dist/modules/background/constants.d.ts +4 -2
- package/dist/modules/background/constants.d.ts.map +1 -1
- package/dist/modules/background/context.d.ts +3 -0
- package/dist/modules/background/context.d.ts.map +1 -1
- package/dist/modules/background/hooks.d.ts +1 -1
- package/dist/modules/background/index.d.ts +2 -2
- package/dist/modules/background/index.d.ts.map +1 -1
- package/dist/modules/background/index.js +1172 -1270
- package/dist/modules/background/index.js.map +1 -1
- package/dist/modules/background/overlay.d.ts +1 -1
- package/dist/modules/background/overlay.d.ts.map +1 -1
- package/dist/modules/background/types.d.ts +1 -1
- package/dist/modules/background/types.d.ts.map +1 -1
- package/dist/modules/context-menu/constants.d.ts +1 -1
- package/dist/modules/context-menu/constants.d.ts.map +1 -1
- package/dist/modules/context-menu/context.d.ts.map +1 -1
- package/dist/modules/context-menu/hooks.d.ts.map +1 -1
- package/dist/modules/context-menu/index.js +133 -238
- package/dist/modules/context-menu/index.js.map +1 -1
- package/dist/modules/controls/constants.d.ts +1 -1
- package/dist/modules/controls/constants.d.ts.map +1 -1
- package/dist/modules/controls/hooks.d.ts +1 -1
- package/dist/modules/controls/index.js +28 -162
- package/dist/modules/controls/index.js.map +1 -1
- package/dist/modules/controls/types.d.ts +1 -1
- package/dist/modules/controls/types.d.ts.map +1 -1
- package/dist/modules/dock/cards.d.ts +2 -2
- package/dist/modules/dock/constants.d.ts +1 -1
- package/dist/modules/dock/constants.d.ts.map +1 -1
- package/dist/modules/dock/context.d.ts +10 -6
- package/dist/modules/dock/context.d.ts.map +1 -1
- package/dist/modules/dock/hooks.d.ts +5 -5
- package/dist/modules/dock/hooks.d.ts.map +1 -1
- package/dist/modules/dock/index.d.ts +1 -1
- package/dist/modules/dock/index.d.ts.map +1 -1
- package/dist/modules/dock/index.js +2060 -2080
- package/dist/modules/dock/index.js.map +1 -1
- package/dist/modules/dock/runtime/dock.d.ts.map +1 -1
- package/dist/modules/dock/types.d.ts +1 -1
- package/dist/modules/dock/types.d.ts.map +1 -1
- package/dist/modules/index.js +10789 -11027
- package/dist/modules/index.js.map +1 -1
- package/dist/modules/loading/constants.d.ts +4 -2
- package/dist/modules/loading/constants.d.ts.map +1 -1
- package/dist/modules/loading/context.d.ts +3 -0
- package/dist/modules/loading/context.d.ts.map +1 -1
- package/dist/modules/loading/hooks.d.ts +1 -1
- package/dist/modules/loading/hooks.d.ts.map +1 -1
- package/dist/modules/loading/index.d.ts +2 -2
- package/dist/modules/loading/index.d.ts.map +1 -1
- package/dist/modules/loading/index.js +118 -222
- package/dist/modules/loading/index.js.map +1 -1
- package/dist/modules/loading/types.d.ts +1 -1
- package/dist/modules/loading/types.d.ts.map +1 -1
- package/dist/modules/media/constants.d.ts +2 -1
- package/dist/modules/media/constants.d.ts.map +1 -1
- package/dist/modules/media/context.d.ts +3 -0
- package/dist/modules/media/context.d.ts.map +1 -1
- package/dist/modules/media/index.d.ts +2 -2
- package/dist/modules/media/index.d.ts.map +1 -1
- package/dist/modules/media/index.js +61 -218
- package/dist/modules/media/index.js.map +1 -1
- package/dist/modules/modal/constants.d.ts +1 -1
- package/dist/modules/modal/constants.d.ts.map +1 -1
- package/dist/modules/modal/context.d.ts.map +1 -1
- package/dist/modules/modal/hooks.d.ts +2 -2
- package/dist/modules/modal/index.js +20 -366
- package/dist/modules/modal/index.js.map +1 -1
- package/dist/modules/notification/constants.d.ts +4 -2
- package/dist/modules/notification/constants.d.ts.map +1 -1
- package/dist/modules/notification/context.d.ts +4 -0
- package/dist/modules/notification/context.d.ts.map +1 -1
- package/dist/modules/notification/hooks.d.ts +1 -1
- package/dist/modules/notification/index.d.ts +2 -3
- package/dist/modules/notification/index.d.ts.map +1 -1
- package/dist/modules/notification/index.js +70 -154
- package/dist/modules/notification/index.js.map +1 -1
- package/dist/modules/notification/module.d.ts.map +1 -1
- package/dist/provider.js +255 -257
- package/dist/provider.js.map +1 -1
- package/dist/theme.d.ts +1 -0
- package/dist/theme.d.ts.map +1 -1
- package/dist/theme.js +2 -2
- package/dist/theme.js.map +1 -1
- package/dist/utils/index.d.ts +5 -6
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -57
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/number.d.ts +0 -1
- package/dist/utils/number.d.ts.map +1 -1
- package/dist/utils/object.d.ts +0 -2
- package/dist/utils/object.d.ts.map +1 -1
- package/dist/utils/string.d.ts +0 -3
- package/dist/utils/string.d.ts.map +1 -1
- package/dist/utils/timing.d.ts +0 -1
- package/dist/utils/timing.d.ts.map +1 -1
- package/docs/README.md +124 -0
- package/docs/architecture-and-rules.md +129 -0
- package/docs/core-engine.md +196 -0
- package/docs/custom-modules.md +267 -0
- package/docs/getting-started.md +199 -0
- package/docs/modules/README.md +176 -0
- package/docs/modules/ambient.md +150 -0
- package/docs/modules/background.md +195 -0
- package/docs/modules/context-menu.md +248 -0
- package/docs/modules/controls.md +159 -0
- package/docs/modules/dock.md +734 -0
- package/docs/modules/error-boundary.md +160 -0
- package/docs/modules/kernel.md +266 -0
- package/docs/modules/loading.md +157 -0
- package/docs/modules/media.md +196 -0
- package/docs/modules/modal.md +229 -0
- package/docs/modules/notification.md +161 -0
- package/docs/modules/result.md +135 -0
- package/docs/testing.md +160 -0
- package/docs/theming.md +185 -0
- package/package.json +50 -2
- package/templates/AGENTS.md +165 -0
- package/dist/hooks/use-async-action.d.ts +0 -3
- package/dist/hooks/use-async-action.d.ts.map +0 -1
- package/dist/hooks/use-debounce.d.ts +0 -2
- package/dist/hooks/use-debounce.d.ts.map +0 -1
- package/dist/hooks/use-intersection-observer.d.ts +0 -4
- package/dist/hooks/use-intersection-observer.d.ts.map +0 -1
- package/dist/hooks/use-media-query.d.ts +0 -2
- package/dist/hooks/use-media-query.d.ts.map +0 -1
- package/dist/hooks/use-mounted.d.ts +0 -2
- package/dist/hooks/use-mounted.d.ts.map +0 -1
- package/dist/hooks/use-server-action.d.ts +0 -4
- package/dist/hooks/use-server-action.d.ts.map +0 -1
- package/dist/hooks/use-storage-state.d.ts +0 -5
- package/dist/hooks/use-storage-state.d.ts.map +0 -1
- package/dist/modules/theme.d.ts +0 -3
- package/dist/modules/theme.d.ts.map +0 -1
- package/dist/utils/json.d.ts +0 -3
- package/dist/utils/json.d.ts.map +0 -1
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { type NotificationThemeSlot } from "./types";
|
|
1
|
+
import { type NotificationActions, type NotificationState, type NotificationThemeSlot } from "./types";
|
|
2
2
|
export declare const TOAST_DURATIONS: Readonly<{
|
|
3
3
|
readonly DEFAULT: 2000;
|
|
4
4
|
readonly SHORT: 1500;
|
|
5
5
|
}>;
|
|
6
6
|
export declare const SESSION_EXPIRED_MESSAGE: "Your session has expired. Please sign in again";
|
|
7
7
|
export declare const DOCK_STACK_ELEMENT_ID = "dock-card-stack";
|
|
8
|
-
export declare const notificationTheme: import("
|
|
8
|
+
export declare const notificationTheme: import("@/theme").ThemeSpec<NotificationThemeSlot>;
|
|
9
|
+
export declare const INITIAL_NOTIFICATION_STATE: NotificationState;
|
|
10
|
+
export declare const INERT_NOTIFICATION_ACTIONS: NotificationActions;
|
|
9
11
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/modules/notification/constants.ts"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/modules/notification/constants.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC3B,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,eAAe;;;EAGjB,CAAC;AAEZ,eAAO,MAAM,uBAAuB,kDAA6B,CAAC;AAElE,eAAO,MAAM,qBAAqB,oBAAoB,CAAC;AAEvD,eAAO,MAAM,iBAAiB,oDAC0B,CAAC;AAEzD,eAAO,MAAM,0BAA0B,EAAE,iBAEvC,CAAC;AAEH,eAAO,MAAM,0BAA0B,EAAE,mBAIvC,CAAC"}
|
|
@@ -4,4 +4,8 @@ export declare const NotificationProvider: ({ children, }: NotificationProviderP
|
|
|
4
4
|
export declare function useNotificationActions(): NotificationActions;
|
|
5
5
|
export declare function useNotificationState(): NotificationState;
|
|
6
6
|
export declare function useNotification(): NotificationState & NotificationActions;
|
|
7
|
+
export declare function useOptionalNotificationState(): NotificationState;
|
|
8
|
+
export declare function useOptionalNotificationState<T>(selector: (state: NotificationState) => T, isEqual?: (a: T, b: T) => boolean): T;
|
|
9
|
+
export declare function useOptionalNotificationActions(): NotificationActions;
|
|
10
|
+
export declare function useNotificationVisible(): boolean;
|
|
7
11
|
//# sourceMappingURL=context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/modules/notification/context.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/modules/notification/context.tsx"],"names":[],"mappings":"AAoBA,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAG7B,KAAK,yBAAyB,EAC9B,KAAK,iBAAiB,EAEvB,MAAM,SAAS,CAAC;AAOjB,eAAO,MAAM,mBAAmB,0DAK7B,CAAC;AAWJ,eAAO,MAAM,oBAAoB,GAAI,eAElC,yBAAyB,gCA2G3B,CAAC;AAEF,wBAAgB,sBAAsB,IAAI,mBAAmB,CAM5D;AAED,wBAAgB,oBAAoB,IAAI,iBAAiB,CAOxD;AAED,wBAAgB,eAAe,IAAI,iBAAiB,GAAG,mBAAmB,CAIzE;AAMD,wBAAgB,4BAA4B,IAAI,iBAAiB,CAAC;AAClE,wBAAgB,4BAA4B,CAAC,CAAC,EAC5C,QAAQ,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,CAAC,EACzC,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,OAAO,GAChC,CAAC,CAAC;AAaL,wBAAgB,8BAA8B,IAAI,mBAAmB,CAGpE;AAED,wBAAgB,sBAAsB,IAAI,OAAO,CAIhD"}
|
|
@@ -5,6 +5,6 @@ export declare function useNotificationContainerModel(): {
|
|
|
5
5
|
dismissNotification: (id: string) => void;
|
|
6
6
|
isHydrated: boolean;
|
|
7
7
|
activeEntry: import("./types").NotificationEntry | null;
|
|
8
|
-
theme: import("
|
|
8
|
+
theme: import("@/theme").ResolvedTheme<import("./types").NotificationThemeSlot>;
|
|
9
9
|
};
|
|
10
10
|
//# sourceMappingURL=hooks.d.ts.map
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
export { TOAST_DURATIONS } from "./constants";
|
|
2
|
-
export { NotificationContext, NotificationProvider, useNotification, useNotificationActions, useNotificationState, } from "./context";
|
|
1
|
+
export { DOCK_STACK_ELEMENT_ID, INITIAL_NOTIFICATION_STATE, INERT_NOTIFICATION_ACTIONS, SESSION_EXPIRED_MESSAGE, TOAST_DURATIONS, notificationTheme, } from "./constants";
|
|
2
|
+
export { NotificationContext, NotificationProvider, useNotification, useNotificationActions, useNotificationState, useNotificationVisible, useOptionalNotificationActions, useOptionalNotificationState, } from "./context";
|
|
3
3
|
export { useToast } from "./hooks";
|
|
4
4
|
export { notificationModule } from "./module";
|
|
5
|
-
export { notificationTheme } from "./constants";
|
|
6
5
|
export * from "./types";
|
|
7
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/notification/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/notification/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,0BAA0B,EAC1B,0BAA0B,EAC1B,uBAAuB,EACvB,eAAe,EACf,iBAAiB,GAClB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,eAAe,EACf,sBAAsB,EACtB,oBAAoB,EACpB,sBAAsB,EACtB,8BAA8B,EAC9B,4BAA4B,GAC7B,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC9C,cAAc,SAAS,CAAC"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { clsx } from 'clsx';
|
|
3
3
|
import { twMerge } from 'tailwind-merge';
|
|
4
|
-
import { createContext, useState, useRef, useCallback, useEffect, useMemo, use, useSyncExternalStore, useLayoutEffect
|
|
4
|
+
import { createContext, useState, useRef, useCallback, useEffect, useMemo, useContext, use, useSyncExternalStore, useLayoutEffect } from 'react';
|
|
5
5
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
6
|
-
import 'next/navigation';
|
|
7
6
|
import { createPortal } from 'react-dom';
|
|
8
7
|
import { AnimatePresence, motion } from 'motion/react';
|
|
9
8
|
|
|
@@ -154,34 +153,6 @@ function getOrCreateGlobalContext(name, defaultValue) {
|
|
|
154
153
|
}
|
|
155
154
|
return store[sym];
|
|
156
155
|
}
|
|
157
|
-
|
|
158
|
-
// src/theme.tsx
|
|
159
|
-
function defineThemeSpec(id) {
|
|
160
|
-
return Object.freeze({ id });
|
|
161
|
-
}
|
|
162
|
-
var EMPTY = /* @__PURE__ */ new Map();
|
|
163
|
-
var ThemeContext = getOrCreateGlobalContext("ThemeContext", EMPTY);
|
|
164
|
-
function useTheme(spec) {
|
|
165
|
-
const config = useContext(ThemeContext).get(spec.id);
|
|
166
|
-
if (!config) {
|
|
167
|
-
throw new Error(
|
|
168
|
-
`Theme "${spec.id}" is missing. Add its theme file to src/config/ and list it in src/config/index.ts.`
|
|
169
|
-
);
|
|
170
|
-
}
|
|
171
|
-
return {
|
|
172
|
-
slots: config.slots,
|
|
173
|
-
styles: config.styles ?? {}
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
// src/modules/notification/constants.ts
|
|
178
|
-
var TOAST_DURATIONS = Object.freeze({
|
|
179
|
-
DEFAULT: 2e3,
|
|
180
|
-
SHORT: 1500
|
|
181
|
-
});
|
|
182
|
-
var SESSION_EXPIRED_MESSAGE = USER_MESSAGES.unauthorized;
|
|
183
|
-
var DOCK_STACK_ELEMENT_ID = "dock-card-stack";
|
|
184
|
-
var notificationTheme = defineThemeSpec("notification");
|
|
185
156
|
function useRequiredContext(context, hookName, providerName) {
|
|
186
157
|
const value = use(context);
|
|
187
158
|
if (value === null) {
|
|
@@ -333,12 +304,49 @@ function useGlobalEvent(event, callback, options) {
|
|
|
333
304
|
};
|
|
334
305
|
}, [event, debounceMs, throttleMs]);
|
|
335
306
|
}
|
|
307
|
+
function defineModule(coreModule) {
|
|
308
|
+
return Object.freeze({ ...coreModule });
|
|
309
|
+
}
|
|
310
|
+
createStore(void 0);
|
|
336
311
|
|
|
337
|
-
// src/
|
|
338
|
-
function
|
|
339
|
-
return
|
|
312
|
+
// src/theme.tsx
|
|
313
|
+
function defineThemeSpec(id) {
|
|
314
|
+
return Object.freeze({ id });
|
|
315
|
+
}
|
|
316
|
+
var EMPTY = /* @__PURE__ */ new Map();
|
|
317
|
+
var ThemeContext = getOrCreateGlobalContext("ThemeContext", EMPTY);
|
|
318
|
+
function useTheme(spec) {
|
|
319
|
+
const config = useContext(ThemeContext).get(spec.id);
|
|
320
|
+
if (!config) {
|
|
321
|
+
throw new Error(
|
|
322
|
+
`Theme "${spec.id}" is missing. Ensure its theme configuration is provided to <ThemeProvider themes={[...]}> (e.g. in src/config/ or your theme setup).`
|
|
323
|
+
);
|
|
324
|
+
}
|
|
325
|
+
return {
|
|
326
|
+
slots: config.slots,
|
|
327
|
+
styles: config.styles ?? {}
|
|
328
|
+
};
|
|
340
329
|
}
|
|
341
330
|
|
|
331
|
+
// src/modules/notification/constants.ts
|
|
332
|
+
var TOAST_DURATIONS = Object.freeze({
|
|
333
|
+
DEFAULT: 2e3,
|
|
334
|
+
SHORT: 1500
|
|
335
|
+
});
|
|
336
|
+
var SESSION_EXPIRED_MESSAGE = USER_MESSAGES.unauthorized;
|
|
337
|
+
var DOCK_STACK_ELEMENT_ID = "dock-card-stack";
|
|
338
|
+
var notificationTheme = defineThemeSpec("notification");
|
|
339
|
+
var INITIAL_NOTIFICATION_STATE = Object.freeze({
|
|
340
|
+
notifications: {}
|
|
341
|
+
});
|
|
342
|
+
var INERT_NOTIFICATION_ACTIONS = Object.freeze({
|
|
343
|
+
dismissAllNotifications: () => {
|
|
344
|
+
},
|
|
345
|
+
dismissNotification: () => {
|
|
346
|
+
},
|
|
347
|
+
showNotification: () => null
|
|
348
|
+
});
|
|
349
|
+
|
|
342
350
|
// src/modules/notification/utils.ts
|
|
343
351
|
function normalizeFeedbackText(value) {
|
|
344
352
|
if (typeof value !== "string") return value;
|
|
@@ -369,7 +377,6 @@ var NotificationContext = getOrCreateGlobalContext(
|
|
|
369
377
|
null
|
|
370
378
|
);
|
|
371
379
|
var notificationIdCounter = 0;
|
|
372
|
-
var INITIAL_NOTIFICATION_STATE = { notifications: {} };
|
|
373
380
|
function normalizeDuration(value) {
|
|
374
381
|
if (value === null) return null;
|
|
375
382
|
if (value === void 0) return TOAST_DURATIONS.DEFAULT;
|
|
@@ -474,6 +481,33 @@ function useNotification() {
|
|
|
474
481
|
const state = useNotificationState();
|
|
475
482
|
return useMemo(() => ({ ...actions, ...state }), [actions, state]);
|
|
476
483
|
}
|
|
484
|
+
var NOOP_NOTIFICATION_STORE = createStore(
|
|
485
|
+
INITIAL_NOTIFICATION_STATE
|
|
486
|
+
);
|
|
487
|
+
function useOptionalNotificationState(selector, isEqual) {
|
|
488
|
+
const ctx = useContext(NotificationContext);
|
|
489
|
+
return useStore(
|
|
490
|
+
ctx?.store ?? NOOP_NOTIFICATION_STORE,
|
|
491
|
+
selector,
|
|
492
|
+
isEqual
|
|
493
|
+
);
|
|
494
|
+
}
|
|
495
|
+
function useOptionalNotificationActions() {
|
|
496
|
+
const ctx = useContext(NotificationContext);
|
|
497
|
+
return ctx?.actions ?? INERT_NOTIFICATION_ACTIONS;
|
|
498
|
+
}
|
|
499
|
+
function useNotificationVisible() {
|
|
500
|
+
return useOptionalNotificationState(
|
|
501
|
+
({ notifications }) => Object.keys(notifications).length > 0
|
|
502
|
+
);
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
// src/result.ts
|
|
506
|
+
function isResult(value) {
|
|
507
|
+
return typeof value === "object" && value !== null && "success" in value && typeof value.success === "boolean" && ("data" in value && value.success === true || "error" in value && value.success === false);
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
// src/modules/notification/hooks.ts
|
|
477
511
|
var toastPromiseIdCounter = 0;
|
|
478
512
|
function resolveMessage(message, arg) {
|
|
479
513
|
return typeof message === "function" ? message(arg) : message;
|
|
@@ -584,124 +618,6 @@ function useNotificationContainerModel() {
|
|
|
584
618
|
return { dismissNotification, isHydrated, activeEntry, theme };
|
|
585
619
|
}
|
|
586
620
|
|
|
587
|
-
// src/kernel/constants.ts
|
|
588
|
-
var REGISTRY_SOURCES = Object.freeze({
|
|
589
|
-
STATIC: "static",
|
|
590
|
-
DYNAMIC: "dynamic",
|
|
591
|
-
USER: "user"
|
|
592
|
-
});
|
|
593
|
-
var REGISTRY_LIFECYCLES = Object.freeze({
|
|
594
|
-
IMMEDIATE: "immediate",
|
|
595
|
-
GRACEFUL: "graceful",
|
|
596
|
-
PERSISTENT: "persistent",
|
|
597
|
-
ROUTE: "route"
|
|
598
|
-
});
|
|
599
|
-
var REGISTRY_METADATA_KEYS = Object.freeze([
|
|
600
|
-
"cleanup",
|
|
601
|
-
"cleanupDelayMs",
|
|
602
|
-
"instanceId",
|
|
603
|
-
"lifecycle",
|
|
604
|
-
"priority",
|
|
605
|
-
"source",
|
|
606
|
-
"scope",
|
|
607
|
-
"validation"
|
|
608
|
-
]);
|
|
609
|
-
Object.freeze({
|
|
610
|
-
[REGISTRY_SOURCES.STATIC]: 100,
|
|
611
|
-
[REGISTRY_SOURCES.DYNAMIC]: 200,
|
|
612
|
-
[REGISTRY_SOURCES.USER]: 300
|
|
613
|
-
});
|
|
614
|
-
Object.freeze({
|
|
615
|
-
[REGISTRY_SOURCES.STATIC]: 10,
|
|
616
|
-
[REGISTRY_SOURCES.DYNAMIC]: 20,
|
|
617
|
-
[REGISTRY_SOURCES.USER]: 30
|
|
618
|
-
});
|
|
619
|
-
new Set(
|
|
620
|
-
Object.values(REGISTRY_LIFECYCLES)
|
|
621
|
-
);
|
|
622
|
-
new Set(
|
|
623
|
-
REGISTRY_METADATA_KEYS
|
|
624
|
-
);
|
|
625
|
-
var REGISTRY_SCOPE_KINDS = Object.freeze({
|
|
626
|
-
APP: "app",
|
|
627
|
-
SESSION: "session",
|
|
628
|
-
ROUTE: "route",
|
|
629
|
-
INSTANCE: "instance",
|
|
630
|
-
WORKSPACE: "workspace"
|
|
631
|
-
});
|
|
632
|
-
REGISTRY_SCOPE_KINDS.APP;
|
|
633
|
-
function createNoopHandle(status = "rejected", reason = "unknown") {
|
|
634
|
-
const handle = Object.assign(() => false, {
|
|
635
|
-
active: false,
|
|
636
|
-
dispose: () => false,
|
|
637
|
-
instanceId: null,
|
|
638
|
-
key: "",
|
|
639
|
-
priority: 0,
|
|
640
|
-
reason,
|
|
641
|
-
source: "",
|
|
642
|
-
status,
|
|
643
|
-
type: "",
|
|
644
|
-
update: () => handle,
|
|
645
|
-
updatedAt: 0,
|
|
646
|
-
validation: "warn"
|
|
647
|
-
});
|
|
648
|
-
return handle;
|
|
649
|
-
}
|
|
650
|
-
createNoopHandle();
|
|
651
|
-
getOrCreateGlobalContext(
|
|
652
|
-
"RegistryContext",
|
|
653
|
-
null
|
|
654
|
-
);
|
|
655
|
-
getOrCreateGlobalContext("ModuleHostContext", null);
|
|
656
|
-
function createPageControllerStore() {
|
|
657
|
-
const listeners = /* @__PURE__ */ new Set();
|
|
658
|
-
let stack = [];
|
|
659
|
-
const notify = () => {
|
|
660
|
-
listeners.forEach((listener) => {
|
|
661
|
-
try {
|
|
662
|
-
listener();
|
|
663
|
-
} catch (error) {
|
|
664
|
-
report("Page controller listener", error);
|
|
665
|
-
}
|
|
666
|
-
});
|
|
667
|
-
};
|
|
668
|
-
return {
|
|
669
|
-
getSnapshot() {
|
|
670
|
-
const top = stack[stack.length - 1];
|
|
671
|
-
return top?.controllerRef?.current || null;
|
|
672
|
-
},
|
|
673
|
-
notify,
|
|
674
|
-
register(id, controllerRef) {
|
|
675
|
-
stack = stack.filter((item) => item.id !== id);
|
|
676
|
-
stack.push({ controllerRef, id });
|
|
677
|
-
notify();
|
|
678
|
-
},
|
|
679
|
-
subscribe(listener) {
|
|
680
|
-
listeners.add(listener);
|
|
681
|
-
return () => {
|
|
682
|
-
listeners.delete(listener);
|
|
683
|
-
};
|
|
684
|
-
},
|
|
685
|
-
unregister(id) {
|
|
686
|
-
stack = stack.filter((item) => item.id !== id);
|
|
687
|
-
notify();
|
|
688
|
-
}
|
|
689
|
-
};
|
|
690
|
-
}
|
|
691
|
-
var fallbackStandaloneStore = createPageControllerStore();
|
|
692
|
-
getOrCreateGlobalContext(
|
|
693
|
-
"PageControllerContext",
|
|
694
|
-
null
|
|
695
|
-
);
|
|
696
|
-
getOrCreateGlobalContext(
|
|
697
|
-
"PageControllerStoreContext",
|
|
698
|
-
fallbackStandaloneStore
|
|
699
|
-
);
|
|
700
|
-
function defineModule(coreModule) {
|
|
701
|
-
return Object.freeze({ ...coreModule });
|
|
702
|
-
}
|
|
703
|
-
createStore(void 0);
|
|
704
|
-
|
|
705
621
|
// src/tokens/motion.ts
|
|
706
622
|
var DURATION_TOKENS = Object.freeze({
|
|
707
623
|
INSTANT: 0.08,
|
|
@@ -873,7 +789,7 @@ function NotificationLayer() {
|
|
|
873
789
|
] });
|
|
874
790
|
}
|
|
875
791
|
|
|
876
|
-
// src/modules/notification/module.
|
|
792
|
+
// src/modules/notification/module.tsx
|
|
877
793
|
function selectToastDuration(config) {
|
|
878
794
|
const notification = config.notification;
|
|
879
795
|
if (typeof notification === "number") return notification;
|
|
@@ -900,6 +816,6 @@ var notificationModule = defineModule({
|
|
|
900
816
|
}
|
|
901
817
|
});
|
|
902
818
|
|
|
903
|
-
export { NotificationContext, NotificationProvider, TOAST_DURATIONS, notificationModule, notificationTheme, useNotification, useNotificationActions, useNotificationState, useToast };
|
|
819
|
+
export { DOCK_STACK_ELEMENT_ID, INERT_NOTIFICATION_ACTIONS, INITIAL_NOTIFICATION_STATE, NotificationContext, NotificationProvider, SESSION_EXPIRED_MESSAGE, TOAST_DURATIONS, notificationModule, notificationTheme, useNotification, useNotificationActions, useNotificationState, useNotificationVisible, useOptionalNotificationActions, useOptionalNotificationState, useToast };
|
|
904
820
|
//# sourceMappingURL=index.js.map
|
|
905
821
|
//# sourceMappingURL=index.js.map
|