@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.
Files changed (171) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +121 -52
  3. package/dist/atoms/index.d.ts +0 -1
  4. package/dist/atoms/index.d.ts.map +1 -1
  5. package/dist/atoms/index.js +1 -64
  6. package/dist/atoms/index.js.map +1 -1
  7. package/dist/error/index.js +22 -25
  8. package/dist/error/index.js.map +1 -1
  9. package/dist/hooks/index.d.ts +2 -9
  10. package/dist/hooks/index.d.ts.map +1 -1
  11. package/dist/hooks/index.js +97 -540
  12. package/dist/hooks/index.js.map +1 -1
  13. package/dist/hooks/types.d.ts +3 -45
  14. package/dist/hooks/types.d.ts.map +1 -1
  15. package/dist/hooks/use-controllable-state.d.ts +1 -1
  16. package/dist/hooks/use-controllable-state.d.ts.map +1 -1
  17. package/dist/hooks/use-global-event.d.ts +0 -2
  18. package/dist/hooks/use-global-event.d.ts.map +1 -1
  19. package/dist/hooks/use-hotkey.d.ts +1 -1
  20. package/dist/hooks/use-hotkey.d.ts.map +1 -1
  21. package/dist/index.js +11283 -11772
  22. package/dist/index.js.map +1 -1
  23. package/dist/kernel/adapters.d.ts.map +1 -1
  24. package/dist/kernel/index.d.ts +1 -0
  25. package/dist/kernel/index.d.ts.map +1 -1
  26. package/dist/kernel/index.js +10 -81
  27. package/dist/kernel/index.js.map +1 -1
  28. package/dist/kernel/installed.d.ts.map +1 -1
  29. package/dist/kernel/page-controller.d.ts.map +1 -1
  30. package/dist/kernel/provider.d.ts.map +1 -1
  31. package/dist/modules/ambient/constants.d.ts +1 -1
  32. package/dist/modules/ambient/constants.d.ts.map +1 -1
  33. package/dist/modules/ambient/index.js +180 -326
  34. package/dist/modules/ambient/index.js.map +1 -1
  35. package/dist/modules/ambient/module.d.ts.map +1 -1
  36. package/dist/modules/background/constants.d.ts +4 -2
  37. package/dist/modules/background/constants.d.ts.map +1 -1
  38. package/dist/modules/background/context.d.ts +3 -0
  39. package/dist/modules/background/context.d.ts.map +1 -1
  40. package/dist/modules/background/hooks.d.ts +1 -1
  41. package/dist/modules/background/index.d.ts +2 -2
  42. package/dist/modules/background/index.d.ts.map +1 -1
  43. package/dist/modules/background/index.js +1172 -1270
  44. package/dist/modules/background/index.js.map +1 -1
  45. package/dist/modules/background/overlay.d.ts +1 -1
  46. package/dist/modules/background/overlay.d.ts.map +1 -1
  47. package/dist/modules/background/types.d.ts +1 -1
  48. package/dist/modules/background/types.d.ts.map +1 -1
  49. package/dist/modules/context-menu/constants.d.ts +1 -1
  50. package/dist/modules/context-menu/constants.d.ts.map +1 -1
  51. package/dist/modules/context-menu/context.d.ts.map +1 -1
  52. package/dist/modules/context-menu/hooks.d.ts.map +1 -1
  53. package/dist/modules/context-menu/index.js +133 -238
  54. package/dist/modules/context-menu/index.js.map +1 -1
  55. package/dist/modules/controls/constants.d.ts +1 -1
  56. package/dist/modules/controls/constants.d.ts.map +1 -1
  57. package/dist/modules/controls/hooks.d.ts +1 -1
  58. package/dist/modules/controls/index.js +28 -162
  59. package/dist/modules/controls/index.js.map +1 -1
  60. package/dist/modules/controls/types.d.ts +1 -1
  61. package/dist/modules/controls/types.d.ts.map +1 -1
  62. package/dist/modules/dock/cards.d.ts +2 -2
  63. package/dist/modules/dock/constants.d.ts +1 -1
  64. package/dist/modules/dock/constants.d.ts.map +1 -1
  65. package/dist/modules/dock/context.d.ts +10 -6
  66. package/dist/modules/dock/context.d.ts.map +1 -1
  67. package/dist/modules/dock/hooks.d.ts +5 -5
  68. package/dist/modules/dock/hooks.d.ts.map +1 -1
  69. package/dist/modules/dock/index.d.ts +1 -1
  70. package/dist/modules/dock/index.d.ts.map +1 -1
  71. package/dist/modules/dock/index.js +2060 -2080
  72. package/dist/modules/dock/index.js.map +1 -1
  73. package/dist/modules/dock/runtime/dock.d.ts.map +1 -1
  74. package/dist/modules/dock/types.d.ts +1 -1
  75. package/dist/modules/dock/types.d.ts.map +1 -1
  76. package/dist/modules/index.js +10789 -11027
  77. package/dist/modules/index.js.map +1 -1
  78. package/dist/modules/loading/constants.d.ts +4 -2
  79. package/dist/modules/loading/constants.d.ts.map +1 -1
  80. package/dist/modules/loading/context.d.ts +3 -0
  81. package/dist/modules/loading/context.d.ts.map +1 -1
  82. package/dist/modules/loading/hooks.d.ts +1 -1
  83. package/dist/modules/loading/hooks.d.ts.map +1 -1
  84. package/dist/modules/loading/index.d.ts +2 -2
  85. package/dist/modules/loading/index.d.ts.map +1 -1
  86. package/dist/modules/loading/index.js +118 -222
  87. package/dist/modules/loading/index.js.map +1 -1
  88. package/dist/modules/loading/types.d.ts +1 -1
  89. package/dist/modules/loading/types.d.ts.map +1 -1
  90. package/dist/modules/media/constants.d.ts +2 -1
  91. package/dist/modules/media/constants.d.ts.map +1 -1
  92. package/dist/modules/media/context.d.ts +3 -0
  93. package/dist/modules/media/context.d.ts.map +1 -1
  94. package/dist/modules/media/index.d.ts +2 -2
  95. package/dist/modules/media/index.d.ts.map +1 -1
  96. package/dist/modules/media/index.js +61 -218
  97. package/dist/modules/media/index.js.map +1 -1
  98. package/dist/modules/modal/constants.d.ts +1 -1
  99. package/dist/modules/modal/constants.d.ts.map +1 -1
  100. package/dist/modules/modal/context.d.ts.map +1 -1
  101. package/dist/modules/modal/hooks.d.ts +2 -2
  102. package/dist/modules/modal/index.js +20 -366
  103. package/dist/modules/modal/index.js.map +1 -1
  104. package/dist/modules/notification/constants.d.ts +4 -2
  105. package/dist/modules/notification/constants.d.ts.map +1 -1
  106. package/dist/modules/notification/context.d.ts +4 -0
  107. package/dist/modules/notification/context.d.ts.map +1 -1
  108. package/dist/modules/notification/hooks.d.ts +1 -1
  109. package/dist/modules/notification/index.d.ts +2 -3
  110. package/dist/modules/notification/index.d.ts.map +1 -1
  111. package/dist/modules/notification/index.js +70 -154
  112. package/dist/modules/notification/index.js.map +1 -1
  113. package/dist/modules/notification/module.d.ts.map +1 -1
  114. package/dist/provider.js +255 -257
  115. package/dist/provider.js.map +1 -1
  116. package/dist/theme.d.ts +1 -0
  117. package/dist/theme.d.ts.map +1 -1
  118. package/dist/theme.js +2 -2
  119. package/dist/theme.js.map +1 -1
  120. package/dist/utils/index.d.ts +5 -6
  121. package/dist/utils/index.d.ts.map +1 -1
  122. package/dist/utils/index.js +1 -57
  123. package/dist/utils/index.js.map +1 -1
  124. package/dist/utils/number.d.ts +0 -1
  125. package/dist/utils/number.d.ts.map +1 -1
  126. package/dist/utils/object.d.ts +0 -2
  127. package/dist/utils/object.d.ts.map +1 -1
  128. package/dist/utils/string.d.ts +0 -3
  129. package/dist/utils/string.d.ts.map +1 -1
  130. package/dist/utils/timing.d.ts +0 -1
  131. package/dist/utils/timing.d.ts.map +1 -1
  132. package/docs/README.md +124 -0
  133. package/docs/architecture-and-rules.md +129 -0
  134. package/docs/core-engine.md +196 -0
  135. package/docs/custom-modules.md +267 -0
  136. package/docs/getting-started.md +199 -0
  137. package/docs/modules/README.md +176 -0
  138. package/docs/modules/ambient.md +150 -0
  139. package/docs/modules/background.md +195 -0
  140. package/docs/modules/context-menu.md +248 -0
  141. package/docs/modules/controls.md +159 -0
  142. package/docs/modules/dock.md +734 -0
  143. package/docs/modules/error-boundary.md +160 -0
  144. package/docs/modules/kernel.md +266 -0
  145. package/docs/modules/loading.md +157 -0
  146. package/docs/modules/media.md +196 -0
  147. package/docs/modules/modal.md +229 -0
  148. package/docs/modules/notification.md +161 -0
  149. package/docs/modules/result.md +135 -0
  150. package/docs/testing.md +160 -0
  151. package/docs/theming.md +185 -0
  152. package/package.json +50 -2
  153. package/templates/AGENTS.md +165 -0
  154. package/dist/hooks/use-async-action.d.ts +0 -3
  155. package/dist/hooks/use-async-action.d.ts.map +0 -1
  156. package/dist/hooks/use-debounce.d.ts +0 -2
  157. package/dist/hooks/use-debounce.d.ts.map +0 -1
  158. package/dist/hooks/use-intersection-observer.d.ts +0 -4
  159. package/dist/hooks/use-intersection-observer.d.ts.map +0 -1
  160. package/dist/hooks/use-media-query.d.ts +0 -2
  161. package/dist/hooks/use-media-query.d.ts.map +0 -1
  162. package/dist/hooks/use-mounted.d.ts +0 -2
  163. package/dist/hooks/use-mounted.d.ts.map +0 -1
  164. package/dist/hooks/use-server-action.d.ts +0 -4
  165. package/dist/hooks/use-server-action.d.ts.map +0 -1
  166. package/dist/hooks/use-storage-state.d.ts +0 -5
  167. package/dist/hooks/use-storage-state.d.ts.map +0 -1
  168. package/dist/modules/theme.d.ts +0 -3
  169. package/dist/modules/theme.d.ts.map +0 -1
  170. package/dist/utils/json.d.ts +0 -3
  171. 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("../theme").ThemeSpec<NotificationThemeSlot>;
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,EAAE,KAAK,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAErD,eAAO,MAAM,eAAe;;;EAGjB,CAAC;AAEZ,eAAO,MAAM,uBAAuB,kDAA6B,CAAC;AAElE,eAAO,MAAM,qBAAqB,oBAAoB,CAAC;AAEvD,eAAO,MAAM,iBAAiB,qDAC0B,CAAC"}
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":"AAcA,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAG7B,KAAK,yBAAyB,EAC9B,KAAK,iBAAiB,EAEvB,MAAM,SAAS,CAAC;AASjB,eAAO,MAAM,mBAAmB,0DAI7B,CAAC;AAaJ,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"}
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("../theme").ResolvedTheme<import("./types").NotificationThemeSlot>;
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,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,eAAe,EACf,sBAAsB,EACtB,oBAAoB,GACrB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,cAAc,SAAS,CAAC"}
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, useContext } from 'react';
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/result.ts
338
- function isResult(value) {
339
- 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);
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.ts
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